69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using C2P_Data;
|
|
|
|
namespace C2P.WebUserControls
|
|
{
|
|
public partial class mod_QuoteList : System.Web.UI.UserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
private void ricalcolaQuote(string quoteType, long CodQuote, int Rev)
|
|
{
|
|
DateTime tick = DateTime.Now;
|
|
// aggiorno dati!
|
|
DtProxy.man.taQL.stp_QL_update(quoteType, CodQuote, Rev);
|
|
lblOut.Text = string.Format("Tempo ricalcolo: {0} ms", DateTime.Now.Subtract(tick).TotalMilliseconds);
|
|
}
|
|
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// ricalcolo!
|
|
string QuoteType = grView.SelectedDataKey["QuoteType"].ToString();
|
|
long CodQuote = Convert.ToInt64(grView.SelectedDataKey["CodQuote"]);
|
|
int QuoteRev = Convert.ToInt16(grView.SelectedDataKey["QuoteRev"]);
|
|
ricalcolaQuote(QuoteType, CodQuote, QuoteRev);
|
|
}
|
|
/// <summary>
|
|
/// Calcola css dato valore prezzo offerto vs importi full cost e min price
|
|
/// </summary>
|
|
/// <param name="FullCost"></param>
|
|
/// <param name="MinPrice"></param>
|
|
/// <param name="PriceOff"></param>
|
|
/// <returns></returns>
|
|
public string priceVsCost(object _FullCost, object _MinPrice, object _PriceOff)
|
|
{
|
|
string answ = "";
|
|
double FullCost = 0;
|
|
double MinPrice = 0;
|
|
double PriceOff = 0;
|
|
try
|
|
{
|
|
FullCost = Convert.ToDouble(_FullCost);
|
|
MinPrice = Convert.ToDouble(_MinPrice);
|
|
PriceOff = Convert.ToDouble(_PriceOff);
|
|
}
|
|
catch
|
|
{ }
|
|
if (PriceOff > MinPrice)
|
|
{
|
|
answ = "allOk";
|
|
}
|
|
else if (PriceOff > FullCost)
|
|
{
|
|
answ = "warnOrange";
|
|
}
|
|
else
|
|
{
|
|
answ = "warnRed";
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
} |