Files
C2P/C2P/MakeSim.aspx.cs
T

103 lines
4.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
using C2P_Data;
namespace C2P
{
public partial class MakeSim : SteamWare.UserPage
{
protected string CodItem;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
// leggo articolo richiesto...
CodItem = Request.QueryString["CodItem"];
lblCodItem.Text = CodItem;
mod_imgPreview.CodItem = CodItem;
}
/// <summary>
/// quantità batch x creazione SIM
/// </summary>
protected int batchQty { get; set; }
/// <summary>
/// RawMatCost x creazione SIM
/// </summary>
protected decimal RawMatCost { get; set; }
/// <summary>
/// richiesta creazione listino
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNew_Click(object sender, EventArgs e)
{
lblAcqOut.Text = "";
// leggo dati x creazione
batchQty = 0;
RawMatCost = 0;
try
{
batchQty = Convert.ToInt32(txtBatchQty.Text);
RawMatCost = Convert.ToDecimal(txtBase6060.Text);
}
catch
{ }
if (batchQty > 0 && RawMatCost > 0)
{
if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("MakeSim: Step 01", tipoLog.INFO);
// verifico SI POSSA creare una nuova offerta standard x item indicato
if (ddlRawMat.SelectedValue != "")
{
if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("MakeSim: Step 02", tipoLog.INFO);
// creo offerta std coi dati indicati
long CodQuote = 0;
try
{
DS_Quotes.QuoteFull_QDataTable tabQuote = DtProxy.man.taQFQ.insertNew("Q", ddlCodCustomer.SelectedValue, CodItem, "", ddlRawMat.SelectedValue, RawMatCost, 0, batchQty, "EXW", "EXT", user_std.UtSn.utente);
CodQuote = tabQuote[0].CodQuote;
if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("MakeSim: Step 03", tipoLog.INFO);
}
catch
{ }
// modifico offerta da Q a S
if (CodQuote > 0)
{
if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("MakeSim: Step 04", tipoLog.INFO);
DS_Quotes.QuoteListDataTable tab = DtProxy.man.taQL.makeSim(Convert.ToInt32(CodQuote), 0, user_std.UtSn.utente);
if (tab.Rows.Count > 0)
{
if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("MakeSim: Step 05", tipoLog.INFO);
// seleziona l'offerta duplicata!
Response.Redirect(string.Format("Quote?QuoteType={0}&CodQuote={1}&QuoteRev={2}", tab[0].QuoteType, tab[0].CodQuote, tab[0].QuoteRev));
}
}
#if false
// mando a pagina della simulazione (S e 0 sono fissi)
Response.Redirect(string.Format("Quote?QuoteType=S&CodQuote={0}&QuoteRev=0", CodQuote));
#endif
}
else
{
lblAcqOut.Text = traduci("ERR-CS-EXT-002");
logger.lg.scriviLog(traduci("ERR-CS-EXT-002"), tipoLog.ERROR);
}
}
else
{
lblAcqOut.Text = traduci("ERR-CS-EXT-001");
logger.lg.scriviLog(traduci("ERR-CS-EXT-001"), tipoLog.ERROR);
}
}
}
}