protected void Page_Load(object sender, EventArgs e) { DataClassesAlbertDataContext db; db = new DataClassesAlbertDataContext(); GoDine a = new GoDine(); MembershipUser user = Membership.GetUser(); Guid userID = (Guid)user.ProviderUserKey; var salesID = (from sid in db.SalesIDs where sid.UserID == userID select sid).Single(); decimal dealRate = a.getDealRateForSellerID(salesID.SellerID); SellerStats table = a.SellerSts(salesID.SellerID); decimal paid = a.Paid_FromSalesPaymentHist(salesID.SellerID); LabelTitle.Text = "Your Sales Progress"; lbldealrate.Text = dealRate.ToString("0.00") + "%"; lblincome.Text = "$" + table.owed.ToString("0.00"); lblnumsales.Text = table.numSales.ToString(); lblpaid.Text = "$" + paid.ToString("0.00"); lbltopay.Text = "$" + (table.owed - paid).ToString("0.00"); String salesUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "BuyGiftCard.aspx?Sale=" + salesID.SellerID.ToString(); UrlBlurb.Text = "Your sales url: " + salesUrl + "</br> (refer people here when you're selling in order to get credit for your sales)"; }
//////////////////////////////////////////////////////////////////////////////////////////// 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 Set_Table_Filtered(string filterSeller) { GoDine GD = new GoDine(); DataTable dt; DataClassesAlbertDataContext db; db = new DataClassesAlbertDataContext(); dt = new DataTable("Sellers"); var Sellers = from sl in db.SalesIDs select sl; dt.Columns.Add("Email", typeof(string)); dt.Columns.Add("NumberOfSales", typeof(string)); dt.Columns.Add("%CurrentDealRate", typeof(string)); dt.Columns.Add("$TotalOfGiftCardsSold", typeof(string)); dt.Columns.Add("$TotalIncomeFromSales", typeof(decimal)); dt.Columns.Add("$WePaidThem", typeof(decimal)); dt.Columns.Add("CreationDate", typeof(DateTime)); dt.Columns.Add("SellerID", typeof(string)); foreach (var seller in Sellers) { MembershipUser user = Membership.GetUser(seller.UserID); String username = user.UserName; if (username.Contains(filterSeller)) { SellerStats stats = GD.SellerSts(seller.SellerID); DataRow tablerow = dt.NewRow(); tablerow["Email"] = username; tablerow["NumberOfSales"] = stats.numSales.ToString(); tablerow["%CurrentDealRate"] = seller.DealRate.ToString("0.00"); tablerow["$TotalOfGiftCardsSold"] = stats.sold.ToString("0.00"); tablerow["$TotalIncomeFromSales"] = stats.owed; tablerow["$WePaidThem"] = GD.getPaidToSeller(seller.SellerID); tablerow["CreationDate"] = user.CreationDate; tablerow["SellerID"] = seller.SellerID.ToString(); dt.Rows.Add(tablerow); } } Session["dt"] = dt; GV.DataSource = dt; GV.AllowSorting = true; GV.AllowPaging = true; GV.PageSize = 50; //GV.Columns["Money"].ItemStyle.HorizontalAlign = HorizontalAlign.Right; GV.DataBind(); }