public ActionResult ReassignProspects(FormCollection form) { var success = true; try { var prospectIds = form["PersonID"]; var userId = form["UserID"]; foreach (var prospectId in prospectIds.Split(',')) { if (string.IsNullOrEmpty(prospectId)) { continue; } var oldUser = prospectId.Split('_')[1]; var pId = prospectId.Split('_')[0]; if (oldUser == userId) { success = false; } else { CRM_UserMapping obj = new CRM_UserMapping(); int length = pId.Length; if (length > 8) { string personsid = pId.Remove(0, 25); obj.PersonID = Convert.ToInt64(personsid); } else { obj.PersonID = Convert.ToInt64(pId); } obj.UpdatedBy = CurrentUser.NameIdentifierInt64; obj.UpdatedOn = DateTime.Now; // AssignedBy= CurrentUser.NameIdentifierInt64.ToString(), obj.UserID = Convert.ToInt64(userId); _objSaleBAL.ReassignProspectBAL(obj); Library.TMS.Notifications nof = new Library.TMS.Notifications(); nof.NotificationText = "Your have assigned a prospect"; nof.Organization_ID = CurrentUser.CompanyID; nof.ToUser = Convert.ToInt64(obj.UserID); nof.FromUser = CurrentUser.NameIdentifierInt64; nof.ActionUrl = "Prospect/Detail?pid=" + obj.PersonID; nof.Event_ID = 2; nof.CreatedDate = DateTime.Now; BALNotification.create_NotificationsBAL(nof); var notificationHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); notificationHub.Clients.All.notify("added"); } } } catch (Exception ex) { } return(View("SaleAdminstration")); }
public ActionResult ReassignProspects(FormCollection form) { var success = true; try { var prospectIds = form["PersonID"]; var userId = form["UserID"]; foreach (var prospectId in prospectIds.Split(',')) { if (string.IsNullOrEmpty(prospectId)) { continue; } var oldUser = prospectId.Split('_')[1]; var pId = prospectId.Split('_')[0]; if (oldUser == userId) { success = false; } else { CRM_UserMapping obj = new CRM_UserMapping(); int length = pId.Length; if (length > 8) { string personsid = pId.Remove(0, 25); obj.PersonID = Convert.ToInt64(personsid); } else { obj.PersonID = Convert.ToInt64(pId); } obj.UpdatedBy = CurrentUser.NameIdentifierInt64; obj.UpdatedOn = DateTime.Now; // AssignedBy= CurrentUser.NameIdentifierInt64.ToString(), obj.UserID = Convert.ToInt64(userId); _objSaleBAL.ReassignProspectBAL(obj); } } } catch (Exception ex) { throw; } return(View("SaleAdminstration")); }