/// <summary>下拉列表改变事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlPROD_NAME1_SelectedIndexChanged(object sender, EventArgs e) { // FineUI.DropDownList ddlPROD_NAME1 = Window2.FindControl("ddlPROD_NAME1") as FineUI.DropDownList; // string ttxtPROD_NAME1 = ddlPROD_NAME1.SelectedText; // FineUI.TextBox txtPROD_ID = Window2.FindControl("txtPROD_ID") as FineUI.TextBox; // string ttxtPROD_ID = txtPROD_ID.Text; txtPROD_ID.Text = ddlPROD_NAME1.SelectedValue; var model = new PRODUCT00(x => x.PROD_ID == ddlPROD_NAME1.SelectedValue); // 读取商品主表 var model_0 = new PRODUCT01(x => x.PROD_ID == ddlPROD_NAME1.SelectedValue); //读商品子表 // FineUI.TextBox ttxtPROD_SPEC = Window2.FindControl("txtPROD_SPEC") as FineUI.TextBox; txtPROD_SPEC.Text = model.PROD_SPEC; // FineUI.TextBox ttxtPROD_UNIT = Window2.FindControl("txtPROD_UNIT") as FineUI.TextBox; txtPROD_UNIT.Text = model.PROD_UNIT; // FineUI.TextBox ttxtU_Cost = Window2.FindControl("txtU_Cost") as FineUI.TextBox; txtU_Cost.Text = model_0.COST.ToString(); // FineUI.TextBox ttxtOrder_QUAN = Window2.FindControl("txtOrder_QUAN") as FineUI.TextBox; // txtOrder_QUAN.Text = model.Order_QUAN.ToString(); }
/// <summary>下拉列表改变事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlPROD_NAME1_SelectedIndexChanged(object sender, EventArgs e) { txtPROD_ID.Text = ddlPROD_NAME1.SelectedValue; var model = new PRODUCT00(x => x.PROD_ID == ddlPROD_NAME1.SelectedValue); // 读取商品主表 var model_0 = new PRODUCT01(x => x.PROD_ID == ddlPROD_NAME1.SelectedValue); //读商品子表 txtPROD_SPEC.Text = model.PROD_SPEC; txtPROD_UNIT.Text = model.PROD_UNIT; txtU_Cost.Text = model_0.COST.ToString(); // txtOrder_QUAN.Text = model.Order_QUAN.ToString(); }
public void Prod_Edit(string SNos) { string id = SNos + ""; string order_id = hidId.Text; if (id != "0") { int id_ = ConvertHelper.Cint0(SNos); //读取资料 var model_0 = new ORDER00(x => x.ORDER_ID == order_id); var model = new ORDER01(x => x.ORDER_ID == order_id && x.SNo == id_); // model.SHOP_ID = model_0.SHOP_ID;//分店编号 // FineUI.DropDownList ddlPROD_NAME1 = Window2.FindControl("ddlPROD_NAME1") as FineUI.DropDownList; // FineUI.TextBox ttxtPROD_ID = Window2.FindControl("txtPROD_ID") as FineUI.TextBox; var model_ = new PRODUCT00(x => x.PROD_ID == model.PROD_ID); // 读取商品主表 var model_0_ = new PRODUCT01(x => x.PROD_ID == model.PROD_ID); //读商品子表 // FineUI.TextBox ttxtPROD_SPEC = Window2.FindControl("txtPROD_SPEC") as FineUI.TextBox; // FineUI.TextBox ttxtON_QUAN = Window2.FindControl("txtON_QUAN") as FineUI.TextBox; // FineUI.TextBox ttxtPROD_UNIT = Window2.FindControl("txtPROD_UNIT") as FineUI.TextBox; // FineUI.TextBox ttxtU_Cost = Window2.FindControl("txtU_Cost") as FineUI.TextBox; // FineUI.TextBox ttxtTotal = Window2.FindControl("txtTotal") as FineUI.TextBox; // FineUI.TextBox ttxtOrder_QUAN = Window2.FindControl("txtOrder_QUAN") as FineUI.TextBox; // FineUI.TextBox ttxtMemo = Window2.FindControl("txtMemo") as FineUI.TextBox; ddlPROD_NAME1.SelectedValue = model.PROD_ID + ""; // ddlPROD_NAME1.SelectedItem.Text = model_.PROD_NAME1; txtPROD_SPEC.Text = model_.PROD_SPEC; // txtOrder_QUAN.Text = model_.Order_QUAN.ToString(); txtPROD_ID.Text = model.PROD_ID; txtON_QUAN.Text = ConvertHelper.Cint0(model.ON_QUAN.ToString()).ToString(); txtTotal.Text = model.QUAN1.ToString(); txtPROD_UNIT.Text = model.STD_UNIT; txtU_Cost.Text = model.STD_PRICE.ToString(); txtMemo.Text = model.Memo; } }
public string Product01Update(DataTable da) { string sPROD_ID = PROD_ID.Text.ToString(); string sPRCAREA_ID = ""; try { if (da.Columns.Contains("PRCAREA_ID")) { sPRCAREA_ID = da.Rows[0]["PRCAREA_ID"].ToString(); } else { return("价格区域编号" + da.Rows[0]["PRCAREA_ID"].ToString() + "更新失败"); } var model = new PRODUCT01(x => x.PROD_ID == sPROD_ID && x.PRCAREA_ID == sPRCAREA_ID); if (model.Id > 0) { if (model.PROD_ID != sPROD_ID || model.PRCAREA_ID != sPRCAREA_ID) { return("价格区域编号" + da.Rows[0]["PRCAREA_ID"].ToString() + "更新失败"); } var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); if (da.Columns.Contains("SUP_ID")) { model.SUP_ID = da.Rows[0]["SUP_ID"].ToString(); } if (da.Columns.Contains("SEND_TYPE")) { model.SEND_TYPE = ConvertHelper.StringToByte(da.Rows[0]["SEND_TYPE"].ToString()); } if (da.Columns.Contains("TAX_TYPE")) { model.TAX_TYPE = ConvertHelper.StringToByte(da.Rows[0]["TAX_TYPE"].ToString()); } if (da.Columns.Contains("Tax")) { model.Tax = ConvertHelper.Cint(da.Rows[0]["Tax"].ToString()); } if (da.Columns.Contains("SUP_COST")) { model.SUP_COST = ConvertHelper.StringToDecimal(da.Rows[0]["SUP_COST"].ToString()); } if (da.Columns.Contains("SUP_COST1")) { model.SUP_COST1 = ConvertHelper.StringToDecimal(da.Rows[0]["SUP_COST1"].ToString()); } if (da.Columns.Contains("SUP_COST2")) { model.SUP_COST2 = ConvertHelper.StringToDecimal(da.Rows[0]["SUP_COST2"].ToString()); } if (da.Columns.Contains("SUP_Return")) { model.SUP_Return = ConvertHelper.StringToDecimal(da.Rows[0]["SUP_Return"].ToString()); } if (da.Columns.Contains("SUP_Return1")) { model.SUP_Return1 = ConvertHelper.StringToDecimal(da.Rows[0]["SUP_Return1"].ToString()); } if (da.Columns.Contains("SUP_Return2")) { model.SUP_Return2 = ConvertHelper.StringToDecimal(da.Rows[0]["SUP_Return2"].ToString()); } if (da.Columns.Contains("U_Cost")) { model.U_Cost = ConvertHelper.StringToDecimal(da.Rows[0]["U_Cost"].ToString()); } if (da.Columns.Contains("U_Cost1")) { model.U_Cost1 = ConvertHelper.StringToDecimal(da.Rows[0]["U_Cost1"].ToString()); } if (da.Columns.Contains("U_Cost2")) { model.U_Cost2 = ConvertHelper.StringToDecimal(da.Rows[0]["U_Cost2"].ToString()); } if (da.Columns.Contains("U_Ret_COST")) { model.U_Ret_COST = ConvertHelper.StringToDecimal(da.Rows[0]["U_Ret_COST"].ToString()); } if (da.Columns.Contains("U_Ret_COST1")) { model.U_Ret_COST1 = ConvertHelper.StringToDecimal(da.Rows[0]["U_Ret_COST1"].ToString()); } if (da.Columns.Contains("U_Ret_COST2")) { model.U_Ret_COST2 = ConvertHelper.StringToDecimal(da.Rows[0]["U_Ret_COST2"].ToString()); } if (da.Columns.Contains("T_COST")) { model.T_COST = ConvertHelper.StringToDecimal(da.Rows[0]["T_COST"].ToString()); } if (da.Columns.Contains("T_COST1")) { model.T_COST1 = ConvertHelper.StringToDecimal(da.Rows[0]["T_COST1"].ToString()); } if (da.Columns.Contains("T_COST2")) { model.T_COST2 = ConvertHelper.StringToDecimal(da.Rows[0]["T_COST2"].ToString()); } if (da.Columns.Contains("T_Ret_COST")) { model.T_Ret_COST = ConvertHelper.StringToDecimal(da.Rows[0]["T_Ret_COST"].ToString()); } if (da.Columns.Contains("T_Ret_COST1")) { model.T_Ret_COST1 = ConvertHelper.StringToDecimal(da.Rows[0]["T_Ret_COST1"].ToString()); } if (da.Columns.Contains("T_Ret_COST2")) { model.T_Ret_COST2 = ConvertHelper.StringToDecimal(da.Rows[0]["T_Ret_COST2"].ToString()); } if (da.Columns.Contains("COST")) { model.COST = ConvertHelper.StringToDecimal(da.Rows[0]["COST"].ToString()); } if (da.Columns.Contains("COST1")) { model.COST1 = ConvertHelper.StringToDecimal(da.Rows[0]["COST1"].ToString()); } if (da.Columns.Contains("COST2")) { model.COST2 = ConvertHelper.StringToDecimal(da.Rows[0]["COST2"].ToString()); } if (da.Columns.Contains("ENABLE")) { if (da.Rows[0]["ENABLE"].ToString() == "True") { model.ENABLE = 1; } else { model.ENABLE = 0; } } if (da.Columns.Contains("VISIBLE")) { if (da.Rows[0]["VISIBLE"].ToString() == "True") { model.VISIBLE = 1; } else { model.VISIBLE = 0; } } if (da.Columns.Contains("BOM_ID")) { model.BOM_ID = da.Rows[0]["BOM_ID"].ToString(); //if (!String.IsNullOrEmpty(da.Rows[0]["BOM_ID"].ToString())) //{ // model.BOM_ID = da.Rows[0]["BOM_ID"].ToString(); //} //else //{ // return "默认配方编码出错,更新失败"; //} } if (da.Columns.Contains("ORDER_UNIT")) { model.ORDER_UNIT = ConvertHelper.StringToByte(da.Rows[0]["ORDER_UNIT"].ToString()); } if (da.Columns.Contains("ORDER_QUAN")) { model.ORDER_QUAN = ConvertHelper.StringToByte(da.Rows[0]["ORDER_QUAN"].ToString()); } if (da.Columns.Contains("Purchase_UNIT")) { model.Purchase_UNIT = ConvertHelper.StringToByte(da.Rows[0]["Purchase_UNIT"].ToString()); } if (da.Columns.Contains("Purchase_QUAN")) { model.Purchase_QUAN = ConvertHelper.StringToByte(da.Rows[0]["Purchase_QUAN"].ToString()); } if (da.Columns.Contains("SAFE_QUAN")) { model.SAFE_QUAN = ConvertHelper.StringToByte(da.Rows[0]["SAFE_QUAN"].ToString()); } if (da.Columns.Contains("PROD_PRICE")) { model.PROD_PRICE = ConvertHelper.StringToByte(da.Rows[0]["PROD_PRICE"].ToString()); } model.MOD_DATETIME = ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); model.MOD_USER_ID = OlUser.Manager_LoginName; model.SetIsNew(false); PRODUCT01Bll.GetInstence().Save(this, model); return(""); } else { return("价格区域编号" + da.Rows[0]["rPRCAREA_ID"].ToString() + "更新失败"); } } catch (Exception err) { return("价格区域编号" + da.Rows[0]["rPRCAREA_ID"].ToString() + "更新失败!失败原因:" + err.Message); } }
/// <summary> /// 数据保存 /// </summary> /// <returns></returns> public override string Save() { string result = string.Empty; int id = ConvertHelper.Cint0(hidId.Text); string prod_id = hidPROD_ID.Text; if (!String.IsNullOrEmpty(prod_id)) { try { #region 数据验证 var sPRCAREA_ID = PRCAREA_ID.SelectedValue; if (string.IsNullOrEmpty(sPRCAREA_ID) || sPRCAREA_ID == "0") { return(PRCAREA_ID.Label + "不能为空!"); } var sSUP_ID = SUP_ID.SelectedValue; if (string.IsNullOrEmpty(sSUP_ID) || sSUP_ID == "0") { return(SUP_ID.Label + "不能为空!"); } var sTAX_TYPE = TAX_TYPE.SelectedValue; if (string.IsNullOrEmpty(sTAX_TYPE)) { return(TAX_TYPE.Label + "不能为空!"); } var sSEND_TYPE = SEND_TYPE.SelectedValue; if (string.IsNullOrEmpty(sSEND_TYPE) || sSEND_TYPE == "0") { return(SEND_TYPE.Label + "不能为空!"); } var sTax = Tax.Text; if (string.IsNullOrEmpty(sTax)) { return(Tax.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sTax)) { return(Tax.Label + "必须为整数!"); } var sSUP_COST = SUP_COST.Text; if (string.IsNullOrEmpty(sSUP_COST)) { return(SUP_COST.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sSUP_COST)) { return(SUP_COST.Label + "必须为整数!"); } var sSUP_COST1 = SUP_COST1.Text; if (string.IsNullOrEmpty(sSUP_COST1)) { return(SUP_COST1.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sSUP_COST1)) { return(SUP_COST1.Label + "必须为整数!"); } var sSUP_COST2 = SUP_COST2.Text; if (string.IsNullOrEmpty(sSUP_COST2)) { return(SUP_COST2.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sSUP_COST2)) { return(SUP_COST2.Label + "必须为整数!"); } var sSUP_Return = SUP_Return.Text; if (string.IsNullOrEmpty(sSUP_Return)) { return(SUP_Return.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sSUP_Return)) { return(SUP_Return.Label + "必须为整数!"); } var sSUP_Return1 = SUP_Return1.Text; if (string.IsNullOrEmpty(sSUP_Return1)) { return(SUP_Return1.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sSUP_Return1)) { return(SUP_Return1.Label + "必须为整数!"); } var sSUP_Return2 = SUP_Return2.Text; if (string.IsNullOrEmpty(sSUP_Return2)) { return(SUP_Return2.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sSUP_Return2)) { return(SUP_Return2.Label + "必须为整数!"); } var sU_Cost = U_Cost.Text; if (string.IsNullOrEmpty(sU_Cost)) { return(U_Cost.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sU_Cost)) { return(U_Cost.Label + "必须为整数!"); } var sU_Cost1 = U_Cost1.Text; if (string.IsNullOrEmpty(sU_Cost1)) { return(U_Cost1.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sU_Cost1)) { return(U_Cost1.Label + "必须为整数!"); } var sU_Cost2 = U_Cost2.Text; if (string.IsNullOrEmpty(sU_Cost2)) { return(U_Cost2.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sU_Cost2)) { return(U_Cost2.Label + "必须为整数!"); } var sU_Ret_COST = U_Ret_COST.Text; if (string.IsNullOrEmpty(sU_Ret_COST)) { return(U_Ret_COST.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sU_Ret_COST)) { return(U_Ret_COST.Label + "必须为整数!"); } var sU_Ret_COST1 = U_Ret_COST1.Text; if (string.IsNullOrEmpty(sU_Ret_COST1)) { return(U_Ret_COST1.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sU_Ret_COST1)) { return(U_Ret_COST1.Label + "必须为整数!"); } var sU_Ret_COST2 = U_Ret_COST2.Text; if (string.IsNullOrEmpty(sU_Ret_COST2)) { return(U_Ret_COST2.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sU_Ret_COST2)) { return(U_Ret_COST2.Label + "必须为整数!"); } var sT_COST = T_COST.Text; if (string.IsNullOrEmpty(sT_COST)) { return(T_COST.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sT_COST)) { return(T_COST.Label + "必须为整数!"); } var sT_COST1 = T_COST1.Text; if (string.IsNullOrEmpty(sT_COST1)) { return(T_COST1.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sT_COST1)) { return(T_COST1.Label + "必须为整数!"); } var sT_COST2 = T_COST2.Text; if (string.IsNullOrEmpty(sT_COST2)) { return(T_COST2.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sT_COST2)) { return(T_COST2.Label + "必须为整数!"); } var sT_Ret_COST = T_Ret_COST.Text; if (string.IsNullOrEmpty(sT_Ret_COST)) { return(T_Ret_COST.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sT_Ret_COST)) { return(T_Ret_COST.Label + "必须为整数!"); } var sT_Ret_COST1 = T_Ret_COST1.Text; if (string.IsNullOrEmpty(sT_Ret_COST1)) { return(T_Ret_COST1.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sT_Ret_COST1)) { return(T_Ret_COST1.Label + "必须为整数!"); } var sT_Ret_COST2 = T_Ret_COST2.Text; if (string.IsNullOrEmpty(sT_Ret_COST2)) { return(T_Ret_COST2.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sT_Ret_COST2)) { return(T_Ret_COST2.Label + "必须为整数!"); } var sCOST = COST.Text; if (string.IsNullOrEmpty(sCOST)) { return(COST.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sCOST)) { return(COST.Label + "必须为整数123!"); } var sCOST1 = COST1.Text; if (string.IsNullOrEmpty(sCOST1)) { return(COST1.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sCOST1)) { return(COST1.Label + "必须为整数!"); } var sCOST2 = COST2.Text; if (string.IsNullOrEmpty(sCOST2)) { return(COST2.Label + "不能为空!"); } if (!ConvertHelper.IsInt(sCOST2)) { return(COST2.Label + "必须为整数!"); } var sENABLE = ENABLE.SelectedValue; if (string.IsNullOrEmpty(sENABLE)) { return(ENABLE.Label + "不能为空!"); } var sVISIBLE = VISIBLE.SelectedValue; if (string.IsNullOrEmpty(sVISIBLE)) { return(VISIBLE.Label + "不能为空!"); } #endregion if (PRODUCT01Bll.GetInstence().Exist(x => x.PRCAREA_ID == sPRCAREA_ID && x.PROD_ID == prod_id) && id == 0) { return(PRCAREA_ID.Label + "已存在!请重新输入!"); } #region 赋值 var model = new PRODUCT01(x => x.Id == id); var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); model.PRCAREA_ID = sPRCAREA_ID; model.PROD_ID = prod_id; model.SUP_ID = sSUP_ID; model.SEND_TYPE = ConvertHelper.StringToByte(sSEND_TYPE); model.TAX_TYPE = ConvertHelper.StringToByte(sTAX_TYPE); model.Tax = ConvertHelper.Cint0(sTax); model.SUP_COST = ConvertHelper.Cint0(sSUP_COST); model.SUP_COST1 = ConvertHelper.Cint0(sSUP_COST1); model.SUP_COST2 = ConvertHelper.Cint0(sSUP_COST2); model.SUP_Return = ConvertHelper.Cint0(sSUP_Return); model.SUP_Return1 = ConvertHelper.Cint0(sSUP_Return1); model.SUP_Return2 = ConvertHelper.Cint0(sSUP_Return2); model.U_Cost = ConvertHelper.Cint0(sU_Cost); model.U_Cost1 = ConvertHelper.Cint0(sU_Cost1); model.U_Cost2 = ConvertHelper.Cint0(sU_Cost2); model.U_Ret_COST = ConvertHelper.Cint0(sU_Ret_COST); model.U_Ret_COST1 = ConvertHelper.Cint0(sU_Ret_COST1); model.U_Ret_COST2 = ConvertHelper.Cint0(sU_Ret_COST2); model.T_COST = ConvertHelper.Cint0(sT_COST); model.T_COST1 = ConvertHelper.Cint0(sT_COST1); model.T_COST2 = ConvertHelper.Cint0(sT_COST2); model.T_Ret_COST = ConvertHelper.Cint0(sT_Ret_COST); model.T_Ret_COST1 = ConvertHelper.Cint0(sT_Ret_COST1); model.T_Ret_COST2 = ConvertHelper.Cint0(sT_Ret_COST2); model.COST = ConvertHelper.Cint0(sCOST); model.COST1 = ConvertHelper.Cint0(sCOST1); model.COST2 = ConvertHelper.Cint0(sCOST2); model.VISIBLE = ConvertHelper.StringToByte(VISIBLE.SelectedValue); model.ENABLE = ConvertHelper.StringToByte(ENABLE.SelectedValue); if (id == 0) { model.CRT_DATETIME = ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); model.CRT_USER_ID = OlUser.Manager_LoginName; } else { model.CRT_DATETIME = model.CRT_DATETIME; model.CRT_USER_ID = model.CRT_USER_ID; } //model.CRT_USER_ID = ""; model.MOD_DATETIME = ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); model.MOD_USER_ID = OlUser.Manager_LoginName; //model.MOD_USER_ID = ""; model.LAST_UPDATE = ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); model.STATUS = 0; #endregion ////---------------------------------------------------------- ////存储到数据库 PRODUCT01Bll.GetInstence().Save(this, model); } catch (Exception e) { result = "保存失败!"; //出现异常,保存出错日志信息 CommonBll.WriteLog(result, e); } } else { result = "保存失败,商品编码为空"; } return(result); }