예제 #1
0
 public ActionResult EditUpdateCompany(CompanyModel objcomp)
 {
     try
     {
         if (objcomp.companyid == 0)
         {
             context.SPInsertCompanies(objcomp.citycircle, objcomp.biztype, objcomp.name, objcomp.addr1, objcomp.addr2, objcomp.city, objcomp.state, objcomp.zip, objcomp.weburl, objcomp.phone, objcomp.priority, objcomp.target, objcomp.combinednotes, objcomp.adminnotes, objcomp.notes, objcomp.listid);
             context.SaveChanges();
             TempData["Message"] = "Record Saved";
         }
         if (objcomp.companyid != 0)
         {
             context.SPupdateCompanies(objcomp.citycircle, objcomp.biztype, objcomp.name, objcomp.addr1, objcomp.addr2, objcomp.city, objcomp.state, objcomp.zip, objcomp.weburl, objcomp.phone, objcomp.priority, objcomp.target, objcomp.combinednotes, objcomp.adminnotes, objcomp.notes, objcomp.companyid, objcomp.listid);
             context.SaveChanges();
             TempData["compnyid"] = objcomp.companyid;
             TempData["Message"]  = "Record Updated";
         }
         var listname = context.Prospecting_Lists.Where(x => x.listid == objcomp.listid).FirstOrDefault().listname;
         objcomp.listname = listname;
     }
     catch (Exception ex)
     {
         TempData["Message"] = "Some Error Occured";
     }
     return(RedirectToAction("Index", new { @listid = objcomp.listid, @lstname = objcomp.listname }));
 }
        public JsonResult Save_List(string ListName, string restricted)
        {
            string str = "";

            try
            {
                byte res = 0;
                if (restricted == "Yes")
                {
                    res = 1;
                }
                else
                {
                    res = 0;
                }
                var countlst = context.Prospecting_Lists.Where(x => x.listname == ListName).Count();
                var username = User.Identity.Name;
                if (countlst == 0)
                {
                    context.SPInsertProspectlist(ListName, res, username);
                    context.SaveChanges();
                    str = "Success";
                }
                else
                {
                    str = "List already exist";
                }
            }
            catch (Exception ex)
            {
                cm.ErrorExceptionLogingByService(ex.ToString(), "ProspectListsClient" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "Save_List", "NA", "NA", "NA", "WEB");
                str = "Error Occured";
            }
            return(Json(str, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ActionResult SaveContact(ContactDetails objcont)
        {
            try
            {
                objcont.companyid = Convert.ToInt32(Request.Form["txtcompid"]);
                objcont.contactid = Convert.ToInt32(Request.Form["txtconid"]);
                if (objcont.contactid == 0)
                {
                    context.SpaddContact(objcont.contactfullname, objcont.titlestandard, "", objcont.contactcellphone, objcont.contactemail, objcont.linkedinprofileurl, objcont.combinednotes, objcont.companyid);
                    context.SaveChanges();
                }
                else
                {
                    context.SpupdateContact(objcont.contactfullname, objcont.titlestandard, "", objcont.contactcellphone, objcont.contactemail, objcont.linkedinprofileurl, objcont.combinednotes, objcont.contactid);
                    context.SaveChanges();
                }
                TempData["ConEmail"] = objcont.contactemail;
            }
            catch (Exception ex)
            {
                cm.ErrorExceptionLogingByService(ex.ToString(), "ProspectViewCompany" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "SaveContact", "NA", "NA", "NA", "WEB");
            }


            return(RedirectToAction("Index", new { @Compid = @cm.Code_Encrypt(CryptorEngine.Encrypt(objcont.companyid.ToString())) }));
        }
예제 #4
0
 public ActionResult SaveWhiteboard()
 {
     try
     {
         var Wbid   = Request.Form["hdnwbid"];
         var Wbname = Request.Form["txtwbname"];
         context.SpupdatewhiteBoard(Wbname, Convert.ToInt32(Wbid));
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         cm.ErrorExceptionLogingByService(ex.ToString(), "WhiteBoards" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "SaveWhiteboard", "NA", "NA", "NA", "WEB");
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult DeleteEmailtemplate(string TemplateId)
        {
            try
            {
                if (!string.IsNullOrEmpty(TemplateId))
                {
                    int TemplateIddecrypt = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(TemplateId))));
                    context.SpDeleteEmailTemplate(TemplateIddecrypt);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                cm.ErrorExceptionLogingByService(ex.ToString(), "EmailTemplate" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "DeleteEmailtemplate", "NA", "NA", "NA", "WEB");
            }

            return(RedirectToAction("Index"));
        }
예제 #6
0
 public ActionResult ActivateUser(string userIdval)
 {
     try
     {
         var userID      = new Guid(userIdval);
         var userdetails = context.aspnet_Membership.Where(x => x.UserId == userID).FirstOrDefault();
         if (userdetails != null)
         {
             userdetails.IsApproved = true;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
     return(View());
 }
예제 #7
0
        public ActionResult CreateUser(UserData objuser)
        {
            try
            {
                if (objuser.UserId == null)
                {
                    MembershipUser newUser = Membership.CreateUser(objuser.name, objuser.Password);
                    if (newUser != null)
                    {
                        newUser.IsApproved = objuser.IsApproved;
                        newUser.Email      = objuser.Email;
                        Membership.UpdateUser(newUser);
                        Roles.AddUserToRoles(newUser.UserName, objuser.Roles);
                        TempData["Message"] = "User Created";
                        return(RedirectToAction("Index", "ManageUser"));
                    }
                }
                else
                {
                    Guid           newid = new Guid(objuser.UserId);
                    MembershipUser u     = Membership.GetUser(newid);
                    if (u != null)
                    {
                        //u.Email=objuser.Email ;
                        //Membership.UpdateUser(u);
                        //u.IsApproved= objuser.IsApproved;
                        //Membership.UpdateUser(u);
                        var rolessaved = Roles.GetRolesForUser(u.UserName);
                        if (!string.IsNullOrEmpty(objuser.Password))
                        {
                            u.ChangePassword(u.ResetPassword(), objuser.Password);
                        }

                        if (rolessaved.Count() > 0)
                        {
                            Roles.RemoveUserFromRoles(u.UserName, rolessaved);
                        }
                        Roles.AddUserToRoles(u.UserName, objuser.Roles);
                        var checkusername = context.aspnet_Users.Where(x => x.UserName == objuser.name && x.UserId != newid).Count();
                        var userdetails   = context.aspnet_Membership.Where(x => x.UserId == newid).FirstOrDefault();
                        if (userdetails != null)
                        {
                            userdetails.Email       = objuser.Email;
                            userdetails.IsApproved  = objuser.IsApproved;
                            userdetails.IsLockedOut = objuser.IsLockedOut;
                            userdetails.FailedPasswordAttemptCount = 0;
                            context.SaveChanges();
                        }
                        if (checkusername == 0)
                        {
                            var usernamedata = context.aspnet_Users.Where(x => x.UserId == newid).FirstOrDefault();
                            usernamedata.UserName = objuser.name;
                            context.SaveChanges();
                            TempData["Message"] = "User Updated";
                            return(RedirectToAction("Index", "ManageUser"));
                        }
                        else
                        {
                            TempData["Message"] = "Username already exist";
                        }
                    }
                    else
                    {
                        TempData["Message"] = "Username not exist";
                    }
                }
            }
            catch (MembershipCreateUserException e)
            {
                cm.ErrorExceptionLogingByService(e.ToString(), "ManageUser" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "CreateUser", "NA", "NA", "NA", "WEB");
                var msg = GetErrorMessage(e.StatusCode);
                TempData["Message"] = msg;
            }
            return(RedirectToAction("SaveUser", new { UserId = objuser.UserId }));
        }
예제 #8
0
        public ActionResult SaveContact(ContactDetails objcont)
        {
            try
            {
                objcont.companyid = Convert.ToInt32(Request.Form["txtcompid"]);
                objcont.contactid = Convert.ToInt32(Request.Form["txtconid"]);
                if (objcont.contactid == 0)
                {
                    ObjectParameter objParam     = new ObjectParameter("NewContactID", typeof(int));
                    var             NewContactid = context.SpaddContactClient(objcont.contactfullname, objcont.titlestandard, objcont.contactphone, objcont.contactcellphone, objcont.contactemail, objcont.linkedinprofileurl, "", objcont.companyid, "", objcont.combinednotes, User.Identity.Name, objParam).FirstOrDefault();
                    context.SaveChanges();
                    objcont.contactid = Convert.ToInt32(NewContactid);
                }
                else
                {
                    context.SpupdateContactClient(objcont.contactfullname, objcont.titlestandard, objcont.contactphone, objcont.contactcellphone, objcont.contactemail, objcont.linkedinprofileurl, objcont.combinednotes, objcont.contactid, "");
                    context.SaveChanges();
                }
                var data = context.Spgetclientnote(objcont.contactid, User.Identity.Name);
                if (data.Count() == 0)
                {
                    context.SpInsertclientnote(objcont.contactid, User.Identity.Name, objcont.combinednotes);
                    context.SaveChanges();
                }
                else
                {
                    context.Spupdateclientnote(objcont.contactid, User.Identity.Name, objcont.combinednotes);
                    context.SaveChanges();
                }


                TempData["ConEmail"] = objcont.contactemail;
            }
            catch (Exception ex)
            {
                cm.ErrorExceptionLogingByService(ex.ToString(), "ProspectViewCompanyClient" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "SaveContact", "NA", "NA", "NA", "WEB");
            }


            return(RedirectToAction("Index", new { @Compid = @cm.Code_Encrypt(CryptorEngine.Encrypt(objcont.companyid.ToString())) }));
        }