Exemple #1
0
        //[DisableValidation]
        public ActionResult EditStatusRescheduled(Sls_Task _objTask)
        {
            _objTask.ModifiedBy = CurrentUser.NameIdentifierInt64;
            _objTask.ModifiedOn = DateTime.Now;
            var result = this._TaskBAL.ChangeStatus_RescheduleBAL(_objTask);

            if (result == -1)
            {
                ModelState.AddModelError(lr.ErrorServerError, lr.ErrorServerError);
            }
            else
            {
                var results = this._TaskBAL.Task_GetBALbyOrganization(CurrentCulture.ToString(), CurrentUser.CompanyID.ToString(), CurrentUser.NameIdentifierInt64, _objTask.ID);
                var r       = results.First();
                Library.TMS.Notifications nof = new Library.TMS.Notifications();
                nof.NotificationText = "Your Task has rescheduled to " + _objTask.DueDate.Date;
                nof.Organization_ID  = CurrentUser.CompanyID;
                nof.ToUser           = Convert.ToInt64(r.AssignedTo);
                nof.FromUser         = CurrentUser.NameIdentifierInt64;
                nof.ActionUrl        = "../Task/Detail?pid=" + _objTask.ID;
                nof.Event_ID         = 3;
                nof.CreatedDate      = DateTime.Now;
                BALNotification.create_NotificationsBAL(nof);
                var notificationHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>();
                notificationHub.Clients.All.notify("added");
            }
            var resultData = new[] { _objTask };

            return(RedirectToAction("Index"));
        }
Exemple #2
0
        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"));
        }
Exemple #3
0
        public ActionResult Task_Create([DataSourceRequest] DataSourceRequest request, Sls_Task _objTasks)
        {
            if (ModelState.IsValid)
            {
                if (_objTasks.LeadID == null)
                {
                    _objTasks.LeadID = "";
                }
                if (_objTasks.Description == null)
                {
                    _objTasks.Description = "";
                }
                Sls_Task objTask = new Sls_Task
                {
                    LeadID         = _objTasks.LeadID,
                    DueDate        = _objTasks.DueDate,
                    OrganizationID = CurrentUser.CompanyID,
                    Status         = 3,
                    Description    = _objTasks.Description,
                    TaskType       = _objTasks.TaskType,
                    CompletionTime = DateTime.Now,
                    CreatedBy      = CurrentUser.NameIdentifierInt64,
                    CreatedOn      = DateTime.Now,
                    ModifiedBy     = CurrentUser.NameIdentifierInt64,
                    ModifiedOn     = DateTime.Now,
                    IsDeleted      = false,
                    IsActive       = true,
                    AssignedBy     = CurrentUser.NameIdentifierInt64,
                    AssignedTo     = _objTasks.AssignedTo
                };
                _objTasks.ID = _TaskBAL.Task_CreateBAL(objTask);
                Library.TMS.Notifications nof = new Library.TMS.Notifications();
                nof.NotificationText = "Your have assigned a New Task";
                nof.Organization_ID  = CurrentUser.CompanyID;
                nof.ToUser           = Convert.ToInt64(_objTasks.AssignedTo);
                nof.FromUser         = CurrentUser.NameIdentifierInt64;
                nof.ActionUrl        = "../Task/Detail?pid=" + _objTasks.ID;
                nof.Event_ID         = 3;
                nof.CreatedDate      = DateTime.Now;
                BALNotification.create_NotificationsBAL(nof);
                var notificationHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>();
                notificationHub.Clients.All.notify("added");
                if (_objTasks.ID == -1)
                {
                    ModelState.AddModelError(lr.ErrorServerError, lr.ErrorServerError);
                }
            }

            var resultData = new[] { _objTasks };

            return(Json(resultData.ToDataSourceResult(request, ModelState)));
        }
Exemple #4
0
        public ActionResult Person_Update([DataSourceRequest] DataSourceRequest request, Person _person, string filename, long aid)
        {
            _person.UpdatedBy   = CurrentUser.NameIdentifierInt64;
            _person.UpdatedDate = DateTime.Now;

            bool _valid = false;

            if (_UserBAL.LoginPerson_DuplicationCheckBAL(new Person {
                Email = _person.Email, CreatedBy = _person.CreatedBy
            }) > 0)
            {
                ModelState.AddModelError(lr.UserEmailAlreadyExist, lr.UserEmailAlreadyExist);
                // return Json(lr.UserEmailAlreadyExist, JsonRequestBehavior.AllowGet);
                _valid = false;
            }
            else if (_UserBAL.LoginPerson_DuplicationPhoneNumberUpdateCheckBAL(new Person {
                ContactNumber = _person.ContactNumber, CreatedBy = CurrentUser.CompanyID, ID = _person.ID
            }) > 0)
            {
                ModelState.AddModelError(lr.DubliocationHappen, lr.PersonContactPhoneDuplicationCheck);
                //return Json(lr.UserEmailAlreadyExist, JsonRequestBehavior.AllowGet);
            }
            else
            {
                if (_person.Email != null)//when Email is Provided
                {
                    _valid = true;
                }
                else if (_person.ContactNumber != null) //when Contact number is provided
                {
                    if (_person.CountryCode == 0)       //when country code is  provided
                    {
                        _person.CountryCode = 134;
                        _valid = true;
                        //ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde);
                    }
                    else
                    {
                        _valid = true;
                    }
                }
                else
                {
                    ModelState.AddModelError(lr.PersonContactEmail, lr.PersonEmailorPhoneRequired);
                }
                if (_valid)
                {
                    _person.UpdatedBy = CurrentUser.NameIdentifierInt64;
                    if (_person.CrmClientType == null)
                    {
                        _person.CrmClientType = CRMClientType.Not_Specified;
                    }
                    var result = _PersonBAL.Person_UpdateBAL(_person);
                    _person.ProfilePicture = HandlePersonProfilePicture(filename, _person.ID, aid);
                    if (result != -1)
                    {
                        if (_person.clientstatus == null)
                        {
                            _person.clientstatus = CRMClientType.Not_Specified;
                        }
                        _PersonBAL.ManageAssigned_UpdateBAL(_person);
                        Library.TMS.Notifications nof = new Library.TMS.Notifications();
                        nof.NotificationText = "Your have assigned a prospect";
                        nof.Organization_ID  = CurrentUser.CompanyID;
                        nof.ToUser           = Convert.ToInt64(_person.AssignedTo);
                        nof.FromUser         = CurrentUser.NameIdentifierInt64;
                        nof.ActionUrl        = "Prospect/Detail?pid=" + _person.ID;
                        nof.Event_ID         = 2;
                        nof.CreatedDate      = DateTime.Now;
                        BALNotification.create_NotificationsBAL(nof);
                        var notificationHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>();
                        notificationHub.Clients.All.notify("added");
                        if (_person.PhoneID > 0)
                        {
                            if (_person.ContactNumber != null)
                            {
                                if (_person.CountryCode == 0)
                                {
                                    _person.CountryCode = 134;
                                }
                                if (_person.CountryCode != 0)//when country code is  provided
                                {
                                    PhoneNumbers _objPhoneNumbers = new PhoneNumbers
                                    {
                                        ID            = _person.PhoneID,
                                        ContactNumber = _person.ContactNumber,
                                        CountryCode   = _person.CountryCode,
                                        IsPrimary     = true,
                                        Extension     = _person.Extension,
                                        UpdatedBy     = CurrentUser.NameIdentifierInt64,
                                        UpdatedDate   = DateTime.Now
                                    };
                                    _objPersonContactBAL.PersonPhoneNumbers_UpdateBAL(_objPhoneNumbers, _person.ID);
                                }
                                else
                                {
                                }
                            }
                        }
                        else
                        {
                            if (_person.ContactNumber != null) //when Contact number is provided
                            {
                                if (_person.CountryCode == 0)  //when country code is  provided
                                {
                                    ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde);
                                }
                                else
                                {
                                    PhoneNumbers _objPhoneNumbers = new PhoneNumbers
                                    {
                                        ID            = _person.PhoneID,
                                        ContactNumber = _person.ContactNumber,
                                        CountryCode   = _person.CountryCode,
                                        IsPrimary     = true,
                                        Extension     = _person.Extension,
                                        CreatedBy     = CurrentUser.NameIdentifierInt64,
                                        CreatedDate   = DateTime.Now
                                    };
                                    _person.PhoneID = _objPersonContactBAL.PersonPhoneNumbers_CreateBAL(_objPhoneNumbers, _person.ID);
                                }
                            }
                        }
                        if (_person.EmailID > 0)
                        {
                            if (_person.Email != null)//when Email is Provided
                            {
                                EmailAddresses _objEmailAddresses = new EmailAddresses
                                {
                                    ID          = _person.EmailID,
                                    Email       = _person.Email,
                                    IsPrimary   = true,
                                    UpdatedBy   = CurrentUser.NameIdentifierInt64,
                                    UpdatedDate = DateTime.Now
                                };
                                _objPersonContactBAL.PersonEmailAddress_UpdateBAL(_objEmailAddresses, _person.ID);
                            }
                        }
                        else
                        {
                            if (_person.Email != null)//when Email is Provided
                            {
                                EmailAddresses _objEmailAddresses = new EmailAddresses
                                {
                                    Email       = _person.Email,
                                    IsPrimary   = true,
                                    CreatedBy   = CurrentUser.NameIdentifierInt64,
                                    CreatedDate = DateTime.Now
                                };
                                _person.EmailID = _objPersonContactBAL.PersonEmailAddress_CreateBAL(_objEmailAddresses, _person.ID);
                            }
                        }
                    }
                }
            }
            var resultData = new[] { _person };

            if (_person.Flags != null)
            {
                _person.Flags = _person.Flags.Where(i => i != null).ToList();
            }
            //return Json(new object[0].ToDataSourceResult(request, ModelState));
            return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState)));
        }
Exemple #5
0
        public ActionResult Person_Create([DataSourceRequest] DataSourceRequest request, Person _person)
        {
            if (ModelState.IsValid)
            {
                bool _valid = false;
                if (_UserBAL.LoginPerson_DuplicationCheckBAL(new Person {
                    Email = _person.Email, CreatedBy = CurrentUser.CompanyID
                }) > 0)
                {
                    ModelState.AddModelError(lr.UserEmailAlreadyExist, lr.UserEmailAlreadyExist);
                    // return Json(lr.UserEmailAlreadyExist, JsonRequestBehavior.AllowGet);
                    _valid = false;
                }
                else if (_UserBAL.LoginPerson_DuplicationPhoneNumberCheckBAL(new Person {
                    ContactNumber = _person.ContactNumber, CreatedBy = CurrentUser.CompanyID
                }) > 0)
                {
                    ModelState.AddModelError(lr.DubliocationHappen, lr.PersonContactPhoneDuplicationCheck);
                    //return Json(lr.UserEmailAlreadyExist, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    //if (_person.Email != null)//when Email is Provided
                    //{
                    //    _valid = true;
                    //}
                    //else
                    //if (_person.ContactNumber != null)//when Contact number is provided
                    //{
                    //    if (_person.CountryCode == 0)//when country code is  provided
                    //    {
                    //        ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde);
                    //    }
                    //    else
                    //    {
                    //        _valid = true;
                    //    }
                    //}
                    //else
                    //{
                    //    ModelState.AddModelError(lr.PersonContactEmail, lr.PersonEmailorPhoneRequired);
                    //}
                    _valid = true;
                    if (_valid)
                    {
                        _person.CreatedBy      = CurrentUser.NameIdentifierInt64;
                        _person.CreatedDate    = DateTime.Now;
                        _person.OrganizationID = CurrentUser.CompanyID;
                        string _profilePict = string.Empty;
                        _person.DateOfBirth = DateTime.Now;
                        var Resp = SavePersonData(_person, ref _profilePict);
                        _person.AddedByAlias = CurrentUser.Name;
                        _person.ID           = Resp.ID;
                        long val = Convert.ToInt64(_person.AssignedToString);
                        if (val == 0 || val < 0)
                        {
                            _person.AssignedTo = CurrentUser.NameIdentifierInt64;
                        }
                        else
                        {
                            _person.AssignedTo = val;
                        }
                        _person.PersonRegCode  = Resp.PersonRegCode;
                        _person.ProfilePicture = _profilePict;
                        long crmval = (long)_person.CrmClientType;


                        if (_person.ID != long.MinValue)
                        {
                            _PersonBAL.ManageAssigned_CreateBAL(_person);
                            Library.TMS.Notifications nof = new Library.TMS.Notifications();
                            nof.NotificationText = "Your have assigned a prospect";
                            nof.Organization_ID  = CurrentUser.CompanyID;
                            nof.ToUser           = Convert.ToInt64(_person.AssignedTo);
                            nof.FromUser         = CurrentUser.NameIdentifierInt64;
                            nof.ActionUrl        = "Prospect/Detail?pid=" + _person.ID;
                            nof.Event_ID         = 2;
                            nof.CreatedDate      = DateTime.Now;
                            BALNotification.create_NotificationsBAL(nof);
                            var notificationHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>();
                            notificationHub.Clients.All.notify("added");
                            if (_person.ContactNumber != null)//when ContactNumber is Provided
                            {
                                PhoneNumbers _objPhoneNumbers = new PhoneNumbers
                                {
                                    ContactNumber = _person.ContactNumber,
                                    CountryCode   = _person.CountryCode,
                                    IsPrimary     = true,
                                    Extension     = _person.Extension,
                                    CreatedBy     = CurrentUser.NameIdentifierInt64,
                                    CreatedDate   = DateTime.Now
                                };
                                _person.PhoneID = _objPersonContactBAL.PersonPhoneNumbers_CreateBAL(_objPhoneNumbers, _person.ID);
                            }
                            if (_person.Email != null)//when Email is Provided
                            {
                                EmailAddresses _objEmailAddresses = new EmailAddresses
                                {
                                    Email       = _person.Email,
                                    IsPrimary   = true,
                                    CreatedBy   = CurrentUser.NameIdentifierInt64,
                                    CreatedDate = DateTime.Now
                                };
                                _person.EmailID = _objPersonContactBAL.PersonEmailAddress_CreateBAL(_objEmailAddresses, _person.ID);
                            }
                        }
                    }
                }
            }

            var resultData = new[] { _person };

            return(Json(resultData.ToDataSourceResult(request, ModelState)));
        }