//删除数据 protected void BtnDel_Click(object sender, DirectEventArgs e) { int Success = 0, Failed = 0; RowSelectionModel sm = Y_StyleFoundation_Grid.SelectionModel.Primary as RowSelectionModel; foreach (SelectedRow row in sm.SelectedRows) { Y_StyleFoundation _Y_StyleFoundation = new Y_StyleFoundation(); _Y_StyleFoundation.Id = int.Parse(row.RecordID); IDataParameter[] param = new IDataParameter[] { new SqlParameter("@Id", _Y_StyleFoundation.Id) }; string result = WMSFactory.Y_StyleFoundation.SynDataByProc("Y_DeleteStyleFoundation", param); if (result == "") { Success++; } else { Failed++; } } Y_StyleFoundation_Grid.Reload(); if (Failed > 0) { MsgBox.MessageShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK"); } else { MsgBox.NotifiShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK"); } }
//查找 protected void BtnSearch_Click(object sender, EventArgs e) { StyleIDHidden.Text = ""; lbinfo.Text = ""; IList <Y_StyleFoundation> style = WMSFactory.Y_StyleFoundation.FindByCondition(string.Format("(StyleId='{0}' OR OldStyleId='{0}')", TxtStyleId.Text.Trim().Replace("'", "").Replace("--", ""))); if (style.Count <= 0) { lbinfo.Text = "没有找到任何记录,请检查款号!"; return; } Y_StyleFoundation sf = style[0]; lbbrand.Text = sf.BrName; lbpm.Text = sf.S_Name; lbproduction.Text = sf.Production; StyleIDHidden.Text = sf.StyleId; Y_CareLabel_Grid.Reload(); }
//删除数据 protected void BtnDel_Click(object sender, DirectEventArgs e) { int Success = 0, Failed = 0; RowSelectionModel sm = Y_StyleFoundation_Grid.SelectionModel.Primary as RowSelectionModel; foreach (SelectedRow row in sm.SelectedRows) { Y_StyleFoundation _Y_StyleFoundation = new Y_StyleFoundation(); _Y_StyleFoundation.Id = int.Parse(row.RecordID); IDataParameter[] param = new IDataParameter[] { new SqlParameter("@Id", _Y_StyleFoundation.Id) }; string result = WMSFactory.Y_StyleFoundation.SynDataByProc("Y_DeleteStyleFoundation", param); if (result=="") Success++; else Failed++; } Y_StyleFoundation_Grid.Reload(); if (Failed > 0) MsgBox.MessageShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK"); else MsgBox.NotifiShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK"); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request["id"])) { Response.Write("参数错误!"); return; } if (!IsPostBack) { Y_StyleFoundation sf = WMSFactory.Y_StyleFoundation.FindById(Request["id"]); lbbn.Text = sf.BrName; lbcf.Text = sf.Fabric.Replace(";", "<br />"); lbfrom.Text = sf.Production; lbpm.Text = sf.S_Name; lbsize.Text = sf.SizeId; lbprice.Text = sf.J_Price.ToString(); lbhh.Text = sf.ClothingId; //颜色 DataTable dt = WMSFactory.Y_GBCode.Query("SELECT c_name FROM F22.dbo.j_color where colorid='" + sf.ColorId + "'"); if (dt != null && dt.Rows.Count > 0) { lbcolor.Text = dt.Rows[0][0].ToString(); } //条码 ImgGBK.ImageUrl = "CodeBar.aspx?code=" + sf.ClothingId; //国标信息 //获取国标码信息 IList <Y_StylePrint> printlist = WMSFactory.Y_StylePrint.FindByCondition("StyleId='" + sf.StyleId + sf.ColorId + "'"); if (printlist.Count > 0) { lbdo.Text = printlist[0].DoType; lbdj.Text = printlist[0].Grade; lbsafe.Text = printlist[0].SafeType; } } }
protected void BtnSave_Click(object sender, DirectEventArgs e) { Y_StyleFoundation sf = new Y_StyleFoundation(); sf.ClothingId = TxtClothingId.Text; //新条形码 sf.StyleId = TxtStyleId.Text; //新款式编码 sf.ColorId = TxtColorId.Text; //新颜色 sf.SizeId = TxtSizeId.Text; //新尺码 if (Hid.Text.Length > 0) { sf = WMSFactory.Y_StyleFoundation.FindById(Hid.Text); } //_Y_StyleFoundation.Id = ; //自动 sf.BrName = TxtBrName.Text; //品牌名称 sf.BrId = TxtBrId.Text; //品牌编码 sf.Production = TxtProduction.Text; //产地 sf.J_Price = decimal.Parse(NFJ_Price.Text); //吊牌价 sf.J_Cost = decimal.Parse(NFJ_Cost.Text); //成本价 sf.S_Name = TxtS_Name.Text; //品名 sf.Fabric = TxtFabric.Text; //成分 sf.PrintState = int.Parse(NFPrintState.Text); //打印 sf.St_Year = int.Parse(NFSt_Year.Text); //年份 sf.St_Month = TxtSt_Month.Text; //季节 sf.St_Xl = TxtSt_Xl.Text; //款式种类 sf.St_Dl = TxtSt_Dl.Text; //款式大类 sf.St_Xz = TxtSt_Xz.Text; //款式小类 sf.OldClothingId = TxtOldClothingId.Text; //旧条形码 sf.OldStyleId = TxtOldStyleId.Text; //旧款式编码 sf.OldColorId = TxtOldColorId.Text; //旧颜色 sf.OldSizeId = TxtOldSizeId.Text; //旧尺码 sf.Remark = TxtRemark.Text; //备注 IDataParameter[] param = new IDataParameter[] { new SqlParameter("@BrName", sf.BrName), new SqlParameter("@BrId", sf.BrId), new SqlParameter("@Production", sf.Production), new SqlParameter("@ClothingId", sf.ClothingId), new SqlParameter("@StyleId", sf.StyleId), new SqlParameter("@ColorId", sf.ColorId), new SqlParameter("@SizeId", sf.SizeId), new SqlParameter("@J_Price", sf.J_Price), new SqlParameter("@J_Cost", sf.J_Cost), new SqlParameter("@S_Name", sf.S_Name), new SqlParameter("@Fabric", sf.Fabric), new SqlParameter("@PrintState", sf.PrintState), new SqlParameter("@St_Year", sf.St_Year), new SqlParameter("@St_Month", sf.St_Month), new SqlParameter("@St_Xl", sf.St_Xl), new SqlParameter("@St_Dl", sf.St_Dl), new SqlParameter("@St_Xz", sf.St_Xz), new SqlParameter("@OldClothingId", sf.OldClothingId), new SqlParameter("@OldStyleId", sf.OldStyleId), new SqlParameter("@OldColorId", sf.OldColorId), new SqlParameter("@OldSizeId", sf.OldSizeId) }; string result = ""; if (Hid.Text.Length > 0) { result = WMSFactory.Y_StyleFoundation.SynDataByProc("Y_UpdateStyleFoundation", param); } else { result = WMSFactory.Y_StyleFoundation.SynDataByProc("Y_InsertStyleFoundation", param); } if (result == "") { Y_StyleFoundation_Win.Hide(); Y_StyleFoundation_Grid.Reload(); MsgBox.NotifiShow("恭喜您,操作成功!", "OK"); } else { MsgBox.MessageShow("操作失败,请您重试!错误:" + result, "ERROR"); } }
//查询 protected void BtnSearch_Click(object sender, EventArgs e) { lbInfo.Text = ""; try { IList <Y_StyleFoundation> style = WMSFactory.Y_StyleFoundation.FindByCondition(string.Format("(StyleId='{0}' OR OldStyleId='{0}') AND (ColorId='{1}' OR OldColorId='{1}')", TxtStyleId.Text.Trim(), TxtColorId.Text.Trim())); if (style.Count <= 0) { lbInfo.Text = "没有找到任何记录!"; return; } Y_StyleFoundation sf = style[0]; //赋值,获取基本信息 lbBrand.Text = sf.BrName; lbdprice.Text = sf.J_Price.ToString(); lbPinM.Text = sf.S_Name; lbCd.Text = sf.Production; lbcf.Text = sf.Fabric == null ? "" : sf.Fabric.Replace(";", "<br />").Replace(";", "<br />"); //获取颜色 DataTable dt = WMSFactory.Y_GBCode.Query("SELECT c_name FROM F22.dbo.j_color where colorid='" + sf.ColorId + "'"); if (dt != null && dt.Rows.Count > 0) { lbColor.Text = dt.Rows[0][0].ToString(); } //获取国标码信息 IList <Y_StylePrint> printlist = WMSFactory.Y_StylePrint.FindByCondition("StyleId='" + sf.StyleId + "'"); if (printlist.Count > 0) { TxtDoType.Text = printlist[0].DoType; TxtGBK.Text = printlist[0].GBCode; TxtGrade.Text = printlist[0].Grade; TxtSafeType.Text = printlist[0].SafeType; } else {//随机分配一个国标码 IList <Y_GBCode> codes = WMSFactory.Y_GBCode.FindAllByPage(0, 1, 1, "", "StyleId='' or StyleId is null"); if (codes.Count > 0) { Y_StylePrint p = new Y_StylePrint(); p.StyleId = sf.StyleId; p.GBCode = codes[0].Code; codes[0].StyleId = p.StyleId; if (WMSFactory.Y_StylePrint.Add(p) && WMSFactory.Y_GBCode.Update(codes[0])) { TxtGBK.Text = codes[0].Code; } else { lbInfo.Text = "国标码分配失败,请重新单击‘查 询’按钮!"; return; } } else { lbInfo.Text = "没有可用的国标码了,请上传新的国标码!"; return; } } //加载尺码信息 RPSize.DataSource = style; RPSize.DataBind(); } catch (Exception error) { lbInfo.Text = "异常:" + error.Message; } }
protected void BtnSave_Click(object sender, DirectEventArgs e) { Y_StyleFoundation sf = new Y_StyleFoundation(); sf.ClothingId = TxtClothingId.Text; //新条形码 sf.StyleId = TxtStyleId.Text; //新款式编码 sf.ColorId = TxtColorId.Text; //新颜色 sf.SizeId = TxtSizeId.Text; //新尺码 if (Hid.Text.Length > 0) sf = WMSFactory.Y_StyleFoundation.FindById(Hid.Text); //_Y_StyleFoundation.Id = ; //自动 sf.BrName = TxtBrName.Text; //品牌名称 sf.BrId = TxtBrId.Text; //品牌编码 sf.Production = TxtProduction.Text; //产地 sf.J_Price = decimal.Parse(NFJ_Price.Text); //吊牌价 sf.J_Cost = decimal.Parse(NFJ_Cost.Text); //成本价 sf.S_Name = TxtS_Name.Text; //品名 sf.Fabric = TxtFabric.Text; //成分 sf.PrintState = int.Parse(NFPrintState.Text); //打印 sf.St_Year = int.Parse(NFSt_Year.Text); //年份 sf.St_Month = TxtSt_Month.Text; //季节 sf.St_Xl = TxtSt_Xl.Text; //款式种类 sf.St_Dl = TxtSt_Dl.Text; //款式大类 sf.St_Xz = TxtSt_Xz.Text; //款式小类 sf.OldClothingId = TxtOldClothingId.Text; //旧条形码 sf.OldStyleId = TxtOldStyleId.Text; //旧款式编码 sf.OldColorId = TxtOldColorId.Text; //旧颜色 sf.OldSizeId = TxtOldSizeId.Text; //旧尺码 sf.Remark = TxtRemark.Text; //备注 IDataParameter[] param = new IDataParameter[]{ new SqlParameter("@BrName",sf.BrName), new SqlParameter("@BrId",sf.BrId), new SqlParameter("@Production",sf.Production), new SqlParameter("@ClothingId",sf.ClothingId), new SqlParameter("@StyleId",sf.StyleId), new SqlParameter("@ColorId",sf.ColorId), new SqlParameter("@SizeId",sf.SizeId), new SqlParameter("@J_Price",sf.J_Price), new SqlParameter("@J_Cost",sf.J_Cost), new SqlParameter("@S_Name",sf.S_Name), new SqlParameter("@Fabric",sf.Fabric), new SqlParameter("@PrintState",sf.PrintState), new SqlParameter("@St_Year",sf.St_Year), new SqlParameter("@St_Month",sf.St_Month), new SqlParameter("@St_Xl",sf.St_Xl), new SqlParameter("@St_Dl",sf.St_Dl), new SqlParameter("@St_Xz",sf.St_Xz), new SqlParameter("@OldClothingId",sf.OldClothingId), new SqlParameter("@OldStyleId",sf.OldStyleId), new SqlParameter("@OldColorId",sf.OldColorId), new SqlParameter("@OldSizeId",sf.OldSizeId) }; string result = ""; if (Hid.Text.Length > 0) result = WMSFactory.Y_StyleFoundation.SynDataByProc("Y_UpdateStyleFoundation", param); else result = WMSFactory.Y_StyleFoundation.SynDataByProc("Y_InsertStyleFoundation", param); if (result=="") { Y_StyleFoundation_Win.Hide(); Y_StyleFoundation_Grid.Reload(); MsgBox.NotifiShow("恭喜您,操作成功!", "OK"); } else MsgBox.MessageShow("操作失败,请您重试!错误:" + result, "ERROR"); }