private void button1_Click(object sender, EventArgs e) { ProModel m = new ProModel(); m.ProId = Convert.ToInt32(this.Tag); m.ProName = txt1.Text; m.ProUnit = txt2.Text; //m.ProDate = DateTime.Now; m.ProPrice = Convert.ToInt32(txt4.Text); m.ProNum = Convert.ToInt32(txt5.Text); //m.ProSta =textBox1.Text; //var obj = { }; //int id = Convert.ToInt32(this.Tag); int i = dal.Update(m); if (i > 0) { MessageBox.Show("材料成功修改"); this.Close(); //ProModel m = new ProModel(); _pro(); } else { MessageBox.Show("修改故障,请检查!"); } }
protected void Page_Load(object sender, EventArgs e) { M_UserInfo mu = GetLogin(); if (!IsPostBack) { ProModel model = new ProModel() { ProID = DataConvert.CLng(Request["ID"]), Pronum = DataConvert.CLng(Request["Pronum"]) }; model.Pronum = model.Pronum < 1 ? 1 : model.Pronum; if (model.ProID > 0)//将商品加入购物车 { M_Product proMod = proBll.GetproductByid(model.ProID); OrderCommon.ProductCheck(proMod); //-----------------检测完成加入购物车 M_Cart cartMod = new M_Cart(); cartMod.Cartid = CartCookID; cartMod.StoreID = proMod.UserShopID; cartMod.ProID = model.ProID; cartMod.Pronum = model.Pronum; cartMod.userid = mu.UserID; cartMod.Username = mu.UserName; cartMod.Getip = EnviorHelper.GetUserIP(); cartMod.Addtime = DateTime.Now; cartMod.FarePrice = proMod.LinPrice.ToString(); cartMod.Proname = proMod.Proname; int id = cartBll.AddModel(cartMod); ImportExtField(id, Request.Form["ext_hid"]);//模型字段 Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); } MyBind(); } }
private void button1_Click(object sender, EventArgs e) { ProModel m = new ProModel(); m.ProName = txt1.Text; m.ProUnit = txt2.Text; m.ProDate = DateTime.Now; m.ProPrice = Convert.ToInt32(txt4.Text); m.ProNum = Convert.ToInt32(txt5.Text); m.ProSta = textBox1.Text; int i = dal.Add(m); if (i > 0) { MessageBox.Show("材料成功添加"); this.Close(); _rep(); // ProModel m = new ProModel(); //Form1 f1 = new Form1(); //f1.Show(); } else { MessageBox.Show("添加故障,请检查!"); } }
//将购买信息,存入购物车 private int AddCart(ProModel pro, M_UserInfo mu, string addition) { int proid = pro.ProID; int pronum = pro.Pronum; if (proid < 1 || pronum < 1) { function.WriteErrMsg("商品ID或数量异常"); } M_Cart cartMod = new M_Cart(); cartMod.Cartid = CartCookID; cartMod.StoreID = pro.StoreID; cartMod.ProID = proid; cartMod.Pronum = pronum; cartMod.userid = mu.UserID; cartMod.Username = mu.UserName; cartMod.Getip = EnviorHelper.GetUserIP(); cartMod.Addtime = DateTime.Now; cartMod.Additional = addition; cartMod.code = pro.code; cartMod.Proname = pro.ProName; cartMod.ID = cartBll.insert(cartMod); return(cartMod.ID); }
/// <summary> /// 获取分页 /// </summary> /// <param name="number">总数</param> /// <param name="pagesize">页大小</param> /// <returns></returns> public static List <ProModel> GetProListPageNoByLang(int lang, int number, int pagesize) { List <ProModel> list = EispProDAL.GetProListPageNoByLang(lang, number, pagesize); ProModel p = new ProModel(); Reverser <ProModel> reverser = new Reverser <ProModel>(p.GetType(), "F_Sort", ReverserInfo.Direction.DESC); list.Sort(reverser); return(list); }
protected void Page_Load(object sender, EventArgs e) { M_UserInfo mu = GetLogin(); if (!IsPostBack) { ProModel model = new ProModel() { ProID = DataConvert.CLng(Request["ID"]), Pronum = DataConvert.CLng(Request["Pronum"]) }; model.Pronum = model.Pronum < 1 ? 1 : model.Pronum; if (model.ProID > 0)//将商品加入购物车 { M_Product proMod = proBll.GetproductByid(model.ProID); if (proMod == null || proMod.ID < 1) { function.WriteErrMsg("商品不存在"); } if (proMod.ProClass == (int)M_Product.ClassType.IDC) { Response.Redirect("/Cart/FillIDCInfo.aspx?proid=" + proMod.ID); } OrderCommon.ProductCheck(proMod); #region 特选商品逻辑 [delete] if (proMod.Largess == 1) { B_User_BindPro ubpBll = new B_User_BindPro(); M_User_BindPro ubpMod = null; if (mu.IsNull) { return; } ubpMod = ubpBll.SelModelByUid(mu.UserID); if (ubpMod == null || !ubpMod.ProIDS.Contains("," + proMod.ID + ",")) { Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); return; } } #endregion //-----------------检测完成加入购物车 M_Cart cartMod = new M_Cart(); cartMod.Cartid = CartCookID; cartMod.StoreID = proMod.UserShopID; cartMod.ProID = model.ProID; cartMod.Pronum = model.Pronum; cartMod.userid = mu.UserID; cartMod.Username = mu.UserName; cartMod.FarePrice = proMod.LinPrice.ToString(); cartMod.ProAttr = DataConvert.CStr(Request["attr"]); cartMod.Proname = proMod.Proname; int id = cartBll.AddModel(cartMod); //ImportExtField(id, Request.Form["ext_hid"]);//模型字段 Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); } MyBind(); } }
//添加 public int Add(ProModel m) { string sql = $"insert into Procurement values('{m.ProName}','{m.ProUnit}','{m.ProDate}',{m.ProPrice},{m.ProNum},default)"; //if (!string.IsNullOrEmpty(name)) //{ // sql += $" and ProName='{name}'"; //} return(db.ExecuteNonQuery(sql)); }
/// <summary> /// 根据产品类别获取产品分页功能 /// </summary> /// <param name="number"></param> /// <param name="pagesize"></param> /// <param name="classid"></param> /// <returns></returns> public static List <ProModel> GetListPageNoByClassID(int number, int pagesize, int classid, int provider) { string strid = ""; GetClassSubAllByClass(classid, ref strid); List <ProModel> list = EispProDAL.GetListPageNoByClassID(number, pagesize, strid, provider, classid); ProModel p = new ProModel(); Reverser <ProModel> reverser = new Reverser <ProModel>(p.GetType(), "F_Sort", ReverserInfo.Direction.DESC); list.Sort(reverser); return(list); }
public void ProBind(int id) { ProModel p = EispProBLL.GetProByID(id); Page.Title = p.F_ProName; proname = p.F_ProName; propic = p.F_Pic; prosize = p.F_ProSize; proshuxing = p.F_Proattributes; prosizetable = p.F_ProSizeTable; procontent = p.F_ProDescription; litpic = ProTopBind(10, 10, p.F_ProClassID); GetClassName(0, p.F_ProClassID, false, ref classname); }
/// <summary> /// 根据产品类别获取产品分页功能 /// </summary> /// <param name="number"></param> /// <param name="pagesize"></param> /// <param name="classid"></param> /// <returns></returns> public static List <ProModel> GetListPageNoByClassID(int number, int pagesize, string classid, int provider, int mainclass) { string sql = string.Empty; string providerstr = "false"; if (provider == 1) { providerstr = "true"; } sql = "select top " + pagesize + " * from (select top " + number + " * from T_Product where (F_ProClassID in(" + classid + ") Or InStr(F_ProExtClass,'," + mainclass + ",')>0) And F_IsProvider=" + providerstr + " order by ProID asc) order by ProID desc"; List <ProModel> list = new List <ProModel>(); ProModel p = null; OleDbDataReader dr = AccessorDB.ExecuteReader(sql); while (dr.Read()) { p = new ProModel(); p.ProID = Convert.ToInt32(dr["ProID"]); p.F_ProName = dr["F_ProName"].ToString(); p.F_Proattributes = dr["F_Proattributes"].ToString(); p.F_ProDescription = dr["F_ProDescription"].ToString(); p.F_ProSize = dr["F_ProSize"].ToString(); p.F_ProSizeTable = dr["F_ProSizeTable"].ToString(); p.F_ProWashing = dr["F_ProWashing"].ToString(); p.F_ProClassID = Convert.ToInt32(dr["F_ProClassID"]); p.F_Date = Convert.ToDateTime(dr["F_Date"]); p.F_Sort = Convert.ToInt32(dr["F_Sort"]); p.F_IsProvider = Convert.ToBoolean(dr["F_IsProvider"]); p.F_Pic = dr["F_ProPic"].ToString(); p.F_ExtClass = dr["F_ProExtClass"].ToString(); p.F_SmallPic = dr["F_ProSmallPic"].ToString(); // p.F_ClassName = dr["F_ClassName"].ToString(); p.F_IsTop = Convert.ToBoolean(dr["F_IsTop"]); list.Add(p); } //throw new Exception("无记录" + sql); dr.Close(); dr.Dispose(); return(list); }
/// <summary> /// 按类别搜索 /// </summary> /// <param name="proclassid"></param> /// <returns></returns> public static List <ProModel> SearchProList(string proclassid) { string sql = "select T_Product.*,T_ProClass.F_ClassName from T_Product,T_ProClass where T_Product.F_ProClassID = T_ProClass.ID and T_Product.F_ProClassID in(" + proclassid + ") order by T_Product.F_Sort desc"; List <ProModel> list = new List <ProModel>(); ProModel p = null; //OleDbParameter[] parameter = new OleDbParameter[1]; //parameter[0] = new OleDbParameter("@F_ProClassID", OleDbType.VarChar); //parameter[0].Value = proclassid; OleDbDataReader dr = AccessorDB.ExecuteReader(sql); while (dr.Read()) { p = new ProModel(); p.ProID = Convert.ToInt32(dr["ProID"]); p.F_ProName = dr["F_ProName"].ToString(); p.F_Proattributes = dr["F_Proattributes"].ToString(); p.F_ProDescription = dr["F_ProDescription"].ToString(); p.F_ProSize = dr["F_ProSize"].ToString(); p.F_ProSizeTable = dr["F_ProSizeTable"].ToString(); p.F_ProWashing = dr["F_ProWashing"].ToString(); p.F_ProClassID = Convert.ToInt32(dr["F_ProClassID"]); p.F_Date = Convert.ToDateTime(dr["F_Date"]); p.F_ClassName = dr["F_ClassName"].ToString(); p.F_IsProvider = Convert.ToBoolean(dr["F_IsProvider"]); p.F_Pic = dr["F_ProPic"].ToString(); p.F_ExtClass = dr["F_ProExtClass"].ToString(); p.F_SmallPic = dr["F_ProSmallPic"].ToString(); list.Add(p); } dr.Close(); dr.Dispose(); return(list); }
protected void ProBind(int id) { ProModel p = EispProBLL.GetProByID(id); this.txtTitle.Text = p.F_ProName; this.txtProid.Value = id.ToString(); this.txtGuige.Value = p.F_ProSizeTable; this.hangye.Value = p.F_Proattributes; this.txtSort.Text = p.F_Sort.ToString(); this.txtImgPath.Text = p.F_Pic; this.txtYingyong.Value = p.F_ProSize; this.content.Value = p.F_ProDescription; this.cbCommend.Checked = p.F_IsTop; this.cbProvider.Checked = p.F_IsProvider; BindDrpClass(0, "-", p.F_ProClassID, p.F_ExtClass); }
/// <summary> /// 更新 /// </summary> /// <param name="p"></param> /// <returns></returns> public static int UpdatePro(ProModel p) { string sql = "update T_Product set F_ProName=?,F_Proattributes=?,F_ProDescription=?,F_ProWashing=?,F_ProSize=?,F_ProClassID=?,F_ProSizeTable=?,F_IsTop=?,F_Sort=?,F_IsProvider=?,F_ProPic=?,F_ProSmallPic=?,F_ProExtClass=? where ProID=?"; OleDbParameter[] parameter = new OleDbParameter[14]; parameter[0] = new OleDbParameter("@F_ProName", OleDbType.VarChar, 50); parameter[1] = new OleDbParameter("@F_Proattributes", OleDbType.VarChar, 300); parameter[2] = new OleDbParameter("@F_ProDescription", OleDbType.VarChar); parameter[3] = new OleDbParameter("@F_ProWashing", OleDbType.VarChar, 250); parameter[4] = new OleDbParameter("@F_ProSize", OleDbType.VarChar, 200); parameter[5] = new OleDbParameter("@F_ProClassID", OleDbType.Integer); parameter[6] = new OleDbParameter("@F_ProSizeTable", OleDbType.VarChar); parameter[7] = new OleDbParameter("@F_IsTop", OleDbType.Boolean); parameter[8] = new OleDbParameter("@F_Sort", OleDbType.Integer); parameter[9] = new OleDbParameter("@F_IsProvider", OleDbType.Boolean); parameter[10] = new OleDbParameter("@F_ProPic", OleDbType.VarChar); parameter[11] = new OleDbParameter("@F_ProSmallPic", OleDbType.VarChar); parameter[12] = new OleDbParameter("@F_ProExtClass", OleDbType.VarChar); parameter[13] = new OleDbParameter("@ProID", OleDbType.Integer); parameter[0].Value = p.F_ProName; parameter[1].Value = p.F_Proattributes; parameter[2].Value = p.F_ProDescription; parameter[3].Value = p.F_ProWashing; parameter[4].Value = p.F_ProSize; parameter[5].Value = p.F_ProClassID; parameter[6].Value = p.F_ProSizeTable; parameter[7].Value = p.F_IsTop; parameter[8].Value = p.F_Sort; parameter[9].Value = p.F_IsProvider; parameter[10].Value = p.F_Pic; parameter[11].Value = p.F_SmallPic; parameter[12].Value = p.F_ExtClass; parameter[13].Value = p.ProID; return(AccessorDB.ExecuteNonQuery(sql, parameter)); }
/// <summary> /// 获取分页 /// </summary> /// <param name="number">总数</param> /// <param name="pagesize">页大小</param> /// <returns></returns> public static List <ProModel> GetProListPageNoByLang(int lang, int number, int pagesize) { string sql = "select top " + pagesize + " * from( select top " + number + " T_Product.*,T_ProClass.F_ClassName from T_Product,T_ProClass where T_Product.F_Lang=" + lang + " And T_Product.F_ProClassID = T_ProClass.ID order by T_Product.ProID asc ) order by T_Product.ProID desc"; List <ProModel> list = new List <ProModel>(); ProModel p = null; OleDbDataReader dr = AccessorDB.ExecuteReader(sql); while (dr.Read()) { p = new ProModel(); p.ProID = Convert.ToInt32(dr["ProID"]); p.F_ProName = dr["F_ProName"].ToString(); p.F_Proattributes = dr["F_Proattributes"].ToString(); p.F_ProDescription = dr["F_ProDescription"].ToString(); p.F_ProSize = dr["F_ProSize"].ToString(); p.F_ProSizeTable = dr["F_ProSizeTable"].ToString(); p.F_ProWashing = dr["F_ProWashing"].ToString(); p.F_ProClassID = Convert.ToInt32(dr["F_ProClassID"]); p.F_Date = Convert.ToDateTime(dr["F_Date"]); p.F_ClassName = dr["F_ClassName"].ToString(); p.F_Sort = Convert.ToInt32(dr["F_Sort"]); p.F_IsTop = Convert.ToBoolean(dr["F_IsTop"]); p.F_IsProvider = Convert.ToBoolean(dr["F_IsProvider"]); p.F_Pic = dr["F_ProPic"].ToString(); p.F_ExtClass = dr["F_ProExtClass"].ToString(); p.F_SmallPic = dr["F_ProSmallPic"].ToString(); list.Add(p); } dr.Close(); dr.Dispose(); return(list); }
/// <summary> /// 获取一条产品信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public static ProModel GetProByID(int id) { string sql = "select T_Product.*,T_ProClass.F_ClassName from T_Product,T_ProClass where T_Product.F_ProClassID = T_ProClass.ID and T_Product.ProID=?"; OleDbParameter[] parameter = new OleDbParameter[1]; parameter[0] = new OleDbParameter("@ProID", OleDbType.Integer); parameter[0].Value = id; OleDbDataReader dr = AccessorDB.ExecuteReader(sql, parameter); ProModel p = new ProModel(); if (dr.Read()) { p.ProID = Convert.ToInt32(dr["ProID"]); p.F_ProName = dr["F_ProName"].ToString(); p.F_Proattributes = dr["F_Proattributes"].ToString(); p.F_ProDescription = dr["F_ProDescription"].ToString(); p.F_ProSize = dr["F_ProSize"].ToString(); p.F_ProSizeTable = dr["F_ProSizeTable"].ToString(); p.F_ProWashing = dr["F_ProWashing"].ToString(); p.F_ProClassID = Convert.ToInt32(dr["F_ProClassID"]); p.F_Date = Convert.ToDateTime(dr["F_Date"]); p.F_ClassName = dr["F_ClassName"].ToString(); p.F_IsTop = Convert.ToBoolean(dr["F_IsTop"]); p.F_Sort = Convert.ToInt32(dr["F_Sort"]); p.F_Pic = dr["F_ProPic"].ToString(); p.F_IsProvider = Convert.ToBoolean(dr["F_IsProvider"]); p.F_ExtClass = dr["F_ProExtClass"].ToString(); p.F_SmallPic = dr["F_ProSmallPic"].ToString(); } dr.Close(); dr.Dispose(); return(p); }
/// <summary> /// 添加 /// </summary> /// <param name="p"></param> /// <returns></returns> public static int AddPro(ProModel p) { string sql = "insert into T_Product(F_ProName,F_Proattributes,F_ProDescription,F_ProWashing,F_ProSize,F_ProClassID,F_ProSizeTable,F_IsTop,F_Sort,F_ProPic,F_Lang,F_IsProvider,F_ProSmallPic,F_ProExtClass) values(@F_ProName,@F_Proattributes,@F_ProDescription,@F_ProWashing,@F_ProSize,@F_ProClassID,@F_ProSizeTable,@F_IsTop,@F_Sort,@F_ProPic,@F_Lang,@F_IsProvider,@F_ProSmallPic,@F_ProExtClass)"; OleDbParameter[] parameter = new OleDbParameter[14]; parameter[0] = new OleDbParameter("@F_ProName", OleDbType.VarChar, 50); parameter[1] = new OleDbParameter("@F_Proattributes", OleDbType.VarChar, 300); parameter[2] = new OleDbParameter("@F_ProDescription", OleDbType.VarChar); parameter[3] = new OleDbParameter("@F_ProWashing", OleDbType.VarChar, 250); parameter[4] = new OleDbParameter("@F_ProSize", OleDbType.VarChar, 200); parameter[5] = new OleDbParameter("@F_ProClassID", OleDbType.Integer); parameter[6] = new OleDbParameter("@F_ProSizeTable", OleDbType.VarChar); parameter[7] = new OleDbParameter("@F_IsTop", OleDbType.Boolean); parameter[8] = new OleDbParameter("@F_Sort", OleDbType.Integer); parameter[9] = new OleDbParameter("@F_ProPic", OleDbType.VarChar, 200); parameter[10] = new OleDbParameter("@F_Lang", OleDbType.Integer); parameter[11] = new OleDbParameter("@F_IsProvider", OleDbType.Boolean); parameter[12] = new OleDbParameter("@F_ProSmallPic", OleDbType.VarChar); parameter[13] = new OleDbParameter("@F_ProExtClass", OleDbType.VarChar); parameter[0].Value = p.F_ProName; parameter[1].Value = p.F_Proattributes; parameter[2].Value = p.F_ProDescription; parameter[3].Value = p.F_ProWashing; parameter[4].Value = p.F_ProSize; parameter[5].Value = p.F_ProClassID; parameter[6].Value = p.F_ProSizeTable; parameter[7].Value = p.F_IsTop; parameter[8].Value = p.F_Sort; parameter[9].Value = p.F_Pic; parameter[10].Value = p.F_Lang; parameter[11].Value = p.F_IsProvider; parameter[12].Value = p.F_SmallPic; parameter[13].Value = p.F_ExtClass; return(AccessorDB.ExecuteInsert(sql, parameter)); }
/// <summary> /// 获取首页推荐产品 /// </summary> /// <param name="count"></param> /// <returns></returns> public static List <ProModel> GetTopRecommendedByLang(int lang, int count) { string sql = "select top " + count + " * from T_Product where F_IsTop=true And F_Lang=" + lang + " order by F_Sort desc"; List <ProModel> list = new List <ProModel>(); ProModel p = null; OleDbDataReader dr = AccessorDB.ExecuteReader(sql); while (dr.Read()) { p = new ProModel(); p.ProID = Convert.ToInt32(dr["ProID"]); p.F_ProName = dr["F_ProName"].ToString(); p.F_Proattributes = dr["F_Proattributes"].ToString(); p.F_ProDescription = dr["F_ProDescription"].ToString(); p.F_ProSize = dr["F_ProSize"].ToString(); p.F_ProSizeTable = dr["F_ProSizeTable"].ToString(); p.F_ProWashing = dr["F_ProWashing"].ToString(); p.F_ProClassID = Convert.ToInt32(dr["F_ProClassID"]); p.F_Date = Convert.ToDateTime(dr["F_Date"]); p.F_IsTop = Convert.ToBoolean(dr["F_IsTop"]); p.F_IsProvider = Convert.ToBoolean(dr["F_IsProvider"]); p.F_SmallPic = dr["F_ProSmallPic"].ToString(); p.F_Pic = dr["F_ProPic"].ToString(); p.F_ExtClass = dr["F_ProExtClass"].ToString(); // p.F_ClassName = dr["F_ClassName"].ToString(); p.F_Sort = Convert.ToInt32(dr["F_Sort"]); list.Add(p); } dr.Close(); dr.Dispose(); return(list); }
public static List <ProModel> GetListPageNoByClassIDByLang(int lang, int number, int pagesize, int classid, int provider) { string strid = ""; if (classid == -1) { GetClassSubAllByLang(lang, ref strid); } else { GetClassSubAllByClass(classid, ref strid); } List <ProModel> list = EispProDAL.GetListPageNoByClassID(number, pagesize, strid, provider, classid); ProModel p = new ProModel(); Reverser <ProModel> reverser = new Reverser <ProModel>(p.GetType(), "F_Sort", ReverserInfo.Direction.DESC); list.Sort(reverser); // ColoProModel n = new ColoProModel(); // list.Sort(n.F_Sort); return(list); }
protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtTitle.Text)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('产品型号不能为空!')", true); return; } if (string.IsNullOrEmpty(this.txtSort.Text)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('产品排序不能为空!')", true); return; } if (!VerifyTool.IsLong(this.txtSort.Text, true)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('产品排序只能填写数字!')", true); return; } if (string.IsNullOrEmpty(this.txtYingyong.Value)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('产品应用不能为空!')", true); return; } if (string.IsNullOrEmpty(this.content.Value)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('产品描述不能为空!')", true); return; } Boolean istop = false; Boolean isprovider = false; if (this.cbCommend.Checked) { istop = true; } if (this.cbProvider.Checked) { isprovider = true; } long timeStamp = DateTime.Now.Ticks; string smallfilepath = txtImgPath.Text; string smallfileurl = smallfilepath.Replace("userfiles", "userfiles/_thumbs"); smallfileurl = smallfilepath.Replace("UserFiles", "UserFiles/_thumbs"); ProModel p = new ProModel(); p.F_IsProvider = isprovider; p.F_ProClassID = Convert.ToInt32(drpClass.SelectedValue); p.F_ProName = VerifyTool.DeleteAll(this.txtTitle.Text.Trim().ToString()); p.F_ProSize = VerifyTool.DeleteAll(this.txtYingyong.Value.ToString()); p.F_ProSizeTable = this.txtGuige.Value; p.F_ProWashing = ""; p.F_Pic = txtImgPath.Text; p.F_SmallPic = smallfileurl; p.F_ProDescription = VerifyTool.DeleteScript(this.content.Value); p.F_Proattributes = this.hangye.Value; p.F_Lang = Convert.ToInt32(lang); p.F_Sort = Convert.ToInt32(this.txtSort.Text.Trim().ToString()); p.F_IsTop = istop; string lbselectedstr = string.Empty; foreach (ListItem li in lbClass.Items) { if (li.Selected) { lbselectedstr += "," + li.Value; } } p.F_ExtClass = lbselectedstr + ","; int pid = EispProBLL.AddPro(p); if (pid > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('添加成功!');", true); } }
protected void Page_Load(object sender, EventArgs e) { B_User.CheckIsLogged(Request.RawUrl); if (!IsPostBack) { M_UserInfo mu = buser.GetLogin(false); switch (SType) { case 1: //酒店 //{ // M_Cart_Hotel model = new M_Cart_Hotel(); // model.UserID = buser.GetLogin().UserID; // //model.HotelName = Request["HotelName"]; // model.GoDate = Convert.ToDateTime(Request["GoDate"]); // model.OutDate = Convert.ToDateTime(Request["OutDate"]); // //-------------联系人(全部都进行一定的规范) // model.Guest.Add(new M_Cart_Contract(Server.UrlDecode(Request["GuestName"]), Request["GuestMobile"], "", "")); // for (int i = 0; i < Request["ContractName"].Split(',').Length; i++) // { // string name = Request["ContractName"].Split(',')[i]; // string mobile = Request["ContractMobile"].Split(',')[i]; // model.Contract.Add(new M_Cart_Contract(Server.UrlDecode(name), Request["ContractMobile"], "", "")); // } // //-------------购物车 // ProModel pro = new ProModel() { ProID = DataConvert.CLng(Request["ProID"]), Pronum = DataConvert.CLng(Request["Pronum"]) }; // string addition = JsonConvert.SerializeObject(model); // int cartid = AddCart(pro, mu, addition); // Response.Redirect("/Cart/GetOrderInfo.aspx?ProClass=8&ids=" + cartid); //} //break; case 2: //旅游 { M_Cart_Travel model = new M_Cart_Travel(); JArray proArr = (JArray)JsonConvert.DeserializeObject(Pros_Hid); JArray guestArr = (JArray)JsonConvert.DeserializeObject(Guest_Hid); JArray contractArr = (JArray)JsonConvert.DeserializeObject(Contract_Hid); if (string.IsNullOrEmpty(Pros_Hid) || string.IsNullOrEmpty(Guest_Hid) || string.IsNullOrEmpty(Contract_Hid)) { function.WriteErrMsg("生成订单失败,提交的信息不完全!"); } foreach (JObject pro in proArr) //赋值店铺信息 { ProModel proMod = JsonConvert.DeserializeObject <ProModel>(pro.ToString()); M_Product proInfo = proBll.GetproductByid(proMod.ProID); proMod.ProName = proInfo.Proname; proMod.StoreID = proInfo.UserShopID; double price = proInfo.LinPrice; DataRow priceDR = proBll.GetPriceByCode(proMod.code, proInfo.Wholesalesinfo, ref price); if (priceDR != null) { proMod.ProName += "(" + priceDR["Proname"] + ")"; } model.ProList.Add(proMod); } foreach (JObject guest in guestArr) { model.Guest.Add(JsonConvert.DeserializeObject <M_Cart_Contract>(guest.ToString())); } foreach (JObject contract in contractArr) { model.Contract.Add(JsonConvert.DeserializeObject <M_Cart_Contract>(contract.ToString())); } //-------------购物车 string addition = JsonConvert.SerializeObject(model); if (!string.IsNullOrEmpty(Request.Form["ctl00$Content$IDS_Hid"])) { cartBll.DelByIDS(CartCookID, mu.UserName, Request.Form["ctl00$Content$IDS_Hid"]); } //-------------跳转 string ids = ""; foreach (ProModel pro in model.ProList) { ids += AddCart(pro, mu, addition) + ","; } ids = ids.TrimEnd(','); int proclass = (SType == 1 ? 8 : 7); Response.Redirect("/Cart/GetOrderInfo.aspx?ProClass=" + proclass + "&ids=" + ids); } break; case 3: //航班 //Response.Redirect("/Cart/GetOrderInfo.aspx?ProClass=&ids=" + ids); break; default: function.WriteErrMsg("未知的提交类型"); break; } } }
/// <summary> /// 添加 /// </summary> /// <param name="p"></param> /// <returns></returns> public static int AddPro(ProModel p) { return(EispProDAL.AddPro(p)); }
/// <summary> /// 更新 /// </summary> /// <param name="p"></param> /// <returns></returns> public static int UpdatePro(ProModel p) { return(EispProDAL.UpdatePro(p)); }
//修改 public int Update(ProModel m) { string sql = $"update Procurement set ProName='{m.ProName}',ProUnit='{m.ProUnit}',ProPrice={m.ProPrice},ProNum={m.ProNum} where ProId={m.ProId}"; return(db.ExecuteNonQuery(sql)); }