usesyrk_edit.aspx.cs

来自「小区警务管理系统」· CS 代码 · 共 197 行

CS
197
字号
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace web.SubDocument
{
    public partial class usesyrk_edit : web.Components.AdminBasePage
    {
        private int id = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            id = int.Parse(Request.QueryString[id].ToString());
            if (!Page.IsPostBack)
            {
                try
                {
                    save.Attributes["onclick"] = "javascript:return checkme();";
                    InitData();
                    InitPage();
                }
                catch (Exception ex)
                {
                    base.ErrorMsg(ex.ToString());
                }
            }
        }

        private void InitPage()
        { 
            SXSLNS.BLL.admin.usesyrk bll = new SXSLNS.BLL.admin.usesyrk();
            SXSLNS.Model.admin.usesyrk model = bll.GetModel(id);
            TextBox1.Text=model.xzz;
            TextBox2.Text=model.hkszd;
            DropDownList1.Items.FindByValue(model.hklx).Selected = true;
            DropDownList2.Items.FindByValue(model.hlx).Selected = true;
            DropDownList3.Items.FindByValue(model.rylb).Selected = true;
            TextBox3.Text=model.hzgx;
            TextBox4.Text=model.xm;
            DropDownList4.Items.FindByText(model.xb).Selected = true;
            TextBox5.Text=model.cym;
            DropDownList5.Items.FindByValue(model.mz).Selected = true;
            TextBox6.Text=model.csrq;
            TextBox7.Text=model.sfzhm;
            DropDownList6.Items.FindByValue(model.whcd).Selected = true;
            TextBox8.Text=model.jg;
            TextBox9.Text=model.fwcs;
            TextBox10.Text=model.zy;
            TextBox11.Text=model.sg;
            DropDownList7.Items.FindByValue(model.xx).Selected = true;
            TextBox12.Text=model.xh;
            DropDownList8.Items.FindByValue(model.hyzk).Selected = true;
            DropDownList9.Items.FindByValue(model.byzk).Selected = true;
            TextBox13.Text=model.jdcph;
            TextBox14.Text=model.czcph;
            DropDownList10.Items.FindByValue(model.zjxy).Selected = true;
            TextBox15.Text=model.fhzz;
            DropDownList11.Items.FindByText(model.ywczf).Selected = true;
            DropDownList12.Items.FindByText(model.ywzzrk).Selected = true;
            DropDownList13.Items.FindByText(model.ywgfzz).Selected = true;
            TextBox16.Text=model.lxdh;
            TextBox17.Text=model.sj;
            TextBox18.Text=model.xwxg;
            TextBox19.Text=model.bz;
        }

        private void InitData()
        {
            SXSLNS.BLL.admin.dect bll = new SXSLNS.BLL.admin.dect();
            DropDownList1.DataTextField = "name";
            DropDownList1.DataValueField = "id";
            DropDownList1.DataSource = bll.GetList("flag='11'");
            DropDownList1.DataBind();

            DropDownList2.DataTextField = "name";
            DropDownList2.DataValueField = "id";
            DropDownList2.DataSource = bll.GetList("flag='12'");
            DropDownList2.DataBind();

            DropDownList3.DataTextField = "name";
            DropDownList3.DataValueField = "id";
            DropDownList3.DataSource = bll.GetList("flag='20'");
            DropDownList3.DataBind();

            DropDownList4.DataTextField = "name";
            DropDownList4.DataValueField = "id";
            DropDownList4.DataSource = bll.GetList("flag='1'");
            DropDownList4.DataBind();

            DropDownList5.DataTextField = "name";
            DropDownList5.DataValueField = "id";
            DropDownList5.DataSource = bll.GetList("flag='13'");
            DropDownList5.DataBind();

            DropDownList6.DataTextField = "name";
            DropDownList6.DataValueField = "id";
            DropDownList6.DataSource = bll.GetList("flag='14'");
            DropDownList6.DataBind();

            DropDownList7.DataTextField = "name";
            DropDownList7.DataValueField = "id";
            DropDownList7.DataSource = bll.GetList("flag='16'");
            DropDownList7.DataBind();

            DropDownList8.DataTextField = "name";
            DropDownList8.DataValueField = "id";
            DropDownList8.DataSource = bll.GetList("flag='15'");
            DropDownList8.DataBind();

            DropDownList9.DataTextField = "name";
            DropDownList9.DataValueField = "id";
            DropDownList9.DataSource = bll.GetList("flag='17'");
            DropDownList9.DataBind();

            DropDownList10.DataTextField = "name";
            DropDownList10.DataValueField = "id";
            DropDownList10.DataSource = bll.GetList("flag='18'");
            DropDownList10.DataBind();

            DropDownList11.DataTextField = "name";
            DropDownList11.DataValueField = "id";
            DropDownList11.DataSource = bll.GetList("flag='19'");
            DropDownList11.DataBind();

            DropDownList12.DataTextField = "name";
            DropDownList12.DataValueField = "id";
            DropDownList12.DataSource = bll.GetList("flag='19'");
            DropDownList12.DataBind();

            DropDownList13.DataTextField = "name";
            DropDownList13.DataValueField = "id";
            DropDownList13.DataSource = bll.GetList("flag='19'");
            DropDownList13.DataBind();
        }

        protected void save_Click(object sender, EventArgs e)
        {
            try
            {
                SXSLNS.BLL.admin.usesyrk bll = new SXSLNS.BLL.admin.usesyrk();
                SXSLNS.Model.admin.usesyrk model = bll.GetModel(id);
                model.xzz = TextBox1.Text.Trim();
                model.hkszd = TextBox2.Text.Trim();
                model.hklx = DropDownList1.SelectedValue;
                model.hlx = DropDownList2.SelectedValue;
                model.rylb = DropDownList3.SelectedValue;
                model.hzgx = TextBox3.Text.Trim();
                model.xm = TextBox4.Text.Trim();
                model.xb = DropDownList4.SelectedItem.Text;
                model.cym = TextBox5.Text.Trim();
                model.mz = DropDownList5.SelectedValue;
                model.csrq = TextBox6.Text.Trim();
                model.sfzhm = TextBox7.Text.Trim();
                model.whcd = DropDownList6.SelectedValue;
                model.jg = TextBox8.Text.Trim();
                model.fwcs = TextBox9.Text.Trim();
                model.zy = TextBox10.Text.Trim();
                model.sg = TextBox11.Text.Trim();
                model.xx = DropDownList7.SelectedValue;
                model.xh = TextBox12.Text.Trim();
                model.hyzk = DropDownList8.SelectedValue;
                model.byzk = DropDownList9.SelectedValue;
                model.jdcph = TextBox13.Text.Trim();
                model.czcph = TextBox14.Text.Trim();
                model.zjxy = DropDownList10.SelectedValue;
                model.fhzz = TextBox15.Text.Trim();
                model.ywczf = DropDownList11.SelectedItem.Text;
                model.ywzzrk = DropDownList12.SelectedItem.Text;
                model.ywgfzz = DropDownList13.SelectedItem.Text;
                model.lxdh = TextBox16.Text.Trim();
                model.sj = TextBox17.Text.Trim();
                model.xwxg = TextBox18.Text.Trim();
                model.bz = TextBox19.Text.Trim();
                bll.Update(model);
                Response.Redirect("usesyrk.aspx", false);
            }
            catch (Exception ex)
            {
                base.ErrorMsg(ex.ToString());
            }
        }

        protected void back_Click(object sender, EventArgs e)
        {
            Response.Redirect("usesyrk.aspx", false);
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?