public List <PricingClass> CallPerformed(string lst_project, string lst_provider) { List <PricingClass> lstPricingClass = new List <PricingClass>(); DataTable dt = new DataTable(); Search obj = new Search(ConfigurationManager.ConnectionStrings["FarsheBoom"].ConnectionString); Common cur = new Common(); dt = obj.Get_Data(string.Format("SELECT srl,code_igd, brand_name, area, size_title, carpet_title, buy_price, discount, sale_price, u_buy, u_sale,discount_amount, final_sale,provider_name,u_date_time, provider_code,margin_profit,title_igd FROM dbo.Sale_Pricing Where (provider_srl = {1}) AND (build_state = 0) AND (code_igd NOT IN (SELECT inv_goods_1.code_igd FROM dbo.bas_project LEFT OUTER JOIN dbo.bas_project_goods ON dbo.bas_project.srl = dbo.bas_project_goods.header_srl LEFT OUTER JOIN dbo.inv_goods AS inv_goods_1 ON dbo.bas_project_goods.igd_srl = inv_goods_1.srl WHERE (dbo.bas_project.srl = {0}) AND(inv_goods_1.provider_srl = {1}))) order by code_igd", lst_project, lst_provider)); if (dt.Rows.Count > 0) { foreach (DataRow Woak in dt.Rows) { PricingClass pc = new PricingClass(); pc.srl = Woak["srl"].ToString(); pc.provider_name = Woak["provider_name"].ToString(); pc.code_igd = Woak["code_igd"].ToString(); pc.brand_name = Woak["brand_name"].ToString(); pc.area = Woak["area"].ToString(); pc.size_title = Woak["size_title"].ToString(); pc.carpet_title = Woak["carpet_title"].ToString(); cur.str = Woak["buy_price"].ToString(); pc.buy_price = cur.str; cur.str = Woak["u_buy"].ToString(); pc.u_buy = cur.str; cur.str = Woak["u_sale"].ToString(); pc.u_sale = cur.str; cur.str = Woak["discount_amount"].ToString(); pc.discount_amount = cur.str; pc.discount = Woak["discount"].ToString(); cur.str = Woak["sale_price"].ToString(); pc.sale_price = cur.str; cur.str = Woak["final_sale"].ToString(); pc.final_sale = cur.str; pc.u_date_time = Woak["u_date_time"].ToString(); pc.provider_code = Woak["provider_code"].ToString(); pc.title_igd = Woak["title_igd"].ToString(); try { if (Woak["margin_profit"] != null) { pc.margin_profit = Convert.ToInt64(Woak["margin_profit"]); } else { pc.margin_profit = 0; } } catch { pc.margin_profit = 0; } if (!Convert.IsDBNull(Woak["buy_price"]) && !Convert.IsDBNull(Woak["final_sale"])) { pc.percent_profit = Convert.ToInt64(Math.Round((((Convert.ToDouble(Woak["final_sale"]) - Convert.ToDouble(Woak["buy_price"])) / Convert.ToDouble(Woak["final_sale"])) * 100), 0)); } lstPricingClass.Add(pc); } } return(lstPricingClass); }
protected void btn_report_Click(object sender, ImageClickEventArgs e) { PricingClass objPricingClass = new PricingClass(); List <PricingClass> lstPricingClass = new List <PricingClass>(); lstPricingClass = objPricingClass.CallPerformed(lst_project.SelectedValue, lst_provider.SelectedValue); grdViewOutstanding.DataSource = lstPricingClass; grdViewOutstanding.DataBind(); ViewState["lstOutstandingOrders"] = lstPricingClass; upnlOutstanding.Update(); ViewState["getall"] = 1; txt_count.Text = lstPricingClass.Count.ToString(); }
protected void lbRemoveFilterOutstanding_Click(object sender, EventArgs e) { if (ViewState["Ocode_igd"] != null) { ViewState["Ocode_igd"] = null; } if (ViewState["Osize_title"] != null) { ViewState["Osize_title"] = null; } if (ViewState["Obrand_name"] != null) { ViewState["Obrand_name"] = null; } if (ViewState["Ocode_igd"] != null) { ViewState["Ocode_igd"] = null; } if (ViewState["Obuy_price"] != null) { ViewState["Obuy_price"] = null; } if (ViewState["Osale_price"] != null) { ViewState["Osale_price"] = null; } if (ViewState["Ou_date_time"] != null) { ViewState["Ou_date_time"] = null; } if (ViewState["Omargin_profit"] != null) { ViewState["Omargin_profit"] = null; } if (ViewState["Opercent_profit"] != null) { ViewState["Opercent_profit"] = null; } PricingClass objPricingClass = new PricingClass(); List <PricingClass> lstPricingClass = new List <PricingClass>(); lstPricingClass = objPricingClass.CallPerformed(lst_project.SelectedValue, lst_provider.SelectedValue); grdViewOutstanding.DataSource = lstPricingClass; grdViewOutstanding.DataBind(); ViewState["lstOutstandingOrders"] = lstPricingClass; }
public List <PricingClass> GetPricingClass(int state, string provider) { List <PricingClass> lstPricingClass = new List <PricingClass>(); DataTable dt = new DataTable(); Search obj = new Search(ConfigurationManager.ConnectionStrings["FarsheBoom"].ConnectionString); Common cur = new Common(); if (state == 1) { dt = obj.Get_Data("SELECT srl,code_igd, brand_name, area, size_title, carpet_title, buy_price, discount, sale_price, u_buy, u_sale,discount_amount, final_sale,provider_name,u_date_time, provider_code, u_date_time,margin_profit,price_home FROM dbo.Sale_Pricing Where buy_price is null or sale_price is null order by buy_price,sale_price"); } else if (state == 2) { dt = obj.Get_Data("SELECT srl,code_igd, brand_name, area, size_title, carpet_title, buy_price, discount, sale_price, u_buy, u_sale,discount_amount, final_sale,provider_name,u_date_time, provider_code, u_date_time,margin_profit,price_home FROM dbo.Sale_Pricing order by buy_price,sale_price"); } else if (state == 3) { dt = obj.Get_Data(string.Format("SELECT srl,code_igd, brand_name, area, size_title, carpet_title, buy_price, discount, sale_price, u_buy, u_sale,discount_amount, final_sale,provider_name,u_date_time, provider_code, u_date_time,margin_profit,price_home FROM dbo.Sale_Pricing Where (buy_price is null or sale_price is null) AND (provider_srl={0}) order by buy_price,sale_price", provider)); } else if (state == 4) { dt = obj.Get_Data(string.Format("SELECT srl,code_igd, brand_name, area, size_title, carpet_title, buy_price, discount, sale_price, u_buy, u_sale,discount_amount, final_sale,provider_name,u_date_time, provider_code, u_date_time,margin_profit,price_home FROM dbo.Sale_Pricing Where (provider_srl={0}) order by buy_price,sale_price", provider)); } if (dt.Rows.Count > 0) { foreach (DataRow Woak in dt.Rows) { PricingClass pc = new PricingClass(); pc.srl = Woak["srl"].ToString(); pc.provider_name = Woak["provider_name"].ToString(); pc.code_igd = Woak["code_igd"].ToString(); pc.brand_name = Woak["brand_name"].ToString(); pc.area = Woak["area"].ToString(); pc.size_title = Woak["size_title"].ToString(); pc.carpet_title = Woak["carpet_title"].ToString(); cur.str = Woak["buy_price"].ToString(); pc.buy_price = cur.str; cur.str = Woak["u_buy"].ToString(); pc.u_buy = cur.str; cur.str = Woak["u_sale"].ToString(); pc.u_sale = cur.str; cur.str = Woak["price_home"].ToString(); pc.price_home = cur.str; cur.str = Woak["discount_amount"].ToString(); pc.discount_amount = cur.str; pc.discount = Woak["discount"].ToString(); cur.str = Woak["sale_price"].ToString(); pc.sale_price = cur.str; cur.str = Woak["final_sale"].ToString(); pc.final_sale = cur.str; pc.u_date_time = Woak["u_date_time"].ToString(); pc.provider_code = Woak["provider_code"].ToString(); try { if (Woak["margin_profit"] != null) { pc.margin_profit = Convert.ToInt64(Woak["margin_profit"]); } else { pc.margin_profit = 0; } } catch { pc.margin_profit = 0; } if (!Convert.IsDBNull(Woak["buy_price"]) && !Convert.IsDBNull(Woak["final_sale"])) { pc.percent_profit = Convert.ToInt64(Math.Round((((Convert.ToDouble(Woak["final_sale"]) - Convert.ToDouble(Woak["buy_price"])) / Convert.ToDouble(Woak["final_sale"])) * 100), 0)); } lstPricingClass.Add(pc); } } return(lstPricingClass); }