//-----------------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------------// void fill_factor() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); dm.Id_User = decimal.Parse(Request.Cookies["Id_User"].Value); if (Request.QueryString["Kind"] == "NoPayment") { GridView1.DataSource = ac.select_factor_nopeyment(dm); } else if (Request.QueryString["Kind"] == "Payment") { GridView1.DataSource = ac.select_factor_peyment(dm); } else if (Request.QueryString["Kind"] == "Sended") { GridView1.DataSource = ac.select_factor_sended(dm); } else if (Request.QueryString["Kind"] == "All") { GridView1.DataSource = ac.select_factor_all_User(dm); } else { GridView1.DataSource = ac.select_factor_all_User(dm); } GridView1.DataBind(); }
//<اطلاعات کاربر را نشان مي دهد> void fill_user_work() { Shoping ac2 = new Shoping(); ShopingDatum dm2 = new ShopingDatum(); DataSet ds = new DataSet(); dm2.Register_Date = ""; dm2.Id_User = decimal.Parse(Request.Cookies["ID_User"].Value); Label38.Text = "مشاهده ( " + ac2.select_factor_nopeyment(dm2).Rows.Count.ToString() + " )"; Label4.Text = "مشاهده ( " + ac2.select_factor_peyment(dm2).Rows.Count.ToString() + " )"; Label40.Text = "مشاهده ( " + ac2.select_factor_sended(dm2).Rows.Count.ToString() + " )"; }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex != -1) { string id = ((Label)(e.Row.FindControl("Lblid"))).Text; Shoping ac2 = new Shoping(); ShopingDatum dm2 = new ShopingDatum(); Support_Comment ac3 = new Support_Comment(); Support_CommentDatum dm3 = new Support_CommentDatum(); dm3.ID_User = decimal.Parse(id); dm3.SendType = "User"; dm2.Register_Date = ""; dm2.Id_User = decimal.Parse(id); int n = ac2.select_factor_nopeyment(dm2).Rows.Count; int p = ac2.select_factor_peyment(dm2).Rows.Count; int s = ac2.select_factor_sended(dm2).Rows.Count; int sp = ac3.Select(dm3).Rows.Count; if (n > 0) { ((HyperLink)(e.Row.FindControl("HyperLinkn"))).Text = "مشاهده ( " + n.ToString() + " )"; } if (p > 0) { ((HyperLink)(e.Row.FindControl("HyperLinkp"))).Text = "مشاهده ( " + p.ToString() + " )"; } if (s > 0) { ((HyperLink)(e.Row.FindControl("HyperLinks"))).Text = "مشاهده ( " + s.ToString() + " )"; } if (sp > 0) { ((HyperLink)(e.Row.FindControl("HyperLinksp"))).Text = "مشاهده ( " + sp.ToString() + " )"; } } }
private void FillGrid() { PublicClass pc = new PublicClass(); dm.Register_Date = pc.GetDate(); dm.Id_User = 0; dm.Factor_Code = TextBox3.Text; dm.Bank_Name = TextBox4.Text; if (TextTitle.Text.Length > 0 && TextBox1.Text.Length > 0 && TextBox2.Text.Length > 0) { dm.Register_Date = TextTitle.Text + "/" + TextBox1.Text + "/" + TextBox2.Text; } else if (TextTitle.Text.Length > 0 && TextBox1.Text.Length > 0 && TextBox2.Text.Length == 0) { dm.Register_Date = TextTitle.Text + "/" + TextBox1.Text; } else if (TextTitle.Text.Length == 0 && TextBox1.Text.Length > 0 && TextBox2.Text.Length > 0) { dm.Register_Date = TextBox1.Text + "/" + TextBox2.Text; } else if (TextTitle.Text.Length > 0 && TextBox1.Text.Length == 0 && TextBox2.Text.Length == 0) { dm.Register_Date = TextTitle.Text; } if (TextTitle.Text.Length == 0 && TextBox1.Text.Length == 0 && TextBox2.Text.Length > 0) { dm.Register_Date = TextBox2.Text; } if (TextTitle.Text.Length == 0 && TextBox1.Text.Length > 0 && TextBox2.Text.Length == 0) { dm.Register_Date = TextBox1.Text; } if (TextTitle.Text.Length == 0 && TextBox1.Text.Length == 0 && TextBox2.Text.Length == 0) { dm.Register_Date = ""; } if (Request.QueryString["ID_User"] != null) { dm.Id_User = decimal.Parse(Request.QueryString["ID_User"]); } if (Request.QueryString["Kind"] == "NoPayment") { GridView1.DataSource = ac.select_factor_nopeyment(dm, txtCity.Text, txtCountry.Text); } else if (Request.QueryString["Kind"] == "Payment") { GridView1.DataSource = ac.select_factor_peyment(dm, txtCity.Text, txtCountry.Text); } else if (Request.QueryString["Kind"] == "Sended") { GridView1.DataSource = ac.select_factor_sended(dm, txtCity.Text, txtCountry.Text); } //footer long sp = 0; foreach (DataRow dr in ((DataTable)GridView1.DataSource).Rows) { sp += long.Parse(dr["sum_price"].ToString()); } GridView1.Columns[2].FooterText = string.Format("جمع کل :{0}", sp.ToString("##,0")); GridView1.DataBind(); //excel out DataTable dt = (DataTable)GridView1.DataSource; new DAL.WriteToExcel().WriteTable(dt, Server.MapPath(@"~/Administrator/files/ExcelOut")); }