Ejemplo n.º 1
0
        public ActionResult Index(string Compid)
        {
            if (string.IsNullOrEmpty(Compid))
            {
                return(RedirectToAction("Index", "ProspectListsClient"));
            }
            CompContact objcomp = new CompContact();

            try
            {
                int CompidIddecrypt = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(Compid))));
                var data            = context.SPgetCompdetailsbycompid(CompidIddecrypt).FirstOrDefault();
                if (data != null)
                {
                    objcomp.name    = data.name;
                    objcomp.biztype = data.biztype;
                    objcomp.addr2   = data.addr2;
                    objcomp.addr1   = data.addr1;
                    objcomp.weburl  = data.weburl;
                    if (data.weburl != "" && data.weburl != null)
                    {
                        if (!data.weburl.Contains("http://") || !data.weburl.Contains("https://"))
                        {
                            objcomp.weburl = "http://" + data.weburl;
                        }
                    }
                    objcomp.city  = data.city;
                    objcomp.state = data.state;
                    objcomp.zip   = data.zip;
                    if (data.target == null)
                    {
                        objcomp.target = false;
                    }
                    else
                    {
                        objcomp.target = Convert.ToBoolean(data.target);
                    }
                    if (data.priority == null)
                    {
                        objcomp.priority = false;
                    }
                    else
                    {
                        objcomp.priority = Convert.ToBoolean(data.priority);
                    }

                    objcomp.phone      = data.phone;
                    objcomp.citycircle = data.citycircle;
                    objcomp.listid     = data.listid;
                    objcomp.companyid  = CompidIddecrypt;
                    var CompContacts = context.SpGetContactlistbyCompid(CompidIddecrypt, objcomp.listid).ToList();
                    if (CompContacts != null)
                    {
                        foreach (var i in CompContacts)
                        {
                            ContactDetails objcondetails = new ContactDetails();
                            objcondetails.contactid          = i.contactid;
                            objcondetails.companyid          = i.companyid;
                            objcondetails.contactfullname    = i.contactfullname;
                            objcondetails.titlestandard      = i.titlestandard;
                            objcondetails.contactphone       = i.contactphone;
                            objcondetails.contactcellphone   = i.contactcellphone;
                            objcondetails.contactemail       = i.contactemail;
                            objcondetails.listid             = i.listid;
                            objcondetails.linkedinprofileurl = i.linkedinprofileurl;
                            objcondetails.combinednotes      = i.combinednotes;
                            objcondetails.contactemail       = i.contactemail;
                        }
                    }
                }

                var Complst = context.SPgetCompanies(objcomp.listid).ToList().Select(xx => new SelectListItem {
                    Value = xx.companyid.ToString(), Text = xx.name + " - Business Type : " + xx.biztype
                }).ToList();
                ViewData["Complst"] = Complst;
                if (TempData["ConEmail"] != null)
                {
                    ViewBag.ConEmail = TempData["ConEmail"];
                }
            }
            catch (Exception ex)
            {
                cm.ErrorExceptionLogingByService(ex.ToString(), "ProspectViewCompanyClient" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "Index", "NA", "NA", "NA", "WEB");
            }
            return(View(objcomp));
        }