示例#1
0
        /// <summary>
        /// 代理商删除
        /// wuyf 20150924
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultModel DeleterYH_Agent(YH_AgentModel model)
        {
            var result = new ResultModel();

            result.Data = _database.Db.YH_Agent.DeleteByUserID(UserID: model.UserID);
            return(result);
        }
示例#2
0
        /// <summary>
        /// 代理商更新
        /// zhoub 20150924
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultModel EditYH_Agent(YH_AgentModel model)
        {
            ResultModel result = new ResultModel();

            result.Data = _database.Db.YH_Agent.UpdateByAgentID(AgentID: model.AgentID, AgentType: model.AgentType, UpdateBy: model.UpdateBy, UpdateDT: model.UpdateDT);
            if (result.Data > 0)
            {
                result.Messages.Add("Agent edit success.");
            }
            else
            {
                result.IsValid = false;
                result.Messages.Add("Agent edit Failure.");
            }
            return(result);
        }
示例#3
0
        /// <summary>
        /// 代理商添加
        /// zhoub 20150924
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultModel AddYH_Agent(YH_AgentModel model)
        {
            ResultModel result        = new ResultModel();
            var         yh_AgentModel = base._database.Db.YH_Agent.Find(base._database.Db.YH_Agent.UserID == model.UserID);

            if (yh_AgentModel == null)
            {
                result.Data = _database.Db.YH_Agent.Insert(model);
                result.Messages.Add("Agent add success.");
            }
            else
            {
                result.IsValid = false;
                result.Messages.Add("Agent already exist.");
            }
            return(result);
        }
示例#4
0
        public ActionResult UpgradeAgentIndex(YH_AgentModel model)
        {
            ResultModel resultModel = new ResultModel();

            if (model.AgentID > 0)
            {
                model.UpdateDT = DateTime.Now;
                model.UpdateBy = UserInfo.CurrentUserName;
                resultModel    = _yh_AgentService.EditYH_Agent(model);
            }
            else
            {
                model.CreateBy = UserInfo.CurrentUserName;
                model.CreateDT = DateTime.Now;
                resultModel    = _yh_AgentService.AddYH_Agent(model);
            }
            string opera = string.Format("升级代理商:{0},操作结果:{1}", JsonConverts.ToJson(model), resultModel.Messages);

            LogPackage.InserAC_OperateLog(opera, "User strategies--Users list--Upgrade Agent");
            return(Json(resultModel, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>

        public JsonResult DeleteYH_User(long?UserID)
        {
            YH_AgentModel model       = new YH_AgentModel();
            var           resultModel = new ResultModel();

            if (UserID.HasValue)
            {
                model.UserID = UserID.Value;
                var result = this._yh_AgentService.DeleterYH_Agent(model).IsValid;
                if (result)
                {
                    resultModel.IsValid  = true;
                    resultModel.Messages = new List <string> {
                        "Delete success"
                    };
                }
                else
                {
                    resultModel.IsValid  = false;
                    resultModel.Messages = new List <string> {
                        "Delete failed"
                    };
                }

                var opera = string.Empty;

                opera = " UserID:" + model.UserID + ",结果:" + resultModel.Messages;
                LogPackage.InserAC_OperateLog(opera, "供应商-删除");
                return(Json(resultModel, JsonRequestBehavior.AllowGet));
            }
            else
            {
                resultModel.IsValid  = false;
                resultModel.Messages = new List <string> {
                    "Parameter ID error"
                };
            }

            return(Json(resultModel, JsonRequestBehavior.AllowGet));
        }