//单机增加新文章
        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            string user = ddlUser.SelectedValue.ToString();
            string category = ddlCategoryAdd.SelectedValue.ToString();
            string address = ddlAddressAdd.SelectedValue.ToString();
            string title = tbTitle.Text.Trim().ToString();
            string content = tbContent.Text.Trim().ToString();
            //获取本机IP
            IPHostEntry ipe = Dns.GetHostEntry(Dns.GetHostName());
            IPAddress ipa = ipe.AddressList[0];
            string ip = ipa.ToString();

            CTMissedPetInfo missedInfo = new CTMissedPetInfo();
            missedInfo.MissId = Guid.NewGuid().ToString();
            missedInfo.IsRecommand = false;
            missedInfo.IsVisible = true;
            missedInfo.IsEssence = false;
            missedInfo.LastEditTime = DateTime.Now.ToShortDateString();
            missedInfo.MissTime = DateTime.Now.ToShortDateString();
            missedInfo.MissTitle = title;
            missedInfo.AddressID = address;
            missedInfo.PetCategoryID = category;
            missedInfo.PriorityScore = 0;
            missedInfo.UserID = user;
            missedInfo.WeiBoID = "";
            missedInfo.MissInfo = content;
            missedInfo.IP = ip;
            missedInfo.FocusNum = 0;
            missedInfo.LinkUrl = "";
            missedInfo.Status = "";
            missedInfo.PicLocation = "";

            MissedPetInfo missedPetInfo = new MissedPetInfo();
            int insertStatus=0;
            insertStatus = missedPetInfo.InsertMissedPetInfo(missedInfo);
            if (insertStatus == 1)
            {
                Response.Write("<script>alert('添加成功!')</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!')</script>");
            }
        }
 protected void BtnEdit_Click(object sender, EventArgs e)
 {
     int selectNumber = 0;
     string sqlstr = string.Empty;
     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();
             selectNumber++;
         }
     }
     if (selectNumber > 1 || selectNumber < 1)
     {
         Response.Write("<script>alert('请选择一个!')</script>");
     }
     else
     {
         MissedPetInfo missPet = new MissedPetInfo();
         CTMissedPetInfo ctmiss = new CTMissedPetInfo();
         ctmiss = missPet.GetMissedInfoByMissedID(sqlstr);
         TextBox_MissID.Text = ctmiss.MissId;
         TextBox_MissIDInfo.Text = ctmiss.MissInfo;
         TextBox_AddressID.Text = ctmiss.AddressID;
         TextBox_MissIDTime.Text = ctmiss.MissTime.ToString();
         TextBox_MissIDTitle.Text = ctmiss.MissTitle.ToString();
         TextBox_FocusNum.Text = ctmiss.FocusNum.ToString();
         TextBox_IP.Text = ctmiss.IP.ToString();
         TextBox_PetCategoryID.Text = ctmiss.PetCategoryID.ToString();
         TextBox_PriorityScore.Text = ctmiss.PriorityScore.ToString();
         TextBox_UserID.Text = ctmiss.UserID.ToString();
         TextBox_WeiBoID.Text = ctmiss.WeiBoID.ToString();
     }
 }
Beispiel #3
0
 //插入丢失信息
 public int InsertMissedPetInfo(CTMissedPetInfo missedPetInfo)
 {
     return dal.InsertMissedPet(missedPetInfo);
 }
 protected void Btn_Save_Click(object sender, EventArgs e)
 {
     if (TextBox_MissID.Text == "")
     {
         Response.Write("<script>alert('请选择一个编辑!')</script>");
     }
     else
     {
         CTMissedPetInfo ctmiss = new CTMissedPetInfo();
         ctmiss.MissId = TextBox_MissID.Text;
         ctmiss.MissInfo = TextBox_MissIDInfo.Text;
         ctmiss.AddressID = TextBox_AddressID.Text;
         ctmiss.MissTime = TextBox_MissIDTime.Text.ToString();
         ctmiss.MissTitle = TextBox_MissIDTitle.Text.ToString();
         ctmiss.FocusNum = int.Parse(TextBox_FocusNum.Text.ToString());
         ctmiss.IP = TextBox_IP.Text.ToString();
         ctmiss.PetCategoryID = TextBox_PetCategoryID.Text.ToString();
         ctmiss.PriorityScore = int.Parse(TextBox_PriorityScore.Text.ToString());
         ctmiss.UserID = TextBox_UserID.Text.ToString();
         ctmiss.WeiBoID = TextBox_WeiBoID.Text.ToString();
         ctmiss.LastEditTime = DateTime.Now.ToShortDateString();
         MissedPetInfo MISSPet = new MissedPetInfo();
         int editStatus = 0;
         editStatus = MISSPet.EditPetInfo(ctmiss);
         if (editStatus == 1)
         {
             Response.Write("<script>alert('Edit成功!')</script>");
         }
         else
         {
             Response.Write("<script>alert('Edit失败!')</script>");
         }
     }
 }
Beispiel #5
0
 //编辑Miss 信息
 public int EditPetInfo(CTMissedPetInfo missPetInfo)
 {
     return dal.EditMissedPet(missPetInfo);
 }