コード例 #1
0
        public UnifyApiResult Edit(ContactGroupModel model)
        {
            if (model == null)
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }

            if (string.IsNullOrEmpty(model.UserName))
            {
                return(UnifyApiResult.Error("姓名不能为空。"));
            }
            if (string.IsNullOrEmpty(model.Contact))
            {
                return(UnifyApiResult.Error("电话不能为空。"));
            }
            if (string.IsNullOrEmpty(model.ContactGroupId))
            {
                return(UnifyApiResult.Error("分组不能为空。"));
            }


            model.ModifyDatetime = DateTime.Now;
            ContactGroupDAL dal    = new ContactGroupDAL();
            dynamic         result = dal.Modify(model);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #2
0
        public UnifyApiResult Add(TechnicianModel model)
        {
            if (model == null)
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }
            if (string.IsNullOrEmpty(model.Name))
            {
                return(UnifyApiResult.Error("姓名不能为空。"));
            }
            if (string.IsNullOrEmpty(model.Phone))
            {
                return(UnifyApiResult.Error("手机不能为空。"));
            }

            TechnicianDAL dal = new TechnicianDAL();

            if (dal.GetData(model.Name) != null)
            {
                return(UnifyApiResult.Error("姓名不允许重复。"));
            }

            dynamic result = dal.Insert(model);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #3
0
        public UnifyApiResult LoginResult(string username, string password)
        {
            if (string.IsNullOrEmpty(username))
            {
                return(UnifyApiResult.Error("用户名不允许为空。"));
            }

            if (string.IsNullOrEmpty(password))
            {
                return(UnifyApiResult.Error("密码不允许为空。"));
            }

            OperatorDAL dal          = new OperatorDAL();
            dynamic     operatorData = dal.GetUserPwd(username, EncryptionHelper.UserMd5(password));

            if (operatorData != null)
            {
                //固定角色的方法  角色只有 admin,system 2种,根据2种角色分别限制不同的Controller,不够灵活
                LoginData data = new LoginData()
                {
                    Sid  = operatorData.OperatorID.ToString(),
                    Name = operatorData.LoginName,
                    Role = "admin"
                };

                return(UnifyApiResult.Sucess(new
                {
                    result = operatorData,
                    token = this.Login(data, _permissionRequirement)
                }));
            }
            return(UnifyApiResult.Error("用户名密码输入不正确。"));
        }
コード例 #4
0
        public UnifyApiResult Add(OperatorModel model)
        {
            if (model == null)
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }
            if (string.IsNullOrEmpty(model.LoginName))
            {
                return(UnifyApiResult.Error("用户名不能为空。"));
            }
            if (string.IsNullOrEmpty(model.Password))
            {
                return(UnifyApiResult.Error("密码不能为空。"));
            }

            OperatorDAL dal = new OperatorDAL();

            if (dal.GetData(model.LoginName) == null)
            {
                return(UnifyApiResult.Error("用户名不允许重复。"));
            }

            model.Password = EncryptionHelper.UserMd5(model.Password);
            dynamic result = dal.Insert(model);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #5
0
        public UnifyApiResult Remove(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }

            ContactGroupDAL dal    = new ContactGroupDAL();
            dynamic         result = dal.Remove(id);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #6
0
        public UnifyApiResult Remove(string code)
        {
            if (string.IsNullOrEmpty(code))
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }

            TechnicianDAL dal    = new TechnicianDAL();
            dynamic       result = dal.Remove(code);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #7
0
        public UnifyApiResult Remove(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(UnifyApiResult.Error("编号不能为空。"));
            }

            RegisterDAL dal    = new RegisterDAL();
            dynamic     result = dal.Remove(id);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #8
0
        public UnifyApiResult Edit(OperatorModel model)
        {
            if (model == null)
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }

            if (!string.IsNullOrEmpty(model.Password))
            {
                model.Password = EncryptionHelper.UserMd5(model.Password);
            }
            OperatorDAL dal    = new OperatorDAL();
            dynamic     result = dal.Modify(model);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #9
0
        public UnifyApiResult Edit(HospitalModel model)
        {
            if (model == null)
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }

            if (string.IsNullOrEmpty(model.HName))
            {
                return(UnifyApiResult.Error("医院名称不能为空。"));
            }

            model.ModifyDate = DateTime.Now;
            HospitalDAL dal    = new HospitalDAL();
            dynamic     result = dal.Modify(model);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #10
0
        public UnifyApiResult Edit(TechnicianModel model)
        {
            if (model == null)
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }

            if (!string.IsNullOrEmpty(model.Name))
            {
                return(UnifyApiResult.Error("姓名不能为空。"));
            }
            if (string.IsNullOrEmpty(model.Phone))
            {
                return(UnifyApiResult.Error("手机不能为空。"));
            }

            TechnicianDAL dal    = new TechnicianDAL();
            dynamic       result = dal.Modify(model);

            return(UnifyApiResult.Sucess(result));
        }
コード例 #11
0
        public UnifyApiResult Add(HospitalModel model)
        {
            if (model == null)
            {
                return(UnifyApiResult.Error("参数不能为空。"));
            }
            if (string.IsNullOrEmpty(model.HName))
            {
                return(UnifyApiResult.Error("医院名称不能为空。"));
            }


            HospitalDAL dal = new HospitalDAL();

            if (dal.GetData(model.HName) != null)
            {
                return(UnifyApiResult.Error("医院名称不允许重复。"));
            }

            model.ModifyDate = DateTime.Now;
            dynamic result = dal.Insert(model);

            return(UnifyApiResult.Sucess(result));
        }