Esempio n. 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //清空列表
            // Grid1.RejectChanges();
            HiddenShop_Id.Text     = ddlShop.SelectedValue;// ddlORDER_DEP.SelectedValue;
            HiddenLastShop_Id.Text = ddlShop.SelectedValue;

            Session[KEY_FOR_DATASOURCE_SESSION] = null;
            // }
            Grid1.DataSource = (DataTable)Session[KEY_FOR_DATASOURCE_SESSION];
            Grid1.DataBind();

            Window1.Hidden = true;

            string SHOP_ID = HiddenShop_Id.Text;

            Random ran = new Random();

            txtORDER_ID.Text = ddlShop.SelectedValue + "OR" + DateTime.Now.ToString("yyyy-MM-dd").Replace("-", "") + ran.Next(1000, 9999);

            if (SHOP_ID != "0")
            {
                PRODUCT00Bll.GetInstence().BandDropDownListShowProductName_1(this, DropDownList1, SHOP_ID);  // (System.Web.UI.WebControls.DropDownList)
            }
        }
        public override void Init()
        {
            //逻辑对象赋值
            bll = PRODUCT00Bll.GetInstence();

            ////表格对象赋值
            grid = Grid1;
        }
 public void ButtonPRODSearch2_Click(Object sender, EventArgs e)
 {
     conditionList = null;
     //conditionList = new List<ConditionFun.SqlqueryCondition>();
     //绑定Grid表格
     FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;
     PRODUCT00Bll.GetInstence().BindGrid(Grid4, 0, 0, InquiryCondition(), sortList);
 }
        protected void Grid1_PreDataBound(object sender, EventArgs e)
        {
            // 设置LinkButtonField的点击客户端事件
            LinkButtonField deleteField = Grid1.FindColumn("Delete") as LinkButtonField;

            deleteField.OnClientClick = GetDeleteScript(Grid1);

            PRODUCT00Bll.GetInstence().BandDropDownListShowProductName_1(this, DropDownList1, "");  // (System.Web.UI.WebControls.DropDownList)
            //DropDownList1.DataTextField = PRODUCT00Table.PROD_NAME1;
            //DropDownList1.DataValueField = PRODUCT00Table.PROD_ID;

            // DropDownList1.SelectedValue = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][PRODUCT00Table.PROD_ID].ToString();
        }
        protected void Grid1_PreRowDataBound(object sender, GridPreRowEventArgs e)
        {
            // 如果绑定到 DataTable,那么这里的 DataItem 就是 DataRowView
            DataRowView row = e.DataItem as DataRowView;
            int         d   = e.RowIndex;

            int j = Grid1.Rows.Count;

            PRODUCT00Bll.GetInstence().BandDropDownListShowProductName_1(this, (System.Web.UI.WebControls.DropDownList)Grid1.Rows[e.RowIndex].FindControl("DropDownList1"));
            DropDownList1.SelectedValue = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][PRODUCT00Table.PROD_ID].ToString();

            //PROD_KINDBll.GetInstence().BandDropDownListShowKind(this, (System.Web.UI.WebControls.DropDownList)Grid1.Rows[e.RowIndex].FindControl("DropDownList1"));
            //DropDownList1.SelectedValue = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][PROD_DEPTable.KIND_ID].ToString();
        }
Esempio n. 6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string Prod_ID  = context.Request["value"];
            string Shop_ID  = context.Request["value1"];
            string Ordep_ID = context.Request["value2"];

            DataTable dt = PRODUCT00Bll.GetInstence().GET_PRODUCT00_PRODUCT01_LIST_(Prod_ID, Shop_ID);
            int       d  = dt.Rows.Count;

            string resultJson = Dtb2Json(dt);

            context.Response.Write(resultJson);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //获取ID值
                hidId.Text = RequestHelper.GetQueryString("ORDER_Id") + "";

                //部门
                int Branch_Id = ConvertHelper.Cint0(OnlineUsersBll.GetInstence().GetUserOnlineInfo("Branch_Id").ToString());

                //绑定下拉列表
                PRODUCT00Bll.GetInstence().BandDropDownListShowProductName1(this, ddlPROD_NAME1);

                //加载数据
                LoadData();
            }
        }
        protected void ddlORDER_DEP_SelectedIndexChanged(object sender, EventArgs e)
        {
            JArray mergedData    = Grid1.GetMergedData();
            int    gridrowsCount = mergedData.Count;

            if (gridrowsCount > 0)
            {
                Window1.Hidden = false;
            }

            string SHOP_ID         = OnlineUsersBll.GetInstence().GetUserOnlineInfo("SHOP_ID").ToString();
            string ORDER_DEP_VALUE = ddlORDER_DEP.SelectedValue;

            if (SHOP_ID != "0")
            {
                PRODUCT00Bll.GetInstence().BandDropDownListShowProductName_1(this, DropDownList1, SHOP_ID);  // (System.Web.UI.WebControls.DropDownList)
            }
        }
        public override void LoadData()
        {
            //关闭窗口
            ButtonCancel.OnClientClick = ActiveWindow.GetHideReference();
            int id = ConvertHelper.Cint0(hidId.Text);

            if (id != 0)
            {
                //获取指定ID的菜单内容,如果不存在,则创建一个菜单实体
                //缓存机制有点问题,改直接初始化数据
                var model = PRODUCT00Bll.GetInstence().GetModelForCache(x => x.Id == id);
                //var model = new PROD_UNIT(x => x.Id == id);
                if (model == null)
                {
                    return;
                }
                PROD_ID.Text                = model.PROD_ID;
                PROD_NAME1.Text             = model.PROD_NAME1;
                PROD_NAME2.Text             = model.PROD_NAME2;
                PROD_KIND.SelectedValue     = model.PROD_KIND;
                PROD_DEP.SelectedValue      = model.PROD_DEP;
                PROD_CATE.SelectedValue     = model.PROD_CATE;
                DIV_ID.SelectedValue        = model.DIV_ID;
                PROD_TYPE.SelectedValue     = model.PROD_TYPE.ToString();
                PROD_Source.SelectedValue   = model.PROD_Source.ToString();
                INV_TYPE.SelectedValue      = model.INV_TYPE.ToString();
                STOCK_TYPE.SelectedValue    = model.STOCK_TYPE.ToString();
                BOM_TYPE.SelectedValue      = model.BOM_TYPE.ToString();
                MarginControl.SelectedValue = model.MarginControl.ToString();
                PROD_RangTYPE.SelectedValue = model.PROD_RangTYPE.ToString();
                PROD_iRang.Text             = model.PROD_iRang.ToString();
                PROD_SPEC.Text              = model.PROD_SPEC;
                PROD_Margin.Text            = model.PROD_Margin;
                PROD_BARCODE.Text           = model.PROD_BARCODE;
                PROD_UNIT.SelectedValue     = model.PROD_UNIT.ToString();
                PROD_CONVERT1.Text          = model.PROD_CONVERT1.ToString();
                PROD_UNIT1.SelectedValue    = model.PROD_UNIT1.ToString();
                PROD_CONVERT2.Text          = model.PROD_CONVERT2.ToString();
                PROD_UNIT2.SelectedValue    = model.PROD_UNIT2.ToString();
                Report_UNIT.SelectedValue   = model.Report_UNIT.ToString();
                PROD_MEMO.Text              = model.PROD_MEMO.ToString();
            }
        }
Esempio n. 10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string opt     = context.Request["opt"];
            string result  = "";
            string PROD_ID = context.Request["PROD_ID"];

            switch (opt)
            {
            case "1": string columnName = context.Request["columnName"];
                result = PRODUCT00Bll.GetInstence().GetModelSingleValue(columnName, x => x.PROD_ID == PROD_ID); break;

            case "2": string P_PRICE   = context.Request["P_PRICE"];
                string       UNIT_TYPE = context.Request["UNIT_TYPE"];
                result = PRODUCT00Bll.GetInstence().Tran_PRICE_UNIT(PROD_ID, P_PRICE, UNIT_TYPE); break;

            default: result = ""; break;
            }
            context.Response.Write(result);
        }
        /// <summary>
        /// 单击事件
        /// </summary>
        public void SingleClick()
        {
            string _id = GridViewHelper.GetSelectedKey(Grid1, true);

            int id = ConvertHelper.Cint0(_id);

            if (id != 0)
            {
                //获取指定ID的菜单内容,如果不存在,则创建一个菜单实体
                //缓存机制有点问题,改直接初始化数据
                var model = PRODUCT00Bll.GetInstence().GetModelForCache(x => x.Id == id);
                //var model = new PROD_UNIT(x => x.Id == id);
                if (model == null)
                {
                    return;
                }
                LoadProduct(model);
                LoadData2(model.PROD_ID);
            }
        }
Esempio n. 12
0
        protected void Grid1_PreDataBound(object sender, EventArgs e)
        {
            // 设置LinkButtonField的点击客户端事件
            // LinkButtonField deleteField = Grid1.FindColumn("Delete") as LinkButtonField;
            //  deleteField.OnClientClick = GetDeleteScript(Grid1);

            string SHOP_ID = OnlineUsersBll.GetInstence().GetUserOnlineInfo("SHOP_ID").ToString();

            //  string ORDER_DEP_VALUE = ddlORDER_DEP.SelectedValue;

            if (SHOP_ID != "0")
            {
                PRODUCT00Bll.GetInstence().BandDropDownListShowProductName_1(this, DropDownList1, SHOP_ID);  // (System.Web.UI.WebControls.DropDownList)
            }

            //DropDownList1.DataTextField = PRODUCT00Table.PROD_NAME1;
            //DropDownList1.DataValueField = PRODUCT00Table.PROD_ID;

            // DropDownList1.SelectedValue = ((System.Data.DataRowView)(row)).Row.Table.Rows[e.RowIndex][PRODUCT00Table.PROD_ID].ToString();
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <returns></returns>
        public string Product00Update()
        {
            string result = "0";
            string _id    = GridViewHelper.GetSelectedKey(Grid1, true);


            int id = ConvertHelper.Cint0(_id);

            try
            {
                #region 数据验证
                var sPROD_ID = PROD_ID.Text.Trim();
                if (string.IsNullOrEmpty(PROD_ID.Text.Trim()))
                {
                    PROD_ID.ShowRedStar = true;
                    return(PROD_ID.Label + "不能为空!");
                }

                if (string.IsNullOrEmpty(PROD_NAME1.Text.Trim()))
                {
                    return(PROD_NAME1.Label + "不能为空!");
                }

                var sPROD_KIND = PROD_KIND.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_KIND) || sPROD_KIND == "0")
                {
                    return(PROD_KIND.Label + "不能为空!");
                }

                var sPROD_DEP = PROD_DEP.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_DEP) || sPROD_DEP == "0")
                {
                    return(PROD_DEP.Label + "不能为空!");
                }

                var sPROD_TYPE = PROD_TYPE.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_DEP))
                {
                    return(PROD_TYPE.Label + "不能为空!");
                }

                var sPROD_Source = PROD_Source.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_Source))
                {
                    return(PROD_Source.Label + "不能为空!");
                }

                var sINV_TYPE = INV_TYPE.SelectedValue;
                if (string.IsNullOrEmpty(sINV_TYPE) || sINV_TYPE == "0")
                {
                    return(INV_TYPE.Label + "不能为空!");
                }

                var sSTOCK_TYPE = STOCK_TYPE.SelectedValue;
                if (string.IsNullOrEmpty(sSTOCK_TYPE) || sSTOCK_TYPE == "0")
                {
                    return(STOCK_TYPE.Label + "不能为空!");
                }

                var sBOM_TYPE = BOM_TYPE.SelectedValue;
                if (string.IsNullOrEmpty(sBOM_TYPE) || sBOM_TYPE == "0")
                {
                    return(BOM_TYPE.Label + "不能为空!");
                }

                var sMarginControl = MarginControl.SelectedValue;
                if (string.IsNullOrEmpty(sMarginControl) || sMarginControl == "0")
                {
                    return(MarginControl.Label + "不能为空!");
                }

                var sPROD_RangTYPE = PROD_RangTYPE.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_RangTYPE) || sPROD_RangTYPE == "0")
                {
                    return(PROD_RangTYPE.Label + "不能为空!");
                }

                var sPROD_iRang = PROD_iRang.Text;
                if (string.IsNullOrEmpty(sPROD_iRang))
                {
                    return(PROD_iRang.Label + "不能为空!");
                }

                if (!ConvertHelper.IsInt(sPROD_iRang))
                {
                    return(PROD_iRang.Label + "必须为整数123!");
                }

                var sPROD_UNIT = PROD_UNIT.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_UNIT) || sPROD_UNIT == "0")
                {
                    return(PROD_UNIT.Label + "不能为空!");
                }

                var sPROD_CONVERT1 = PROD_CONVERT1.Text;
                if (string.IsNullOrEmpty(sPROD_CONVERT1))
                {
                    return(PROD_CONVERT1.Label + "不能为空!");
                }

                if (!ConvertHelper.IsInt(sPROD_CONVERT1))
                {
                    return(PROD_CONVERT1.Label + "必须为整数!");
                }

                var sPROD_UNIT1 = PROD_UNIT1.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_UNIT1) || sPROD_UNIT1 == "0")
                {
                    return("包装单位不能为空!");
                }


                var sPROD_CONVERT2 = PROD_CONVERT2.Text;
                if (string.IsNullOrEmpty(sPROD_CONVERT2))
                {
                    return(PROD_CONVERT2.Label + "不能为空!");
                }
                if (!ConvertHelper.IsInt(sPROD_CONVERT2))
                {
                    return(PROD_CONVERT2.Label + "必须为整数!");
                }

                var sPROD_UNIT2 = PROD_UNIT2.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_UNIT2) || sPROD_UNIT2 == "0")
                {
                    return("外箱单位不能为空!");
                }

                var sReport_UNIT = Report_UNIT.SelectedValue;
                if (string.IsNullOrEmpty(sReport_UNIT) || sReport_UNIT == "0")
                {
                    return(Report_UNIT.Label + "不能为空!");
                }


                sPROD_ID = StringHelper.Left(sPROD_ID, 50);
                if (!PRODUCT00Bll.GetInstence().Exist(x => x.PROD_ID == sPROD_ID) && id != 0)
                {
                    return(PROD_ID.Label + "不存在!请重新输入!");
                }
                string sPROD_NAME1 = PROD_NAME1.Text.Trim();
                if (PRODUCT00Bll.GetInstence().Exist(x => x.PROD_NAME1 == sPROD_NAME1 && x.PROD_ID != sPROD_ID) && id != 0)
                {
                    return(PROD_NAME1.Label + "与其他商品重复!请重新输入!");
                }

                #endregion

                #region 赋值



                var model  = new PRODUCT00(x => x.PROD_ID == sPROD_ID);
                var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
                //if (model.PROD_ID == sPROD_ID)
                //{
                //    model.SetIsNew(false);
                //}
                //else
                //{
                //    model.SetIsNew(true);
                //}
                model.PROD_ID             = sPROD_ID;
                model.PROD_NAME1          = PROD_NAME1.Text;
                model.PROD_NAME1_SPELLING = PROD_NAME1_SPELLING.Text;
                model.PROD_NAME2          = PROD_NAME2.Text;
                model.PROD_KIND           = sPROD_KIND;
                model.PROD_DEP            = sPROD_DEP;
                model.PROD_CATE           = PROD_CATE.SelectedValue;
                model.DIV_ID        = DIV_ID.SelectedValue;
                model.INV_TYPE      = ConvertHelper.Cint(sINV_TYPE);
                model.STOCK_TYPE    = ConvertHelper.Cint(sSTOCK_TYPE);
                model.BOM_TYPE      = ConvertHelper.Cint(sBOM_TYPE);
                model.MarginControl = ConvertHelper.Cint(sMarginControl);
                model.PROD_RangTYPE = ConvertHelper.Cint(sPROD_RangTYPE);
                model.PROD_iRang    = ConvertHelper.Cint(sPROD_iRang);
                model.PROD_SPEC     = PROD_SPEC.Text;
                model.PROD_Margin   = PROD_Margin.Text;
                model.PROD_BARCODE  = PROD_BARCODE.Text;
                model.PROD_UNIT     = sPROD_UNIT;
                model.PROD_UNIT1    = sPROD_UNIT1;
                model.PROD_CONVERT1 = ConvertHelper.Cint(sPROD_CONVERT1);
                model.PROD_UNIT2    = sPROD_UNIT2;
                model.PROD_CONVERT2 = ConvertHelper.Cint(sPROD_CONVERT2);
                model.Report_UNIT   = ConvertHelper.Cint(sReport_UNIT);
                model.PROD_MEMO     = PROD_MEMO.Text;


                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
                ////----------------------------------------------------------
                ////存储到数据库
                model.SetIsNew(false);
                //PRODUCT00Bll.GetInstence().Save(this, model, null, false, true);
                result = result + "\r\n" + Product01Update();
                if (!String.IsNullOrEmpty(result))
                {
                    PRODUCT00Bll.GetInstence().Save(this, model);
                    PRODUCT00Bll.GetInstence().Insert_PRODUCT01(sPROD_ID, model.CRT_USER_ID);
                    result = "商品资料更新成功";
                    LoadData();
                    LoadData2(sPROD_ID);
                }
            }
            catch (Exception e)
            {
                result = "更新失败!";

                //出现异常,保存出错日志信息
                CommonBll.WriteLog(result, e);
            }
            return(result);
        }
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;
            int    id     = ConvertHelper.Cint0(hidId.Text);

            try
            {
                #region 数据验证
                var sPROD_ID = PROD_ID.Text.Trim();
                if (string.IsNullOrEmpty(PROD_ID.Text.Trim()))
                {
                    PROD_ID.ShowRedStar = true;
                    return(PROD_ID.Label + "不能为空!");
                }

                if (string.IsNullOrEmpty(PROD_NAME1.Text.Trim()))
                {
                    return(PROD_NAME1.Label + "不能为空!");
                }

                var sPROD_KIND = PROD_KIND.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_KIND) || sPROD_KIND == "0")
                {
                    return(PROD_KIND.Label + "不能为空!");
                }

                var sPROD_DEP = PROD_DEP.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_DEP) || sPROD_DEP == "0")
                {
                    return(PROD_DEP.Label + "不能为空!");
                }

                var sPROD_TYPE = PROD_TYPE.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_DEP))
                {
                    return(PROD_TYPE.Label + "不能为空!");
                }

                var sPROD_Source = PROD_Source.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_Source))
                {
                    return(PROD_Source.Label + "不能为空!");
                }

                var sINV_TYPE = INV_TYPE.SelectedValue;
                if (string.IsNullOrEmpty(sINV_TYPE) || sINV_TYPE == "0")
                {
                    return(INV_TYPE.Label + "不能为空!");
                }

                var sSTOCK_TYPE = STOCK_TYPE.SelectedValue;
                if (string.IsNullOrEmpty(sSTOCK_TYPE) || sSTOCK_TYPE == "0")
                {
                    return(STOCK_TYPE.Label + "不能为空!");
                }

                var sBOM_TYPE = BOM_TYPE.SelectedValue;
                if (string.IsNullOrEmpty(sBOM_TYPE) || sBOM_TYPE == "0")
                {
                    return(BOM_TYPE.Label + "不能为空!");
                }

                var sMarginControl = MarginControl.SelectedValue;
                if (string.IsNullOrEmpty(sMarginControl) || sMarginControl == "0")
                {
                    return(MarginControl.Label + "不能为空!");
                }

                var sPROD_RangTYPE = PROD_RangTYPE.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_RangTYPE) || sPROD_RangTYPE == "0")
                {
                    return(PROD_RangTYPE.Label + "不能为空!");
                }

                var sPROD_iRang = PROD_iRang.Text;
                if (string.IsNullOrEmpty(sPROD_iRang))
                {
                    return(PROD_iRang.Label + "不能为空!");
                }

                if (!ConvertHelper.IsInt(sPROD_iRang))
                {
                    return(PROD_iRang.Label + "必须为整数123!");
                }

                var sPROD_UNIT = PROD_UNIT.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_UNIT) || sPROD_UNIT == "0")
                {
                    return(PROD_UNIT.Label + "不能为空!");
                }

                var sPROD_CONVERT1 = PROD_CONVERT1.Text;
                if (string.IsNullOrEmpty(sPROD_CONVERT1))
                {
                    return(PROD_CONVERT1.Label + "不能为空!");
                }

                if (!ConvertHelper.IsInt(sPROD_CONVERT1))
                {
                    return(PROD_CONVERT1.Label + "必须为整数!");
                }

                var sPROD_UNIT1 = PROD_UNIT1.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_UNIT1) || sPROD_UNIT1 == "0")
                {
                    return("包装单位不能为空!");
                }


                var sPROD_CONVERT2 = PROD_CONVERT2.Text;
                if (string.IsNullOrEmpty(sPROD_CONVERT2))
                {
                    return(PROD_CONVERT2.Label + "不能为空!");
                }
                if (!ConvertHelper.IsInt(sPROD_CONVERT2))
                {
                    return(PROD_CONVERT2.Label + "必须为整数!");
                }

                var sPROD_UNIT2 = PROD_UNIT2.SelectedValue;
                if (string.IsNullOrEmpty(sPROD_UNIT2) || sPROD_UNIT2 == "0")
                {
                    return("外箱单位不能为空!");
                }

                var sReport_UNIT = Report_UNIT.SelectedValue;
                if (string.IsNullOrEmpty(sReport_UNIT) || sReport_UNIT == "0")
                {
                    return(Report_UNIT.Label + "不能为空!");
                }

                var sOrder_UNIT = Order_UNIT.SelectedValue;
                if (string.IsNullOrEmpty(sOrder_UNIT) || sOrder_UNIT == "0")
                {
                    return(Order_UNIT.Label + "不能为空!");
                }

                var sOrder_Quan = Order_QUAN.Text;
                if (string.IsNullOrEmpty(sOrder_Quan) || sOrder_Quan == "0")
                {
                    return(Order_QUAN.Label + "不能为空!");
                }
                if (!ConvertHelper.IsInt(sOrder_Quan))
                {
                    return(Order_QUAN.Label + "必须为整数!");
                }

                var sPurchase_UNIT = Purchase_UNIT.SelectedValue;
                if (string.IsNullOrEmpty(sPurchase_UNIT) || sPurchase_UNIT == "0")
                {
                    return(Purchase_UNIT.Label + "不能为空!");
                }

                var sPurchase_QUAN = Purchase_QUAN.Text;
                if (string.IsNullOrEmpty(sPurchase_QUAN))
                {
                    return(Purchase_QUAN.Label + "不能为空!");
                }
                if (!ConvertHelper.IsInt(sPurchase_QUAN))
                {
                    return(Purchase_QUAN.Label + "必须为整数!");
                }

                var sSAFE_QUAN = SAFE_QUAN.Text;
                if (string.IsNullOrEmpty(sSAFE_QUAN))
                {
                    return(SAFE_QUAN.Label + "不能为空!");
                }
                if (!ConvertHelper.IsInt(sSAFE_QUAN))
                {
                    return(SAFE_QUAN.Label + "必须为整数!");
                }


                sPROD_ID = StringHelper.Left(sPROD_ID, 50);
                if (PRODUCT00Bll.GetInstence().Exist(x => x.PROD_ID == sPROD_ID) && id == 0)
                {
                    return(PROD_ID.Label + "已存在!请重新输入!");
                }

                //var sMeno = StringHelper.Left(UNIT_MENO.Text, 40);
                //if (UNIT_MENO.Text.Trim().Length > 40)
                //{
                //    return UNIT_MENO.Label + "超长!";
                //}

                #endregion

                #region 赋值

                var model  = new PRODUCT00(x => x.Id == id);
                var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());

                model.PROD_ID       = sPROD_ID;
                model.PROD_NAME1    = PROD_NAME1.Text;
                model.PROD_NAME2    = PROD_NAME2.Text;
                model.PROD_KIND     = sPROD_KIND;
                model.PROD_DEP      = sPROD_DEP;
                model.PROD_CATE     = PROD_CATE.SelectedValue;
                model.DIV_ID        = DIV_ID.SelectedValue;
                model.INV_TYPE      = ConvertHelper.Cint(sINV_TYPE);
                model.STOCK_TYPE    = ConvertHelper.Cint(sSTOCK_TYPE);
                model.BOM_TYPE      = ConvertHelper.Cint(sBOM_TYPE);
                model.MarginControl = ConvertHelper.Cint(sMarginControl);
                model.PROD_RangTYPE = ConvertHelper.Cint(sPROD_RangTYPE);
                model.PROD_iRang    = ConvertHelper.Cint(sPROD_iRang);
                model.PROD_SPEC     = PROD_SPEC.Text;
                model.PROD_Margin   = PROD_Margin.Text;
                model.PROD_BARCODE  = PROD_BARCODE.Text;
                model.PROD_UNIT     = sPROD_UNIT;
                model.PROD_UNIT1    = sPROD_UNIT1;
                model.PROD_CONVERT1 = ConvertHelper.Cint(sPROD_CONVERT1);
                model.PROD_UNIT2    = sPROD_UNIT2;
                model.PROD_CONVERT2 = ConvertHelper.Cint(sPROD_CONVERT2);
                model.Report_UNIT   = ConvertHelper.Cint(sReport_UNIT);
                model.PROD_MEMO     = PROD_MEMO.Text;


                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
                ////----------------------------------------------------------
                ////存储到数据库
                PRODUCT00Bll.GetInstence().Save(this, model);
            }
            catch (Exception e)
            {
                result = "保存失败!";

                //出现异常,保存出错日志信息
                CommonBll.WriteLog(result, e);
            }

            return(result);
        }
Esempio n. 15
0
        public override void LoadData()
        {
            //关闭窗口
            ButtonCancel.OnClientClick = ActiveWindow.GetHideReference();
            int    id      = ConvertHelper.Cint0(hidId.Text);
            string prod_id = hidPROD_ID.Text;

            if (!String.IsNullOrEmpty(prod_id))
            {
                var prod_model = PRODUCT00Bll.GetInstence().GetModelForCache(x => x.PROD_ID == prod_id);
                if (prod_model != null)
                {
                    PROD_NAME.Text = prod_model.PROD_NAME1;
                }
                else
                {
                    return;
                }
            }

            if (id != 0)
            {
                //获取指定ID的菜单内容,如果不存在,则创建一个菜单实体
                //缓存机制有点问题,改直接初始化数据
                var model = PRODUCT01Bll.GetInstence().GetModelForCache(x => x.Id == id);
                //var model = new PROD_UNIT(x => x.Id == id);
                if (model == null)
                {
                    return;
                }
                #region 控件数据加载
                PRCAREA_ID.SelectedValue = model.PRCAREA_ID;
                SUP_ID.SelectedValue     = model.SUP_ID;
                SEND_TYPE.SelectedValue  = model.SEND_TYPE + "";
                TAX_TYPE.SelectedValue   = model.TAX_TYPE + "";
                Tax.Text              = model.Tax.ToString();
                SUP_COST.Text         = model.SUP_COST.ToString();
                SUP_COST1.Text        = model.SUP_COST1.ToString();
                SUP_COST2.Text        = model.SUP_COST2.ToString();
                SUP_Return.Text       = model.SUP_Return.ToString();
                SUP_Return1.Text      = model.SUP_Return1.ToString();
                SUP_Return2.Text      = model.SUP_Return2.ToString();
                U_Cost.Text           = model.U_Cost.ToString();
                U_Cost1.Text          = model.U_Cost1.ToString();
                U_Cost2.Text          = model.U_Cost2.ToString();
                U_Ret_COST.Text       = model.U_Ret_COST.ToString();
                U_Ret_COST1.Text      = model.U_Ret_COST1.ToString();
                U_Ret_COST2.Text      = model.U_Ret_COST2.ToString();
                T_COST.Text           = model.T_COST.ToString();
                T_COST1.Text          = model.T_COST1.ToString();
                T_COST2.Text          = model.T_COST2.ToString();
                T_Ret_COST.Text       = model.T_Ret_COST.ToString();
                T_Ret_COST1.Text      = model.T_Ret_COST1.ToString();
                T_Ret_COST2.Text      = model.T_Ret_COST2.ToString();
                COST.Text             = model.COST.ToString();
                COST1.Text            = model.COST1.ToString();
                COST2.Text            = model.COST2.ToString();
                COST.Text             = model.COST.ToString();
                COST1.Text            = model.COST1.ToString();
                COST2.Text            = model.COST2.ToString();
                ENABLE.SelectedValue  = model.ENABLE + "";
                VISIBLE.SelectedValue = model.VISIBLE + "";
                #endregion
            }
        }