Exemple #1
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e

        private void BindGrid(bool addRow, bool deleteRow)
        {
            NatureofFinancingBLL BLLobj = new NatureofFinancingBLL();

            grdNature.DataSource = BLLobj.GetnatureAllfinance("");
            grdNature.DataBind();
        }
Exemple #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               financeNatureID   = ((Literal)gr.FindControl("litNatureID")).Text;
                NatureofFinancingBLL NatureofFinancBLL = new NatureofFinancingBLL();

                message = NatureofFinancBLL.ObsoleteFcond(Convert.ToInt32(financeNatureID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                BindGrid(false, true);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #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 grdNature_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["FINANCENATUREID"] = e.CommandArgument;
                GetNatureFinanceDetail();
                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                NatureofFinancingBLL BLLobj = new NatureofFinancingBLL();
                message = BLLobj.DeleteNatureFinance(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                ClearAll();
                SetUpdateMode(false);
                BindGrid(false, true);
            }
            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
Exemple #4
0
        /// <summary>
        /// To fetch values to Nature dropdownlist
        /// </summary>
        private void getNatureoffinance()
        {
            NatureofFinancingBLL BLLobj = new NatureofFinancingBLL();

            ddlNature.DataSource     = BLLobj.GetNatureOfFinance();
            ddlNature.DataTextField  = "FINANCENATURE";
            ddlNature.DataValueField = "FINANCENATUREID";
            ddlNature.DataBind();
        }
Exemple #5
0
        /// <summary>
        /// to fetch details from database
        /// </summary>
        private void GetNatureFinanceDetail()
        {
            NatureofFinancingBLL BLLobj = new NatureofFinancingBLL();
            int NatureFinanceID         = 0;

            if (ViewState["FINANCENATUREID"] != null)
            {
                NatureFinanceID = Convert.ToInt32(ViewState["FINANCENATUREID"]);
            }

            NatureofFinancingBO BOobj = new NatureofFinancingBO();

            BOobj = BLLobj.GetNatureFinanceID(NatureFinanceID);

            NatureTextBox.Text   = BOobj.FINANCENATURE;
            NatureIDTextBox.Text = BOobj.FINANCENATUREID.ToString();
        }
Exemple #6
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            if (NatureIDTextBox.Text.ToString().Trim() == string.Empty)
            {
                NatureofFinancingBLL BLLobj = new NatureofFinancingBLL();

                try
                {
                    string uID = Session["USER_ID"].ToString();
                    NatureofFinancingBO BOobj = new NatureofFinancingBO();
                    BOobj.FINANCENATURE = NatureTextBox.Text;

                    BOobj.CREATEDBY = Convert.ToInt32(uID);

                    NatureofFinancingBLL NatureofFinancingBLLobj = new NatureofFinancingBLL();
                    message = NatureofFinancingBLLobj.Insert(BOobj);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        ClearAll();
                        BindGrid(true, true);
                    }
                    //BindGrid(true, true);
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Vaccination details added successfully');", true);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    BLLobj = null;
                }
            }
            else if (NatureIDTextBox.Text.ToString().Trim() != string.Empty)
            {
                NatureofFinancingBLL BLLobj = new NatureofFinancingBLL();

                try
                {
                    string uID = Session["USER_ID"].ToString();
                    NatureofFinancingBO BOobj = new NatureofFinancingBO();
                    BOobj.FINANCENATURE   = NatureTextBox.Text;
                    BOobj.FINANCENATUREID = Convert.ToInt32(NatureIDTextBox.Text);
                    BOobj.CREATEDBY       = Convert.ToInt32(uID);

                    NatureofFinancingBLL NatureofFinancingBLLobj = new NatureofFinancingBLL();
                    message = NatureofFinancingBLLobj.Update(BOobj);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        ClearAll();
                        BindGrid(true, true);
                        SetUpdateMode(false);
                    }
                    //BindGrid(true, true);
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Vaccination details added successfully');", true);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    BLLobj = null;
                }
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }