Exemple #1
0
 public ActionResult Import(int dataType = 0, string content = "")
 {
     if (string.IsNullOrEmpty(content))
     {
         return View();
     }
     var arry = content.Split('\r');
     CItem last = null;
     var list = new List<Department>();
     foreach (var s in arry)
     {
         string name = s.TrimEnd();
         int length = name.Length;
         int length2 = name.Replace("\t", "").Length;
         int level = length - length2;
         CItem c = new CItem() { Level = level, Name = name, Pre = last };
         last = c;
         Department Department = new Department();
         Department.DataType = dataType;
         Department.Name = name.Trim();
         Department.SequenceCode = c.Code;
         Department.ParentCode = Department.SequenceCode.Substring(0, Department.SequenceCode.Length - 2);
         list.Add(Department);
     }
     CRL.Package.RoleAuthorize.DepartmentBusiness.Instance.BatchInsert(list);
     return AutoBackResult("导入成功");
 }
Exemple #2
0
 public ActionResult Save(CRL.Package.RoleAuthorize.Department Department)
 {
     CRL.ParameCollection c = new CRL.ParameCollection();
     c["name"]    = Department.Name;
     c["Disable"] = Department.Disable;
     c["Sort"]    = Department.Sort;
     CRL.Package.RoleAuthorize.DepartmentBusiness.Instance.Update(b => b.SequenceCode == Department.SequenceCode && b.DataType == 0, c);
     return(JsonResult(true, ""));
 }
Exemple #3
0
 public ActionResult Add(string name, string parentCode = "", int dataType = 0)
 {
     var arry = name.Split(',');
     foreach (var item in arry)
     {
         Department c = new Department();
         c.Name = item.Trim();
         c.DataType = dataType;
         c.ParentCode = parentCode;
         CRL.Package.RoleAuthorize.DepartmentBusiness.Instance.Add(parentCode, c);
     }
     return JsonResult(true, "");
 }