コード例 #1
0
        protected override bool CheckModelBeforeSave(UserInfo model, ref string strError)
        {
            if (model == null)
            {
                strError = "客户端传来的实体类不能为空!";
                return(false);
            }

            if (model.UserStatus <= 0)
            {
                strError = "用户状态必须选择!";
                return(false);
            }

            if (model.UserType <= 0)
            {
                strError = "用户类型必须选择!";
                return(false);
            }


            if (BILBasic.Common.Common_Func.IsNullOrEmpty(model.UserNo))
            {
                strError = "登录名不能为空!";
                return(false);
            }
            if (Common_Func.IsNullOrEmpty(model.UserName))
            {
                strError = "用户姓名不能为空!";
                return(false);
            }
            if (Common_Func.IsNullOrEmpty(model.PassWord) || Common_Func.IsNullOrEmpty(model.RePassword))
            {
                strError = "登陆密码和确认密码不能为空!";
                return(false);
            }
            //判断据点和仓库的关系
            T_WareHouse_Func Wfunc = new T_WareHouse_Func();
            string           Msg   = "";

            string[] warehousenos = model.WarehouseCode.Split(',');
            for (int i = 0; i < warehousenos.Length; i++)
            {
                T_WareHouseInfo warehouse = new T_WareHouseInfo()
                {
                    ID = Convert.ToInt16(warehousenos[i])
                };
                Wfunc.GetModelByID(ref warehouse, ref Msg);
                if (model.StrongHoldCode == "0300")
                {
                    if (warehouse.WareHouseNo.Substring(0, 1) != "G")
                    {
                        strError = "仓库和据点没有对应关系!";
                        return(false);
                    }
                }
                if (model.StrongHoldCode == "0401")
                {
                    if (warehouse.WareHouseNo.Substring(0, 2) != "C1")
                    {
                        strError = "仓库和据点没有对应关系!";
                        return(false);
                    }
                }
                if (model.StrongHoldCode == "0402")
                {
                    if (warehouse.WareHouseNo.Substring(0, 2) != "C2")
                    {
                        strError = "仓库和据点没有对应关系!";
                        return(false);
                    }
                }
                if (model.StrongHoldCode == "0403")
                {
                    if (warehouse.WareHouseNo.Substring(0, 2) != "C3")
                    {
                        strError = "仓库和据点没有对应关系!";
                        return(false);
                    }
                }
            }


            //if (Common_Func.IsNullOrEmpty(model.GroupCode))
            //{
            //    strError = "用户分组不能为空!";
            //    return false;
            //}
            if (!Common_Func.IsEqualString(model.PassWord, model.RePassword))
            {
                strError = "确认密码与登陆密码不一致!";
                return(false);
            }


            return(true);
        }
コード例 #2
0
ファイル: ServiceWareHouse.cs プロジェクト: shew990/TaiBang
        public bool GetT_WareHouseByID(ref T_WareHouseInfo model, ref string strError)
        {
            T_WareHouse_Func tfunc = new T_WareHouse_Func();

            return(tfunc.GetModelByID(ref model, ref strError));
        }