//////////////////////////////////////////////////////////////////////////////////////////// FOR SELLERS protected void ddSalesPpl_SelectedIndexChanged(object sender, EventArgs e) { GoDine a = new GoDine(); if (!(ddSalesPpl.SelectedValue.Contains("---sellers---"))) { Guid UserID = a.UserName_2_Guid(ddSalesPpl.SelectedValue); Guid SellerID = a.getSellerFromUser(UserID).SellerID; SellerStats seller = a.SellerSts(SellerID); decimal paid = a.getPaidToSeller(SellerID); lblPaidSalesAmount.Text = "Amount left to pay for this seller = " + (seller.owed - paid).ToString("0.00"); } else { tbPaidAmount.Text = ""; } }
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."; } }
/////////////////////////////////////////////////////////////////////////// FOR SELLER DEAL RATE protected void ddSalesDealRate_SelectedIndexChanged(object sender, EventArgs e) { DataClassesAlbertDataContext db = new DataClassesAlbertDataContext(); string Seller = ddSalesDealRate.Text; GoDine a = new GoDine(); if (!(ddSalesDealRate.SelectedValue.Contains("---sellers---"))) { Guid UserID = a.UserName_2_Guid(ddSalesDealRate.SelectedValue); Guid SellerID = a.getSellerFromUser(UserID).SellerID; decimal rate = a.getDealRateForSellerID(SellerID); tbSalesDealRate.Text = rate.ToString("0.00"); } else { tbSalesDealRate.Text = ""; } }
protected void btnPaidSalesAmount_Click(object sender, EventArgs e) { DataClassesAlbertDataContext db = new DataClassesAlbertDataContext(); GoDine a = new GoDine(); try { decimal amount = Convert.ToDecimal(tbPaidSalesAmount.Text); Guid userId = a.UserName_2_Guid(ddSalesPpl.SelectedValue); SalesID seller = (from s in db.SalesIDs where s.UserID == userId select s).Single(); string concept = tbPaidSalesAmountConcept.Text; if (a.Pay_Amount_to_Seller(amount, seller.SellerID, concept) == 0) { lblPaidSalesAmount.Text = "OK -> Seller " + ddSalesPpl.SelectedValue + " received " + amount.ToString(); tbPaidSalesAmount.Text = ""; } else { lblPaidSalesAmount.Text = "Error -> Seller " + ddSalesPpl.SelectedValue + " did not 'get paid' Have Lana Check the logs for details :P"; }; } catch { lblPaidSalesAmount.Text = "Error -> Input value must be a number."; } }