protected void Page_Load(object sender, EventArgs e) { if (Request["name"] != null) { //接受参数封装对象 Organiz org = new Organiz(); org.Name = Request["name"]; org.Explanation = Request["desc"]; org.SortID = Convert.ToInt32(Request["sortID"]); org.SecretKey = Request["secretKey"]; org.ParentID = Convert.ToInt32(Request["parentID"]); org.ParentCode = Request["parentCode"]; org.MenuLevel = Convert.ToInt32(Request["level"]); org.UpdateTime = DateTime.Now; org.IsDel = 0; //添加到数据库里面去 OrganizDal dal = new OrganizDal(); int rows = dal.Add(org); //返回执行结果 Response.Clear(); Response.ContentType = "text/plain"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(rows); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request["method"] != null) { //获得角色 int flag = Convert.ToInt32(Request["flag"]); //查询 OrganizDal dal = new OrganizDal(); DataTable dt = dal.GetAll(flag); DataSet set = new DataSet(); set.Tables.Add(dt); string json = JsonConvert.SerializeObject(set, Formatting.Indented); //返回 Response.Clear(); Response.ContentType = "text/plain"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(json); Response.End(); } if (Request["id"] != null) { //执行删除 OrganizDal dal = new OrganizDal(); int rows = dal.Del(Convert.ToInt32(Request["id"])); //返回 Response.Clear(); Response.ContentType = "text/plain"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(rows); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { //第一次访问先展示用户数据 if (Request["id"] != null) { ShowData(); } if (Request["name"] != null) { //封装对象 org = new Organiz(); org.ID = Convert.ToInt32(Request["id"]); org.Name = Request["name"]; org.Explanation = Request["desc"]; org.SortID = Convert.ToInt32(Request["sortID"]); org.SecretKey = Request["secretKey"]; org.ParentID = Convert.ToInt32(Request["parentID"]); org.ParentCode = Request["parentCode"]; org.MenuLevel = Convert.ToInt32(Request["level"]); org.UpdateTime = DateTime.Now; //进行修改 OrganizDal dal = new OrganizDal(); int rows = dal.Update(org); org = dal.GetByID(Convert.ToInt32(Request["id"])); //返回执行结果 Response.Clear(); Response.ContentType = "text/plain"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(rows); Response.End(); } //修改的时候 //if (Request["name"] != null) //{ // //封装对象 // org = new Organiz(); // org.ID = Convert.ToInt32(Request["id"]); // org.Name = Request["name"]; // org.Explanation = Request["desc"]; // org.SortID = Convert.ToInt32(Request["sortID"]); // org.SecretKey = Request["secretKey"]; // org.ParentID = Convert.ToInt32(Request["parentID"]); // org.ParentCode = Request["parentCode"]; // org.MenuLevel = Convert.ToInt32(Request["level"]); // org.UpdateTime = DateTime.Now; // //进行修改 // OrganizDal dal = new OrganizDal(); // org = dal.GetByID(Convert.ToInt32(Request["id1"])); // int rows = dal.Update(org); // //返回执行结果 // Response.Clear(); // Response.ContentType = "text/plain"; // Response.ContentEncoding = System.Text.Encoding.UTF8; // Response.Write(rows); // Response.End(); //} }
protected void Page_Load(object sender, EventArgs e) { //初始化表格的数量 //拿到组织的数量 OrganizDal dal = new OrganizDal(); DataTable dt = dal.GetAll(18); string json = JsonConvert.SerializeObject(dt); list = JsonConvert.DeserializeObject <List <Organiz> >(json); //拿到每个执行员的数据 if (Request["method2"] != null) { //获取执行员数据 ReceiverBll bll = new ReceiverBll(); DataTable dt2 = bll.GetAll(); DataSet set = new DataSet(); set.Tables.Add(dt2); string json2 = JsonConvert.SerializeObject(set); //返回 Response.Clear(); Response.ContentType = "text/plain"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(json2); Response.End(); } //拿到组织每个表里面的数据 if (Request["method"] != null && Request["organiz"] != null) { //获得数据 int id = Convert.ToInt32(Request["organiz"]); OrganiUserBll bll = new OrganiUserBll(); DataTable dt2 = bll.GetUserByID(id, 1); DataSet set = new DataSet(); set.Tables.Add(dt2); string json2 = JsonConvert.SerializeObject(set); //返回 Response.Clear(); Response.ContentType = "text/plain"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(json2); Response.End(); } }
//展示用户数据的函数 private void ShowData() { OrganizDal dal = new OrganizDal(); org = dal.GetByID(Convert.ToInt32(Request["id"])); }