Пример #1
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 dv_Details_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["FenceID"] = e.CommandArgument;
                int reasonID = Convert.ToInt32(ViewState["FenceID"]);
                GetVulnerabiltyDetails();
                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                string message = string.Empty;

                FenceDescriptionBLLObj = new FenceDescriptionBLL();

                message = FenceDescriptionBLLObj.Delete(Convert.ToInt32(e.CommandArgument));

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

                ClearFields();
                SetUpdateMode(false);
                BindGrid(false, true);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
        }
Пример #2
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 fenceID = ((Literal)gr.FindControl("litFenceID")).Text;
                FenceDescriptionBLLObj = new FenceDescriptionBLL();

                message = FenceDescriptionBLLObj.ObsoleteFenceDescription(Convert.ToInt32(fenceID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                ClearFields();
                BindGrid(false, true);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        /// <summary>
        /// To fetch details
        /// </summary>
        private void GetVulnerabiltyDetails()
        {
            FenceDescriptionBLLObj = new FenceDescriptionBLL();
            int FenceID = 0;

            if (ViewState["FenceID"] != null)
            {
                FenceID = Convert.ToInt32(ViewState["FenceID"]);
            }
            FenceDescriptionBOObj    = new FenceDescriptionBO();
            FenceDescriptionBOObj    = FenceDescriptionBLLObj.GetFencebyID(FenceID);
            txtFenceDescription.Text = FenceDescriptionBOObj.FenceDescription;
            ConcernIDTextBox.Text    = FenceDescriptionBOObj.FenceID.ToString();
        }
Пример #4
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string message      = string.Empty;
            string AlertMessage = string.Empty;

            if (ConcernIDTextBox.Text == string.Empty)
            {
                FenceDescriptionBOObj = new FenceDescriptionBO();
                FenceDescriptionBOObj.FenceDescription = txtFenceDescription.Text.ToString();
                FenceDescriptionBOObj.Createdby        = Convert.ToInt32(Session["USER_ID"].ToString());
                FenceDescriptionBLLObj = new FenceDescriptionBLL();
                message = FenceDescriptionBLLObj.insert(FenceDescriptionBOObj);

                AlertMessage = "alert('" + message + "');";

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearFields();
                    BindGrid(true, true);
                }
                //BindGrid(true, true);
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Fence description details added successfully');", true);
                // ClearFields();
            }
            else
            {
                int reasonid = Convert.ToInt32(ViewState["FenceID"]);
                FenceDescriptionBOObj = new FenceDescriptionBO();
                FenceDescriptionBOObj.FenceDescription = txtFenceDescription.Text.ToString();
                FenceDescriptionBOObj.Createdby        = Convert.ToInt32(Session["USER_ID"].ToString());
                FenceDescriptionBLLObj = new FenceDescriptionBLL();
                message = FenceDescriptionBLLObj.Update(FenceDescriptionBOObj, reasonid);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    BindGrid(true, true);
                    ClearFields();
                }
            }
            //BindGrid(true, true);
            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Fence description details updated  successfully');", true);
            //ClearFields();
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
            SetUpdateMode(false);
        }
Пример #5
0
 /// <summary>
 /// To save details to database
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Insert()
 {
     try
     {
         FenceDescriptionBOObj = new FenceDescriptionBO();
         FenceDescriptionBOObj.FenceDescription = txtFenceDescription.Text.ToString();
         FenceDescriptionBOObj.Createdby        = 1;
         FenceDescriptionBLLObj = new FenceDescriptionBLL();
         FenceDescriptionBLLObj.insert(FenceDescriptionBOObj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         FenceDescriptionBLLObj = null;
     }
 }
Пример #6
0
 /// <summary>
 /// Set Grid Data source
 /// </summary>
 /// <param name="addRow"></param>
 /// <param name="deleteRow"></param>e
 private void BindGrid(bool addRow, bool deleteRow)
 {
     FenceDescriptionBLLObj = new FenceDescriptionBLL();
     dv_Details.DataSource  = FenceDescriptionBLLObj.GetAllFence();
     dv_Details.DataBind();
 }