Example #1
0
 protected void btnCardDealRate_Click(object sender, EventArgs e)
 {
     decimal number = -1;
     string num = tbCardDealRate.Text;
     string strcompany = ddCardDealRate.SelectedValue;
     if (!strcompany.Contains("---company"))
     {
         number = Convert.ToDecimal(num);
         if (number >= 0 && number <= 100)
         {
             DataClassesAlbertDataContext db = new DataClassesAlbertDataContext();
             Company qry = (from c in db.Companies where c.Name == strcompany select c).Single();
             //Company qry = qry.Single(); // if we do not insert the fist single
             qry.GCSaleDealRate = number;
             db.SubmitChanges();
             lblDealRate.Text = "OK -> Deal Rate set to " + number.ToString("0.0000") + " % for company " + strcompany;
             tbDealRate.Text = number.ToString("0.0000") + " %";
         }
         else
         {
             lblDealRate.Text = "ERROR -> Entered value must be an integer between 1 and 99 for company " + strcompany;
         }
     }
     else
     {
         lblDealRate.Text = "ERROR -> Entered value must be an integer between 1 and 99 for the selected company" + strcompany;
     }
 }
Example #2
0
 protected void btnSalesDealRate_Click(object sender, EventArgs e)
 {
     decimal number = -1;
     string num = tbSalesDealRate.Text;
     GoDine a = new GoDine();
     string username = ddSalesDealRate.SelectedValue;
     if (!username.Contains("---sellers---"))
     {
         number = Convert.ToDecimal(num);
         if (number >= 0 && number <= 100)
         {
             DataClassesAlbertDataContext db = new DataClassesAlbertDataContext();
             SalesID qry = (from s in db.SalesIDs where s.UserID == a.UserName_2_Guid(username) select s).Single();
             //Company qry = qry.Single(); // if we do not insert the fist single
             qry.DealRate = number;
             db.SubmitChanges();
             lblSalesDealRate.Text = "OK -> Deal Rate set to " + number.ToString() + " % for seller " + username;
             tbSalesDealRate.Text = number.ToString();
         }
         else
         {
             lblSalesDealRate.Text = "ERROR -> Entered value must be an integer between 1 and 99 for company " + username;
         }
     }
     else
     {
         lblSalesDealRate.Text = "Please select a seller.";
     }
 }