Пример #1
0
        public ActionResult AddDeliverMan()
        {
            M_Shop_DeliveryMan delyMod = manBll.SelReturnModel(Mid);

            if (delyMod == null)
            {
                delyMod = new M_Shop_DeliveryMan();
            }
            return(View(delyMod));
        }
Пример #2
0
 public int Insert(M_Shop_DeliveryMan model)
 {
     return(DBCenter.Insert(model));
 }
Пример #3
0
 public bool UpdateByID(M_Shop_DeliveryMan model)
 {
     return(DBCenter.UpdateByID(model, model.ID));
 }
Пример #4
0
        public void DeliveryMan_Add()
        {
            M_Shop_DeliveryMan manMod = manBll.SelReturnModel(Mid);

            if (manMod == null)
            {
                manMod = new M_Shop_DeliveryMan();
            }
            M_CommonData storeMod = conBll.SelMyStore_Ex(ref err);

            if (!string.IsNullOrEmpty(err))
            {
                function.WriteErrMsg(err); return;
            }
            manMod.Remind = Request.Form["Remind"];
            manMod.Auth   = Request.Form["auth"];
            manMod.Bonus  = DataConvert.CDouble(Request.Form["Bonus"]);
            //用户相关
            string input_user = Request.Form["user"];

            if (string.IsNullOrWhiteSpace(input_user))
            {
                function.WriteErrMsg("用户信息不能为空"); return;
            }
            M_UserInfo user = buser.SelReturnModel(DataConverter.CLng(input_user));

            if (user.IsNull)
            {
                user = buser.GetUserByName(input_user);
            }
            if (user.IsNull)
            {
                function.WriteErrMsg("用户不存在"); return;
            }
            manMod.UserID = user.UserID;
            if (manMod.ID > 0)
            {
                if (manMod.StoreID != storeMod.GeneralID)
                {
                    function.WriteErrMsg("你无权修改该送货员"); return;
                }
                manBll.UpdateByID(manMod);
            }
            else
            {
                DataTable dt = manBll.Sel(manMod.UserID);
                if (dt != null && dt.Rows.Count > 0)
                {
                    if (DataConverter.CLng(dt.Rows[0]["StoreID"]) == storeMod.GeneralID)
                    {
                        function.WriteErrMsg("该送货员已存在,不可重复添加"); return;
                    }
                    else
                    {
                        function.WriteErrMsg("该用户已经是送货员"); return;
                    }
                }
                manMod.StoreID = storeMod.GeneralID;
                manBll.Insert(manMod);
            }
            function.WriteSuccessMsg("操作成功", "DeliveryMan");
        }