Esempio n. 1
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                GeographyBO oGeo = new GeographyBO();
                oGeo.GeographicalID   = Convert.ToInt32(ViewState["Geography_ID"]);
                oGeo.ProjectID        = Convert.ToInt32(Session["PROJECT_ID"]);
                oGeo.GeneralDirection = txtGeneralDirection.Text.Trim();
                string sKeyFeatures = "";
                if (txtKeyGeoFeatures.Text.Trim().Length > 1000)
                {
                    sKeyFeatures = txtKeyGeoFeatures.Text.Trim().Substring(0, 1000);
                }
                else
                {
                    sKeyFeatures = txtKeyGeoFeatures.Text.Trim();
                }
                oGeo.KeyFeatures = sKeyFeatures;
                oGeo.UpdatedBy   = Convert.ToInt32(Session["USER_ID"]);

                ProjectBLL objProjectBLL = new ProjectBLL();
                objProjectBLL.AddProjectGeography(oGeo);
                if (btnSave.Text == "Save")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data saved successfully');", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data updated successfully');", true);
                }
                ClearDetails();
                BindGrid();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// To fetch and assign values to textbox
        /// </summary>
        protected void GetGeographyDetails()
        {
            GeographyBO oGeo = (new ProjectBLL()).GetProjectGeographyByProjectID(Convert.ToInt32(Session["PROJECT_ID"]));

            if (oGeo != null)
            {
                txtGeneralDirection.Text = oGeo.GeneralDirection;
                txtKeyGeoFeatures.Text   = oGeo.KeyFeatures;
            }
        }
Esempio n. 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 grdProjectGeo_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            try
            {
                if (e.CommandName == "EditRow")
                {
                    ViewState["Geography_ID"] = e.CommandArgument;
                    GeographyBO oGeo = (new ProjectBLL()).GetProjectGeographyByProjectID(Convert.ToInt32(ViewState["Geography_ID"]));

                    if (oGeo != null)
                    {
                        txtGeneralDirection.Text = oGeo.GeneralDirection;
                        txtKeyGeoFeatures.Text   = oGeo.KeyFeatures;
                    }
                    btnSave.Text  = "Update";
                    btnClear.Text = "Cancel";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
                }

                else if (e.CommandName == "DeleteRow")
                {
                    ProjectBLL ProjectBLLobj = new ProjectBLL();
                    message = ProjectBLLobj.DeleteProjGeo(Convert.ToInt32(e.CommandArgument));
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data Deleted successfully";
                    }

                    BindGrid();
                    ClearDetails();
                }
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
 /// <summary>
 /// To Add Project Geography
 /// </summary>
 /// <param name="oGeo"></param>
 public void AddProjectGeography(GeographyBO oGeo)
 {
     (new ProjectDAL()).AddProjectGeography(oGeo);
 }