protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { string un = AspNetSecurityHelper.GetCurrentUserName; NotificationManager _NotificationManager = new NotificationManager(); if (e.CommandName == "DeleteUpdate") { string Id = e.CommandArgument.ToString(); int id = 0; if (int.TryParse(Id, out id)) { string operation = (String)GetGlobalResourceObject("HCMResource", "Delete"); int i = 0;//_NotificationManager.DeleteNotification(id); DAL.Entity.Notification obj = _NotificationManager.GetNotification(id); if (obj != null) { obj.DeletedFlag = true; obj.LastUpdatedBy = un; obj.LastUpdatedDate = DateTime.Now; i = _NotificationManager.UpdateNotification(obj); } if (i != 0) { ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationSuccess"), operation), "", Common.msgType.alertMessageSuccess); } else { ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationError"), operation), "", Common.msgType.alertMessageDanger); } FillData(); } } }
public int UpdateNotification(DAL.Entity.Notification Notification) { try { _INotificationRepository.Update(Notification); return(_INotificationRepository.Save()); } catch (Exception exception) { exception.Log(); return(0); } }
protected void btnSave_Click(object sender, EventArgs e) { var user = AspNetSecurityHelper.currentAppUser; if (user != null) { NotificationManager _NotificationManager = new NotificationManager(); SSAManager _SSAManager = new SSAManager(); DAL.Entity.Notification obj = _NotificationManager.GetNotification(queryStringId); if (obj == null) { obj = new DAL.Entity.Notification(); } obj.Title = txtTitle.Text; obj.Description = txtDescription.Text.Replace("\r\n", "<br/>"); string lat = ucLocation.Lat; string lng = ucLocation.Lng; if (!String.IsNullOrEmpty(lat) && !String.IsNullOrEmpty(lng)) { obj.Latitude = lat; obj.Longitude = lng; } int ut = 0; if (int.TryParse(ddlUserType.SelectedValue, out ut) && ut != 0) { obj.UserTypeId = ut; } int nl = 0; if (int.TryParse(ddlNotificationLevel.SelectedValue, out nl) && nl != 0) { obj.NotificationLevelId = nl; } obj.Status = true; int i = 0; if (obj.Id == 0) { obj.CreatedBy = user.UserName; obj.CreatedDate = DateTime.Now; obj.DeletedFlag = false; i = _NotificationManager.AddNotification(obj); Operation = (String)GetGlobalResourceObject("HCMResource", "Add"); btnSave.Visible = false; } else { obj.LastUpdatedBy = user.UserName; obj.LastUpdatedDate = DateTime.Now; i = _NotificationManager.UpdateNotification(obj); Operation = (String)GetGlobalResourceObject("HCMResource", "Update"); } if (i != 0) { ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationSuccess"), Operation), "", Common.msgType.alertMessageSuccess); FillData(); } else { ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationError"), Operation), "", Common.msgType.alertMessageDanger); } } else { Response.Redirect("/"); } }