Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            object obj = this.GridView1.DataKeys[e.RowIndex].Value;
            int    id  = Convert.ToInt32(obj);

            DuringWaterDBI.DeleteDuring(id);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            MasterPageHelper.SetTitle(this, Titles.DuringWaterDefine);
            DataTable tbl = DuringWaterDBI.GetDuringDataTable();

            H.DataSource = tbl;
            H.Bind();
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        private void BindDuringWater()
        {
            DataTable            dwtbl   = DuringWaterDBI.GetDuringDataTable();
            NameIDPairCollection nameids = NameIDPairFactory.Create(dwtbl,
                                                                    YongShuiGuanLiDBI.DBNames.tblDuringWater.Name,
                                                                    YongShuiGuanLiDBI.DBNames.tblDuringWater.DuringWaterID);

            nameids.Insert(0, NameIDPair.ALL);

            this.ddlDuringWaterName.DataSource     = nameids;
            this.ddlDuringWaterName.DataTextField  = "Name";
            this.ddlDuringWaterName.DataValueField = "ID";
            this.ddlDuringWaterName.DataBind();
        }
Exemple #4
0
 // TODO: 2011-06-10
 //
 // 1. valid begin and end date
 // 2. valid exist name
 //
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (IsEdit())
         {
             int              id  = this.DuringID;
             DataTable        tbl = DuringWaterDBI.GetDuringDataTable(id);
             DuringWaterClass d   = DuringWaterFactory.CreateDuringWater(id);
             if (d != null)
             {
                 this.txtName.Text  = d.Name;
                 this.txtBegin.Text = d.BeginString;
                 this.txtEnd.Text   = d.EndString;
             }
         }
     }
 }
Exemple #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            string bs = "2000-" + this.txtBegin.Text;
            string es = "2000-" + this.txtEnd.Text;

            DateTime b    = Convert.ToDateTime(bs);
            DateTime end  = Convert.ToDateTime(es);
            string   name = this.txtName.Text.Trim();

            if (!IsEdit())
            {
                DuringWaterDBI.InsertDuring(name, b, end, string.Empty);
            }
            else
            {
                int id = this.DuringID;
                DuringWaterDBI.UpdateDuring(id, name, b, end, string.Empty);
            }
            Response.Redirect("pDuringList.aspx");
        }
Exemple #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Xdgk.UI.GridViewHelper h = new Xdgk.UI.GridViewHelper(this.GridView1);

            this.GridView1.RowEditing  += new GridViewEditEventHandler(GridView1_RowEditing);
            this.GridView1.RowDeleting += new GridViewDeleteEventHandler(GridView1_RowDeleting);
            this.GridView1.DataKeyNames = new string[] { YongShuiGuanLiDBI.DBNames.tblDuringWater.DuringWaterID };
            if (!IsPostBack)
            {
                h.GridViewConfig = GetViewConfig();
                YongShuiGuanLiDBI.GridViewHelper.AddEditDeleteColumn(this.GridView1);
            }

            //GridViewHelper.AddEditDeleteColumn(this.GridView1);

            DataTable t = DuringWaterDBI.GetDuringDataTable();

            ////this.GridView1.DataSource = t;
            //this.GridView1.DataBind();
            h.DataSource = t;
            h.Bind();
        }