Пример #1
0
 private void LoadData(string ID)
 {
     PersonInfoManager manager = new PersonInfoManager();
     PersonInfo code = manager.GetItemById(new Guid(ID));
     txtID.Value = code.ID.ToString();
     txtUserName.Value = code.UserName;
     txtEmail.Value = code.Email;
     txtRealName.Value = code.RealName;
     txtLocation.Value = code.Location;
     txtDetailedAddress.Value = code.DetailedAddress;
     txtSex.SelectedValue = code.Sex.ToString();
     txtTelphone.Value = code.Telphone;
     txtIDCardNumber.Value = code.IDCardNumber;
     hidBirthday.Value = code.Birthday.HasValue ? code.Birthday.Value.ToString("yyyy/MM/dd") : "";
     txtMarryStatus.SelectedValue = code.MarryStatus.HasValue ? code.MarryStatus.ToString() : "";
     txtNote.Value = code.Note;
     //获取默认部门
      DepartAndPerson dp=   manager.GetDefaultDepart(code.ID);
      if (dp!=null)
      {
      AdministrativeRegions ar = new AdministrativeRegionsManager().GetItemById(dp.DepartID);
      txtDepartID.Value = ar.ID.ToString();
      txtSocrceDepart.Value = ar.Name;
      }
 }
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     AdministrativeRegionsManager manager = new AdministrativeRegionsManager();
     DataTable dt = manager.GetDataTable();
     string result = JsonConvert.Convert2Json(dt);
     context.Response.Write(result);
     context.Response.End();
 }
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     HttpRequest rp = context.Request;
     string msg = string.Empty;
     try
     {
         AdministrativeRegionsManager manager = new AdministrativeRegionsManager();
         if (string.IsNullOrEmpty(rp["txtID"]))
         {
             entity.ID = Guid.NewGuid();
             if (!string.IsNullOrEmpty(rp["txtParentID"]))
             {
                 entity.ParentID = new Guid(rp["txtParentID"]);
                 AdministrativeRegions paraent = manager.GetItemById(entity.ParentID.Value);
                 entity.ParentName = rp["txtParentName"];
                 entity.ClassCode = paraent.ClassCode + entity.ID + ";";
             }
             else
             {
                 entity.ClassCode = entity.ID + ";";
             }
         }
         else
         {
             entity.ID = new Guid(rp["txtID"]);
             entity.RecordStatus = StatusType.update;
         }
         entity.Code = rp["txtCode"];
         entity.Name = rp["txtName"];
         entity.ZipCode = rp["txtZipCode"];
         entity.Phone = rp["txtPhone"];
         entity.Note = rp["txtNote"];
         entity.ShortName = rp["txtShortName"];
         bool IsExit = manager.ExitCodeAndName(entity);//重复校验参考
         if (IsExit)
         {
             msg = "已存在相同编号或名称!";
         }
         else
         {
             manager.Save(entity);
             context.Response.Write("{\"success\":\"true\",\"ID\":\"" + entity.ID + "\"}");
         }
     }
     catch (Exception ex)
     {
         msg = ex.Message;
     }
     if (!string.IsNullOrEmpty(msg))
     {
         byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>"));
         string encode = Convert.ToBase64String(bytes);
         context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}");
     }
     context.Response.End();
 }
 public void ProcessRequest(HttpContext context)
 {
     HttpRequest rp = context.Request;
     context.Response.ContentType = "text/plain";
     AdministrativeRegionsManager manager = new AdministrativeRegionsManager();
     int currentPage = int.Parse(rp["pagenum"]);
     int pageSize = int.Parse(rp["pagesize"]);
     int count = 0, recordCount = 0;
     DataTable dt = manager.GetPersonByDepartID(currentPage + 1, pageSize, null, rp["departid"], true, ref count, ref recordCount);
     string result = JsonConvert.Convert2Json(dt);
     context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}");
     context.Response.End();
 }
        private void LoadData(string ID)
        {
            AdministrativeRegions code = new OAManager.AdministrativeRegionsManager().GetItemById(new Guid(ID));
            txtID.Value = code.ID.ToString();
            txtCode.Value = code.Code;
            txtName.Value = code.Name;
            if (code.ParentID.HasValue)
            {
                txtParentID.Value = code.ParentID.ToString();

            }
            else
            {
                txtParentID.Value = string.Empty;
            }
            txtZipCode.Value = code.ZipCode;
            txtPhone.Value = code.Phone;
            txtNote.Value = code.Note;
            txtShortName.Value = code.ShortName;
        }
Пример #6
0
        private void LoadData(string ID)
        {
            AdministrativeRegions code = new OAManager.AdministrativeRegionsManager().GetItemById(new Guid(ID));

            txtID.Value   = code.ID.ToString();
            txtCode.Value = code.Code;
            txtName.Value = code.Name;
            if (code.ParentID.HasValue)
            {
                txtParentID.Value = code.ParentID.ToString();
            }
            else
            {
                txtParentID.Value = string.Empty;
            }
            txtZipCode.Value   = code.ZipCode;
            txtPhone.Value     = code.Phone;
            txtNote.Value      = code.Note;
            txtShortName.Value = code.ShortName;
        }
Пример #7
0
 public void ProcessRequest(HttpContext context)
 {
     HttpRequest rp = context.Request;
     context.Response.ContentType = "text/plain";
     AdministrativeRegionsManager manager = new AdministrativeRegionsManager();
     int currentPage = int.Parse(rp["pagenum"]);
     int pageSize = int.Parse(rp["pagesize"]);
     string fiter = rp["filtervalue0"];
     WhereClip where = null;
     if (!string.IsNullOrEmpty(fiter))
     {
         fiter = fiter.Trim();
         where = (PersonInfo._.UserName.Contains(fiter) || PersonInfo._.RealName.Contains(fiter));
     }
     int count = 0, recordCount = 0;
     DataTable dt = manager.GetPersonByDepartID(currentPage + 1, pageSize, where, rp["DepartID"], false, ref count, ref recordCount);
     string result = JsonConvert.Convert2Json(dt);
     context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}");
     context.Response.End();
 }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpRequest rp = context.Request;
            string msg = string.Empty;
            try
            {

                if (string.IsNullOrEmpty(rp["ID"]))
                {
                    msg = "请选择要删除的数据!";
                }
                else
                {
                    int i = new AdministrativeRegionsManager().DelateDepartPersonById(new Guid(rp["ID"]));
                    if (i > 0)
                    {
                        context.Response.Write("{\"success\":\"true\"}");
                    }
                    else
                    {
                        context.Response.Write("{\"success\":\"true\"}");
                        msg = "删除失败!";

                    }

                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;

            }
            if (!string.IsNullOrEmpty(msg))
            {
                byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>"));
                string encode = Convert.ToBase64String(bytes);
                context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}");
            }
            context.Response.End();
        }
Пример #9
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpRequest rp = context.Request;
            string msg = string.Empty;
            try
            {
                Guid RoleID = new Guid(rp["roleID"]);
                string personID = rp["person"];
                string[] personArray = personID.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                List<BaseEntity> list = new List<BaseEntity>();
                foreach (string item in personArray)
                {
                    DepartAndPerson rpi = new DepartAndPerson();
                    rpi.ID = Guid.NewGuid();
                    rpi.UserID = new Guid(item);
                    rpi.DepartID = RoleID;
                    list.Add(rpi);

                }
                AdministrativeRegionsManager manager = new AdministrativeRegionsManager();
                manager.Save(list);
                context.Response.Write("{\"success\":\"true\"}");

            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            if (!string.IsNullOrEmpty(msg))
            {
                byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>"));
                string encode = Convert.ToBase64String(bytes);
                context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}");
            }
            context.Response.End();
        }