예제 #1
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox    chk = (CheckBox)sender;
                GridViewRow gr  = (GridViewRow)chk.Parent.Parent;

                string VILLAGEID = ((Literal)gr.FindControl("litVILLAGEID")).Text;

                VillageBLL VillageBLLobj = new VillageBLL();
                message = VillageBLLobj.ObsoleteVillage(Convert.ToInt32(VILLAGEID), Convert.ToString(chk.Checked), Convert.ToInt32(Session["USER_ID"]));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                ClearData();
                BindGrid();
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Obsoleted", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        /// <summary>
        /// binds village data
        /// </summary>
        private void searchVillage(string val)
        {
            VillageBLL objVillageBLL = new VillageBLL();

            grdvillage.DataSource = objVillageBLL.SearchVillage(val);
            grdvillage.DataBind();
        }
예제 #3
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdvillage_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["VILLAGEID"] = e.CommandArgument;
                SetUpdateMode(true);
                GetVillageById();
                pnlAddVillage.Visible = true;
                pnlSearch.Visible     = false;
            }
            else if (e.CommandName == "DeleteRow")
            {
                // ViewState["CDAPBUDGETID"] = e.CommandArgument;
                VillageBLL VillageBLLobj = new VillageBLL();
                message = VillageBLLobj.DeleteVillage(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                SetUpdateMode(false);
                BindGrid();
                ClearData();
            }
            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
예제 #4
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid()
        {
            int        SUBCOUNTYID   = Convert.ToInt32(ddlSubcounty.SelectedValue);
            VillageBLL VillageBLLobj = new VillageBLL();

            grdvillage.DataSource = VillageBLLobj.GetAllVillage(SUBCOUNTYID);
            grdvillage.DataBind();
        }
예제 #5
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindSearchVillage()
        {
            string     value         = txtVillagename.Text;
            VillageBLL VillageBLLobj = new VillageBLL();

            grdvillage.DataSource = VillageBLLobj.SearchVillage(value);
            grdvillage.DataBind();
        }
예제 #6
0
        /// <summary>
        /// calls seach village method
        /// </summary>
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string val = "";

            if (txtVillagename.Text.Trim() != string.Empty)
            {
                val = txtVillagename.Text;
            }
            VillageBLL villageBLL = new VillageBLL();

            searchVillage(val);
        }
예제 #7
0
        /// <summary>
        /// To update details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateBudgetItem()
        {
            VillageBLL VillageBLLobj = new VillageBLL();
            VillageBO  objVillageBO  = new VillageBO();

            string message = "";


            string uID = string.Empty;

            uID = Session["USER_ID"].ToString();
            objVillageBO.VillageID   = Convert.ToInt32(ViewState["VILLAGEID"].ToString());
            objVillageBO.DistrictID  = Convert.ToInt32(ddlDistrict.SelectedItem.Value);
            objVillageBO.CountyID    = Convert.ToInt32(ddlCounty.SelectedItem.Value);
            objVillageBO.SubCountyID = Convert.ToInt32(ddlSubcounty.SelectedItem.Value);
            objVillageBO.VillageName = txtVillage.Text.Trim();
            objVillageBO.CreatedBy   = Convert.ToInt32(uID);
            try
            {
                message = VillageBLLobj.UpdateVillage(objVillageBO);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }

                ClearData();
                SetUpdateMode(false);
                BindGrid();

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                VillageBLLobj = null;
            }
        }
예제 #8
0
        /// <summary>
        ///To fetch village details based on ID and assign to textbox
        /// </summary>
        private void GetVillageById()
        {
            VillageBLL VillageBLLobj = new VillageBLL();


            VillageBO objVillageBO = VillageBLLobj.GetVillageById(Convert.ToInt32(ViewState["VILLAGEID"]));

            if (objVillageBO != null)
            {
                txtVillage.Text = objVillageBO.VillageName;
            }
            ddlDistrict.ClearSelection();
            ddlCounty.ClearSelection();

            if (ddlDistrict.Items.FindByText(objVillageBO.DistrictName.ToString()) != null)
            {
                ddlDistrict.Items.FindByText(objVillageBO.DistrictName.ToString()).Selected = true;
            }

            BindCounties(ddlDistrict.SelectedItem.Value);

            if (ddlCounty.Items.FindByText(objVillageBO.CountyName.ToString()) != null)
            {
                ddlCounty.Items.FindByText(objVillageBO.CountyName.ToString()).Selected = true;
            }
            //string countyID = objVillageBO.CountyID.ToString();
            BindSubCounties(ddlCounty.SelectedItem.Value);

            if (ddlSubcounty.Items.FindByText(objVillageBO.SubCountyName.ToString()) != null)
            {
                ddlSubcounty.Items.FindByText(objVillageBO.SubCountyName.ToString()).Selected = true;
            }


            objVillageBO  = null;
            VillageBLLobj = null;
        }