示例#1
0
        /// <summary>
        /// to fetch details and assign to textbox
        /// </summary>
        private void Getdatarow()
        {
            GraveBLL gravesaveBLLobj = new GraveBLL();
            int      Pap_graveid     = 0;

            if (ViewState["PAP_GRAVEID"] != null)
            {
                Pap_graveid = Convert.ToInt32(ViewState["PAP_GRAVEID"]);
            }
            GraveBO GraveBOobj = new GraveBO();

            GraveBOobj = gravesaveBLLobj.Getdatarow(Pap_graveid);

            gravefinishDropDownList.ClearSelection();
            if (gravefinishDropDownList.Items.FindByValue(GraveBOobj.Grv_finishid.ToString()) != null)
            {
                gravefinishDropDownList.Items.FindByValue(GraveBOobj.Grv_finishid.ToString()).Selected = true;
            }

            lengthTextBox.Text      = Convert.ToString(GraveBOobj.Grv_dimen_length);
            widthTextBox.Text       = Convert.ToString(GraveBOobj.Grv_dimen_width);
            surfaceareaTextBox.Text = (GraveBOobj.Grv_dimen_length * GraveBOobj.Grv_dimen_width).ToString();

            depreciatedvalueTextBox.Text = GraveBOobj.Depreciatedvalue.ToString();
            otherfinishTextBox.Text      = GraveBOobj.Othergravefinish.ToString();
        }
示例#2
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid()
        {
            GraveBLL gravesaveBLLobj = new GraveBLL();

            grdGrave.DataSource = gravesaveBLLobj.GetGravedata(Convert.ToInt32(Session["HH_ID"]));
            grdGrave.DataBind();
        }
示例#3
0
        /// <summary>
        /// fetch values and assign to dropdownlist
        /// </summary>
        private void GetGraveFinish()
        {
            GraveBLL GraveBLLobj = new GraveBLL();

            gravefinishDropDownList.DataSource     = GraveBLLobj.GetGraveFinish();
            gravefinishDropDownList.DataTextField  = "Grv_finishtype";
            gravefinishDropDownList.DataValueField = "Grv_finishid";
            gravefinishDropDownList.DataBind();
            gravefinishDropDownList.Items.Insert(0, "--Select--");
        }
示例#4
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 grdUsers_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["PAP_GRAVEID"] = e.CommandArgument;
                popupData();
                //lnkViewPhoto.Visible = true;
                Getdatarow();
                SetUpdateMode(true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                int      Pap_graveid     = Convert.ToInt32(e.CommandArgument);
                GraveBLL gravesaveBLLobj = new GraveBLL();
                gravesaveBLLobj.Delete(Pap_graveid);
                BindGrid();
                SetUpdateMode(false);

                clearfields();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data deleted successfully');", true);
            }
        }
示例#5
0
        /// <summary>
        /// to save data to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int      count           = 0;
            GraveBLL gravesaveBLLobj = new GraveBLL();
            GraveBO  GraveBOobj      = null;

            if (Convert.ToInt32(ViewState["PAP_GRAVEID"]) > 0)
            {
                // update
                try
                {
                    // string uID = Session["USER_ID"].ToString();
                    string hhid = Session["HH_ID"].ToString();
                    GraveBOobj = new GraveBO();

                    GraveBOobj.Pap_graveid = Convert.ToInt32(ViewState["PAP_GRAVEID"]);

                    GraveBOobj.Grv_finishid = Convert.ToInt32(gravefinishDropDownList.SelectedValue);
                    if (otherfinishTextBox.Text != string.Empty)
                    {
                        GraveBOobj.Othergravefinish = otherfinishTextBox.Text;
                    }
                    else
                    {
                        GraveBOobj.Othergravefinish = "";
                    }

                    if (lengthTextBox.Text != string.Empty)
                    {
                        GraveBOobj.Grv_dimen_length = Convert.ToDecimal(lengthTextBox.Text);
                    }
                    else
                    {
                        GraveBOobj.Grv_dimen_length = Convert.ToDecimal(0);
                    }

                    if (widthTextBox.Text != string.Empty)
                    {
                        GraveBOobj.Grv_dimen_width = Convert.ToDecimal(widthTextBox.Text);
                    }
                    else
                    {
                        GraveBOobj.Grv_dimen_width = Convert.ToDecimal(0);
                    }

                    if (depreciatedvalueTextBox.Text != string.Empty)
                    {
                        GraveBOobj.Depreciatedvalue = Convert.ToDecimal(depreciatedvalueTextBox.Text);
                    }
                    else
                    {
                        GraveBOobj.Depreciatedvalue = 0;
                    }

                    // GraveBOobj.Othergravefinish = otherfinishTextBox.Text.ToString().Trim();

                    //  GraveBOobj.Grv_dimen_length = Convert.ToInt32(lengthTextBox.Text.ToString().Trim());
                    //  GraveBOobj.Grv_dimen_width = Convert.ToInt32(widthTextBox.Text.ToString().Trim());
                    SetUpdateMode(false);
                    // GraveBOobj.Depreciatedvalue = Convert.ToInt32(depreciatedvalueTextBox.Text.ToString().Trim());

                    GraveBOobj.CreatedBy   = Convert.ToInt32(Session["USER_ID"]);
                    GraveBOobj.HouseholdID = Convert.ToInt32(hhid);
                    if (photoFileUpload.HasFile)
                    {
                        byte[] fileBytes = photoFileUpload.FileBytes;
                        GraveBOobj.Photo = fileBytes;
                    }
                    GraveBLL gravesaveBLL = new GraveBLL();
                    count = gravesaveBLLobj.EditGRAVE(GraveBOobj);
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "ShowUpdateMessage('');", true);

                    clearfields();
                    BindGrid();
                    SetUpdateMode(false);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    gravesaveBLLobj = null;
                }
            }
            else
            {
                // insert

                try
                {
                    // string uID = Session["USER_ID"].ToString();
                    string hhid = Session["HH_ID"].ToString();
                    GraveBOobj = new GraveBO();
                    GraveBOobj.Grv_finishid = Convert.ToInt32(gravefinishDropDownList.SelectedValue);
                    // GraveBOobj.Othergravefinish = otherfinishTextBox.Text.ToString().Trim();
                    if (otherfinishTextBox.Text != string.Empty)
                    {
                        GraveBOobj.Othergravefinish = otherfinishTextBox.Text;
                    }
                    else
                    {
                        GraveBOobj.Othergravefinish = "";
                    }

                    if (lengthTextBox.Text != string.Empty)
                    {
                        GraveBOobj.Grv_dimen_length = Convert.ToDecimal(lengthTextBox.Text);
                    }
                    else
                    {
                        GraveBOobj.Grv_dimen_length = Convert.ToDecimal(0);
                    }

                    if (widthTextBox.Text != string.Empty)
                    {
                        GraveBOobj.Grv_dimen_width = Convert.ToDecimal(widthTextBox.Text);
                    }
                    else
                    {
                        GraveBOobj.Grv_dimen_width = Convert.ToDecimal(0);
                    }

                    if (depreciatedvalueTextBox.Text != string.Empty)
                    {
                        GraveBOobj.Depreciatedvalue = Convert.ToDecimal(depreciatedvalueTextBox.Text);
                    }
                    else
                    {
                        GraveBOobj.Depreciatedvalue = 0;
                    }

                    //GraveBOobj.Grv_dimen_length = Convert.ToInt32(lengthTextBox.Text.ToString().Trim());
                    // GraveBOobj.Grv_dimen_width = Convert.ToInt32(widthTextBox.Text.ToString().Trim());
                    // GraveBOobj.Depreciatedvalue = Convert.ToInt32(depreciatedvalueTextBox.Text.ToString().Trim());
                    GraveBOobj.CreatedBy   = Convert.ToInt32(Session["USER_ID"]);
                    GraveBOobj.HouseholdID = Convert.ToInt32(hhid);
                    if (photoFileUpload.HasFile)
                    {
                        byte[] fileBytes = photoFileUpload.FileBytes;
                        GraveBOobj.Photo = fileBytes;
                    }

                    GraveBLL graveBLLobj = new GraveBLL();
                    count = graveBLLobj.Insert(GraveBOobj);
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "ShowSaveMessage('');", true);

                    clearfields();
                    BindGrid();
                    SetUpdateMode(false);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    gravesaveBLLobj = null;
                }
            }
            ChangeRequestStatusGrave();
            projectFrozen();
        }