예제 #1
0
        /// <summary>
        /// Check CDAP Request Status
        /// </summary>
        private void CheckPendings()
        {
            objCDAPBudgetBLL = new CDAPBudgetBLL();
            int    ProjectID = Convert.ToInt32(Session["PROJECT_ID"].ToString());
            string Status    = "ALL";

            objCDAPBudgetList = objCDAPBudgetBLL.GetCDAPBudget(ProjectID, Status);
            int iCount = 0;

            for (int i = 0; i < objCDAPBudgetList.Count; i++)
            {
                if (objCDAPBudgetList[i].FundReqStatus.ToString().ToUpper() == "Pending Approval".ToUpper() ||
                    objCDAPBudgetList[i].FundReqStatus.ToString().ToUpper() == "Declined".ToUpper())
                {
                    iCount++;
                }
            }
            if (iCount > 0)
            {
                checkApprovalExitOrNot();
                //btnApproval.Visible = true;
            }
            else
            {
                btnApproval.Visible = false;
            }
        }
예제 #2
0
        /// <summary>
        /// to check how many sent for approval
        /// </summary>
        /// <returns></returns>
        public int sentforapproval()
        {
            int Result;
            int projectID = Convert.ToInt32(Session["PROJECT_ID"]);

            //objCDAPBudgetBO = new CDAPBudgetBO();
            objCDAPBudgetBLL = new CDAPBudgetBLL();
            Result           = objCDAPBudgetBLL.SendforApproval(projectID);
            return(Result);
        }
예제 #3
0
        /// <summary>
        /// get data from data base abd bind it to grid
        /// </summary>
        private void BindGrid()
        {
            objCDAPBudgetBLL = new CDAPBudgetBLL();
            int    ProjectID = Convert.ToInt32(Session["PROJECT_ID"].ToString());
            string Status    = "ALL";

            objCDAPBudgetList        = objCDAPBudgetBLL.GetCDAPBudget(ProjectID, Status);
            grdCDAPBudget.DataSource = objCDAPBudgetList;
            grdCDAPBudget.DataBind();
        }
예제 #4
0
 /// <summary>
 /// to Edit and Delete Data
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void grdCDAPBudget_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditRow")
     {
         ViewState["CDAP_BUDGID"] = e.CommandArgument;
         objCDAPBudgetBLL         = new CDAPBudgetBLL();
         objCDAPBudgetBO          = new CDAPBudgetBO();
         objCDAPBudgetBO          = objCDAPBudgetBLL.GetCDAPBudgetItem(Convert.ToInt32(ViewState["CDAP_BUDGID"]));
         BindItem();
         ddlItem.ClearSelection();
         if (ddlItem.Items.FindByValue(objCDAPBudgetBO.Cdap_categoryid.ToString()) != null)
         {
             ddlItem.Items.FindByValue(objCDAPBudgetBO.Cdap_categoryid.ToString()).Selected = true;
         }
         int catid = Convert.ToInt32(ddlItem.SelectedValue);
         BindSubItem(catid);
         ddlItemDesc.ClearSelection();
         if (ddlItemDesc.Items.FindByValue(objCDAPBudgetBO.Cdap_subcategoryid.ToString()) != null)
         {
             ddlItemDesc.Items.FindByValue(objCDAPBudgetBO.Cdap_subcategoryid.ToString()).Selected = true;
         }
         BindUnit();
         ddlUnit.ClearSelection();
         if (ddlUnit.Items.FindByValue(objCDAPBudgetBO.Unit.ToString()) != null)
         {
             ddlUnit.Items.FindByValue(objCDAPBudgetBO.Unit.ToString()).Selected = true;
         }
         txtQuantity.Text    = Convert.ToString(objCDAPBudgetBO.Quantity);
         txtRateperUnit.Text = UtilBO.CurrencyFormat(objCDAPBudgetBO.Rateperunit);
         txtAmount.Text      = UtilBO.CurrencyFormat(objCDAPBudgetBO.Quantity * objCDAPBudgetBO.Rateperunit);
         SetUpdateMode(true);
     }
     else if (e.CommandName == "DeleteRow")
     {
         ViewState["CDAP_BUDGID"] = e.CommandArgument;
         objCDAPBudgetBLL         = new CDAPBudgetBLL();
         objCDAPBudgetBLL.DeleteCDAPBudget(Convert.ToInt32(ViewState["CDAP_BUDGID"]));
         ClearDetails();
         BindGrid();
         btnApproval.Visible = false;
     }
 }
예제 #5
0
        /// <summary>
        /// Save and Update in to data base
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            objCDAPBudgetBO  = new CDAPBudgetBO();
            objCDAPBudgetBLL = new CDAPBudgetBLL();
            try
            {
                string i = "";
                objCDAPBudgetBO.Cdap_budgid        = Convert.ToInt32(ViewState["CDAP_BUDGID"]);
                objCDAPBudgetBO.Cdap_categoryid    = Convert.ToInt32(ddlItem.SelectedValue);
                objCDAPBudgetBO.Cdap_subcategoryid = Convert.ToInt32(ddlItemDesc.SelectedValue);
                objCDAPBudgetBO.Unit        = Convert.ToDecimal(ddlUnit.SelectedValue);
                objCDAPBudgetBO.Quantity    = Convert.ToDecimal(txtQuantity.Text.Trim());
                objCDAPBudgetBO.Rateperunit = Convert.ToDecimal(txtRateperUnit.Text.Trim());
                objCDAPBudgetBO.UpdatedBy   = Convert.ToInt32(Session["USER_ID"]);
                objCDAPBudgetBO.ProjectID   = Convert.ToInt32(Session["PROJECT_ID"]);

                i = objCDAPBudgetBLL.AddCDAPBudget(objCDAPBudgetBO);
                if (i == "I")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('Data saved successfully');", true);
                }
                else if (i == "U")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('Data updated successfully');", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertError", "alert('Error: " + ex.Message + "');", true);
            }
            ClearDetails();
            BindGrid();
            SetUpdateMode(false);
            checkApprovalExitOrNot();
            CheckPendings();
        }