Exemple #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)
        {
            string      message = "";
            FinancierBO objFin  = new FinancierBO();

            objFin.FinancierID        = Convert.ToInt32(ViewState["FINANCE_ID"]);
            objFin.FinancierName      = txtFinancierName.Text.Trim();
            objFin.ProjectID          = Convert.ToInt32(Session["PROJECT_ID"]);
            objFin.FINANCECONDITIONID = Convert.ToInt32(ddlCondition.SelectedValue);
            objFin.FINANCENATUREID    = Convert.ToInt32(ddlNature.SelectedValue);
            objFin.FINANCEREASONID    = Convert.ToInt32(ddlReason.SelectedValue);


            ProjectBLL objProjectBLL = new ProjectBLL();

            if (objFin.FinancierID > 0)
            {
                objFin.UpdatedBy = Convert.ToInt32(Session["USER_ID"]);
                message          = objProjectBLL.UpdateProjectFinancier(objFin);

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

                SetUpdateMode(false);
            }
            else
            {
                objFin.CreatedBy = Convert.ToInt32(Session["USER_ID"]);
                message          = objProjectBLL.AddProjectFinancier(objFin);

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

            ClearFields();
            BindFinanciers();

            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }