public void AddNotification(NotificationType notificationType, string senderId, string recipientId, string notificationUrl) { try { NotificationBO notification = new NotificationBO(); string senderName = "";// senderId == recipientId ? "You" : zeus.staffManager.GetStaffName(senderId); string message = null; switch (notificationType) { case NotificationType.NewTask: message = senderName + " created a New Task."; break; case NotificationType.NewTaskEvaluation: message = senderName + " evaluated one of your Tasks."; break; case NotificationType.Nomination: message = "You have a New Nomination."; break; case NotificationType.NewTaskComment: message = senderName + " comented on one of your Tasks."; break; case NotificationType.TaskAccepted: message = "A Task of yours has been approved."; break; case NotificationType.TaskDeclined: message = "A Task of yours has been declined."; break; case NotificationType.SupervisorRequest: message = senderName + " sent you a Supervisor Request."; break; case NotificationType.SupervisorAccepted: message = senderName + " accepted your request."; break; case NotificationType.SupervisorDeclined: message = senderName + " declined your request."; break; case NotificationType.SupervisorAppraisalApproval: message = "Your Supervisor has approved your appraisal."; break; case NotificationType.HodAppraisalApproval: message = "Your HOD has approved your appraisal."; break; case NotificationType.NewCompetencyEvaluation: message = senderName + " evaluated one of your job competencies."; break; case NotificationType.NewCompetencyComment: message = senderName + " comented on one of your job competencies. "; break; case NotificationType.AppraisalContest: message = senderName + " contested their appraisal result. "; break; default: message = ""; break; } notification.Message = message; notification.NotificationState = NotificationState.Unread; notification.NotificationType = notificationType; notification.SenderId = senderId; notification.RecipientId = recipientId; notification.URL = notificationUrl; notification.Audit = new Entity.Entities.Audit(); zeus.notificationManager.Add(notification); } catch (Exception ex) { LogError(ex, CurrentUserId); } }
/// <summary> /// To close batch /// </summary> /// <param name="HHID"></param> /// <param name="UserId"></param> /// <param name="BatchNo"></param> /// <returns></returns> public string CloseBatch(int HHID, int UserId, int BatchNo, WorkFlowBO objWorkFlow) { string returnResult = string.Empty; cnn = new OracleConnection(con); proc = "USP_TRN_CMP_CLOSE_PAYREQ_BATCH"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); //cmd.Parameters.Add("HHID_", HHID); cmd.Parameters.Add("CMP_BATCHNO_", BatchNo); cmd.Parameters.Add("UPDATEDBY_", UserId); cmd.Parameters.Add("ERRORMESSAGE_", OracleDbType.Varchar2, 100).Direction = ParameterDirection.Output; try { cmd.ExecuteNonQuery(); if (cmd.Parameters["ERRORMESSAGE_"].Value != null) { returnResult = cmd.Parameters["ERRORMESSAGE_"].Value.ToString(); } else { returnResult = string.Empty; } } catch (Exception ex) { returnResult = string.Empty; throw ex; } #region Notify Higher Authority of Batch Completion: if (objWorkFlow != null) { NotificationBO objNotification = new NotificationBO(); StringBuilder sb = new StringBuilder(); if (objWorkFlow.HigherAuthorityEmailID != null) { string HigherAuthorityName = objWorkFlow.HigherAuthorityName; string ProjectName = objWorkFlow.ProjectName; string ProjectCode = objWorkFlow.ProjectCode; sb.Append("Dear " + HigherAuthorityName + ","); sb.Append("<br/><br/>"); sb.Append("Approval completed on " + "Batch: <a href='wisapp.uetcl.com' style='text-decoration:none'><b>" + BatchNo + "</b></a>"); sb.Append("<br/>"); sb.Append("You can now prepare the MEMO for payment processing."); sb.Append("<br/>"); sb.Append("Follow the link to WIS for Batch Details report, and approver Comments"); sb.Append("<br/><br/>"); sb.Append("<br/><br/>"); sb.Append("<br/><br/>"); sb.Append("<br/><br/>"); sb.Append("<br/><br/>"); sb.Append("<br/><br/>"); sb.Append("___________________________________"); sb.Append("<br/><br/>"); sb.Append("Wayleaves Information System (WIS)"); objNotification.EmailID = objWorkFlow.HigherAuthorityEmailID; objNotification.EmailSubject = "Batch: " + BatchNo + " (" + ProjectCode + " Project) - Ready for payment"; objNotification.EmailBody = sb.ToString(); (new NotificationDAL()).SendEmail(objNotification); } } #endregion return(returnResult); }
public static void updateNotification(NotificationBO objNotification) { NotificationDAL.updateNotification(objNotification); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var pushSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet()); UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings); UIApplication.SharedApplication.RegisterForRemoteNotifications(); } else { UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound; UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } FirebasePushNotificationManager.Initialize(options, true); CrossFirebasePushNotification.Current.RegisterForPushNotifications(); CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) => { System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}"); // UserDialogs.Instance.AlertAsync(p.Token); UIPasteboard clipboard = UIPasteboard.General; clipboard.String = p.Token; Settings.DeviceToken = p.Token; //var stack = new StackLayout(); //var btn = new Button() {Text = "Click"}; //stack.Children.Add(new Entry() { Text = p.Token }); //stack.Children.Add(btn); //var testpage = new TestPage(){Content = stack}; //App.Current.MainPage = testpage; //btn.Clicked += (ss, e) => { App.Current.MainPage = new Login(); }; }; // Push message received event usage sample: CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) => { System.Diagnostics.Debug.WriteLine("Received"); Dictionary <string, string> dic = p.Data as Dictionary <string, string>; NotificationBO notificationBo = new NotificationBO(); FirebasePushNotificationManager.CurrentNotificationPresentationOption = UNNotificationPresentationOptions.Alert; foreach (var item in p.Data) { if (item.Key.Contains("title")) { notificationBo.Title = Convert.ToString(item.Value); } if (item.Key.Contains("message")) { notificationBo.Message = Convert.ToString(item.Value); } if (item.Key.Contains("screen")) { notificationBo.Screen = Convert.ToString(item.Value); } if (item.Key.Contains("body")) { notificationBo.Body = Convert.ToString(item.Value); } if (item.Key == "sound") { notificationBo.Sound = Convert.ToString(item.Value); } if (item.Key.Contains("content_available")) { notificationBo.ContentAvailable = Convert.ToString(item.Value); } } App.Database.InsertNotification(notificationBo); ProcessNotification(dic, false); }; // Push message opened event usage sample: CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) => { App.Current.MainPage = new MainPage() { Detail = new NavigationPage(new NotificationsPage()) }; //System.Diagnostics.Debug.WriteLine("Opened"); //foreach (var data in p.Data) //{ // System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}"); //} //if (!string.IsNullOrEmpty(p.Identifier)) //{ // System.Diagnostics.Debug.WriteLine($"ActionId: {p.Identifier}"); //} }; LoadApplication(new App()); SlideOverKit.iOS.SlideOverKit.Init(); return(base.FinishedLaunching(app, options)); }
/// <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"])); }