Exemplo n.º 1
0
        public static string InviteBOwner(string obj)
        {
            JavaScriptSerializer jss = new JavaScriptSerializer();
            InvitationType       it  = new InvitationType();

            it = jss.Deserialize <InvitationType>(obj);
            Guid UserID = new Guid(HttpContext.Current.Session["UserID"].ToString());
            int  rValue = 0;

            RegistrationModel.GetRegisterDetails ObjUserInfo = RegisterManager.GetProfileDetailsByUserID(UserID);
            string strFullName              = ObjUserInfo.strFirstName + " " + ObjUserInfo.strLastName;
            string strEmailID               = it.strEmail;
            string strMailSubject           = "Be part of business contacts and grow your business!";
            Guid   OwnerInvitationID        = Guid.NewGuid();
            string RegistrationLink         = System.Configuration.ConfigurationManager.AppSettings["SiteURL"] + "/LaunchPage.aspx?InviID=" + OwnerInvitationID + "&&mid=" + UserID;
            NameValueCollection mergeFields = new NameValueCollection();

            mergeFields.Add("**REGISTRATIONURL**", RegistrationLink);
            mergeFields.Add("**ToName**", it.strName);
            mergeFields.Add("**FromName**", strFullName);
            mergeFields.Add("**FromEmail**", ObjUserInfo.strEmail);
            mergeFields.Add("**FromMobile**", ObjUserInfo.strMobile);
            ContactsModel.InviteOwner ObjOwnr = jss.Deserialize <ContactsModel.InviteOwner>(obj);
            string strMessageBody             = EmailUtils.GetMailBody("InviteByHelpdesk.html", mergeFields);
            Guid   InvitedToID = new Guid();

            EmailUtils.SendEmail(ObjUserInfo.strEmail, strEmailID, strMailSubject, strMessageBody);
            //insert query
            ObjOwnr.guidOwnerInvitationID = OwnerInvitationID;
            ObjOwnr.guidInvitedByID       = UserID;
            ObjOwnr.guidInvitedToID       = InvitedToID;
            ObjOwnr.byteMInvitationStatus = Convert.ToByte(UIEnums.MInvitationStatus.Sent);
            ObjOwnr.strEmail  = it.strEmail;
            ObjOwnr.strName   = it.strName;
            ObjOwnr.strMobile = it.strMobile;
            rValue            = ContactManager.InviteOwner(ObjOwnr);
            return(rValue.ToString());
        }