Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="source"></param>
        /// <param name="args"></param>
        protected void cvExistWaterUserName_ServerValidate(object source, ServerValidateEventArgs args)
        {
            string newWaterUserName = this.txtWaterUserName.Text.Trim();
            bool   exist            = WaterUserDBI.ExistWaterUserName(newWaterUserName, WS.WaterUser.WaterUserID);

            args.IsValid = exist == false;
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        static private object GetOrganizationDataSource()
        {
            DataTable            tbl = WaterUserDBI.GetWaterUserDataTable();
            NameIDPairCollection c   = NameIDPairFactory.Create(tbl, "WaterUserName", "WaterUserID");

            return(c);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        private void Bind()
        {
            GridViewHelper.SetGridViewColumn(this.GridView1, ColumnNameTextManager.WaterUserListColumnNames);
            GridViewHelper.AddEditDeleteColumn(this.GridView1);
            DataTable tbl = WaterUserDBI.GetWaterUserDataTable();

            this.GridView1.DataSource = tbl;
            this.GridView1.DataBind();
        }
Example #4
0
        static private object GetOrganizationDataSource(WaterUserClass waterUser)
        {
            //LoginSession ls = SessionManager.LoginSession;
            //DataTable tbl = WaterUserDBI.GetManagementOrganization(ls.WaterUser.WaterUserID,
            DataTable tbl = WaterUserDBI.GetManagementOrganization(waterUser.WaterUserID,

                                                                   waterUser.WaterUserLevel.LevelOrdinal);
            NameIDPairCollection c = NameIDPairFactory.Create(tbl, "WaterUserName", "WaterUserID");

            return(c);
        }
Example #5
0
        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListItem li = this.DropDownList2.SelectedItem;

            if (li != null)
            {
                string    value    = li.Value;
                int       ParentID = Convert.ToInt32(value);
                DataTable dt       = WaterUserDBI.GetLowLevelWaterUserDataTable(ParentID);
                DataBind(dt, DropDownList3);
            }
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int index = e.RowIndex;

            if (index != -1)
            {
                //this.GridView1.Rows
                object obj         = this.GridView1.DataKeys[index].Value;
                int    wateruserID = Convert.ToInt32(obj);
                WaterUserDBI.DeleteWaterUser(wateruserID);

                Bind();
            }
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        private bool Check()
        {
            WaterUserLevel level           = WS.WaterUser.WaterUserLevel;
            WaterUserClass parentWaterUser = WS.WaterUser.ParentWaterUser;

            // 1. 管理局无上级单位, 其他有上级单位
            //
            // 2. 只能有一个顶级单位(管理局)
            //
            if (level.IsTopManager())
            {
                if (WS.WaterUser.IsAdd())
                {
                    if (WaterUserDBI.HasWaterUser(WaterUserLevelEnum.Ju))
                    {
                        cvWaterUserLevel.ErrorMessage = "exist ju water user";
                        cvWaterUserLevel.IsValid      = false;
                        return(false);
                    }
                }

                if (parentWaterUser == null || parentWaterUser.IsNoneWaterUser())
                {
                }
                else
                {
                    this.cvWaterUserLevel.ErrorMessage = "cannot has parent wateruser";
                    this.cvWaterUserLevel.IsValid      = false;
                    return(false);
                }
            }
            else
            {
                if (parentWaterUser == null || parentWaterUser.IsNoneWaterUser())
                {
                    this.cvWaterUserLevel.ErrorMessage = "need parent";
                    this.cvWaterUserLevel.IsValid      = false;
                    return(false);
                }
            }

            return(true);
        }
Example #8
0
        private void BindCheckBoxListChu()
        {
            DataTable dt = WaterUserDBI.GetWaterUserDataTable(WaterUserLevelEnum.Chu);

            DataBind(dt, DropDownList1);
        }