/// <summary> /// Update status /// </summary> protected void UpdateStatus() { ProjectRouteBO objApprovalHeaderSave = new ProjectRouteBO(); objApprovalHeaderSave.WorkFlowApproverID = Convert.ToInt32(WorkFlowApproverIDTextBox.Text.ToString()); objApprovalHeaderSave.StatusID = (StatusIDTextBox.Text.ToString()); objApprovalHeaderSave.CreatedBy = Convert.ToInt32(Request.QueryString["userID"]); objApprovalHeaderSave.ApproverUserID = Convert.ToInt32(ApproverUserIdTextBox.Text.ToString()); objApprovalHeaderSave.WorkFlowDefinitionID = Convert.ToInt32(WorkFlowDefinitionIDTextBox.Text.ToString()); objApprovalHeaderSave.HHID = Convert.ToInt32(HHIDTextBox.Text.ToString()); objApprovalHeaderSave.PageCode = PageCodeTextBox.Text.ToString(); objApprovalHeaderSave.EmailSubject = EmailSubjectTextBox.Text.ToString(); objApprovalHeaderSave.EmailBody = EmailBodyTextBox.Text.ToString(); if (ViewState["BatchNo"] != null) { objApprovalHeaderSave.ElementID = Convert.ToInt32(ViewState["BatchNo"]); } else if (ViewState["GrievanceID"] != null) { objApprovalHeaderSave.ElementID = Convert.ToInt32(ViewState["GrievanceID"]); } ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); string message = objProjectRouteBLL.AddApprovalTrackheader(objApprovalHeaderSave); }
//After Save Approval Data Check the status of approval /// <summary> /// To find Route Status after Save /// </summary> /// <param name="objProjectRoute"></param> /// <returns></returns> public ProjectRouteBO findRouteStatusafterSave(ProjectRouteBO objProjectRoute) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_TRN_APPAFTERSAVEROUTE"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("ProjectedId_", objProjectRoute.Project_Id); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ProjectRouteBO objProjectApprovedRoute = null; ProjectRouteList ProjectRoute = new ProjectRouteList(); while (dr.Read()) { objProjectApprovedRoute = new ProjectRouteBO(); if (!dr.IsDBNull(dr.GetOrdinal("STATUSID"))) { objProjectApprovedRoute.ApprovedstatusID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("STATUSID"))); } } dr.Close(); return(objProjectApprovedRoute); }
/// <summary> /// to check the grievance data Exit Or Not /// to enable the change request button /// </summary> public void checkGrievanceApprovalExitOrNot() { #region Enable ChangeRequest Button string ResultValue = string.Empty; string message = string.Empty; ProjectRouteBO objProjectRoute = new ProjectRouteBO(); ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteList objProjectRouteList = new ProjectRouteList(); objProjectRoute.WorkFlowApprover = UtilBO.WorkflowGrievances; objProjectRoute.Project_Id = Convert.ToInt32(Session["PROJECT_ID"]); objProjectRoute = objProjectRouteBLL.getWOrkFlowApprovalID(objProjectRoute); if ((objProjectRoute) != null) { btnSave.Visible = true; btnClear.Visible = true; } else { btnSave.Visible = false; btnClear.Visible = false; } #endregion }
/// <summary> /// To find route status after save /// </summary> /// <param name="ProjectId"></param> public void findRouteStatusafterSave(int ProjectId) { ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteBO objProjectRoute = new ProjectRouteBO(); objProjectRoute.Project_Id = ProjectId; objProjectRoute = objProjectRouteBLL.findRouteStatusafterSave(objProjectRoute); if ((objProjectRoute) != null) { txtFinalRoute.Enabled = false; txtComments.Enabled = false; txtapprovedby.Enabled = false; txtapprovedDate.Enabled = false; GetApproavlComments(); if (objProjectRoute.ApprovedstatusID == 3) { pnlApprovel.Visible = false; //StatusLabel.Visible = true; ApprovalMessage1.SetMessage = ApprovalMessage.MessageValue.RouteApprovalSent; //StatusLabel.Text = "Route Approval is Pending"; btn_Save.Visible = false; btn_Clear.Visible = false; ApproverButton.Visible = false; } } }
/// <summary> /// To Add Project Routes /// </summary> /// <param name="objProjectRoute"></param> /// <returns></returns> public int AddProjectRoutes(ProjectRouteBO objProjectRoute) { OracleConnection myConnection; OracleCommand myCommand; myConnection = new OracleConnection(AppConfiguration.ConnectionString); myCommand = new OracleCommand("USP_TRN_INS_PROJECTROUTE", myConnection); myCommand.Connection = myConnection; myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("ROUTEID_", objProjectRoute.Route_ID); myCommand.Parameters.Add("PROJECTID_", objProjectRoute.Project_Id); myCommand.Parameters.Add("ROUTENAME_", objProjectRoute.Route_Name); if (objProjectRoute.Route_Details.Length > 1000) { myCommand.Parameters.Add("ROUTEDETAIL_", objProjectRoute.Route_Details.Substring(0, 1000)); } else { myCommand.Parameters.Add("ROUTEDETAIL_", objProjectRoute.Route_Details.Trim()); } myCommand.Parameters.Add("CREATEDBY_", objProjectRoute.CreatedBy); OracleParameter param = new OracleParameter("NEW_ROUTE_ID_", OracleDbType.Int32, ParameterDirection.Output); myCommand.Parameters.Add(param); myConnection.Open(); myCommand.ExecuteNonQuery(); myCommand.Connection.Close(); return(Convert.ToInt32(myCommand.Parameters["NEW_ROUTE_ID_"].Value.ToString())); }
/// <summary> /// to check the approver /// </summary> /// <returns></returns> public bool CheckApprover() { string ResultValue = string.Empty; string message = string.Empty; //bool mailSent = false; bool approverExists = false; ProjectRouteBO objProjectRoute = new ProjectRouteBO(); ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteList objProjectRouteList = new ProjectRouteList(); objProjectRoute.WorkFlowApprover = UtilBO.WorkflowGrievances; objProjectRoute.Project_Id = Convert.ToInt32(Session["PROJECT_ID"]); objProjectRoute = objProjectRouteBLL.getWOrkFlowApprovalID(objProjectRoute); if (objProjectRoute != null) { //(new NotificationBLL()).SendEmail(Convert.ToInt32(Session["PROJECT_ID"]), UtilBO.WorkflowGrievances); ////NotificationObj.SendEmail(objProjectRoute.EmailID, objProjectRoute.EmailSubject, objProjectRoute.EmailBody, objProjectRoute.ProjectCode, objProjectRoute.ProjectName); ////ResultValue = NotificationObj.SendSMS(objProjectRoute.CellNumber, objProjectRoute.SmsText, objProjectRoute.ProjectCode, objProjectRoute.ProjectName); //string Description = descriptionTextBox.Text.ToString().Trim(); //int GrievanceID = Convert.ToInt32(ViewState["GRIEVANCEID"]); //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("Dear Sir,"); //sb.Append(System.Environment.NewLine); //sb.Append(objProjectRoute.EmailBody); sb.Append(GrievanceID); //sb.Append(System.Environment.NewLine); //sb.Append(Description); //sb.Append(System.Environment.NewLine); //sb.Append("Project Code : " + objProjectRoute.ProjectCode); //sb.Append(System.Environment.NewLine); //sb.Append("Project Name : " + objProjectRoute.ProjectName); //sb.Append(System.Environment.NewLine); //sb.Append(" Thanks and Regards"); //sb.Append(System.Environment.NewLine); //sb.Append("WIS - UETCL Team"); //string InputEmail = sb.ToString(); //ProjectRouteBO objApprovalHeaderSave = new ProjectRouteBO(); //objApprovalHeaderSave.WorkFlowApproverID = objProjectRoute.WorkFlowApproverID; //objApprovalHeaderSave.StatusID = objProjectRoute.StatusID; //objApprovalHeaderSave.CreatedBy = Convert.ToInt32(Session["USER_ID"]); //objApprovalHeaderSave.PageCode = UtilBO.WorkflowGrievances; //objApprovalHeaderSave.HHID = Convert.ToInt32(Session["HH_ID"].ToString()); //objApprovalHeaderSave.ElementID = Convert.ToInt32(ViewState["GRIEVANCEID"]); //sending Grivanceid //objApprovalHeaderSave.ApproverUserID = objProjectRoute.ApproverUserID; //objApprovalHeaderSave.WorkFlowDefinitionID = objProjectRoute.WorkFlowDefinitionID; //objApprovalHeaderSave.EmailSubject = objProjectRoute.EmailSubject; //objApprovalHeaderSave.EmailBody = InputEmail; //message = objProjectRouteBLL.AddApprovalTrackheader(objApprovalHeaderSave); approverExists = true; } return(approverExists); }
/// <summary> /// Set the Route coordinates to Map /// </summary> private void GenerateMap() { ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteBO objProjectRoute = new ProjectRouteBO(); ProjectRouteList ProjectRouteList = new ProjectRouteList(); objProjectRoute.Project_Id = Convert.ToInt32(projectID);; bool checck = true; ProjectRouteList = objProjectRouteBLL.getFinalRouteApprovalDetial(objProjectRoute); for (int i = 0; i < ProjectRouteList.Count; i++) { if (ProjectRouteList[i].IsFinal == "TRUE") { checck = false; RouteCoordinatesBLL objRouteCoordinatesBLL = new RouteCoordinatesBLL(); RouteCoordinatesList RouteCoordinates = objRouteCoordinatesBLL.GetRouteCoordinates(ProjectRouteList[i].Route_ID.ToString()); System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (RouteCoordinatesBO objRouteCoord in RouteCoordinates) { sb.Append(string.Format("'{0},{1},{2}'", objRouteCoord.Latitude, objRouteCoord.Longitude, objRouteCoord.Routename)); sb.Append(";"); } if (sb.Length > 0) { sb.Remove(sb.Length - 1, 1); } //Response.Write(sb.ToString()); System.Text.StringBuilder sb1 = new System.Text.StringBuilder(); sb1.Append(string.Format("'{0},{1},{2}'", "0.469104", "33.164163", "E")); sb1.Append(";"); sb1.Append(string.Format("'{0},{1},{2}'", "0.469145", "33.164285", "B")); sb1.Append(";"); sb1.Append(string.Format("'{0},{1},{2}'", "0.468865", "33.164583", "C")); sb1.Append(";"); sb1.Append(string.Format("'{0},{1},{2}'", "0.468782", "33.164507", "D")); sb1.Append(";"); sb1.Append(string.Format("'{0},{1},{2}'", "0.469104", "33.164163", "E")); sb1.Append(";"); if (sb1.Length > 0) { sb1.Remove(sb1.Length - 1, 1); } ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowMap", string.Format("initialize(\"{0}\")", sb.ToString()), true); //string paramView = string.Format("initialize('{0}','{1}');", sb.ToString(), sb1.ToString()); //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowMap", paramView, true); } } lblMessage.Visible = checck; }
/// <summary> /// To get Final Route Approval Detial /// </summary> /// <param name="objProjectRoute"></param> /// <returns></returns> public ProjectRouteList getFinalRouteApprovalDetial(ProjectRouteBO objProjectRoute) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_TRN_GETAPPROVEDROUTE"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("ProjectIdIN_", objProjectRoute.Project_Id); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ProjectRouteBO objProjectApprovedRoute = null; ProjectRouteList ProjectRoute = new ProjectRouteList(); while (dr.Read()) { objProjectApprovedRoute = new ProjectRouteBO(); if (!dr.IsDBNull(dr.GetOrdinal("ROUTENAME"))) { objProjectApprovedRoute.Route_Name = dr.GetString(dr.GetOrdinal("ROUTENAME")); } if (!dr.IsDBNull(dr.GetOrdinal("ROUTEID"))) { objProjectApprovedRoute.Route_ID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("ROUTEID"))); } if (!dr.IsDBNull(dr.GetOrdinal("USERNAME"))) { objProjectApprovedRoute.ApproverUserName = dr.GetString(dr.GetOrdinal("USERNAME")); } if (!dr.IsDBNull(dr.GetOrdinal("APPROVEDDATE"))) { objProjectApprovedRoute.Approveddate = dr.GetDateTime(dr.GetOrdinal("APPROVEDDATE")).ToString(UtilBO.DateFormat); } ; if (!dr.IsDBNull(dr.GetOrdinal("COMMENTS"))) { objProjectApprovedRoute.ApproverComment = dr.GetString(dr.GetOrdinal("COMMENTS")); } if (!dr.IsDBNull(dr.GetOrdinal("STATUSID"))) { objProjectApprovedRoute.ApprovedstatusID = dr.GetInt32(dr.GetOrdinal("STATUSID")); } if (!dr.IsDBNull(dr.GetOrdinal("ISFINAL"))) { objProjectApprovedRoute.IsFinal = dr.GetString(dr.GetOrdinal("ISFINAL")); } ProjectRoute.Add(objProjectApprovedRoute); } dr.Close(); return(ProjectRoute); }
/// <summary> /// To fetch FinalRouteApprovalDetial /// </summary> /// <param name="ProjectId"></param> public void getFinalRouteApprovalDetial(int ProjectId) { ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteBO objProjectRoute = new ProjectRouteBO(); ProjectRouteList ProjectRouteList = new ProjectRouteList(); objProjectRoute.Project_Id = ProjectId; ProjectRouteList = objProjectRouteBLL.getFinalRouteApprovalDetial(objProjectRoute); //ProjectRouteList = objProjectRouteBLL.getFinalRouteApprovalDetial(objProjectRoute); if ((ProjectRouteList.Count) > 0) { for (int i = 0; i < ProjectRouteList.Count; i++) { if (ProjectRouteList[i].IsFinal == "TRUE") { if (ProjectRouteList[i].ApprovedstatusID == 1) { btn_Save.Visible = false; btn_Clear.Visible = false; btn_ImportExcel.Visible = false; GrdRouteCoordinates.Columns[GrdRouteCoordinates.Columns.Count - 1].Visible = false; GrdRouteCoordinates.Columns[GrdRouteCoordinates.Columns.Count - 2].Visible = false; } } else { if (ProjectRouteList[i].ApprovedstatusID == 3) { btn_Save.Visible = false; btn_Clear.Visible = false; btn_ImportExcel.Visible = false; GrdRouteCoordinates.Columns[GrdRouteCoordinates.Columns.Count - 1].Visible = false; GrdRouteCoordinates.Columns[GrdRouteCoordinates.Columns.Count - 2].Visible = false; } if (ProjectRouteList[i].ApprovedstatusID == 2) { btn_Save.Visible = true; btn_Clear.Visible = true; btn_ImportExcel.Visible = true; GrdRouteCoordinates.Columns[GrdRouteCoordinates.Columns.Count - 1].Visible = true; GrdRouteCoordinates.Columns[GrdRouteCoordinates.Columns.Count - 2].Visible = true; } } } } }
/// <summary> /// To find Route Status after Save /// </summary> /// <param name="ProjectId"></param> public void findRouteStatusafterSave(int ProjectId) { ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteBO objProjectRoute = new ProjectRouteBO(); objProjectRoute.Project_Id = ProjectId; objProjectRoute = objProjectRouteBLL.findRouteStatusafterSave(objProjectRoute); if ((objProjectRoute) != null) { if (objProjectRoute.ApprovedstatusID == 3) { btnSave.Visible = false; btnClear.Visible = false; } } }
/// <summary> /// To Get Approved Comments /// </summary> /// <param name="ProjectID"></param> /// <returns></returns> public ProjectRouteList GetApprovedComments(int ProjectID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_TRN_RTAAPPROVALCOMMENTS"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("ProjectIdIN_", ProjectID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ProjectRouteBO objProjectBO = null; ProjectRouteList ProjectList = new ProjectRouteList(); while (dr.Read()) { objProjectBO = new ProjectRouteBO(); if (!dr.IsDBNull(dr.GetOrdinal("USERNAME"))) { objProjectBO.AppName = dr.GetString(dr.GetOrdinal("USERNAME")); } if (!dr.IsDBNull(dr.GetOrdinal("STATUS"))) { objProjectBO.Status = dr.GetString(dr.GetOrdinal("STATUS")); } if (!dr.IsDBNull(dr.GetOrdinal("ACTIONTAKENDATE"))) { objProjectBO.ActioDate = dr.GetDateTime(dr.GetOrdinal("ACTIONTAKENDATE")).ToString(UtilBO.DateFormat); } if (!dr.IsDBNull(dr.GetOrdinal("APPROVERCOMMENTS"))) { objProjectBO.Comments = dr.GetString(dr.GetOrdinal("APPROVERCOMMENTS")); } if (!dr.IsDBNull(dr.GetOrdinal("ROLENAME"))) { objProjectBO.RoleName = dr.GetString(dr.GetOrdinal("ROLENAME")); } ProjectList.Add(objProjectBO); } dr.Close(); return(ProjectList); }
/// <summary> /// to find Route Status after Save /// </summary> /// <param name="ProjectId"></param> public void findRouteStatusafterSave(int ProjectId) { ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteBO objProjectRoute = new ProjectRouteBO(); objProjectRoute.Project_Id = ProjectId; objProjectRoute = objProjectRouteBLL.findRouteStatusafterSave(objProjectRoute); if ((objProjectRoute) != null) { if (objProjectRoute.ApprovedstatusID == 3) { btn_Save.Visible = false; btn_Clear.Visible = false; btn_ImportExcel.Visible = false; GrdRouteCoordinates.Columns[GrdRouteCoordinates.Columns.Count - 1].Visible = false; GrdRouteCoordinates.Columns[GrdRouteCoordinates.Columns.Count - 2].Visible = false; } } }
/// <summary> /// To Get Project Route by Id /// </summary> /// <param name="ProjectId"></param> /// <returns></returns> public ProjectRouteList GetProjectRoutebyId(int ProjectId) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_TRN_GETPROJECTROUTEBYID"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ProjectIdIN", ProjectId); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ProjectRouteBO objProjectRoute = null; ProjectRouteList ProjectRoute = new ProjectRouteList(); while (dr.Read()) { objProjectRoute = new ProjectRouteBO(); if (ColumnExists(dr, "RouteID") && !dr.IsDBNull(dr.GetOrdinal("RouteID"))) { objProjectRoute.Route_ID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("RouteID"))); } if (ColumnExists(dr, "routename") && !dr.IsDBNull(dr.GetOrdinal("routename"))) { objProjectRoute.Route_Name = dr.GetString(dr.GetOrdinal("routename")); } if (ColumnExists(dr, "routedetails") && !dr.IsDBNull(dr.GetOrdinal("routedetails"))) { objProjectRoute.Route_Details = dr.GetString(dr.GetOrdinal("routedetails")); } if (ColumnExists(dr, "totalroutescore") && !dr.IsDBNull(dr.GetOrdinal("totalroutescore"))) { objProjectRoute.TotalRouteScore = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("totalroutescore"))); } ProjectRoute.Add(objProjectRoute); } dr.Close(); return(ProjectRoute); }
//After clicking Approval Button checking status /// <summary> /// To find Route Status after Save /// </summary> /// <param name="objProjectRoute"></param> /// <returns></returns> public ProjectRouteBO findRouteStatusafterSave(ProjectRouteBO objProjectRoute) { ProjectRouteDAL objProjectRouteDAL = new ProjectRouteDAL(); return(objProjectRouteDAL.findRouteStatusafterSave(objProjectRoute)); }
/// <summary> /// To get Final Route Approval Detial /// </summary> /// <param name="objProjectRoute"></param> /// <returns></returns> public ProjectRouteList getFinalRouteApprovalDetial(ProjectRouteBO objProjectRoute) { ProjectRouteDAL objProjectRouteDAL = new ProjectRouteDAL(); return(objProjectRouteDAL.getFinalRouteApprovalDetial(objProjectRoute)); }
/// <summary> /// To Add Approval Track header /// </summary> /// <param name="objApprovalHeaderSave"></param> /// <returns></returns> public string AddApprovalTrackheader(ProjectRouteBO objApprovalHeaderSave) { ProjectRouteDAL objProjectRouteDAL = new ProjectRouteDAL(); return(objProjectRouteDAL.AddApprovalTrackheader(objApprovalHeaderSave)); }
/// <summary> /// To get WOrk Flow Approval ID /// </summary> /// <param name="objProjectRoute"></param> /// <returns></returns> public ProjectRouteBO getWOrkFlowApprovalID(ProjectRouteBO objProjectRoute) { ProjectRouteDAL ProjectRouteDALObj = new ProjectRouteDAL(); return(ProjectRouteDALObj.getWOrkFlowApprovalID(objProjectRoute)); }
/// <summary> /// To Add Project Routes /// </summary> /// <param name="objProjectRoute"></param> /// <returns></returns> public int AddProjectRoutes(ProjectRouteBO objProjectRoute) { ProjectRouteDAL objProjectRouteDAL = new ProjectRouteDAL(); return(objProjectRouteDAL.AddProjectRoutes(objProjectRoute)); }
/// <summary> /// To get WOrk Flow Approval ID /// </summary> /// <param name="objProjectRoute"></param> /// <returns></returns> public ProjectRouteBO getWOrkFlowApprovalID(ProjectRouteBO objProjectRoute) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_TRN_GET_WORKFLOWAPPREID"; //string APPROVERLEVEL = "1"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("ProjectId_", objProjectRoute.Project_Id); cmd.Parameters.Add("WorkFlowApprover_", objProjectRoute.WorkFlowApprover); //cmd.Parameters.Add("APPROVERLEVEL_", APPROVERLEVEL); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ProjectRouteBO ProjectRouteBOobj = null; ProjectRouteList ProjectRouteList = new ProjectRouteList(); while (dr.Read()) { ProjectRouteBOobj = new ProjectRouteBO(); if (ColumnExists(dr, "CELLNUMBER") && !dr.IsDBNull(dr.GetOrdinal("CELLNUMBER"))) { ProjectRouteBOobj.CellNumber = (dr.GetString(dr.GetOrdinal("CELLNUMBER"))); } if (ColumnExists(dr, "EMAILID") && !dr.IsDBNull(dr.GetOrdinal("EMAILID"))) { ProjectRouteBOobj.EmailID = (dr.GetString(dr.GetOrdinal("EMAILID"))); } if (ColumnExists(dr, "WORKFLOWDEFINITIONID") && !dr.IsDBNull(dr.GetOrdinal("WORKFLOWDEFINITIONID"))) { ProjectRouteBOobj.WorkFlowDefinitionID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("WORKFLOWDEFINITIONID"))); } if (ColumnExists(dr, "WORKFLOWAPPROVERID") && !dr.IsDBNull(dr.GetOrdinal("WORKFLOWAPPROVERID"))) { ProjectRouteBOobj.WorkFlowApproverID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("WORKFLOWAPPROVERID"))); } if (ColumnExists(dr, "APPROVERUSERID") && !dr.IsDBNull(dr.GetOrdinal("APPROVERUSERID"))) { ProjectRouteBOobj.ApproverUserID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("APPROVERUSERID"))); } if (ColumnExists(dr, "APPROVERUSERNAME") && !dr.IsDBNull(dr.GetOrdinal("APPROVERUSERNAME"))) { ProjectRouteBOobj.ApproverUserName = (dr.GetString(dr.GetOrdinal("APPROVERUSERNAME"))); } if (ColumnExists(dr, "PROJECTCODE") && !dr.IsDBNull(dr.GetOrdinal("PROJECTCODE"))) { ProjectRouteBOobj.ProjectCode = (dr.GetString(dr.GetOrdinal("PROJECTCODE"))); } if (ColumnExists(dr, "PROJECTNAME") && !dr.IsDBNull(dr.GetOrdinal("PROJECTNAME"))) { ProjectRouteBOobj.ProjectName = (dr.GetString(dr.GetOrdinal("PROJECTNAME"))); } if (ColumnExists(dr, "EMAILSUBJECT") && !dr.IsDBNull(dr.GetOrdinal("EMAILSUBJECT"))) { ProjectRouteBOobj.EmailSubject = (dr.GetString(dr.GetOrdinal("EMAILSUBJECT"))); } if (ColumnExists(dr, "EMAILBODY") && !dr.IsDBNull(dr.GetOrdinal("EMAILBODY"))) { ProjectRouteBOobj.EmailBody = (dr.GetString(dr.GetOrdinal("EMAILBODY"))); } if (ColumnExists(dr, "SMSTEXT") && !dr.IsDBNull(dr.GetOrdinal("SMSTEXT"))) { ProjectRouteBOobj.SmsText = (dr.GetString(dr.GetOrdinal("SMSTEXT"))); } } dr.Close(); return(ProjectRouteBOobj); }
/// <summary> /// To save details to the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Save_Click(object sender, EventArgs e) { if (txtRoute1.Text != "") { ProjectRouteBO objProjectRoute = new ProjectRouteBO(); objProjectRoute.Route_ID = Convert.ToInt32(ViewState["ROUTE_ID1"]); objProjectRoute.Project_Id = Convert.ToInt32(Session["PROJECT_ID"]); objProjectRoute.Route_Name = txtRoute1.Text; objProjectRoute.Route_Details = txtRouteDetails1.Text.Trim(); if (objProjectRoute.Route_Details.Length > 1000) { objProjectRoute.Route_Details = objProjectRoute.Route_Details.Substring(0, 999); } objProjectRoute.CreatedBy = Convert.ToInt32(Session["USER_ID"]); ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ViewState["ROUTE_ID1"] = objProjectRouteBLL.AddProjectRoutes(objProjectRoute); if (Convert.ToInt32(ViewState["ROUTE_ID1"]) != 0) { lnkbtnone1.Visible = true; RouteCoordinatesOne(); } } if (txtRoute2.Text != "") { ProjectRouteBO objProjectRoute = new ProjectRouteBO(); objProjectRoute.Route_ID = Convert.ToInt32(ViewState["ROUTE_ID2"]); objProjectRoute.Project_Id = Convert.ToInt32(Session["PROJECT_ID"]); objProjectRoute.Route_Name = txtRoute2.Text; objProjectRoute.Route_Details = txtRouteDetails2.Text.Trim(); if (objProjectRoute.Route_Details.Length > 1000) { objProjectRoute.Route_Details = objProjectRoute.Route_Details.Substring(0, 999); } objProjectRoute.CreatedBy = Convert.ToInt32(Session["USER_ID"]); ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); //objProjectRouteBLL.AddProjectRoutes(objProjectRoute); ViewState["ROUTE_ID2"] = objProjectRouteBLL.AddProjectRoutes(objProjectRoute); if (Convert.ToInt32(ViewState["ROUTE_ID2"]) != 0) { lnkbtnTwo.Visible = true; RouteCoordinatesTwo(); } } if (txtRoute3.Text != "") { ProjectRouteBO objProjectRoute = new ProjectRouteBO(); objProjectRoute.Route_ID = Convert.ToInt32(ViewState["ROUTE_ID3"]); objProjectRoute.Project_Id = Convert.ToInt32(Session["PROJECT_ID"]); objProjectRoute.Route_Name = txtRoute3.Text; objProjectRoute.Route_Details = txtRouteDetails3.Text.Trim(); if (objProjectRoute.Route_Details.Length > 1000) { objProjectRoute.Route_Details = objProjectRoute.Route_Details.Substring(0, 999); } objProjectRoute.CreatedBy = Convert.ToInt32(Session["USER_ID"]); ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); // objProjectRouteBLL.AddProjectRoutes(objProjectRoute); ViewState["ROUTE_ID3"] = objProjectRouteBLL.AddProjectRoutes(objProjectRoute); if (Convert.ToInt32(ViewState["ROUTE_ID3"]) != 0) { lnkbtnthree.Visible = true; RouteCoordinatesThree(); } } GetProjectRouteDetails(Convert.ToInt32(Session["PROJECT_ID"])); findRouteStatusafterSave(Convert.ToInt32(Session["PROJECT_ID"])); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data saved successfully');", true); // ClearDetails(); }
/// <summary> /// To Add Approval Track header /// </summary> /// <param name="objApprovalHeaderSave"></param> /// <returns></returns> public string AddApprovalTrackheader(ProjectRouteBO objApprovalHeaderSave) { string result = string.Empty; OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); cnn.Open(); OracleCommand dcmd = new OracleCommand("USP_TRN_INS_PRJ_ROUTEAPPROVER", cnn); dcmd.CommandType = CommandType.StoredProcedure; try { dcmd.Parameters.Add("WorkFlowApproverID_", objApprovalHeaderSave.WorkFlowApproverID); dcmd.Parameters.Add("StatusID_", objApprovalHeaderSave.StatusID); dcmd.Parameters.Add("CreatedBy_", objApprovalHeaderSave.CreatedBy); dcmd.Parameters.Add("ApproverUserID_", objApprovalHeaderSave.ApproverUserID); dcmd.Parameters.Add("WorkFlowDefinitionID_", objApprovalHeaderSave.WorkFlowDefinitionID); if (objApprovalHeaderSave.HHID != 0) { dcmd.Parameters.Add("HHID_", objApprovalHeaderSave.HHID); } else { dcmd.Parameters.Add("HHID_", "0"); } if (objApprovalHeaderSave.PageCode != "0") { dcmd.Parameters.Add("PageCode_", objApprovalHeaderSave.PageCode); } else { dcmd.Parameters.Add("PageCode_", "0"); } if (objApprovalHeaderSave.EmailSubject != "0") { dcmd.Parameters.Add("EmailSubject_", objApprovalHeaderSave.EmailSubject); } else { dcmd.Parameters.Add("EmailSubject_", "0"); } if (objApprovalHeaderSave.EmailBody != "0") { dcmd.Parameters.Add("EmailBody_", objApprovalHeaderSave.EmailBody); } else { dcmd.Parameters.Add("EmailBody_", "0"); } if (objApprovalHeaderSave.ElementID != 0) { dcmd.Parameters.Add("ElementID_", objApprovalHeaderSave.ElementID); } else { dcmd.Parameters.Add("ElementID_", "0"); } dcmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; dcmd.ExecuteNonQuery(); if (dcmd.Parameters["errorMessage_"].Value != null) { result = dcmd.Parameters["errorMessage_"].Value.ToString(); } } catch { throw; } finally { dcmd.Dispose(); cnn.Close(); cnn.Dispose(); } return(result); }
/// <summary> /// To get final route approval detail /// </summary> /// <param name="ProjectId"></param> public void getFinalRouteApprovalDetial(int ProjectId) { ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteBO objProjectRoute = new ProjectRouteBO(); ProjectRouteList ProjectRouteList = new ProjectRouteList(); objProjectRoute.Project_Id = ProjectId; ProjectRouteList = objProjectRouteBLL.getFinalRouteApprovalDetial(objProjectRoute); //ProjectRouteList = objProjectRouteBLL.getFinalRouteApprovalDetial(objProjectRoute); if ((ProjectRouteList.Count) > 0) { for (int i = 0; i < ProjectRouteList.Count; i++) { if (ProjectRouteList[i].IsFinal == "TRUE") { txtFinalRoute.Enabled = false; txtComments.Enabled = false; txtapprovedby.Enabled = false; txtapprovedDate.Enabled = false; GetApproavlComments(); if (ProjectRouteList[i].ApprovedstatusID == 1) { pnlApprovel.Visible = true; txtFinalRoute.Text = ProjectRouteList[i].Route_Name.ToString(); txtComments.Text = ProjectRouteList[i].ApproverComment.ToString(); txtapprovedby.Text = ProjectRouteList[i].ApproverUserName.ToString(); txtapprovedDate.Text = ProjectRouteList[i].Approveddate.ToString(); btn_Save.Visible = false; btn_Clear.Visible = false; ApproverButton.Visible = false; // lnkApprovalComments.Visible = false; //StatusLabel.Visible = false; //StatusLabel.Text = ""; ApprovalMessage1.SetMessage = ApprovalMessage.MessageValue.None; } } else { if (ProjectRouteList[i].ApprovedstatusID == 3) { pnlApprovel.Visible = false; //StatusLabel.Visible = true; //StatusLabel.Text = "Route Approval is Pending"; ApprovalMessage1.SetMessage = ApprovalMessage.MessageValue.RouteApprovalSent; btn_Save.Visible = false; btn_Clear.Visible = false; ApproverButton.Visible = false; ///lnkApprovalComments.Visible = true; } if (ProjectRouteList[i].ApprovedstatusID == 2) { pnlApprovel.Visible = false; //StatusLabel.Visible = true; //StatusLabel.Text = "Route Declined"; ApprovalMessage1.SetMessage = ApprovalMessage.MessageValue.RouteApprovalDeclined; btn_Save.Visible = true; btn_Clear.Visible = true; ApproverButton.Visible = false; //lnkApprovalComments.Visible = true; } } } } else { pnlApprovel.Visible = false; } }
/// <summary> /// To send route approval notification /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ApproverButton_Click(object sender, EventArgs e) { string ResultValue = string.Empty; string message = string.Empty; string WorkFlowCode = UtilBO.WorkflowRouteApproval; string emailSubject = string.Empty; string emailBody = string.Empty; ProjectRouteBO objProjectRoute = new ProjectRouteBO(); ProjectRouteBLL objProjectRouteBLL = new ProjectRouteBLL(); ProjectRouteList objProjectRouteList = new ProjectRouteList(); objProjectRoute.WorkFlowApprover = UtilBO.WorkflowRouteApproval; objProjectRoute.Project_Id = Convert.ToInt32(Session["PROJECT_ID"]); objProjectRoute = objProjectRouteBLL.getWOrkFlowApprovalID(objProjectRoute); if ((objProjectRoute) != null) { (new NotificationBLL()).SendEmail(Convert.ToInt32(Session["PROJECT_ID"]), UtilBO.WorkflowRouteApproval); #region for sending SMS WIS_ConfigBO WIS_ConfigBO = new WIS_ConfigBO(); WIS_ConfigBLL WIS_ConfigBLL = new WIS_ConfigBLL(); WIS_ConfigBO = WIS_ConfigBLL.GetConfigSMSsending(); if (WIS_ConfigBO != null) { if (WIS_ConfigBO.MobileStatus == "Y") { string Result = string.Empty; string SendsmsTest = objProjectRoute.SmsText + objProjectRoute.ProjectCode + objProjectRoute.ProjectName; NotificationBO SMSNotificationBO = new NotificationBO(); NotificationBLL SMSNotificationBLL = new NotificationBLL(); SMSNotificationBO.ProviderMobileNo = WIS_ConfigBO.MobileNumber; SMSNotificationBO.ProviderPasword = WIS_ConfigBO.MobilePassword; SMSNotificationBO.ProviderURL = WIS_ConfigBO.SiteUrl; SMSNotificationBO.CellNumber = objProjectRoute.CellNumber; SMSNotificationBO.SmsText = SendsmsTest; Result = SMSNotificationBLL.SENDSMS(SMSNotificationBO); } } #endregion //NotificationObj.SendEmail(objProjectRoute.EmailID, objProjectRoute.EmailSubject, objProjectRoute.EmailBody, objProjectRoute.ProjectCode, objProjectRoute.ProjectName); //ResultValue = NotificationObj.SendSMS(objProjectRoute.CellNumber, objProjectRoute.SmsText, objProjectRoute.ProjectCode, objProjectRoute.ProjectName); ProjectRouteBO objApprovalHeaderSave = new ProjectRouteBO(); objApprovalHeaderSave.WorkFlowApproverID = objProjectRoute.WorkFlowApproverID; objApprovalHeaderSave.StatusID = objProjectRoute.StatusID; objApprovalHeaderSave.CreatedBy = Convert.ToInt32(Session["USER_ID"]); objApprovalHeaderSave.PageCode = "RTA"; objApprovalHeaderSave.ApproverUserID = objProjectRoute.ApproverUserID; objApprovalHeaderSave.WorkFlowDefinitionID = objProjectRoute.WorkFlowDefinitionID; #region email formate switch (WorkFlowCode) { case "RTA": emailSubject = string.Format("{0} {1}", objProjectRoute.EmailSubject, objProjectRoute.ProjectName); //emailBody = emailBody.Replace("@@PROJECTNAME", objProjectRoute.EmailBody); emailBody = objProjectRoute.EmailBody.Replace("@@PROJECTNAME", objProjectRoute.ProjectName); break; default: emailSubject = objProjectRoute.EmailSubject; break; } string approverName = objProjectRoute.ApproverUserName; StringBuilder sb = new StringBuilder(); sb.Append("Dear " + approverName + ","); sb.Append("<br/><br/>"); sb.Append(emailBody); sb.Append("<br/><br/>"); sb.Append("Thanks and Regards,"); sb.Append("<br/>"); sb.Append("WIS - UETCL Team"); #endregion objApprovalHeaderSave.EmailSubject = emailSubject; objApprovalHeaderSave.EmailBody = sb.ToString(); message = objProjectRouteBLL.AddApprovalTrackheader(objApprovalHeaderSave); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Route Approval Notification has been sent"; } if (message != "") { int ProjectId = Convert.ToInt32(Session["PROJECT_ID"]); findRouteStatusafterSave(ProjectId); getFinalRouteApprovalDetial(ProjectId); GetApproavlComments(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); ApproverButton.Visible = false; } } else { message = "Route Approver is not defined"; if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } findRouteStatusafterSave(Convert.ToInt32(Session["PROJECT_ID"])); }