/// <summary> /// To Add CDAP Budget into database /// </summary> /// <param name="objCDAPBudgetBO"></param> /// <returns></returns> public string AddCDAPBudget(CDAPBudgetBO objCDAPBudgetBO) { cnn = new OracleConnection(con); string returnResult = ""; proc = "USP_TRN_CDAP_BUDG"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); cmd.Parameters.Add("@CDAP_BUDGID_", objCDAPBudgetBO.Cdap_budgid); cmd.Parameters.Add("@CDAP_CATEGORYID_", objCDAPBudgetBO.Cdap_categoryid); cmd.Parameters.Add("@CDAP_SUBCATEGORYID_", objCDAPBudgetBO.Cdap_subcategoryid); cmd.Parameters.Add("@UNIT_", objCDAPBudgetBO.Unit); cmd.Parameters.Add("@QUANTITY_", objCDAPBudgetBO.Quantity); cmd.Parameters.Add("@RATEPERUNIT_", objCDAPBudgetBO.Rateperunit); cmd.Parameters.Add("@UPDATEDBY_", objCDAPBudgetBO.UpdatedBy); cmd.Parameters.Add("ProjectID_", objCDAPBudgetBO.ProjectID); cmd.Parameters.Add("@errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); if (cmd.Parameters["@errorMessage_"].Value != null) { returnResult = cmd.Parameters["@errorMessage_"].Value.ToString(); } cmd.Connection.Close(); return(returnResult); }
/// <summary> /// To Get CDAP Budget from database /// </summary> /// <param name="ProjectID"></param> /// <param name="Status"></param> /// <returns></returns> public CDAPBudgetList GetCDAPBudget(int ProjectID, string Status) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_GET_TRN_CDAP_BUDG"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("PROJECTID_", ProjectID); cmd.Parameters.Add("Status_", Status); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); CDAPBudgetBO objCDAPBudgetBO = null; CDAPBudgetList CDAPBudget = new CDAPBudgetList(); while (dr.Read()) { objCDAPBudgetBO = new CDAPBudgetBO(); if (!dr.IsDBNull(dr.GetOrdinal("CDAP_BUDGID"))) { objCDAPBudgetBO.Cdap_budgid = dr.GetInt32(dr.GetOrdinal("CDAP_BUDGID")); } if (!dr.IsDBNull(dr.GetOrdinal("CDAP_CATEGORYNAME"))) { objCDAPBudgetBO.Cdap_categoryname = dr.GetString(dr.GetOrdinal("CDAP_CATEGORYNAME")); } if (!dr.IsDBNull(dr.GetOrdinal("CDAP_SUBCATEGORYNAME"))) { objCDAPBudgetBO.Cdap_subcategoryname = dr.GetString(dr.GetOrdinal("CDAP_SUBCATEGORYNAME")); } if (!dr.IsDBNull(dr.GetOrdinal("UNITNAME"))) { objCDAPBudgetBO.UnitName = dr.GetString(dr.GetOrdinal("UNITNAME")); } if (!dr.IsDBNull(dr.GetOrdinal("QUANTITY"))) { objCDAPBudgetBO.Quantity = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("QUANTITY"))); } if (!dr.IsDBNull(dr.GetOrdinal("RATEPERUNIT"))) { objCDAPBudgetBO.Rateperunit = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("RATEPERUNIT"))); } if (!dr.IsDBNull(dr.GetOrdinal("FUNDREQSTATUS"))) { objCDAPBudgetBO.FundReqStatus = dr.GetString(dr.GetOrdinal("FUNDREQSTATUS")); } CDAPBudget.Add(objCDAPBudgetBO); } dr.Close(); return(CDAPBudget); }
/// <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; } }
/// <summary> /// To Get CDAP Budget Item from database /// </summary> /// <param name="cdap_budgid"></param> /// <returns></returns> public CDAPBudgetBO GetCDAPBudgetItem(int cdap_budgid) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_GET_TRN_CDAP_BUDGBYID"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@CDAP_BUDGID_", cdap_budgid); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); CDAPBudgetBO obCDAPBudgetBO = null; while (dr.Read()) { obCDAPBudgetBO = new CDAPBudgetBO(); if (!dr.IsDBNull(dr.GetOrdinal("CDAP_CATEGORYID"))) { obCDAPBudgetBO.Cdap_categoryid = dr.GetInt32(dr.GetOrdinal("CDAP_CATEGORYID")); } if (!dr.IsDBNull(dr.GetOrdinal("CDAP_SUBCATEGORYID"))) { obCDAPBudgetBO.Cdap_subcategoryid = dr.GetInt32(dr.GetOrdinal("CDAP_SUBCATEGORYID")); } if (!dr.IsDBNull(dr.GetOrdinal("UNIT"))) { obCDAPBudgetBO.Unit = dr.GetInt32(dr.GetOrdinal("UNIT")); } if (!dr.IsDBNull(dr.GetOrdinal("QUANTITY"))) { obCDAPBudgetBO.Quantity = dr.GetInt32(dr.GetOrdinal("QUANTITY")); } if (!dr.IsDBNull(dr.GetOrdinal("RATEPERUNIT"))) { obCDAPBudgetBO.Rateperunit = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("RATEPERUNIT"))); } } dr.Close(); return(obCDAPBudgetBO); }
/// <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(); }
/// <summary> /// To Add CDAP Budget into database /// </summary> /// <param name="objCDAPBudgetBO"></param> /// <returns></returns> public string AddCDAPBudget(CDAPBudgetBO objCDAPBudgetBO) { return((new CDAPBudgetDAL()).AddCDAPBudget(objCDAPBudgetBO)); }