private void LoadAdopt() { List <CTAdoptPet> LIST = new List <CTAdoptPet>(); AdoptPet aa = new AdoptPet(); LIST = aa.GetPetAdoptPetList(); }
//根据地区和类型进行检索 protected void Button1_Click(object sender, EventArgs e) { string address = ddlAddress.SelectedValue.ToString(); string petcategory = ddlPetCategory.SelectedValue.ToString(); if (address == "") { address = "NULL"; } if (petcategory == "") { petcategory = "NULL"; } bool isAdopt = bool.Parse(ckIsAdopt.Checked.ToString()); int perPageNumb = CPetCareConfiguration.PetPerPageNumbers; int pageNumb = 1; int howmanyPages = 0; AdoptPet adoptpet = new AdoptPet(); List <CVAdoptPet> list = new List <CVAdoptPet>(); list = adoptpet.GetPetAdoptPetListByAddressID(isAdopt, address, petcategory, pageNumb, perPageNumb, out howmanyPages); GridView1.DataSource = list; GridView1.DataKeyNames = new string[] { "AdoptID" }; GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string delAdoptID = GridView1.DataKeys[e.RowIndex].Value.ToString(); AdoptPet adoptPetone = new AdoptPet(); adoptPetone.DeleteAdoptPet(delAdoptID); }
private void BindGrid() { AdoptPet adopet = new AdoptPet(); GridView1.DataSource = adopet.GetPetAdoptPetList(); GridView1.DataBind(); }
protected void Btn_Save_Click(object sender, EventArgs e) { CTAdoptPet ctadopt = new CTAdoptPet(); ctadopt.AdoptID = TextBox_AdoptID.Text; ctadopt.AdoptInfo = TextBox_AdoptInfo.Text; ctadopt.AddressID = TextBox_AddressID.Text; ctadopt.AdoptTime = TextBox_AdoptTime.Text.ToString(); ctadopt.AdoptTitle = TextBox_AdoptTitle.Text.ToString(); ctadopt.FocusNum = int.Parse(TextBox_FocusNum.Text.ToString()); ctadopt.IP = TextBox_IP.Text.ToString(); ctadopt.PetCategoryID = TextBox_PetCategoryID.Text.ToString(); ctadopt.PriorityScore = int.Parse(TextBox_PriorityScore.Text.ToString()); ctadopt.UserID = TextBox_UserID.Text.ToString(); ctadopt.WeiBoID = TextBox_WeiBoID.Text.ToString(); ctadopt.LastEditTime = DateTime.Now.ToShortDateString(); AdoptPet adoptPet = new AdoptPet(); int editStatus = 0; editStatus = adoptPet.EditAdoptInfo(ctadopt); if (editStatus == 1) { Response.Write("<script>alert('Edit成功!')</script>"); } else { Response.Write("<script>alert('Edit失败!')</script>"); } }
private void LoadAdopt() { List <CTAdoptPet> LIST = new List <CTAdoptPet>(); AdoptPet aa = new AdoptPet(); LIST = aa.GetPetAdoptPetList(); ddAdopt.DataSource = LIST; ddAdopt.DataTextField = "AdoptTitle"; ddAdopt.DataValueField = "AdoptID"; ddAdopt.DataBind(); ddAdopt1.DataSource = LIST; ddAdopt1.DataTextField = "AdoptTitle"; ddAdopt1.DataValueField = "AdoptID"; ddAdopt1.DataBind(); }
protected void BtnDelete_Click(object sender, EventArgs e) { AdoptPet adoptPet = new AdoptPet(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxs"); if (cbox.Checked == true) { string sqlstr = GridView1.DataKeys[i].Value.ToString(); adoptPet.DeleteAdoptPet(sqlstr); } } BindGridNew(1); }
protected void BtnAdd_Click(object sender, EventArgs e) { string title = tbTitle.Text.Trim().ToString(); string content = tbContent.Text.ToString(); string userID = ddlUser.SelectedValue.ToString(); string categoryID = ddlCategoryAdd.SelectedValue.ToString(); string addressID = ddlAddressAdd.SelectedValue.ToString(); string adoptID = Guid.NewGuid().ToString(); bool isAdopt = bool.Parse(CheckBox1.Checked.ToString()); //获取本机IP IPHostEntry ipe = Dns.GetHostEntry(Dns.GetHostName()); IPAddress ipa = ipe.AddressList[0]; string ip = ipa.ToString(); CTAdoptPet adoptPet = new CTAdoptPet(); adoptPet.AddressID = addressID; adoptPet.PetCategoryID = categoryID; adoptPet.AdoptID = adoptID; adoptPet.AdoptInfo = content; adoptPet.AdoptTime = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); adoptPet.LastEditTime = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); adoptPet.AdoptTitle = title; adoptPet.FocusNum = 0; adoptPet.IP = ip; adoptPet.IsVisible = true; adoptPet.PriorityScore = 0; adoptPet.WeiBoID = ""; adoptPet.UserID = userID; adoptPet.IsAdopt = isAdopt; AdoptPet adoptPetone = new AdoptPet(); int insertStatus = 0; insertStatus = adoptPetone.InsertAdoptPet(adoptPet); if (insertStatus == 1) { Response.Write("<script>alert('添加成功!')</script>"); } else { Response.Write("<script>alert('添加失败!')</script>"); } }
private void BindGridNew(int pageNumber) { int perPage = CPetCareConfiguration.PetPerPageNumbers; AdoptPet adopt = new AdoptPet(); int howmany = 0; GridView1.DataSource = adopt.GetPetAdoptPerPageList(pageNumber, perPage, out howmany); GridView1.DataKeyNames = new string[] { "AdoptID" }; int howmanyPages = 0; howmanyPages = int.Parse(Math.Ceiling((double)howmany / (double)perPage).ToString()); List <int> list = new List <int>(); for (int a = 1; a <= howmanyPages; a++) { list.Add(a); } ddPages.DataSource = list; ddPages.DataBind(); GridView1.DataBind(); }
// // GET: /Adopt/ /// <summary> /// 获取领养宠物信息 /// </summary> /// <param name="pageIndex">当前页码</param> /// <param name="limit">每页显示条数</param> /// <returns></returns> public JsonResult Index(int pageIndex, int limit) { AdoptPet adoption = new AdoptPet(); PagingModel <WebCommonModel> _pageKnowledge = new PagingModel <WebCommonModel>(); List <WebCommonModel> commonList = new List <WebCommonModel>(); List <CVAdoptPet> adoptList = new List <CVAdoptPet>(); //获取总页数 int count = 0; try { adoptList = adoption.GetPetAdoptPerPageList(pageIndex, limit, out count); commonList = CommonDao.DataTransferToAdoptionWebCommonModelList(adoptList); _pageKnowledge.total = count; _pageKnowledge.records = commonList; } catch (Exception ex) { throw ex; } return(Json(_pageKnowledge, JsonRequestBehavior.AllowGet)); }
protected void BtnEdit_Click(object sender, EventArgs e) { string sqlstr = string.Empty; int checkNumber = 0; for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxs"); if (cbox.Checked == true) { sqlstr = GridView1.DataKeys[i].Value.ToString(); checkNumber++; break; } } if (checkNumber > 1 || checkNumber < 1) { Response.Write("<script>alert('请选择一个!')</script>"); } else { AdoptPet adoptPet = new AdoptPet(); CTAdoptPet ctadopt = new CTAdoptPet(); ctadopt = adoptPet.GetPetAdoptPetByAdoptID(sqlstr); TextBox_AdoptID.Text = ctadopt.AdoptID; TextBox_AdoptInfo.Text = ctadopt.AdoptInfo; TextBox_AddressID.Text = ctadopt.AddressID; TextBox_AdoptTime.Text = ctadopt.AdoptTime.ToString(); TextBox_AdoptTitle.Text = ctadopt.AdoptTitle.ToString(); TextBox_FocusNum.Text = ctadopt.FocusNum.ToString(); TextBox_IP.Text = ctadopt.IP.ToString(); TextBox_PetCategoryID.Text = ctadopt.PetCategoryID.ToString(); TextBox_PriorityScore.Text = ctadopt.PriorityScore.ToString(); TextBox_UserID.Text = ctadopt.UserID.ToString(); TextBox_WeiBoID.Text = ctadopt.WeiBoID.ToString(); } }
private void LoadAdopt() { List<CTAdoptPet> LIST = new List<CTAdoptPet>(); AdoptPet aa = new AdoptPet(); LIST = aa.GetPetAdoptPetList(); ddAdopt.DataSource = LIST; ddAdopt.DataTextField = "AdoptTitle"; ddAdopt.DataValueField = "AdoptID"; ddAdopt.DataBind(); ddAdopt1.DataSource = LIST; ddAdopt1.DataTextField = "AdoptTitle"; ddAdopt1.DataValueField = "AdoptID"; ddAdopt1.DataBind(); }
protected void BtnAdd_Click(object sender, EventArgs e) { string title = tbTitle.Text.Trim().ToString(); string content = tbContent.Text.ToString(); string userID = ddlUser.SelectedValue.ToString(); string categoryID = ddlCategoryAdd.SelectedValue.ToString(); string addressID = ddlAddressAdd.SelectedValue.ToString(); string adoptID = Guid.NewGuid().ToString(); bool isAdopt = bool.Parse(CheckBox1.Checked.ToString()); //获取本机IP IPHostEntry ipe = Dns.GetHostEntry(Dns.GetHostName()); IPAddress ipa = ipe.AddressList[0]; string ip=ipa.ToString(); CTAdoptPet adoptPet = new CTAdoptPet(); adoptPet.AddressID = addressID; adoptPet.PetCategoryID = categoryID; adoptPet.AdoptID = adoptID; adoptPet.AdoptInfo = content; adoptPet.AdoptTime = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); adoptPet.LastEditTime = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); adoptPet.AdoptTitle = title; adoptPet.FocusNum = 0; adoptPet.IP = ip; adoptPet.IsVisible = true; adoptPet.PriorityScore = 0; adoptPet.WeiBoID = ""; adoptPet.UserID = userID; adoptPet.IsAdopt = isAdopt; AdoptPet adoptPetone = new AdoptPet(); int insertStatus = 0; insertStatus=adoptPetone.InsertAdoptPet(adoptPet); if (insertStatus == 1) { Response.Write("<script>alert('添加成功!')</script>"); } else { Response.Write("<script>alert('添加失败!')</script>"); } }
private void LoadAdopt() { List<CTAdoptPet> LIST = new List<CTAdoptPet>(); AdoptPet aa = new AdoptPet(); LIST = aa.GetPetAdoptPetList(); }
private void BindGridNew(int pageNumber) { int perPage = CPetCareConfiguration.PetPerPageNumbers; AdoptPet adopt = new AdoptPet(); int howmany = 0; GridView1.DataSource = adopt.GetPetAdoptPerPageList(pageNumber, perPage, out howmany); GridView1.DataKeyNames = new string[] { "AdoptID"}; int howmanyPages = 0; howmanyPages = int.Parse(Math.Ceiling((double)howmany / (double)perPage).ToString()); List<int> list = new List<int>(); for(int a=1;a<=howmanyPages;a++) { list.Add(a); } ddPages.DataSource = list; ddPages.DataBind(); GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string delAdoptID= GridView1.DataKeys[e.RowIndex].Value.ToString() ; AdoptPet adoptPetone = new AdoptPet(); adoptPetone.DeleteAdoptPet(delAdoptID); }
//根据地区和类型进行检索 protected void Button1_Click(object sender, EventArgs e) { string address = ddlAddress.SelectedValue.ToString(); string petcategory = ddlPetCategory.SelectedValue.ToString(); if (address == "") { address = "NULL"; } if (petcategory == "") { petcategory = "NULL"; } bool isAdopt=bool.Parse(ckIsAdopt.Checked.ToString()); int perPageNumb=CPetCareConfiguration.PetPerPageNumbers; int pageNumb=1; int howmanyPages=0; AdoptPet adoptpet = new AdoptPet(); List<CVAdoptPet>list=new List<CVAdoptPet>(); list=adoptpet.GetPetAdoptPetListByAddressID(isAdopt,address,petcategory, pageNumb, perPageNumb, out howmanyPages); GridView1.DataSource = list; GridView1.DataKeyNames = new string[] { "AdoptID"}; GridView1.DataBind(); }
protected void Btn_Save_Click(object sender, EventArgs e) { CTAdoptPet ctadopt = new CTAdoptPet(); ctadopt.AdoptID = TextBox_AdoptID.Text; ctadopt.AdoptInfo = TextBox_AdoptInfo.Text; ctadopt.AddressID = TextBox_AddressID.Text; ctadopt.AdoptTime = TextBox_AdoptTime.Text.ToString(); ctadopt.AdoptTitle = TextBox_AdoptTitle.Text.ToString(); ctadopt.FocusNum =int.Parse(TextBox_FocusNum.Text.ToString()); ctadopt.IP = TextBox_IP.Text.ToString(); ctadopt.PetCategoryID = TextBox_PetCategoryID.Text.ToString(); ctadopt.PriorityScore = int.Parse(TextBox_PriorityScore.Text.ToString()); ctadopt.UserID = TextBox_UserID.Text.ToString(); ctadopt.WeiBoID = TextBox_WeiBoID.Text.ToString(); ctadopt.LastEditTime = DateTime.Now.ToShortDateString(); AdoptPet adoptPet = new AdoptPet(); int editStatus = 0; editStatus=adoptPet.EditAdoptInfo(ctadopt); if (editStatus == 1) { Response.Write("<script>alert('Edit成功!')</script>"); } else { Response.Write("<script>alert('Edit失败!')</script>"); } }
protected void BtnEdit_Click(object sender, EventArgs e) { string sqlstr=string.Empty; int checkNumber = 0; for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxs"); if (cbox.Checked == true) { sqlstr = GridView1.DataKeys[i].Value.ToString(); checkNumber++; break; } } if (checkNumber > 1 || checkNumber < 1) { Response.Write("<script>alert('请选择一个!')</script>"); } else { AdoptPet adoptPet = new AdoptPet(); CTAdoptPet ctadopt = new CTAdoptPet(); ctadopt = adoptPet.GetPetAdoptPetByAdoptID(sqlstr); TextBox_AdoptID.Text = ctadopt.AdoptID; TextBox_AdoptInfo.Text = ctadopt.AdoptInfo; TextBox_AddressID.Text = ctadopt.AddressID; TextBox_AdoptTime.Text = ctadopt.AdoptTime.ToString(); TextBox_AdoptTitle.Text = ctadopt.AdoptTitle.ToString(); TextBox_FocusNum.Text = ctadopt.FocusNum.ToString(); TextBox_IP.Text = ctadopt.IP.ToString(); TextBox_PetCategoryID.Text = ctadopt.PetCategoryID.ToString(); TextBox_PriorityScore.Text = ctadopt.PriorityScore.ToString(); TextBox_UserID.Text = ctadopt.UserID.ToString(); TextBox_WeiBoID.Text = ctadopt.WeiBoID.ToString(); } }