public int InsertGoods(CMSMStruct.GoodsStruct gs) { int recount = 0; string strGoodsID = ""; string strsql = "select isnull(max(cast(vcGoodsID as numeric(10,0))),0) as maxid from tbGoods where substring (vcGoodsID,1,4) like ('" + gs.strGoodsType + "%')"; drr = SqlHelper.ExecuteReader(con, CommandType.Text, strsql); drr.Read(); int strmaxid = int.Parse(drr[0].ToString()); drr.Close(); if (strmaxid == 0) { strmaxid = int.Parse(gs.strGoodsType + "00000"); } strGoodsID = (strmaxid + 1).ToString(); string sql1 = "insert into tbGoods values('" + strGoodsID + "','" + gs.strGoodsName + "','" + gs.strSpell + "'," + gs.dPrice.ToString() + ",0," + gs.iIgValue.ToString() + ",'0','" + gs.strComments + "')"; recount = SqlHelper.ExecuteNonQuery(con, CommandType.Text, sql1); if (con.State == ConnectionState.Open) { con.Close(); } return(recount); }
protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (Session["Login"] == null) { Response.Redirect("../Exit.aspx"); return; } string strid = Request.QueryString["id"]; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; m1 = new Manager(strcons); if (!IsPostBack) { this.FillDropDownList("tbCommCode", this.DropDownList1, "vcCommSign='GT'"); if (strid == "" || strid == null) { this.btAdd.Enabled = true; this.btDel.Enabled = false; this.btMod.Enabled = false; this.txtGoodsID.ReadOnly = true; lbltitle.Text = "新商品资料录入"; this.Label1.Text = "商品类别"; this.DropDownList1.Visible = true; this.txtGoodsID.Visible = false; this.CBDiscount.Checked = true; } else { this.btAdd.Enabled = false; this.btDel.Enabled = false; this.btMod.Enabled = true; CMSMStruct.GoodsStruct gs = m1.GetGoodsInfo(strid); txtGoodsID.Text = gs.strGoodsID; txtGoodsName.Text = gs.strGoodsName; txtSpell.Text = gs.strSpell; txtPrice.Text = gs.dPrice.ToString(); txtigvalue.Text = gs.iIgValue.ToString(); // txtComments.Text=gs.strComments; this.txtGoodsID.ReadOnly = true; this.txtGoodsName.ReadOnly = false; lbltitle.Text = "商品资料修改删除"; Session["gsold"] = gs; this.Label1.Text = "商品ID"; this.txtGoodsID.Visible = true; this.DropDownList1.Visible = false; if (gs.strComments == "" || gs.strComments == "否") { this.CBDiscount.Checked = false; } else { this.CBDiscount.Checked = true; } } } }
public bool InsertGoods(CMSMStruct.GoodsStruct gs, string strGoodsType, out string strGoodsId) { int recount = opa.InsertGoods(gs, strGoodsType, out strGoodsId); if (recount <= 0) { return(false); } return(true); }
private void btAdd_Click(object sender, System.EventArgs e) { CMSMStruct.GoodsStruct gs = new CMSMStruct.GoodsStruct(); if (txtGoodsName.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品名称不能为空!"); return; } else if (m1.ChkGoodsNameDup(txtGoodsName.Text.Trim())) { gs.strGoodsName = txtGoodsName.Text.Trim(); } else { this.SetErrorMsgPageBydir("该商品名称已经存在,请重新输入!"); return; } if (txtPrice.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品单价不能为空!"); return; } else { gs.dPrice = Double.Parse(txtPrice.Text.Trim()); } if (txtigvalue.Text.Trim() == "" || txtigvalue.Text.Trim() == "0" || int.Parse(txtigvalue.Text.Trim()) < -1) { this.SetErrorMsgPageBydir("兑换分值不正确!"); return; } else { gs.iIgValue = int.Parse(txtigvalue.Text.Trim()); } gs.strSpell = txtSpell.Text.Trim().ToLower(); gs.strComments = txtComments.Text.Trim(); gs.strGoodsType = this.ddlGoodsType.SelectedValue; if (!m1.InsertGoods(gs)) { this.SetErrorMsgPageBydir("添加商品信息失败,请重试!"); return; } else { this.SetSuccMsgPageBydir("添加商品信息成功!", ""); return; } }
public bool InsertGoods(CMSMStruct.GoodsStruct gs) { int recount = opa.InsertGoods(gs); if (recount <= 0) { return(false); } return(true); }
protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (Session["Login"] == null) { Response.Redirect("../Exit.aspx"); return; } string strid = Request.QueryString["id"]; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; m1 = new Manager(strcons); if (!IsPostBack) { this.txtGoodsID.Text = "8---"; if (strid == "" || strid == null) { this.btAdd.Enabled = true; this.btDel.Enabled = false; this.btMod.Enabled = false; this.txtGoodsID.ReadOnly = true; lbltitle.Text = "新商品资料录入"; } else { this.btAdd.Enabled = false; this.btDel.Enabled = false; this.btMod.Enabled = true; CMSMStruct.GoodsStruct gs = m1.GetGoodsInfo(strid); txtGoodsID.Text = gs.strGoodsID; txtGoodsName.Text = gs.strGoodsName; txtSpell.Text = gs.strSpell; txtPrice.Text = gs.dPrice.ToString(); txtigvalue.Text = gs.iIgValue.ToString(); txtComments.Text = gs.strComments; this.chkPackage.Checked = gs.bPackage; this.txtGoodsID.ReadOnly = true; this.txtGoodsName.ReadOnly = true; IsNew.Checked = gs.bNew; IsKey.Checked = gs.bKey; IsDeptPrice.Checked = gs.bDeptPrice; this.Unit.Text = gs.Unit; this.NewDate.Text = gs.NewDate; lbltitle.Text = "商品资料修改删除"; Session["gsold"] = gs; } } }
public bool InsertGoods(CMSMStruct.GoodsStruct gs, string strGoodsType) { int recount = opa.InsertGoods(gs, strGoodsType); if (recount <= 0) { return(false); } //zhh 20121104 //Helpers.SyncGoods(); return(true); }
public bool InsertGoods(CMSMStruct.GoodsStruct gs) { int recount = opa.InsertGoods(gs); if (recount <= 0) { return(false); } //zhh 20121104 var uow = DependencyResolver.Current.GetService <IFairiesMemberManageUow>(); var amsuow = DependencyResolver.Current.GetService <IAMSCMUow>(); DXInfo.Business.Common businessCommon = new DXInfo.Business.Common(uow); businessCommon.SyncGoods(amsuow); return(true); }
public bool UpdateGoods(CMSMStruct.GoodsStruct gsnew, CMSMStruct.GoodsStruct gsold) { string sqlset = ""; if (gsnew.strGoodsName != gsold.strGoodsName) { sqlset += "vcGoodsName='" + gsnew.strGoodsName + "',"; } if (gsnew.strSpell != gsold.strSpell) { sqlset += "vcSpell='" + gsnew.strSpell + "',"; } if (gsnew.dPrice != gsold.dPrice) { sqlset += "nPrice=" + gsnew.dPrice.ToString() + ","; } if (gsnew.iIgValue != gsold.iIgValue) { sqlset += "iIgValue=" + gsnew.iIgValue.ToString() + ","; } if (gsnew.strComments != gsold.strComments) { sqlset += "vcComments='" + gsnew.strComments + "',"; } if (sqlset != "") { sqlset = sqlset.Substring(0, sqlset.Length - 1); int recount = opa.UpdateGoods(gsnew.strGoodsID, sqlset); if (recount <= 0) { return(false); } } return(true); }
public ArrayList DownGoodsData() { DataTable dtAss = new DataTable(); ArrayList alAss = new ArrayList(); string sql1 = "select * from tbGoods order by vcGoodsID"; dtAss = SqlHelper.ExecuteDataTable(con, CommandType.Text, sql1); for (int i = 0; i < dtAss.Rows.Count; i++) { CMSMStruct.GoodsStruct asstmp = new CMSMStruct.GoodsStruct(); asstmp.strGoodsID = dtAss.Rows[i]["vcGoodsID"].ToString(); asstmp.strGoodsName = dtAss.Rows[i]["vcGoodsName"].ToString(); asstmp.strSpell = dtAss.Rows[i]["vcSpell"].ToString(); asstmp.dPrice = double.Parse(dtAss.Rows[i]["nPrice"].ToString()); asstmp.dRate = double.Parse(dtAss.Rows[i]["nRate"].ToString()); asstmp.iIgValue = int.Parse(dtAss.Rows[i]["iIgValue"].ToString()); asstmp.strNewFlag = dtAss.Rows[i]["cNewFlag"].ToString(); asstmp.strComments = dtAss.Rows[i]["vcComments"].ToString(); alAss.Add(asstmp); } return(alAss); }
private void btMod_Click(object sender, System.EventArgs e) { CMSMStruct.GoodsStruct gsold = (CMSMStruct.GoodsStruct)Session["gsold"]; if (gsold.strGoodsID != txtGoodsID.Text.Trim()) { this.SetErrorMsgPageBydir("保存失败,请重试!"); return; } CMSMStruct.GoodsStruct gsnew = new CMSMStruct.GoodsStruct(); gsnew.strGoodsID = txtGoodsID.Text.Trim(); if (txtGoodsName.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品名称不能为空!"); return; } else if (m1.ChkNewGoodsNameDup(txtGoodsName.Text.Trim(), gsnew.strGoodsID)) { gsnew.strGoodsName = txtGoodsName.Text.Trim(); } else { this.SetErrorMsgPageBydir("该商品名称已经存在,请重新输入!"); return; } if (txtPrice.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品单价不能为空!"); return; } else { gsnew.dPrice = Double.Parse(txtPrice.Text.Trim()); } if (txtigvalue.Text.Trim() == "" || txtigvalue.Text.Trim() == "0" || int.Parse(txtigvalue.Text.Trim()) < -1) { this.SetErrorMsgPageBydir("兑换分值不正确!"); return; } else { gsnew.iIgValue = int.Parse(txtigvalue.Text.Trim()); } gsnew.strSpell = txtSpell.Text.Trim().ToLower(); gsnew.strComments = txtComments.Text.Trim(); gsnew.strGoodsName = this.txtGoodsName.Text.Trim(); if (!m1.UpdateGoods(gsnew, gsold)) { this.SetErrorMsgPageBydir("保存商品修改信息失败,请重试!"); return; } else { this.SetSuccMsgPageBydir("保存商品修改信息成功!", ""); return; } }
private bool CreateDataLocalPara(string strdownfiles) { // #region 加载系统参数 // ArrayList alDownSysPara=new ArrayList(); // alDownSysPara=m1.DownSysPara(); // if(alDownSysPara==null) // { // clog.WriteLine("加载系统参数错误"); // return false; // } // #endregion #region 加载商品资料 ArrayList alDownGoods = new ArrayList(); alDownGoods = m1.DownGoodsData(); if (alDownGoods == null) { clog.WriteLine("加载商品资料错误"); return(false); } #endregion StreamWriter swFile = new StreamWriter(strdownfiles + ".tmp", true); StructToString sts = new StructToString(); // #region 写系统参数 // CMSMStruct.CommStruct Commtmp=null; // swFile.WriteLine("COMMTOL=" + alDownSysPara.Count.ToString()); // for(int i=0;i<alDownSysPara.Count;i++) // { // Commtmp=alDownSysPara[i] as CMSMStruct.CommStruct; // swFile.WriteLine(sts.ToCommCodeString(Commtmp)); // } // swFile.WriteLine("END"); // #endregion #region 写商品资料 CMSMStruct.GoodsStruct goodstmp = null; swFile.WriteLine("GOODTOL=" + alDownGoods.Count.ToString()); for (int i = 0; i < alDownGoods.Count; i++) { goodstmp = alDownGoods[i] as CMSMStruct.GoodsStruct; swFile.WriteLine(sts.ToGoodsString(goodstmp)); } swFile.WriteLine("END"); #endregion swFile.Close(); #region 加密 DESEncryptor dese = new DESEncryptor(); dese.InputFilePath = strdownfiles + ".tmp"; dese.OutFilePath = strdownfiles; dese.EncryptKey = "cmsmyykx"; dese.FileDesEncrypt(); if (dese.NoteMessage != null) { clog.WriteLine(dese.NoteMessage); return(false); } dese = null; #endregion if (System.IO.File.Exists(strdownfiles + ".tmp")) { System.IO.File.Delete(strdownfiles + ".tmp"); } return(true); }
public bool UpdateGoods(CMSMStruct.GoodsStruct gsnew, CMSMStruct.GoodsStruct gsold) { string sqlset = ""; if (gsnew.strGoodsName != gsold.strGoodsName) { sqlset += "vcGoodsName='" + gsnew.strGoodsName + "',"; } if (gsnew.strSpell != gsold.strSpell) { sqlset += "vcSpell='" + gsnew.strSpell + "',"; } if (gsnew.dPrice != gsold.dPrice) { sqlset += "nPrice=" + gsnew.dPrice.ToString() + ","; } if (gsnew.iIgValue != gsold.iIgValue) { sqlset += "iIgValue=" + gsnew.iIgValue.ToString() + ","; } if (gsnew.strComments != gsold.strComments) { sqlset += "vcComments='" + gsnew.strComments + "',"; } if (gsnew.bPackage != gsold.bPackage) { if (gsnew.bPackage) { sqlset += "IsPackage=1,"; } else { sqlset += "IsPackage=0,"; } } sqlset += gsnew.bNew ? "IsNew=1," : "IsNew=0,"; //if (!string.IsNullOrEmpty(gsnew.bNew)) //{ // sqlset += "IsNew=1,"; //} sqlset += gsnew.bKey ? "IsKey=1," : "IsKey=0,"; //if (!string.IsNullOrEmpty(gsnew.bKey)) //{ // sqlset += "IsKey=1,"; //} if (!string.IsNullOrEmpty(gsnew.Unit)) { sqlset += "Unit='" + gsnew.Unit + "',"; } if (!string.IsNullOrEmpty(gsnew.NewDate)) { sqlset += "NewDate='" + gsnew.NewDate + "',"; } sqlset += gsnew.bDeptPrice ? "IsDeptPrice=1," : "IsDeptPrice=0,"; //if (!string.IsNullOrEmpty(gsnew.bDeptPrice)) //{ // sqlset += "IsDeptPrice=1,"; //} if (sqlset != "") { sqlset = sqlset.Substring(0, sqlset.Length - 1); int recount = opa.UpdateGoods(gsnew.strGoodsID, sqlset); if (recount <= 0) { return(false); } } return(true); }
protected void btMod_Click(object sender, System.EventArgs e) { CMSMStruct.GoodsStruct gsold = (CMSMStruct.GoodsStruct)Session["gsold"]; if (gsold.strGoodsID != txtGoodsID.Text.Trim()) { this.SetErrorMsgPageBydir("保存失败,请重试!"); return; } CMSMStruct.GoodsStruct gsnew = new CMSMStruct.GoodsStruct(); gsnew.strGoodsID = txtGoodsID.Text.Trim(); if (txtGoodsName.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品名称不能为空!"); return; } else if (m1.ChkNewGoodsNameDup(txtGoodsName.Text.Trim(), gsnew.strGoodsID)) { gsnew.strGoodsName = txtGoodsName.Text.Trim(); } else { this.SetErrorMsgPageBydir("该商品名称已经存在,请重新输入!"); return; } if (txtPrice.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品单价不能为空!"); return; } else { gsnew.dPrice = Double.Parse(txtPrice.Text.Trim()); } if (txtigvalue.Text.Trim() == "" || txtigvalue.Text.Trim() == "0" || int.Parse(txtigvalue.Text.Trim()) < -1) { this.SetErrorMsgPageBydir("兑换分值不正确!"); return; } else { gsnew.iIgValue = int.Parse(txtigvalue.Text.Trim()); } gsnew.strSpell = txtSpell.Text.Trim().ToLower(); gsnew.strComments = txtComments.Text.Trim(); gsnew.bPackage = this.chkPackage.Checked; //if (this.IsNew.Checked) //{ // gsnew.bNew = "1"; //} //if (this.IsKey.Checked) //{ // gsnew.bKey = "1"; //} gsnew.bNew = this.IsNew.Checked; gsnew.bKey = this.IsKey.Checked; gsnew.Unit = this.Unit.Text; if (!string.IsNullOrEmpty(this.NewDate.Text)) { gsnew.NewDate = DateTime.Parse(this.NewDate.Text).ToString("yyyy-MM-dd"); } //if (IsDeptPrice.Checked) //{ // gsnew.bDeptPrice = "1"; //} gsnew.bDeptPrice = this.IsDeptPrice.Checked; if (!m1.UpdateGoods(gsnew, gsold)) { this.SetErrorMsgPageBydir("保存商品修改信息失败,请重试!"); return; } else { this.SetSuccMsgPageBydir("保存商品修改信息成功!", ""); return; } }
protected void btAdd_Click(object sender, System.EventArgs e) { CMSMStruct.GoodsStruct gs = new CMSMStruct.GoodsStruct(); //获取以8开头的商品最大ID,判断是否已经达到999种。 string strMaxID = m1.GetGoodsMaxID("8"); if (int.Parse(strMaxID) >= 8999) { this.SetErrorMsgPageBydir("外购商品已经到达999种的上限水平,不能再添加!"); return; } if (txtGoodsName.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品名称不能为空!"); return; } else if (m1.ChkGoodsNameDup(txtGoodsName.Text.Trim())) { gs.strGoodsName = txtGoodsName.Text.Trim(); } else { this.SetErrorMsgPageBydir("该商品名称已经存在,请重新输入!"); return; } if (txtPrice.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品单价不能为空!"); return; } else { gs.dPrice = Double.Parse(txtPrice.Text.Trim()); } if (txtigvalue.Text.Trim() == "" || txtigvalue.Text.Trim() == "0" || int.Parse(txtigvalue.Text.Trim()) < -1) { this.SetErrorMsgPageBydir("兑换分值不正确!"); return; } else { gs.iIgValue = int.Parse(txtigvalue.Text.Trim()); } gs.strSpell = txtSpell.Text.Trim().ToLower(); gs.strComments = txtComments.Text.Trim(); gs.bPackage = this.chkPackage.Checked; //if (this.IsNew.Checked) //{ // gs.bNew = "1"; //} //if(this.IsKey.Checked) //{ // gs.bKey = "1"; //} gs.bNew = this.IsNew.Checked; gs.bKey = this.IsKey.Checked; gs.Unit = this.Unit.Text; if (!string.IsNullOrEmpty(this.NewDate.Text)) { gs.NewDate = DateTime.Parse(this.NewDate.Text).ToString("yyyy-MM-dd"); } //if (IsDeptPrice.Checked) //{ // gs.bDeptPrice = "1"; //} gs.bDeptPrice = this.IsDeptPrice.Checked; if (!m1.InsertGoods(gs)) { this.SetErrorMsgPageBydir("添加商品信息失败,请重试!"); return; } else { this.SetSuccMsgPageBydir("添加商品信息成功!", ""); return; } }
protected void btAdd_Click(object sender, System.EventArgs e) { CMSMStruct.GoodsStruct gs = new CMSMStruct.GoodsStruct(); gs.strGoodsType = this.DropDownList1.SelectedItem.Text; string strGoodsTypeEN = this.DropDownList1.SelectedValue; if (txtGoodsName.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品名称不能为空!"); return; } else if (m1.ChkGoodsNameDup(txtGoodsName.Text.Trim())) { gs.strGoodsName = txtGoodsName.Text.Trim(); } else { this.SetErrorMsgPageBydir("该商品名称已经存在,请重新输入!"); return; } if (txtPrice.Text.Trim() == "") { this.SetErrorMsgPageBydir("商品单价不能为空!"); return; } else { gs.dPrice = Double.Parse(txtPrice.Text.Trim()); } if (txtigvalue.Text.Trim() == "" || txtigvalue.Text.Trim() == "0" || int.Parse(txtigvalue.Text.Trim()) < -1) { this.SetErrorMsgPageBydir("兑换分值不正确!"); return; } else { gs.iIgValue = int.Parse(txtigvalue.Text.Trim()); } if (this.CBDiscount.Checked == true) { gs.strComments = "是"; } else { gs.strComments = "否"; } gs.strSpell = txtSpell.Text.Trim().ToLower(); // gs.strComments=txtComments.Text.Trim(); if (!m1.InsertGoods(gs, strGoodsTypeEN)) { this.SetErrorMsgPageBydir("添加商品信息失败,商品编号可能已经达到最大值,请重试!"); return; } else { this.SetSuccMsgPageBydir("添加商品信息成功!", ""); return; } }