Exemple #1
0
        public ActionResult Create(Model.SubtMedicineDetail model)
        {
            bool result = false;

            //model.ID = 1;
            HTNResp.BLL.Program  bllProgram  = new BLL.Program();
            HTNResp.BLL.EvalGuid bllEvalGuid = new BLL.EvalGuid();
            if (!String.IsNullOrEmpty(model.Name))
            {
                HTNResp.BLL.SubtMedicineDetail bll = new HTNResp.BLL.SubtMedicineDetail();
                HTNResp.BLL.PermissionTable    per = new BLL.PermissionTable();
                var state = bll.Add(model);

                if (state != 0)
                {
                    result = true;
                }
            }
            if (result)
            {
                return(this.Json(new { result = 1, data = "" }));
            }
            else
            {
                return(this.Json(new { result = 0, msg = "新建失败" }));
            }
        }
        public ActionResult Update(Model.UserTable model, string authIdsa)
        {
            bool result = false;

            HTNResp.BLL.Program         bllProgram = new BLL.Program();
            HTNResp.BLL.PermissionTable per        = new BLL.PermissionTable();
            if (!String.IsNullOrEmpty(model.UserName) && !String.IsNullOrEmpty(model.UserCode) && !String.IsNullOrEmpty(model.Password))
            {
                result = bll.Update(model);
                var list = authIdsa.Split(',');
                if (result)
                {
                    if (string.IsNullOrEmpty(authIdsa))
                    {
                        list = new List <string>().ToArray();
                    }
                    else
                    {
                        int temp = DbHelperSQL.ExecuteSql("delete from PermissionTable where UserID=" + model.ID);
                    }
                    foreach (var item in list)
                    {
                        if (per.Add(new Model.PermissionTable()
                        {
                            TableID = int.Parse(item),
                            UserID = model.ID
                        }) != 0)
                        {
                            continue;
                        }
                        else
                        {
                            result = false;
                            break;
                        }
                    }
                    result = true;
                }
            }
            if (result)
            {
                return(this.Json(new { result = 1, data = "" }));
            }
            else
            {
                return(this.Json(new { result = 0, msg = "修改失败" }));
            }
        }
        public ActionResult Create(Model.UserTable model, string authIdsa)
        {
            bool result = false;

            //model.ID = 1;
            HTNResp.BLL.Program  bllProgram  = new BLL.Program();
            HTNResp.BLL.EvalGuid bllEvalGuid = new BLL.EvalGuid();
            if (!String.IsNullOrEmpty(model.UserName) && !String.IsNullOrEmpty(model.UserCode) && !String.IsNullOrEmpty(model.Password))
            {
                HTNResp.BLL.UserTable       bll = new HTNResp.BLL.UserTable();
                HTNResp.BLL.PermissionTable per = new BLL.PermissionTable();
                var state = bll.Add(model);
                var list  = authIdsa.Split(',');
                if (state != 0)
                {
                    if (string.IsNullOrEmpty(authIdsa))
                    {
                        list = new List <string>().ToArray();
                    }
                    foreach (var item in list)
                    {
                        if (per.Add(new Model.PermissionTable()
                        {
                            TableID = int.Parse(item),
                            UserID = state
                        }) != 0)
                        {
                            continue;
                        }
                        else
                        {
                            result = false;
                            break;
                        }
                    }
                    result = true;
                }
            }
            if (result)
            {
                return(this.Json(new { result = 1, data = "" }));
            }
            else
            {
                return(this.Json(new { result = 0, msg = "新建失败" }));
            }
        }
Exemple #4
0
        public ActionResult Update(Model.SubtMedicineDetail model)
        {
            bool result = false;

            HTNResp.BLL.Program         bllProgram = new BLL.Program();
            HTNResp.BLL.PermissionTable per        = new BLL.PermissionTable();
            if (!String.IsNullOrEmpty(model.Name))
            {
                result = bll.Update(model);
                if (result)
                {
                    result = true;
                }
            }
            if (result)
            {
                return(this.Json(new { result = 1, data = "" }));
            }
            else
            {
                return(this.Json(new { result = 0, msg = "修改失败" }));
            }
        }