void factor_peyment_register() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"]); if (RadioButton1.Checked) { dm.Peyment_Kind = "پرداخت اینترنتی"; } if (RadioButton2.Checked) { dm.Peyment_Kind = "واريز به حساب"; } dm.Bank_Name = DropDownList1.SelectedItem.Text; dm.Peyment_Code = TextBox1.Text; dm.Bank_Code = TextBox9.Text; dm.Peyment_Date = TextBox2.Text; dm.Peyment_Price = decimal.Parse(TextBox3.Text); dm.Customer_Name = TextBox4.Text; dm.Customer_Tell = TextBox5.Text; dm.Customer_Time_Recive = TextBox6.Text; dm.Customer_Address = TextBox7.Text; dm.Description = TextBox8.Text; ac.Update_Peyment_Factor(dm); factor_condition_update(); Response.Redirect("~/index.aspx?Type=ShopPeymentEnd&Factor_Code=" + Label37.Text + "&Id_Factor=" + Label34.Text + "&Sum_Price=" + Label55.Text); }
public ActionResult AddShouCang(int userId, int goodId) { var good = GoodsServices.LoadEntities(u => u.Id == goodId).FirstOrDefault(); if (good == null) { return(Content("数据有误")); } Shoping shop = new Shoping(); shop.GoodsId = good.Id; shop.UserInfoId = userId; shop.DelFlag = normal; shop.SubTime = DateTime.Now; try { ShopingServices.Add(shop); return(Content("加入收藏成功")); } catch (Exception) { return(Content("错误,请重试")); } }
// Metoda Main jest to tzw. "Punkt wejścia programu". Musi być statyczna bo inaczej .net framework mogłby nie rozpoznac, ze jest to "Punkt wejścia programu". static void Main(string[] args) { // klasy Citizen są w różnych przestrzeniach nazw. Pełne nazwy tych klas to Assemblies.Poland.Citizen. Nie musimy uzywać pełnych nazw od tego słuzy nam dyrektywa using. Citizen pole = new Citizen(); USA.Citizen american = new USA.Citizen(); // Przestrzeń nazw i Assemble nie muszą być w relacji 1:1. // Jedna Assembla może zawierać wiele przestrzni nazw przykład Travelling. (moze zawierac klasy zdefinowane w wielu przestrzeniach nazw) // Jedna Przestrzen nazw moze istnieć w kilku Assemblach przykład Shopping/Paying. (klasy, elementy z jednej przestrzeni nazw mogą być zdefiniowane w wielu assemlach) Shoping shoping = new Shoping(); shoping.Pay(); TravellingByTrain travellingByTrain = new TravellingByTrain(); travellingByTrain.Pay(); //klasa z przestrzeni nazw Travelling. Klasy nie mogą nazywać się jak przestrzeń nazw. Gdyby nazwać tak samo kompilator poinformuje nas 'Travelling' is a namespace but is used like a type Assemblies. Travel travelling = new Travel(); travelling.TravelOnFoot(); // Klasy i inne elemnty z przestrzni nazw System zostały zaimplementowane w kilku assemblies tj.: mscorlib.dll, System.dll, System.Core.dll. //Własna klasa w przestrzeni nazw 'System' SystemData systemData = new SystemData(); systemData.GetComputerName(); systemData.GetUserName(); Console.ReadKey(); }
private void Fill() { OneRecord aco = new OneRecord(); OneRecordDatum dmo = new OneRecordDatum(); DataTable dt; dmo.Type = "AddressPrint"; dt = aco.SelectOne(dmo); if (dt.Rows.Count > 0) { Label1.Text = dt.Rows[0]["text"].ToString(); } BLL.user blu = new user(); Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); string company, post_code; dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); DataTable dt2 = ac.select_factor_one(dm); DataTable dtuser = blu.select_one_user(new userDatum() { Id = int.Parse(dt2.Rows[0]["id_user"].ToString()) }); company = dtuser.Rows[0]["company"].ToString(); post_code = dtuser.Rows[0]["post_code"].ToString(); Label1.Text = Label1.Text.Replace("NameUser", dt2.Rows[0]["customer_name"].ToString()); Label1.Text = Label1.Text.Replace("TellphoneUser", dt2.Rows[0]["customer_tell"].ToString()); Label1.Text = Label1.Text.Replace("AddressUser", string.Format(" {0} <br/> کد پستی {1} <br/> نام شرکت {2}", dt2.Rows[0]["customer_address"].ToString(), company, post_code)); }
//-----------------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------------// 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 check_factor() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); if (Request.QueryString["Id_User"] != null && Request.QueryString["Id_Factor"] != null && Request.QueryString["Factor_Code"] != null) { dm.Id_User = decimal.Parse(Request.QueryString["Id_User"].ToString()); dm.Factor_Code = Request.QueryString["Factor_Code"].ToString(); dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); if (ac.check_factor(dm)) { fill_factor(); } else { Response.Redirect("~/index.aspx?Type=404"); } } else { Response.Redirect("~/index.aspx?Type=404"); } }
void Factor_Payment_Update() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"]); if (RadioButton1.Checked) { dm.Peyment_Kind = "پرداخت اینترنتی"; } if (RadioButton2.Checked) { dm.Peyment_Kind = "واريز به حساب"; } dm.Bank_Name = DropDownList1.SelectedItem.Text; dm.Peyment_Code = TextBox1.Text; dm.Bank_Code = TextBox9.Text; dm.Peyment_Date = TextBox2.Text; dm.Peyment_Price = decimal.Parse(TextBox3.Text); dm.Customer_Name = TextBox4.Text; dm.Customer_Tell = TextBox5.Text; dm.Customer_Time_Recive = TextBox6.Text; dm.Customer_Address = TextBox7.Text; dm.Description = TextBox8.Text; ac.Update_Peyment_Factor(dm); Label20.Visible = true; Label20.Text = "اطلاعات به روز شد"; }
//<اطلاعات فاکتور را نمايش مي دهد> void fill_factor() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); DataSet ds = new DataSet(); decimal Sum_Price; decimal All_Sum_Price = 0; if (Request.QueryString["Id_Factor"] != null && Request.QueryString["Id_Factor"].Length > 0) { dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); GridView1.DataSource = ac.select_factor_detail(dm); GridView1.DataBind(); DataTable dt = ac.select_factor_one(dm); Label10.Text = dt.Rows[0]["date_register"].ToString(); Label11.Text = dt.Rows[0]["id"].ToString(); Label20.Text = dt.Rows[0]["factor_code"].ToString(); Label32.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["sum_price"].ToString()); Label31.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["send_price"].ToString()); Label34.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["tasx"].ToString()); if (Label34.Text.Trim() == "0") { Label33.Visible = false; Label34.Visible = false; Image3.Visible = false; } Label44.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["discount"].ToString()); if (Label44.Text.Trim() == "0") { Label43.Visible = false; Label44.Visible = false; Image5.Visible = false; } for (int i = 0; i < GridView1.Rows.Count; i++) { Sum_Price = decimal.Parse(((Label)(GridView1.Rows[i].FindControl("Label24"))).Text); All_Sum_Price = All_Sum_Price + Sum_Price; } Label36.Text = BLL.PublicClass.numberToMoney(All_Sum_Price.ToString()); //Label47.Text = ds.Tables[0].Rows[0]["bank_name"].ToString(); //Label42.Text = ds.Tables[0].Rows[0]["peyment_code"].ToString(); //Label49.Text = ds.Tables[0].Rows[0]["bank_code"].ToString(); //Label51.Text = ds.Tables[0].Rows[0]["peyment_date"].ToString(); //Label53.Text = ds.Tables[0].Rows[0]["peyment_price"].ToString(); //Label56.Text = ds.Tables[0].Rows[0]["customer_name"].ToString(); //Label62.Text = ds.Tables[0].Rows[0]["customer_time_recive"].ToString(); //Label66.Text = ds.Tables[0].Rows[0]["description"].ToString(); lbDescription.Text = dt.Rows[0]["description"].ToString(); } }
protected void Rep_GoodsNo_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Del") { Shoping.DeleteShopCar(e.CommandArgument.ToString()); Of_bind_ShopCar(); Response.Redirect(Request.Url.ToString()); } }
void factor_condition_update2() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); PublicClass pc = new PublicClass(); dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"]); dm.Factor_Condition = "در تاریخ " + pc.GetDate() + " سفارش ارسال شد"; ac.Update_Factor_Condition(dm); }
void factor_condition_update() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); PublicClass pc = new PublicClass(); if (Request.QueryString["Id_Factor"] != null) { dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"]); } dm.Factor_Condition = "در تاریخ " + pc.GetDate() + " مبلغ واریز شد"; ac.Update_Factor_Condition(dm); }
//<اطلاعات کاربر را نشان مي دهد> 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() + " )"; }
void fill_factor() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); DataSet ds = new DataSet(); decimal Sum_Price; decimal All_Sum_Price = 0; dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); GridView1.DataSource = ac.select_factor_detail(dm); GridView1.DataBind(); DataTable dt = ac.select_factor_one(dm); Label38.Text = Request.QueryString["Id_Factor"].ToString(); Label22.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["sum_price"].ToString()); Label19.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["send_price"].ToString()); Label33.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["tasx"].ToString()); if (Label33.Text == "0") { lblTasx.Visible = false; } Label40.Text = dt.Rows[0]["factor_condition"].ToString(); Label2.Text = dt.Rows[0]["date_register"].ToString(); Label4.Text = dt.Rows[0]["peyment_date"].ToString(); Label12.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["discount"].ToString()); if (Label12.Text == "0") { DivTakhfif.Visible = false; } if (Label4.Text.Length == 0) { PayDiv.Visible = false; } Label7.Text = dt.Rows[0]["date_send"].ToString(); if (Label7.Text.Length == 0) { SendDiv.Visible = false; } for (int i = 0; i < GridView1.Rows.Count; i++) { Sum_Price = decimal.Parse(((Label)(GridView1.Rows[i].FindControl("Label14"))).Text); All_Sum_Price = All_Sum_Price + Sum_Price; } Label15.Text = BLL.PublicClass.numberToMoney(All_Sum_Price.ToString()); }
//<اطلاعات فيش واريزي را نشان دهد> void fill_peyment() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); DataSet ds = new DataSet(); if (Request.QueryString["Id_Factor"] != null && Request.QueryString["Factor_Code"] != null && Request.Cookies["Id_User"] != null) { dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"]); dm.Factor_Code = Request.QueryString["Factor_Code"]; dm.Id_User = decimal.Parse(Request.Cookies["Id_User"].Value); } DataTable dt = ac.select_factor_one(dm); if (dt.Rows.Count > 0) { TextBox1.Text = dt.Rows[0]["peyment_code"].ToString(); TextBox9.Text = dt.Rows[0]["bank_code"].ToString(); TextBox2.Text = dt.Rows[0]["peyment_date"].ToString(); TextBox3.Text = dt.Rows[0]["peyment_price"].ToString(); TextBox4.Text = dt.Rows[0]["customer_name"].ToString(); TextBox5.Text = dt.Rows[0]["customer_tell"].ToString(); TextBox6.Text = dt.Rows[0]["customer_time_recive"].ToString(); TextBox7.Text = dt.Rows[0]["customer_address"].ToString(); TextBox8.Text = dt.Rows[0]["description"].ToString(); if (dt.Rows[0]["peyment_kind"].ToString() == "واريز به حساب") { RadioButton2.Checked = true; RadioButton1.Checked = false; } else { RadioButton2.Checked = false; RadioButton1.Checked = true; } if (dt.Rows[0]["bank_name"].ToString().Length > 0) { DropDownList1.Items.FindByText(dt.Rows[0]["bank_name"].ToString()).Selected = true; } if (TextBox2.Text.Length == 0) { fill_user(); PublicClass p = new PublicClass(); TextBox2.Text = p.GetDate(); } } }
protected void Button3_Click(object sender, EventArgs e) { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); PublicClass pc = new PublicClass(); dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); dm.Date_Agreement_Factor = pc.GetDate(); dm.Factor_Agreement = "False"; dm.Factor_Condition = " در تاریخ " + pc.GetDate() + " سفارش لغو شد"; ac.Update_Factor_Agreement(dm); Label20.Visible = true; Label20.Text = "سفارش لغو شد"; }
protected void Button4_Click(object sender, EventArgs e) { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); Calcuate(); dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); dm.Discount = decimal.Parse(TextBoxTakhfif.Text); dm.Tasx = decimal.Parse(TextBox10.Text); dm.Send_Price = decimal.Parse(TextBox11.Text); dm.Sum_Price = decimal.Parse(Label22.Text); dm.Description = txtDescription.Text; ac.Factor_Update_Takhfif(dm); Label19.Visible = true; }
protected void Button2_Click(object sender, EventArgs e) { Factor_Payment_Update(); Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); PublicClass pc = new PublicClass(); dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); dm.Date_Send = pc.GetDate(); dm.Send_Product = true; dm.Factor_Condition = " در تاریخ " + pc.GetDate() + " سفارش ارسال شد"; ac.Update_Send_Factor(dm); Label20.Visible = true; Label20.Text = "ارسال سفارش تایید شد"; factor_condition_update2(); }
//<بررسی می کند که این فاکتور با این کوئری استریگ درست می باشد> void check_factor() { Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); if (Request.QueryString["Id_User"] != null && Request.QueryString["Id_Factor"] != null && Request.QueryString["Factor_Code"] != null) { dm.Id_User = decimal.Parse(Request.QueryString["Id_User"].ToString()); dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); dm.Factor_Code = Request.QueryString["Factor_Code"].ToString(); if (ac.check_factor(dm)) { fill_factor(); fill_user(); } } }
protected void Page_Load(object sender, EventArgs e) { UserInfo.GetUserInfo(out as_Cus_code, out as_Cus_Name); if (!string.IsNullOrEmpty(Request.QueryString["goocode"]))//是否修改购物车 { string aa = ""; aa = Request.QueryString["goocode"]; if (aa.IndexOf('|') > 0) { try { string[] k = aa.Split('|'); if (int.Parse(k[1]) < 1000) { Shoping.UpdateShopCar(k[0], k[1], "Change"); } } catch { } } } if (!IsPostBack) { if (!UserInfo.SureUserWinxin(Request.QueryString["userweixinid"])) { Response.Redirect("Error.aspx"); } Hashtable Hash = Shoping.GetHash(); if (Hash.Count == 0) { P_Err.Visible = true; P_Good.Visible = false; } CustomerModel Model = new CustomerModel(); CustomerDAL DAL = new CustomerDAL(); Model = DAL.GetModel(as_Cus_code); Txt_Phone.Text = Model.Phone; Txt_receiveaddr.Text = Model.Cus_Address; txt_trafficadd.Text = Model.Cus_TrafficeAddr; Of_bind_ShopCar(); } }
private void of_bindGetmain(string as_OrderNO, string type) { string StrSql = "SELECT getdetail.detaildiscountrate,getdetail.disbeforeprice,getdetail.num,goodsno.goo_code," + "getdetail.havepack,goodsno.goo_name,getdetail.sequence,getdetail.HaveSendNum," + "goodsno.goo_no,getdetail.detaildiscountrate,goodsno.content," + "goodsno.spec,getdetail.memo," + "getdetail.num-isnull(getdetail.havesendnum,0) as cp_notsendnum," + "getdetail.num/isnull(specnum,1) as orderPiece," + "getdetail.HaveSendNum/isnull(specnum,1) as HaveSendPiece," + "(getdetail.num-isnull(getdetail.havesendnum,0))/isnull(specnum,1) as NotSendPiece " + "FROM getdetail ,getmain,goodsno " + "WHERE ( getdetail.goo_code = goodsno.goo_code ) " + "and getdetail.orderno=getmain.orderno " + "and getdetail.Orderno=@Orderno " + "order by sequence"; GysoftParameter[] Pa = { new GysoftParameter("@Orderno", as_OrderNO) }; DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, StrSql, Pa); if (type == "show") { GV_Getdetail.DataSource = dt; GV_Getdetail.DataBind(); } if (type == "Replenishment") { for (int li_rows = 0; li_rows < dt.Rows.Count; li_rows++) { string ls_GooCode = dt.Rows[li_rows]["goo_code"].ToString(); Decimal lde_Num = 0; try { lde_Num = Convert.ToDecimal(dt.Rows[li_rows]["num"].ToString()); } catch { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('数量有误!')", true); return; } Shoping.UpdateShopCar(ls_GooCode, lde_Num, "Change"); } } }
private void SaveMun() { for (int li_rows = 0; li_rows < Rep_GoodsNo.Items.Count; li_rows++) { TextBox lTxt_Num = Rep_GoodsNo.Items[li_rows].FindControl("txt_num") as TextBox; if (lTxt_Num.Text.Trim() == "") { continue; } string ls_GooCode = lTxt_Num.Attributes["GooCode"].ToString(); Decimal lde_Num = 0; try { lde_Num = Convert.ToDecimal(lTxt_Num.Text); } catch { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('数量有误!')", true); return; } Shoping.UpdateShopCar(ls_GooCode, lde_Num, "Change"); } }
public ActionResult DeleteShop(int id) { Shoping shop = ShopingServices.LoadEntities(s => s.Id == id).FirstOrDefault(); if (shop == null) { return(Content("数据错误,请刷新本页面")); } shop.DelFlag = delete; try { ShopingServices.Update(shop); return(Content("ok")); } catch (Exception) { return(Content("数据库错误,请联系管理员")); throw; } }
/// <summary> /// 保存到购物车 /// </summary> private void SaveMun(DataTable ad_tab) { for (int i = 0; i < ad_tab.Rows.Count; i++) { if (!string.IsNullOrEmpty(ad_tab.Rows[i][0].ToString()) && !string.IsNullOrEmpty(ad_tab.Rows[i][1].ToString())) { string ls_GooCode = Dyeing_GooCode(Request.QueryString["goodtype"], ad_tab.Rows[i][0].ToString()); Decimal lde_Num = 0; if (Request.Form[i] != "") { try { lde_Num = Convert.ToDecimal(ad_tab.Rows[i][1].ToString()); } catch { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('数量有误!')", true); return; } Shoping.UpdateShopCar(ls_GooCode, lde_Num, "Change"); } } } Shoping.GetHash(); }
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 Of_bind_Goods() { int li_PageIndex = 1; try { li_PageIndex = Convert.ToInt32(Lbl_PageIndex.Text); } catch { } //isnull((select memo from Goodsno_picture where Goo_code=goodsno.goo_code),'')as memo, string ls_SQL = @"select isnull((select ThumbnaiIimg from Goodsno_picture where Goo_code=goodsno.goo_code),'img/error.png')as ThumbnaiIimg, goo_code,goo_no,specnum,Goo_Type,Goo_Mate,goo_name,0.00 as UserPrice,Spec, Content,Goo_unit,getdetail_memo,0 as num,0 as piece,'' as lasttime,saleprice,'' as discount from goodsno where 1=1 and isnull(goo_mate,'')<>'PR' and goo_code in ( select goods_code from outone,outmany where outone.out_no=outmany.out_no and outone.cus_code ='#cus_code' and outone.out_date >='#out_date' group by goods_code ) order by goo_name"; //GysoftParameter[] Pa ={new GysoftParameter("@cus_code",SysVisitor.Current.UserCode), // new GysoftParameter("@out_date",DateTime.Now.AddYears(-1).ToString())}; ls_SQL = ls_SQL.Replace("#cus_code", SysVisitor.Current.UserCode); ls_SQL = ls_SQL.Replace("#out_date", DateTime.Now.AddYears(-1).ToString()); n_findby_dw lnv_find = new n_findby_dw(); lnv_find.of_setSQL(ls_SQL); lnv_find.of_SetOr("Txt_GoodNo", "goo_no", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "GyNo", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "goo_name", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "barcode", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "content", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "CAST(saleprice as varchar(50))", "like", Txt_GoodNo.Text); lnv_find.of_SetCol("DDL_GooMate", "goo_mate", "=", DDL_GooMate.SelectedValue.ToString()); lnv_find.of_SetCol("DDL_GooType", "goo_type", "=", DDL_GooMate.SelectedValue.ToString()); int count = 0; DataTable ldt_Goods = new DataTable(); ldt_Goods = lnv_find.Of_GetPageDataTable("goodsno.goo_code", gi_PageSize, li_PageIndex, ref count); if (li_PageIndex == 1) { if (count % gi_PageSize != 0) { Lbl_PageCount.Text = ((count / gi_PageSize) + 1).ToString(); } else { Lbl_PageCount.Text = (count / gi_PageSize).ToString(); } } #region 添加价格和采购量 Hashtable Hash = Shoping.GetHash(); for (int li_Rows = 0; li_Rows < ldt_Goods.Rows.Count; li_Rows++)//discount { string ls_goodcode; ls_goodcode = ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim(); string ls_getdetail_memo; ls_getdetail_memo = ldt_Goods.Rows[li_Rows]["getdetail_memo"].ToString(); string ls_key_goodcode; ls_key_goodcode = SysVisitor.Current.UserCode + "." + ls_goodcode + ".price"; string ls_Price; ls_Price = GyRedis.GyRedis.Get(ls_key_goodcode, ""); if (ls_Price == "") { ls_Price = UserInfo.ShowGoo_price(ls_goodcode, ls_getdetail_memo); GyRedis.GyRedis.Set(ls_key_goodcode, ls_Price); } Decimal lde_Price = 0; try { lde_Price = Convert.ToDecimal(ls_Price); } catch { ldt_Goods.Rows[li_Rows]["UserPrice"] = 0.00; continue; } ldt_Goods.Rows[li_Rows]["UserPrice"] = lde_Price; if (Hash.ContainsKey(ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim())) { try { Decimal num = Convert.ToDecimal(Hash[ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim()]); int li_num = Convert.ToInt32(Decimal.Round(num, 0)); ldt_Goods.Rows[li_Rows]["num"] = li_num; ldt_Goods.Rows[li_Rows]["piece"] = li_num / Convert.ToDecimal(ldt_Goods.Rows[li_Rows]["specnum"]); } catch { ldt_Goods.Rows[li_Rows]["num"] = 0; ldt_Goods.Rows[li_Rows]["piece"] = 0; } } //获取折扣率 //string ls_Discount = UserInfo.ShowGoo_price(ldt_Goods.Rows[li_Rows]["goo_code"], // ldt_Goods.Rows[li_Rows]["getdetail_memo"], "discount"); //ldt_Goods.Rows[li_Rows]["discount"] = ls_Discount.Substring(0,3); //string ls_SalePrice = ldt_Goods.Rows[li_Rows]["saleprice"].ToString(); //Decimal lde_SalePrice = 0; //try { lde_SalePrice = Convert.ToDecimal(ls_SalePrice); } //catch { } //ldt_Goods.Rows[li_Rows]["saleprice"] = lde_SalePrice.ToString("f2"); } #endregion #region 取得最后订货时间 for (int li_Rows = 0; li_Rows < ldt_Goods.Rows.Count; li_Rows++) { string ls_goodcode; ls_goodcode = ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim(); string ls_key_goodcode; ls_key_goodcode = SysVisitor.Current.UserCode + "." + ls_goodcode; string ls_LastTime; ls_LastTime = GyRedis.GyRedis.Get(ls_key_goodcode, ""); if (ls_LastTime == "") { ls_LastTime = UserInfo.ShowLastTime(ls_goodcode); GyRedis.GyRedis.Set(ls_key_goodcode, ls_LastTime); } try { DateTime dt = Convert.ToDateTime(ls_LastTime); ls_LastTime = dt.ToString("yyyy-MM-dd"); } catch { ls_LastTime = ""; } ldt_Goods.Rows[li_Rows]["lasttime"] = ls_LastTime; } if (Convert.ToInt32(Lbl_PageCount.Text) > 1) { Pages.Visible = true; } else { Pages.Visible = false; } #endregion //#region 对图文信息进行转义 //for (int i = 0; i < ldt_Goods.Rows.Count; i++) //{ // ldt_Goods.Rows[i]["memo"] = SysVisitor.GetFormatHtmlStr(ldt_Goods.Rows[i]["memo"].ToString()); //} //#endregion Rep_GoodsNo.DataSource = ldt_Goods; Rep_GoodsNo.DataBind(); }
void fill_factor() { int userid; Shoping ac = new Shoping(); ShopingDatum dm = new ShopingDatum(); DataSet ds = new DataSet(); decimal Sum_Price; decimal All_Sum_Price = 0; dm.Id_Factor = decimal.Parse(Request.QueryString["Id_Factor"].ToString()); GridView1.DataSource = ac.select_factor_detail(dm); GridView1.DataBind(); DataTable dt = ac.select_factor_one(dm); userid = int.Parse(dt.Rows[0]["id_user"].ToString()); Label38.Text = Request.QueryString["Id_Factor"].ToString(); Label22.Text = BLL.PublicClass.numberToMoney(dt.Rows[0]["sum_price"].ToString()); TextBox11.Text = dt.Rows[0]["send_price"].ToString(); TextBox10.Text = dt.Rows[0]["tasx"].ToString(); TextBoxTakhfif.Text = dt.Rows[0]["Discount"].ToString(); Label40.Text = dt.Rows[0]["factor_condition"].ToString(); Label2.Text = dt.Rows[0]["date_register"].ToString(); Label4.Text = dt.Rows[0]["peyment_date"].ToString(); txtDescription.Text = dt.Rows[0]["description"].ToString(); for (int i = 0; i < GridView1.Rows.Count; i++) { Sum_Price = decimal.Parse(((Label)(GridView1.Rows[i].FindControl("Label14"))).Text); All_Sum_Price = All_Sum_Price + Sum_Price; } Label15.Text = BLL.PublicClass.numberToMoney(All_Sum_Price.ToString()); TextBox1.Text = dt.Rows[0]["peyment_code"].ToString(); TextBox9.Text = dt.Rows[0]["bank_code"].ToString(); TextBox2.Text = dt.Rows[0]["peyment_date"].ToString(); TextBox3.Text = dt.Rows[0]["peyment_price"].ToString(); TextBox4.Text = dt.Rows[0]["customer_name"].ToString(); TextBox5.Text = dt.Rows[0]["customer_tell"].ToString(); TextBox6.Text = dt.Rows[0]["customer_time_recive"].ToString(); TextBox7.Text = dt.Rows[0]["customer_address"].ToString(); TextBox8.Text = dt.Rows[0]["description"].ToString(); if (dt.Rows[0]["peyment_kind"].ToString() == "واريز به حساب") { RadioButton2.Checked = true; RadioButton1.Checked = false; } else { RadioButton2.Checked = false; RadioButton1.Checked = true; } if (dt.Rows[0]["bank_name"].ToString().Length > 0) { DropDownList1.Items.FindByText(dt.Rows[0]["bank_name"].ToString()).Selected = true; } if (Label4.Text.Length == 0) { Label4.Text = "هنوز ثبت نشده است"; FillUser(decimal.Parse(dt.Rows[0]["ID_User"].ToString())); } Label7.Text = dt.Rows[0]["date_send"].ToString(); if (Label7.Text.Length == 0) { Label7.Text = "هنوز ارسال نشده است"; } TextBox12.Text = new BLL.user().select_one_user(new userDatum() { Id = userid }).Rows[0]["post_code"].ToString(); }
private void Of_bind_Goods() { int li_PageIndex = 1; try { li_PageIndex = Convert.ToInt32(Lbl_PageIndex.Text); } catch { } string ls_SQL = @"select isnull((select ThumbnaiIimg from Goodsno_picture where Goo_code=goodsno.goo_code),'img/error.png')as ThumbnaiIimg, goodsno.goo_code,goodsno.goo_no,goodsno.specnum,goodsno.Goo_Type,goodsno.Goo_Mate,goodsno.goo_name,0.00 as UserPrice,goodsno.Spec, goodsno.Content,goodsno.Goo_unit,goodsno.getdetail_memo,0 as num,0 as piece from goodsno,goodmate,goodtype where 1=1 and goo_type=typeno and goo_mate*=matecode and goodsno.isweb='Y' and goodtype.isweb='Y' and goodmate.isweb='Y'"; ls_SQL += WebSet.GetShowGood_SQL("all"); n_findby_dw lnv_find = new n_findby_dw(); lnv_find.of_setSQL(ls_SQL); lnv_find.of_SetOr("Txt_GoodNo", "goo_no", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "GyNo", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "goo_name", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "barcode", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "content", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "CAST(saleprice as varchar(50))", "like", Txt_GoodNo.Text); lnv_find.of_SetCol("goo_mate", "goodsno.goo_mate", "=", DDL_GooMate.SelectedValue.Trim()); lnv_find.of_SetCol("goo_type", "goodsno.goo_type", "=", DDL_GooType.SelectedValue.Trim()); int count = 0; DataTable ldt_Goods = lnv_find.Of_GetPageDataTable("goodsno.goo_code", gi_PageSize, li_PageIndex, ref count);//PageDAL.Page(Page, baseclass.GysoftParameter.ChangeParameter(ll_Pa), out count); Log.WriteTextLog("Dw_OrderCarSql", "Log", lnv_find.AllSQL + " sql=" + ls_SQL, 9); if (li_PageIndex == 1) { if (count % gi_PageSize != 0) { Lbl_PageCount.Text = ((count / gi_PageSize) + 1).ToString(); } else { Lbl_PageCount.Text = (count / gi_PageSize).ToString(); } } #region 添加价格和采购量 Hashtable Hash = Shoping.GetHash(); for (int li_Rows = 0; li_Rows < ldt_Goods.Rows.Count; li_Rows++) { string ls_Price = UserInfo.ShowGoo_price(ldt_Goods.Rows[li_Rows]["goo_code"], ldt_Goods.Rows[li_Rows]["getdetail_memo"]); Decimal lde_Price = 0; try { lde_Price = Convert.ToDecimal(ls_Price); } catch { ldt_Goods.Rows[li_Rows]["UserPrice"] = 0.00; continue; } ldt_Goods.Rows[li_Rows]["UserPrice"] = lde_Price; if (Hash.ContainsKey(ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim())) { try { Decimal num = Convert.ToDecimal(Hash[ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim()]); int li_num = Convert.ToInt32(Decimal.Round(num, 0)); ldt_Goods.Rows[li_Rows]["num"] = li_num; ldt_Goods.Rows[li_Rows]["piece"] = li_num / Convert.ToDecimal(ldt_Goods.Rows[li_Rows]["specnum"]); } catch { ldt_Goods.Rows[li_Rows]["num"] = 0; ldt_Goods.Rows[li_Rows]["piece"] = 0; } } } #endregion if (Convert.ToInt32(Lbl_PageCount.Text) > 1) { Pages.Visible = true; } else { Pages.Visible = false; } Rep_GoodsNo.DataSource = ldt_Goods; Rep_GoodsNo.DataBind(); }
private void Of_bind_ShopCar() { Hashtable Hash = Shoping.GetHash(); StringBuilder ls_id = new StringBuilder(); foreach (string id in Hash.Keys) { if (ls_id.Length != 0) { ls_id.Append(",'" + id + "'"); } else { ls_id.Append("'" + id + "'"); } } if (ls_id.Length == 0) { return; } string StrSql = "SELECT goo_no,goo_name,goo_code,goo_type,goo_mate,0 as num,0 as piece," + "Specnum,getdetail_memo,Content,spec,0.00 as Total,Goo_unit FROM goodsno " + " where goo_code in (" + ls_id.ToString() + ") " + //WebSet.GetShowGood_SQL("Cus") + " order by goo_type,goo_no "; DataTable ldt_Goods = new DataTable(); ldt_Goods = SqlHelper.ExecuteDataTable(StrSql); DataColumn[] Keys = { ldt_Goods.Columns["goo_code"] }; ldt_Goods.PrimaryKey = Keys; Decimal ld_TotalAll = 0; foreach (string X in Hash.Keys) { try { Decimal num = Convert.ToDecimal(Hash[X]); int li_num = Convert.ToInt32(Decimal.Round(num, 0)); DataRow Dr = ldt_Goods.Rows.Find(X); Dr["num"] = li_num; Dr["piece"] = li_num / Convert.ToDecimal(Dr["specnum"]); string ls_price = UserInfo.ShowGoo_price(Dr["goo_code"], Dr["Getdetail_Memo"]); if (ls_price == "登陆可见") { continue; } Decimal price = Convert.ToDecimal(ls_price); Dr["Total"] = li_num * price; ld_TotalAll += li_num * price; } catch { } } Rep_GoodsNo.DataSource = ldt_Goods; Rep_GoodsNo.DataBind(); Lbl_TotalAll.Text = ld_TotalAll.ToString(); }
protected void ImageButton5_Click(object sender, ImageClickEventArgs e) { decimal id_user; string user_name; if (Request.Cookies["Login_User"] == null) { Label30.Visible = true; Login1.Visible = true; TextTitle.Focus(); } else { Label30.Visible = false; id_user = decimal.Parse(Request.Cookies["Id_User"].Value); user_name = Request.Cookies["Family_User"].Value; user ac = new user(); userDatum dm = new userDatum(); dm.Id = id_user; DataTable dt = ac.select_one_user(dm); user_name = dt.Rows[0]["name"].ToString() + " " + dt.Rows[0]["family"].ToString(); //-----------------------------------------------------------------------------------------------// Shoping ac2 = new Shoping(); ShopingDatum dm2 = new ShopingDatum(); PublicClass pc = new PublicClass(); dm2.Id_User = id_user; dm2.Register_Date = pc.GetDate(); Random rnd = new Random(); string f_code = null; for (int j = 0; j < 16; j++) { f_code = f_code + rnd.Next(0, 9).ToString(); } dm2.Factor_Code = f_code; dm2.Tasx = decimal.Parse(Label33.Text); dm2.Send_Price = decimal.Parse(Label19.Text); dm2.Sum_Price = decimal.Parse(Label22.Text); dm2.Factor_Condition = "در تاریخ " + pc.GetDate() + " سفارش ثبت شد"; dm2.Customer_Name = user_name; decimal id_factor = ac2.Insert_Factor(dm2); dm2.Id_Factor = id_factor; for (int i = 0; i < GridView1.Rows.Count; i++) { dm2.Count = int.Parse(((DropDownList)(GridView1.Rows[i].FindControl("DropDownList1"))).SelectedValue); dm2.Id_Product = decimal.Parse(((Label)(GridView1.Rows[i].FindControl("lblid"))).Text); ac2.Insert_Factor_Details(dm2); update_number_shop(decimal.Parse(((Label)(GridView1.Rows[i].FindControl("lblid"))).Text), int.Parse(((DropDownList)(GridView1.Rows[i].FindControl("DropDownList1"))).SelectedValue)); } Session["ProductTable"] = null; Response.Redirect("~/index.aspx?Type=ShopPeymentRegister&Factor_Code=" + f_code + "&Id_Factor=" + id_factor + "&Sum_Price=" + decimal.Parse(Label22.Text)); } }
protected void IBtn_Save_Click(object sender, ImageClickEventArgs e) { Hashtable Hash = Shoping.GetHash(); if (Hash.Count == 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('你的购物车内没有商品!');", true); return; } GoodsNoDAL DAL = new GoodsNoDAL(); //创建DataTable DataTable ldt_GoodsNo = new DataTable(); ldt_GoodsNo.Columns.Add("GoodCode"); ldt_GoodsNo.Columns.Add("GooNo"); ldt_GoodsNo.Columns.Add("Num"); ldt_GoodsNo.Columns.Add("GooType"); ldt_GoodsNo.Columns.Add("GooMate"); ldt_GoodsNo.Columns.Add("Getdetail_Memo"); ldt_GoodsNo.Columns.Add("Goo_price"); #region 先转换成DataTable foreach (string id in Hash.Keys) { string ls_Goodcode = id; if (ls_Goodcode.Trim().Length == 0 || ls_Goodcode == " ") { continue; } string ls_num = Hash[id].ToString(); Decimal ld_Num; try { ld_Num = Convert.ToDecimal(ls_num); if (ld_Num <= 0) { continue; } } catch { continue; } GoodsNoModel Mode = DAL.GetShowModel(id); DataRow Dr = ldt_GoodsNo.NewRow(); Dr["GoodCode"] = Mode.Goo_code; Dr["GooNo"] = Mode.Goo_no; Dr["Num"] = ld_Num; Dr["GooType"] = Mode.Goo_type; Dr["GooMate"] = Mode.Goo_mate; Dr["Getdetail_Memo"] = Mode.Getdetail_Memo; Dr["Goo_price"] = Mode.Goo_price; if (Mode.Goo_price == "") { Log.WriteTextLog("Dw_OrderSave_Err", "Log", "GoodCode=" + Mode.Goo_code + " Getdetail_Memo=" + Mode.Getdetail_Memo, 3); ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('获取价格失败!订单无法保存');", true);//select * from dbo.uf_getcussaleprice('GD198','600001','2015-10-10','正常') return; } ldt_GoodsNo.Rows.Add(Dr); } ldt_GoodsNo.DefaultView.Sort = "GooType,GooNo"; #endregion #region 提取分单数据 DataTable ldt_Extract = new DataTable(); string ls_Extract_ID = publicfuns.of_GetMySysSet("网上商城", "分单"); if (ls_Extract_ID != "") { ldt_Extract.Columns.Add("GoodCode"); ldt_Extract.Columns.Add("GooNo"); ldt_Extract.Columns.Add("Num"); ldt_Extract.Columns.Add("GooType"); ldt_Extract.Columns.Add("GooMate"); ldt_Extract.Columns.Add("Getdetail_Memo"); ldt_Extract.Columns.Add("Goo_price"); for (int li_Rows = 0; li_Rows < ldt_GoodsNo.Rows.Count; li_Rows++) { if (ldt_GoodsNo.Rows[li_Rows]["GooMate"].ToString().Trim() == ls_Extract_ID.Trim()) { ldt_Extract.Rows.Add(ldt_GoodsNo.Rows[li_Rows].ItemArray); ldt_GoodsNo.Rows[li_Rows].Delete(); } } ldt_Extract.DefaultView.Sort = "GooType,GooNo"; } #endregion if (ldt_GoodsNo.Rows.Count > 0) { of_OrderSave(ldt_GoodsNo.DefaultView.ToTable()); } if (ldt_Extract.Rows.Count > 0) { of_OrderSave(ldt_Extract.DefaultView.ToTable()); } Shoping.Clear(); ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('保存成功,谢谢你的订单!');location.href='Dw_OrderCar.aspx?UserKey=" + UserInfo.GetUserKey() + "&userweixinid=" + SysVisitor.Current.UserWeixinID + "'", true); //IBtn_Save2.Enabled = false; //Response.Redirect("Dw_OrderCar.aspx?UserKey=" + UserInfo.GetUserKey()); }