Exemplo n.º 1
0
 public MirandaDatabaseEventArgs(ContactInfo contact, DatabaseEventInfo eventInfo) : base(contact)
 {
     if (eventInfo == null) 
         throw new ArgumentNullException("eventInfo");
                 
     this.eventInfo = eventInfo;
 }
Exemplo n.º 2
0
        public MirandaContactEventArgs(ContactInfo contactInfo)
        {
            if (contactInfo == null) 
                throw new ArgumentNullException("contactInfo");

            this.contactInfo = contactInfo;
        }
    protected void EditForm_OnAfterValidate(object sender, EventArgs e)
    {
        // Test if selected date is not empty
        if (ValidationHelper.GetString(EditForm.GetFieldValue("ActivityCreated"), String.Empty) == String.Empty)
        {
            ShowError(GetString("om.sctivity.selectdatetime"));
            StopProcessing = true;
        }

        // Ignore contact selector value when there is contactId in query string (contact selector should be hidden in this case due to its visibility condition)
        int queryContactID = QueryHelper.GetInteger("ContactID", 0);
        if (queryContactID > 0)
        {
            mContact = ContactInfoProvider.GetContactInfo(queryContactID);
        }
        else
        {
            int contactID = ValidationHelper.GetInteger(EditForm.GetFieldValue("ActivityActiveContactID"), 0);
            mContact = ContactInfoProvider.GetContactInfo(contactID);
        }

        // Test if selected contact exists
        if (mContact == null)
        {
            ShowError(GetString("om.activity.contactdoesnotexist"));
            StopProcessing = true;
        }
    }
 public VMContactInfo(ContactInfo c)
 {
     Title = c.Title;
     Information = c.Information;
     Id = c.Id;
     UserId = c.UserId;
 }
Exemplo n.º 5
0
        public static bool ShowAwayMessage(ContactInfo contact)
        {
            int result = MirandaContext.Current.CallService(MS_AWAYMSG_SHOWAWAYMSG, contact.MirandaHandle, IntPtr.Zero);
            Debug.Assert(result == 0);

            return result == 0;
        }
        public List<ContactInfo> GetContactList()
        {
            List<ContactInfo> contacts = new List<ContactInfo>();
            // System.Console.WriteLine("Before FetchContact {0}", m_handle);
            BulletHelper_FetchContact(m_handle);
            uint numEntries = m_collisionsPinned[1];
            uint offsetStride = m_collisionsPinned[2];
            uint offset = 3;     // size of header (max, cnt, stride)
            for (int ii = 0; ii < numEntries ; ii++)
            {
                ContactInfo ci = new ContactInfo();
                ci.contact = m_collisionsPinned[offset + 0];
                ci.contactWith = m_collisionsPinned[offset + 1];
                ci.pX = m_collisionsPinned[offset + 2] / 1000.0f;
                ci.pY = m_collisionsPinned[offset + 3] / 1000.0f;
                ci.pZ = m_collisionsPinned[offset + 4] / 1000.0f;
                ci.nX = m_collisionsPinned[offset + 5] / 1000.0f;
                ci.nY = m_collisionsPinned[offset + 6] / 1000.0f;
                ci.nZ = m_collisionsPinned[offset + 7] / 1000.0f;
                ci.depth = m_collisionsPinned[offset + 8] / 1000.0f;
                offset += offsetStride;
                // if collision info is zero, don't pass the info up
                // if (ci.X == 0 && ci.Y == 0 && ci.Z == 0) continue;
                contacts.Add(ci);
            }

            return contacts;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUIElementAccessHierarchical(ModuleName.ONLINEMARKETING, "ContactMembership.Subscribers");
        ci = (ContactInfo)EditedObject;
        if (ci == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        CheckReadPermission(ci.ContactSiteID);

        globalContact = (ci.ContactSiteID <= 0);
        mergedContact = (ci.ContactMergedWithContactID > 0);
        modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false);

        contactId = QueryHelper.GetInteger("contactid", 0);

        string where = null;
        // Filter only site members in CMSDesk (for global contacts)
        if (!IsSiteManager && globalContact && AuthorizedForSiteContacts)
        {
            where = " (ContactSiteID IS NULL OR ContactSiteID=" + SiteContext.CurrentSiteID + ")";
        }

        // Choose correct object ("query") according to type of contact
        if (globalContact)
        {
            gridElem.ObjectType = ContactMembershipGlobalSubscriberListInfo.OBJECT_TYPE;
        }
        else if (mergedContact)
        {
            gridElem.ObjectType = ContactMembershipMergedSubscriberListInfo.OBJECT_TYPE;
        }
        else
        {
            gridElem.ObjectType = ContactMembershipSubscriberListInfo.OBJECT_TYPE;
        }

        // Query parameters
        QueryDataParameters parameters = new QueryDataParameters();
        parameters.Add("@ContactId", contactId);

        gridElem.WhereCondition = where;
        gridElem.QueryParameters = parameters;
        gridElem.OnAction += gridElem_OnAction;
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;

        // Hide header actions for global contact or merged contact.
        CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact;

        // Setup subscriber selector
        selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton;
        selectSubscriber.UniSelector.OnItemsSelected += UniSelector_OnItemsSelected;
        selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID";
        selectSubscriber.UniSelector.DisplayNameFormat = "{%SubscriberFullName%} ({%SubscriberEmail%})";
        selectSubscriber.ShowSiteFilter = false;
        selectSubscriber.IsLiveSite = false;
        selectSubscriber.SiteID = ci.ContactSiteID;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ci = (ContactInfo)EditedObject;
        CheckReadPermission(ci.ContactSiteID);

        globalContact = (ci.ContactSiteID <= 0);
        mergedContact = (ci.ContactMergedWithContactID > 0);
        modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false);

        contactId = QueryHelper.GetInteger("contactid", 0);

        string where = null;
        // Filter only site members in CMSDesk (for global contacts)
        if (!IsSiteManager && globalContact && AuthorizedForSiteContacts)
        {
            where += " (ContactSiteID IS NULL OR ContactSiteID=" + CMSContext.CurrentSiteID + ")";
        }

        // Choose correct object ("query") according to type of contact
        if (globalContact)
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPGLOBALCUSTOMERLIST;
        }
        else if (mergedContact)
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPMERGEDCUSTOMERLIST;
        }
        else
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPCUSTOMERLIST;
        }

        // Query parameters
        QueryDataParameters parameters = new QueryDataParameters();
        parameters.Add("@ContactId", contactId);

        gridElem.WhereCondition = where;
        gridElem.QueryParameters = parameters;
        gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction);
        gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound);

        // Hide header actions for global contact
        CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact;

        // Setup customer selector
        try
        {
            ucSelectCustomer = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/Ecommerce/FormControls/CustomerSelector.ascx");
            ucSelectCustomer.SetValue("Mode", "OnlineMarketing");
            ucSelectCustomer.SetValue("SiteID", ci.ContactSiteID);
            ucSelectCustomer.Changed += new EventHandler(ucSelectCustomer_Changed);
            ucSelectCustomer.IsLiveSite = false;
            pnlSelectCustomer.Controls.Clear();
            pnlSelectCustomer.Controls.Add(ucSelectCustomer);
        }
        catch
        {
        }
    }
Exemplo n.º 9
0
        public CCSDATA(ContactInfo contact, string serviceName)
        {
            this.ContactHandle = contact.MirandaHandle;
            this.ServiceNamePtr = new UnmanagedStringHandle(serviceName, StringEncoding.Ansi).IntPtr;

            this.WParam = UIntPtr.Zero;
            this.LParam = IntPtr.Zero;
        }
Exemplo n.º 10
0
 public void addContactInfo(ContactInfo c, int userID)
 {
     using (var db = new PortfolioUnleashedContext())
     {
         db.Users.Include("ContactInfoes").Include("Educations").Include("Links").Include("Portfolios").Include("QuickReferences").FirstOrDefault(user => user.Id == userID).ContactInfoes.Add(c);
         db.SaveChanges();
     }
 }
Exemplo n.º 11
0
 public override bool UserCallback(Body body, float distance, Vector3 normal, int collisionID)
 {
     ContactInfo contact = new ContactInfo();
       contact.Distance = distance;
       contact.Body = body;
       contact.Normal = normal;
       Contacts.Add(contact);
       return true;
 }
Exemplo n.º 12
0
        public static ValidationResult ValidatePhoneNumber(ContactInfo contact)
        {
            bool isValid = !contact.ShowPhoneNumber || !string.IsNullOrEmpty(contact.PhoneNumber);

            if (isValid)
                return ValidationResult.Success;
            else
                return new ValidationResult("The Phone field is required when it is made visible on the listing.");
        }
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     ContactInfo contact = new ContactInfo();
     MacroResolver resolver = MacroContext.CurrentResolver.CreateChild();
     resolver.SetNamedSourceData("Contact", contact);
     DescriptionMacroEditor.Resolver = resolver;
     DescriptionMacroEditor.Editor.Language = LanguageEnum.Text;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        ci = (ContactInfo)EditedObject;
        CheckReadPermission(ci.ContactSiteID);

        globalContact = (ci.ContactSiteID <= 0);
        mergedContact = (ci.ContactMergedWithContactID > 0);
        modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false);

        contactId = QueryHelper.GetInteger("contactid", 0);

        string where = null;
        // Filter only site members in CMSDesk (for global contacts)
        if (!IsSiteManager && globalContact && AuthorizedForSiteContacts)
        {
            where = " (ContactSiteID IS NULL OR ContactSiteID=" + CMSContext.CurrentSiteID + ")";
        }

        // Choose correct object ("query") according to type of contact
        if (globalContact)
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPGLOBALSUBSCRIBERLIST;
        }
        else if (mergedContact)
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPMERGEDSUBSCRIBERLIST;
        }
        else
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPSUBSCRIBERLIST;
        }

        // Query parameters
        QueryDataParameters parameters = new QueryDataParameters();
        parameters.Add("@ContactId", contactId);

        gridElem.WhereCondition = where;
        gridElem.QueryParameters = parameters;
        gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction);
        gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound);

        // Hide header actions for global contact
        CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact;

        // Setup subscriber selector
        selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton;
        selectSubscriber.UniSelector.OnItemsSelected += new EventHandler(UniSelector_OnItemsSelected);
        selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID";
        selectSubscriber.UniSelector.DisplayNameFormat = "{%SubscriberFullName%} ({%SubscriberEmail%})";
        selectSubscriber.UniSelector.ButtonImage = GetImageUrl("Objects/Newsletter_Subscriber/add.png");
        selectSubscriber.UniSelector.DialogLink.CssClass = "MenuItemEdit";
        selectSubscriber.ShowSiteFilter = false;
        selectSubscriber.UniSelector.DialogButton.CssClass = "LongButton";
        selectSubscriber.IsLiveSite = false;
        selectSubscriber.SiteID = ci.ContactSiteID;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        editedContact = (ContactInfo)CMSPage.EditedObject;
        currentUser = CMSContext.CurrentUser;
        siteID = ContactHelper.ObjectSiteID(EditedObject);

        LoadPermissions();
        CheckReadPermissions();
        LoadGroupSelector();
        LoadContactGroups();
    }
        public MirandaContactSettingEventArgs(ContactInfo contactInfo, string name, string owner, object value, DatabaseSettingType valueType)
            : base(contactInfo)
        {
            if (String.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            this.settingName = name;
            this.settingOwner = owner;
            this.value = value;
            this.valueType = valueType;
        }
        private bool DetectChange(ContactInfo contact, params string[] columnNames)
        {
            foreach (string columnName in columnNames)
            {
                object current = contact.GetValue(columnName);
                object original = contact.GetOriginalValue(columnName);
                if (current != original)
                {
                    return true;
                }
            }

            return false;
        }
        public ConversationWindow(Conversation conversation, LyncClient client, ContactInfo contact, ConversationType conversationType)
        {
            InitializeComponent();

            //this.ApplyThemes();

            this.client = client;
            this.conversation = conversation;
            this.Contact = contact;
            this.conversationType = conversationType;

            this.Title = contact.DisplayName;

            InitializeConversation();
        }
Exemplo n.º 19
0
        public static List<ContactInfo> contactInfoListFromVMContactInfoList(List<VMContactInfo> vmContactInfos)
        {
            List<ContactInfo> contactInfos = new List<ContactInfo>();
            foreach(VMContactInfo vmContact in vmContactInfos)
            {
                ContactInfo contact = new ContactInfo()
                {
                    Title = vmContact.Title,
                    Information = vmContact.Information,
                    Id = vmContact.Id

                };
                contactInfos.Add(contact);
            }
            return contactInfos;
        }
 public int Contacts(ContactInfo contacts, int maxContacts, ref idVec3 start, ref idVec6 dir, float depth, idTraceModel trm, ref idMat3 trmAxis, int contentMask, CmHandle model, ref idVec3 origin, ref idMat3 modelAxis)
 {
     // same as Translation but instead of storing the first collision we store all collisions as contacts
     this.getContacts = true;
     this.contacts = contacts;
     this.maxContacts = maxContacts;
     this.numContacts = 0;
     idVec3 end = start + dir.SubVec3(0) * depth;
     Trace results;
     Translation(out results, start, end, trm, trmAxis, contentMask, model, origin, modelAxis);
     if (dir.SubVec3(1).LengthSqr() != 0.0f)
     { 
         // FIXME: rotational contacts 
     }
     this.getContacts = false;
     this.maxContacts = 0;
     return this.numContacts;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check UI personalization
        CheckUIElementAccessHierarchical(ModuleName.ONLINEMARKETING, "ContactContactGroups");

        editedContact = (ContactInfo)EditedObject;
        if (editedContact == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        currentUser = MembershipContext.AuthenticatedUser;
        siteID = ContactHelper.ObjectSiteID(EditedObject);

        LoadPermissions();
        CheckReadPermission();
        LoadGroupSelector();
        LoadContactGroups();
    }
Exemplo n.º 22
0
        public Customer Create(
			Guid id, string name, Address tradingAddressDetails, ContactInfo tradingContactInfo,
			string invoiceTitle, Address invoiceAddressDetails, ContactInfo invoiceContactInfo,
			string deliveryTitle, Address deliveryAddressDetails, ContactInfo deliveryContactInfo)
        {
            if (id == null || id == Guid.Empty)
                throw new ArgumentException("An ID must be supplied for the customer", "id");
            var customer = new Customer();
            customer.Name = name;
            customer.InvoiceTitle = !String.IsNullOrEmpty(invoiceTitle) ? invoiceTitle : String.Empty;
            customer.DeliveryTitle = !String.IsNullOrEmpty(deliveryTitle) ? deliveryTitle : String.Empty;
            PopulateTradingAddressInfo(customer, tradingAddressDetails);
            PopulateTradingContactInfo(customer, tradingContactInfo);
            PopulateInvoiceAddressInfo(customer, invoiceAddressDetails);
            PopulateSalesContactInfo(customer, invoiceContactInfo);
            PopulateDeliveryAddressInfo(customer, deliveryAddressDetails);
            PopulateDeliveryContactInfo(customer, deliveryContactInfo);
            _customerValidator.ValidateThrowOnFailure(customer);
            _customerRepository.Create(customer);
            return customer;
        }
Exemplo n.º 23
0
 public async Task SendEmail(ContactInfo contact)
 {
     await this.httpClient.PostAsJsonAsync("api/email", contact);
 }
Exemplo n.º 24
0
 public static void Contact_Update(ContactInfo data)
 {
     db.Contact_Update(data);
 }
Exemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Contact"/> class.
 /// </summary>
 /// <param name="world">The world on which to place the joint.</param>
 /// <param name="contact">
 /// A structure containing information about the contact point and
 /// colliding surfaces.
 /// </param>
 /// <param name="group">The joint group that will contain the joint.</param>
 public Contact(World world, ContactInfo contact, JointGroup group)
     : base(NativeMethods.dJointCreateContact(world.Id, dJointGroupID.Null, ref contact), world, group)
 {
 }
Exemplo n.º 26
0
        public ActionResult Contact()
        {
            ContactInfo m = ContactInfo.GetData();

            return(View(m));
        }
Exemplo n.º 27
0
        public ActionResult Footer()
        {
            ContactInfo m = ContactInfo.GetData();

            return(PartialView("_Footer", m));
        }
Exemplo n.º 28
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                _context = context;

                SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);

                if (!CheckPermission())
                {
                    throw new Exception(CRMSettingResource.WebToLeadsForm_InvalidKeyException);
                }

                Contact contact;

                var fieldCollector = new NameValueCollection();

                var addressTemplate = new JObject();

                foreach (String addressPartName in Enum.GetNames(typeof(AddressPart)))
                {
                    addressTemplate.Add(addressPartName.ToLower(), "");
                }

                var addressTemplateStr = addressTemplate.ToString();

                var firstName   = GetValue("firstName");
                var lastName    = GetValue("lastName");
                var companyName = GetValue("companyName");

                if (!(String.IsNullOrEmpty(firstName) || String.IsNullOrEmpty(lastName)))
                {
                    contact = new Person();

                    ((Person)contact).FirstName = firstName;
                    ((Person)contact).LastName  = lastName;
                    ((Person)contact).JobTitle  = GetValue("jobTitle");

                    fieldCollector.Add(CRMContactResource.FirstName, firstName);
                    fieldCollector.Add(CRMContactResource.LastName, lastName);

                    if (!String.IsNullOrEmpty(GetValue("jobTitle")))
                    {
                        fieldCollector.Add(CRMContactResource.JobTitle, ((Person)contact).JobTitle);
                    }
                }
                else if (!String.IsNullOrEmpty(companyName))
                {
                    contact = new Company();

                    ((Company)contact).CompanyName = companyName;

                    fieldCollector.Add(CRMContactResource.CompanyName, companyName);
                }
                else
                {
                    throw new ArgumentException();
                }

                contact.About = GetValue("about");

                if (!String.IsNullOrEmpty(contact.About))
                {
                    fieldCollector.Add(CRMContactResource.About, contact.About);
                }

                contact.ID = Global.DaoFactory.GetContactDao().SaveContact(contact);

                var contactInfos = new List <ContactInfo>();

                foreach (var key in _context.Request.Form.AllKeys)
                {
                    if (key.StartsWith("customField_"))
                    {
                        var    fieldID    = Convert.ToInt32(key.Split(new[] { '_' })[1]);
                        String fieldValue = GetValue(key);

                        if (String.IsNullOrEmpty(fieldValue))
                        {
                            continue;
                        }

                        var customField = Global.DaoFactory.GetCustomFieldDao().GetFieldDescription(fieldID);

                        if (customField == null)
                        {
                            continue;
                        }

                        fieldCollector.Add(customField.Label, fieldValue);

                        Global.DaoFactory.GetCustomFieldDao().SetFieldValue(EntityType.Contact, contact.ID, fieldID, fieldValue);
                    }
                    else if (key.StartsWith("contactInfo_"))
                    {
                        var nameParts       = key.Split(new[] { '_' }).Skip(1).ToList();
                        var contactInfoType = (ContactInfoType)Enum.Parse(typeof(ContactInfoType), nameParts[0]);
                        var category        = Convert.ToInt32(nameParts[1]);

                        if (contactInfoType == ContactInfoType.Address)
                        {
                            var addressPart = (AddressPart)Enum.Parse(typeof(AddressPart), nameParts[2]);

                            var findedAddress = contactInfos.Find(item => (category == item.Category) && (item.InfoType == ContactInfoType.Address));

                            if (findedAddress == null)
                            {
                                findedAddress = new ContactInfo
                                {
                                    Category  = category,
                                    InfoType  = contactInfoType,
                                    Data      = addressTemplateStr,
                                    ContactID = contact.ID
                                };

                                contactInfos.Add(findedAddress);
                            }

                            var addressParts = JObject.Parse(findedAddress.Data);

                            addressParts[addressPart.ToString().ToLower()] = GetValue(key);

                            findedAddress.Data = addressParts.ToString();

                            continue;
                        }

                        var fieldValue = GetValue(key);

                        if (String.IsNullOrEmpty(fieldValue))
                        {
                            continue;
                        }

                        contactInfos.Add(new ContactInfo
                        {
                            Category  = category,
                            InfoType  = contactInfoType,
                            Data      = fieldValue,
                            ContactID = contact.ID,
                            IsPrimary = true
                        });
                    }
                    else if (String.Compare(key, "tag", true) == 0)
                    {
                        var tags = _context.Request.Form.GetValues("tag");

                        Global.DaoFactory.GetTagDao().SetTagToEntity(EntityType.Contact, contact.ID, tags);
                    }
                }

                contactInfos.ForEach(item => fieldCollector.Add(item.InfoType.ToLocalizedString(), PrepareteDataToView(item.InfoType, item.Data)));

                Global.DaoFactory.GetContactInfoDao().SaveList(contactInfos);

                var notifyList = GetValue("notify_list");

                if (!String.IsNullOrEmpty(notifyList))
                {
                    NotifyClient.Instance.SendAboutCreateNewContact(
                        notifyList
                        .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                        .Select(item => new Guid(item)).ToList(), contact.ID, contact.GetTitle(), fieldCollector);
                }


                SetPermission(contact, GetValue("private_list"));

                if (contact is Person && !String.IsNullOrEmpty(companyName))
                {
                    AssignPersonToCompany((Person)contact, companyName, GetValue("private_list"));
                }

                SecurityContext.Logout();

                context.Response.Redirect(GetValue("return_url"));
            }
            catch (Exception error)
            {
                LogManager.GetLogger("ASC.CRM").Error(error);
                throw;
            }
        }
Exemplo n.º 29
0
        protected void RegisterContactFields()
        {
            var columnSelectorData = new[]
            {
                new
                {
                    name  = "firstName",
                    title = CRMContactResource.FirstName
                },
                new
                {
                    name  = "lastName",
                    title = CRMContactResource.LastName
                },
                new
                {
                    name  = "jobTitle",
                    title = CRMContactResource.JobTitle
                },
                new
                {
                    name  = "companyName",
                    title = CRMContactResource.CompanyName
                },
                new
                {
                    name  = "about",
                    title = CRMContactResource.About
                }
            }.ToList();

            foreach (ContactInfoType infoTypeEnum in Enum.GetValues(typeof(ContactInfoType)))
            {
                var localName  = String.Format("contactInfo_{0}_{1}", infoTypeEnum, ContactInfo.GetDefaultCategory(infoTypeEnum));
                var localTitle = infoTypeEnum.ToLocalizedString();

                if (infoTypeEnum == ContactInfoType.Address)
                {
                    foreach (AddressPart addressPartEnum in Enum.GetValues(typeof(AddressPart)))
                    {
                        columnSelectorData.Add(new
                        {
                            name  = String.Format(localName + "_{0}_{1}", addressPartEnum, (int)AddressCategory.Work),
                            title = String.Format(localTitle + " {0}", addressPartEnum.ToLocalizedString().ToLower())
                        });
                    }
                }
                else
                {
                    columnSelectorData.Add(new
                    {
                        name  = localName,
                        title = localTitle
                    });
                }
            }

            columnSelectorData.AddRange(Global.DaoFactory.GetCustomFieldDao().GetFieldsDescription(EntityType.Contact)
                                        .FindAll(customField => customField.FieldType == CustomFieldType.TextField || customField.FieldType == CustomFieldType.TextArea)
                                        .ConvertAll(customField => new
            {
                name  = "customField_" + customField.ID,
                title = customField.Label.HtmlEncode()
            }));

            var tagList = Global.DaoFactory.GetTagDao().GetAllTags(EntityType.Contact);

            if (tagList.Length > 0)
            {
                TagList = tagList.ToList();

                Page.RegisterInlineScript(String.Format(" var tagList = {0}; ",
                                                        JavaScriptSerializer.Serialize(TagList.Select(tagName =>
                                                                                                      new
                {
                    name  = "tag_" + tagName.HtmlEncode(),
                    title = tagName.HtmlEncode()
                }))), onReady: false);
            }

            Page.RegisterInlineScript(String.Format(" var columnSelectorData = {0}; ", JavaScriptSerializer.Serialize(columnSelectorData)), onReady: false);
        }
Exemplo n.º 30
0
        public string PostContactUs(ReqContactUs objReq)
        {
            string rst = "0";
            if (!string.IsNullOrWhiteSpace(objReq.emailId))
            {
                try
                {
                    using (var db = new UnseentalentdbDataContext())
                    {
                        var objNew = new ContactInfo();
                        objNew.contactName = objReq.name;
                        objNew.emailId = objReq.emailId;
                        objNew.description = objReq.description;

                        db.ContactInfos.InsertOnSubmit(objNew);
                        db.SubmitChanges();
                        rst = "1";
                    }
                }
                catch
                {
                }
            }
            return rst;
        }
Exemplo n.º 31
0
 public DataTable Get_Contact_By_Type_For(ContactInfo AddInfo, ref PaginationInfo pager)
 {
     return(_ContactRepo.Get_ContactMaster_By_Type_For_Id(AddInfo, ref pager));
 }
Exemplo n.º 32
0
        public override object Save <T>(T entity)
        {
            BO.SaveLocation saveLocationBO = (BO.SaveLocation)(object) entity;

            if (saveLocationBO.location == null)
            {
                return(new BO.ErrorObject {
                    ErrorMessage = "Location object can't be null", errorObject = "", ErrorLevel = ErrorLevel.Error
                });
            }
            if (saveLocationBO.location.ID == 0)
            {
                if (saveLocationBO.addressInfo == null)
                {
                    return(new BO.ErrorObject {
                        ErrorMessage = "Addressinfo object can't be null", errorObject = "", ErrorLevel = ErrorLevel.Error
                    });
                }
            }
            if (saveLocationBO.location.ID == 0)
            {
                if (saveLocationBO.contactInfo == null)
                {
                    return(new BO.ErrorObject {
                        ErrorMessage = "Contactinfo object can't be null", errorObject = "", ErrorLevel = ErrorLevel.Error
                    });
                }
            }
            if (saveLocationBO.location.ID == 0)
            {
                if (saveLocationBO.company == null)
                {
                    return(new BO.ErrorObject {
                        ErrorMessage = "Company object can't be null", errorObject = "", ErrorLevel = ErrorLevel.Error
                    });
                }
            }


            BO.Location    locationBO    = saveLocationBO.location;
            BO.Company     companyBO     = saveLocationBO.company;
            BO.AddressInfo addressBO     = saveLocationBO.addressInfo;
            BO.ContactInfo contactinfoBO = saveLocationBO.contactInfo;

            Location    locationDB    = new Location();
            Company     companyDB     = new Company();
            User        userDB        = new User();
            AddressInfo addressDB     = new AddressInfo();
            ContactInfo contactinfoDB = new ContactInfo();

            #region Location
            locationDB.id           = locationBO.ID;
            locationDB.Name         = locationBO.Name;
            locationDB.LocationType = System.Convert.ToByte(locationBO.LocationType);
            locationDB.IsDefault    = locationBO.IsDefault;
            locationDB.IsDeleted    = locationBO.IsDeleted.HasValue ? locationBO.IsDeleted : false;
            #endregion

            #region Company
            if (companyBO.ID > 0)
            {
                Company company = _context.Companies.Where(p => p.id == companyBO.ID).FirstOrDefault <Company>();
                if (company != null)
                {
                    locationDB.Company            = company;
                    _context.Entry(company).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    return new BO.ErrorObject {
                               errorObject = "", ErrorMessage = "Please pass valid Company details.", ErrorLevel = ErrorLevel.Error
                    }
                };
            }
            #endregion

            #region Address
            if (addressBO != null)
            {
                addressDB.id       = addressBO.ID;
                addressDB.Name     = addressBO.Name;
                addressDB.Address1 = addressBO.Address1;
                addressDB.Address2 = addressBO.Address2;
                addressDB.City     = addressBO.City;
                addressDB.State    = addressBO.State;
                addressDB.ZipCode  = addressBO.ZipCode;
                addressDB.Country  = addressBO.Country;
                //[STATECODE-CHANGE]
                //addressDB.StateCode = addressBO.StateCode;
                //[STATECODE-CHANGE]
            }
            #endregion

            #region Contact Info

            if (contactinfoBO != null)
            {
                contactinfoDB.id           = contactinfoBO.ID;
                contactinfoDB.Name         = contactinfoBO.Name;
                contactinfoDB.CellPhone    = contactinfoBO.CellPhone;
                contactinfoDB.EmailAddress = contactinfoBO.EmailAddress;
                contactinfoDB.HomePhone    = contactinfoBO.HomePhone;
                contactinfoDB.WorkPhone    = contactinfoBO.WorkPhone;
                contactinfoDB.FaxNo        = contactinfoBO.FaxNo;
                if (contactinfoBO.IsDeleted.HasValue)
                {
                    contactinfoDB.IsDeleted = contactinfoBO.IsDeleted;
                }
            }
            #endregion

            //Added code to get data in AddressInfo and ContactInfo
            locationDB.AddressInfo = addressDB;
            locationDB.ContactInfo = contactinfoDB;

            if (saveLocationBO.schedule != null)
            {
                #region Schedule
                if (saveLocationBO.schedule != null)
                {
                    if (saveLocationBO.schedule.ID > 0)
                    {
                        Schedule schedule = _context.Schedules.Where(p => p.id == saveLocationBO.schedule.ID).FirstOrDefault <Schedule>();
                        if (schedule != null)
                        {
                            locationDB.Schedule = schedule;
                        }
                        else
                        {
                            return new BO.ErrorObject {
                                       errorObject = "", ErrorMessage = "Please pass valid Schedule.", ErrorLevel = ErrorLevel.Error
                            }
                        };
                    }
                }
                #endregion
            }
            else
            {
                //Default schedule

                Schedule defaultschedule = _context.Schedules.Where(p => p.IsDefault == true).FirstOrDefault <Schedule>();
                if (defaultschedule != null)
                {
                    locationDB.Schedule = defaultschedule;
                }
                else
                {
                    return new BO.ErrorObject {
                               errorObject = "", ErrorMessage = "Please set default schedule in database.", ErrorLevel = ErrorLevel.Error
                    }
                };
            }

            if (locationDB.id > 0)
            {
                //For Update Record

                //Find Location By ID
                Location location = _context.Locations.Include("Company").Include("ContactInfo").Include("AddressInfo").Where(p => p.id == locationDB.id).FirstOrDefault <Location>();

                if (location != null)
                {
                    #region Location
                    locationDB.id = locationBO.ID;

                    location.Name           = locationBO.Name == null ? location.Name : locationBO.Name;
                    location.LocationType   = locationBO.LocationType == null ? location.LocationType : System.Convert.ToByte(locationBO.LocationType);
                    location.IsDefault      = locationBO.IsDefault;
                    location.IsDeleted      = locationBO.IsDeleted == null ? locationBO.IsDeleted : locationDB.IsDeleted;
                    location.UpdateDate     = locationBO.UpdateDate;
                    location.UpdateByUserID = locationBO.UpdateByUserID;
                    #endregion

                    #region AddressInfo
                    location.AddressInfo.CreateByUserID = location.CreateByUserID;
                    location.AddressInfo.CreateDate     = location.CreateDate;
                    if (locationBO.UpdateByUserID.HasValue)
                    {
                        location.AddressInfo.UpdateByUserID = locationBO.UpdateByUserID.Value;
                    }
                    location.AddressInfo.UpdateDate = DateTime.UtcNow;
                    location.AddressInfo.Name       = addressBO.Name;
                    location.AddressInfo.Address1   = addressBO.Address1;
                    location.AddressInfo.Address2   = addressBO.Address2;
                    location.AddressInfo.City       = addressBO.City;
                    location.AddressInfo.State      = addressBO.State;
                    location.AddressInfo.ZipCode    = addressBO.ZipCode;
                    location.AddressInfo.Country    = addressBO.Country;
                    //[STATECODE-CHANGE]
                    //location.AddressInfo.StateCode = addressBO.StateCode;
                    //[STATECODE-CHANGE]
                    location.AddressInfo.UpdateDate     = addressBO.UpdateDate;
                    location.AddressInfo.UpdateByUserID = addressBO.UpdateByUserID;
                    #endregion

                    #region Contact Info
                    location.ContactInfo.CreateByUserID = location.CreateByUserID;
                    location.ContactInfo.CreateDate     = location.CreateDate;
                    if (locationBO.UpdateByUserID.HasValue)
                    {
                        location.ContactInfo.UpdateByUserID = locationBO.UpdateByUserID.Value;
                    }
                    location.ContactInfo.UpdateDate     = DateTime.UtcNow;
                    location.ContactInfo.Name           = contactinfoBO.Name;
                    location.ContactInfo.CellPhone      = contactinfoBO.CellPhone;
                    location.ContactInfo.EmailAddress   = contactinfoBO.EmailAddress;
                    location.ContactInfo.HomePhone      = contactinfoBO.HomePhone;
                    location.ContactInfo.WorkPhone      = contactinfoBO.WorkPhone;
                    location.ContactInfo.FaxNo          = contactinfoBO.FaxNo;
                    location.ContactInfo.UpdateDate     = contactinfoBO.UpdateDate;
                    location.ContactInfo.UpdateByUserID = contactinfoBO.UpdateByUserID;
                    #endregion

                    #region Schedule
                    if (saveLocationBO.schedule != null)
                    {
                        if (saveLocationBO.schedule.ID > 0)
                        {
                            Schedule schedule = _context.Schedules.Where(p => p.id == saveLocationBO.schedule.ID).FirstOrDefault <Schedule>();

                            if (schedule != null)
                            {
                                location.Schedule = schedule;
                            }
                            else
                            {
                                return new BO.ErrorObject {
                                           errorObject = "", ErrorMessage = "Please pass valid Schedule.", ErrorLevel = ErrorLevel.Error
                                }
                            };
                        }
                    }
                    #endregion

                    _context.Entry(location).State = System.Data.Entity.EntityState.Modified;
                }
            }
            else
            {
                locationDB.CreateDate     = companyBO.CreateDate;
                locationDB.CreateByUserID = companyBO.CreateByUserID;

                addressDB.CreateDate     = companyBO.CreateDate;
                addressDB.CreateByUserID = companyBO.CreateByUserID;

                contactinfoDB.CreateDate     = companyBO.CreateDate;
                contactinfoDB.CreateByUserID = companyBO.CreateByUserID;

                locationDB.AddressInfo = addressDB;
                locationDB.ContactInfo = contactinfoDB;
                _dbSet.Add(locationDB);
            }
            _context.SaveChanges();

            var res = Convert <BO.Location, Location>(locationDB);
            return((object)res);
        }
        protected void SaveOrUpdateContact(object sender, CommandEventArgs e)
        {
            try
            {
                var            dao = Global.DaoFactory;
                Contact        contact;
                List <Contact> contactsForSetManager = new List <Contact>();

                var typeAddedContact = Request["typeAddedContact"];


                #region Rights part #1

                ShareType shareType = ShareType.None;// 0 - NotShared, 1 - ReadWriting, 2 - Reading

                if (!String.IsNullOrEmpty(Request["isPublicContact"]))
                {
                    try
                    {
                        shareType = (ShareType)(Convert.ToInt32(Request["isPublicContact"]));
                    }
                    catch (Exception)
                    {
                        throw new ArgumentException();
                    }
                }


                #endregion

                #region BaseInfo

                var companyID = 0;

                if (!String.IsNullOrEmpty(Request["baseInfo_compID"]))
                {
                    companyID = Convert.ToInt32(Request["baseInfo_compID"]);
                }
                else if (!String.IsNullOrEmpty(Request["baseInfo_compName"]))
                {
                    var peopleCompany = new Company
                    {
                        CompanyName = Request["baseInfo_compName"].Trim(),
                        ShareType   = shareType
                    };

                    peopleCompany.ID = dao.GetContactDao().SaveContact(peopleCompany);

                    companyID = peopleCompany.ID;
                    contactsForSetManager.Add(peopleCompany);
                }


                if (typeAddedContact.Equals("people"))
                {
                    contact = new Person
                    {
                        FirstName = Request["baseInfo_firstName"].Trim(),
                        LastName  = Request["baseInfo_lastName"].Trim(),
                        JobTitle  = Request["baseInfo_personPosition"].Trim(),
                        CompanyID = companyID
                    };
                }
                else
                {
                    contact = new Company
                    {
                        CompanyName = Request["baseInfo_companyName"].Trim()
                    };
                }


                contact.About     = !String.IsNullOrEmpty(Request["baseInfo_contactOverview"]) ? Request["baseInfo_contactOverview"].Trim() : null;
                contact.ShareType = shareType;

                #endregion

                #region ContactType and Currency

                contact.ContactTypeID = Convert.ToInt32(Request["baseInfo_contactType"]);
                if (contact.ContactTypeID != 0)
                {
                    var listItem = dao.GetListItemDao().GetByID(contact.ContactTypeID);
                    if (listItem == null)
                    {
                        throw new Exception(CRMErrorsResource.ContactTypeNotFound);
                    }
                }

                contact.Currency = Convert.ToString(Request["baseInfo_currency"]);
                if (!String.IsNullOrEmpty(contact.Currency))
                {
                    var currency = CurrencyProvider.Get(contact.Currency);
                    if (currency == null)
                    {
                        throw new Exception(CRMErrorsResource.CurrencyNotFound);
                    }
                }

                #endregion

                #region Base Operation Of Save/Update

                if (TargetContact != null)
                {
                    contact.ID       = TargetContact.ID;
                    contact.StatusID = TargetContact.StatusID;
                    dao.GetContactDao().UpdateContact(contact);

                    var messageAction = contact is Company ? MessageAction.CompanyUpdated : MessageAction.PersonUpdated;
                    MessageService.Send(HttpContext.Current.Request, messageAction, contact.GetTitle());

                    contact = dao.GetContactDao().GetByID(contact.ID);
                }
                else
                {
                    contact.ID = dao.GetContactDao().SaveContact(contact);

                    var messageAction = contact is Company ? MessageAction.CompanyCreated : MessageAction.PersonCreated;
                    MessageService.Send(HttpContext.Current.Request, messageAction, contact.GetTitle());

                    contact = dao.GetContactDao().GetByID(contact.ID);
                }

                contactsForSetManager.Add(contact);

                #endregion

                #region persons for company

                if (contact is Company)
                {
                    var assignedContactsIDs = new List <int>();

                    if (!String.IsNullOrEmpty(Request["baseInfo_assignedNewContactsIDs"]))
                    {
                        try
                        {
                            var assignedContactsObjs = JArray.Parse(Request["baseInfo_assignedNewContactsIDs"]);
                            var newAssignedContacts  = new List <Contact>();
                            var recordIndex          = 0;

                            foreach (var assignedContactsObj in assignedContactsObjs)
                            {
                                newAssignedContacts.Add(new Person
                                {
                                    ID        = recordIndex,
                                    ShareType = shareType,
                                    CompanyID = contact.ID,
                                    FirstName = assignedContactsObj.Value <String>("FirstName"),
                                    LastName  = assignedContactsObj.Value <String>("LastName")
                                });
                                recordIndex++;
                            }

                            dao.GetContactDao().SaveContactList(newAssignedContacts);

                            if (newAssignedContacts.Count != 0)
                            {
                                contactsForSetManager.AddRange(newAssignedContacts);
                                assignedContactsIDs.AddRange(newAssignedContacts.Select(c => c.ID).ToList());
                            }
                        }
                        catch (Exception ex)
                        {
                            log4net.LogManager.GetLogger("ASC.CRM").Error(ex);
                        }
                    }

                    if (!String.IsNullOrEmpty(Request["baseInfo_assignedContactsIDs"]))
                    {
                        assignedContactsIDs.AddRange(Request["baseInfo_assignedContactsIDs"].Split(',').Select(item => Convert.ToInt32(item)).ToList());
                    }


                    if (TargetContact != null && !CRMSecurity.IsAdmin)
                    {
                        var restrictedMembers = dao.GetContactDao().GetRestrictedMembers(contact.ID);
                        assignedContactsIDs.AddRange(restrictedMembers.Select(m => m.ID).ToList());
                    }

                    dao.GetContactDao().SetMembers(contact.ID, assignedContactsIDs.ToArray());
                }

                #endregion

                #region tags

                var assignedTags = Request["baseInfo_assignedTags"];
                if (assignedTags != null)
                {
                    var oldTagList = dao.GetTagDao().GetEntityTags(EntityType.Contact, contact.ID);
                    foreach (var tag in oldTagList)
                    {
                        dao.GetTagDao().DeleteTagFromEntity(EntityType.Contact, contact.ID, tag);
                    }
                    if (assignedTags != string.Empty)
                    {
                        var tagListInfo = JObject.Parse(assignedTags)["tagListInfo"].ToArray();
                        var newTagList  = tagListInfo.Select(t => t.ToString()).ToArray();
                        dao.GetTagDao().SetTagToEntity(EntityType.Contact, contact.ID, newTagList);
                    }
                }

                #endregion

                #region contact infos (addresses, mailes, phones etc.)

                var contactInfos    = new List <ContactInfo>();
                var addressList     = new Dictionary <int, ContactInfo>();
                var addressTemplate = new JObject();

                foreach (String addressPartName in Enum.GetNames(typeof(AddressPart)))
                {
                    addressTemplate.Add(addressPartName.ToLower(), "");
                }

                var addressTemplateStr = addressTemplate.ToString();

                foreach (var item in Request.Form.AllKeys)
                {
                    if (item.StartsWith("customField_"))
                    {
                        int    fieldID    = Convert.ToInt32(item.Split('_')[1]);
                        String fieldValue = Request.Form[item].Trim();

                        if (contact is Person)
                        {
                            if (!String.IsNullOrEmpty(fieldValue))
                            {
                                dao.GetCustomFieldDao().SetFieldValue(EntityType.Person, contact.ID, fieldID, "");
                            }
                            dao.GetCustomFieldDao().SetFieldValue(EntityType.Person, contact.ID, fieldID, fieldValue);
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(fieldValue))
                            {
                                dao.GetCustomFieldDao().SetFieldValue(EntityType.Company, contact.ID, fieldID, "");
                            }
                            dao.GetCustomFieldDao().SetFieldValue(EntityType.Company, contact.ID, fieldID, fieldValue);
                        }
                    }
                    else if (item.StartsWith("contactInfo_"))
                    {
                        var nameParts       = item.Split('_').Skip(1).ToList();
                        var contactInfoType = (ContactInfoType)Enum.Parse(typeof(ContactInfoType), nameParts[0]);
                        var category        = Convert.ToInt32(nameParts[2]);

                        if (contactInfoType == ContactInfoType.Address)
                        {
                            var index            = Convert.ToInt32(nameParts[1]);
                            var addressPart      = (AddressPart)Enum.Parse(typeof(AddressPart), nameParts[3]);
                            var isPrimaryAddress = Convert.ToInt32(nameParts[4]) == 1;
                            var dataValues       = Request.Form.GetValues(item).Select(n => n.Trim()).ToList();

                            if (!addressList.ContainsKey(index))
                            {
                                var newAddress = new ContactInfo
                                {
                                    Category  = category,
                                    InfoType  = contactInfoType,
                                    Data      = addressTemplateStr,
                                    IsPrimary = isPrimaryAddress,
                                    ContactID = contact.ID
                                };
                                addressList.Add(index, newAddress);
                            }

                            foreach (var data in dataValues)
                            {
                                var addressParts = JObject.Parse(addressList[index].Data);
                                addressParts[addressPart.ToString().ToLower()] = data;
                                addressList[index].Data = addressParts.ToString();
                            }
                            continue;
                        }

                        var isPrimary = Convert.ToInt32(nameParts[3]) == 1;
                        if (Request.Form.GetValues(item) != null)
                        {
                            var dataValues = Request.Form.GetValues(item).Where(n => !string.IsNullOrEmpty(n.Trim())).ToList();

                            contactInfos.AddRange(dataValues.Select(dataValue => new ContactInfo
                            {
                                Category  = category,
                                InfoType  = contactInfoType,
                                Data      = dataValue.Trim(),
                                IsPrimary = isPrimary,
                                ContactID = contact.ID
                            }));
                        }
                    }
                }

                if (addressList.Count > 0)
                {
                    contactInfos.AddRange(addressList.Values.ToList());
                }

                dao.GetContactInfoDao().DeleteByContact(contact.ID);
                dao.GetContactInfoDao().SaveList(contactInfos);

                #endregion

                #region Photo

                var photoPath = Request["uploadPhotoPath"];

                if (!String.IsNullOrEmpty(photoPath))
                {
                    if (photoPath != "null")
                    {
                        if (photoPath.StartsWith(PathProvider.BaseAbsolutePath))
                        {
                            var tmpDirName = photoPath.Substring(0, photoPath.LastIndexOf('/'));
                            ContactPhotoManager.TryUploadPhotoFromTmp(contact.ID, TargetContact == null, tmpDirName);
                        }
                        else
                        {
                            ContactPhotoManager.UploadPhoto(photoPath, contact.ID);
                        }
                    }
                }
                else if (TargetContact != null)
                {
                    ContactPhotoManager.DeletePhoto(TargetContact.ID);
                }
                #endregion


                #region Rights part #2

                SetContactManager(contactsForSetManager);

                #endregion

                #region Link with mail message

                int result;
                var linkMessageId = int.TryParse(Request["linkMessageId"], out result) ? result : 0;

                if (linkMessageId > 0)
                {
                    try
                    {
                        LinkWithMessage(linkMessageId, contact.ID);
                    }
                    catch (Exception ex)
                    {
                        log4net.LogManager.GetLogger("ASC.CRM").Error(ex);
                    }
                }

                #endregion

                Response.Redirect(String.Compare(e.CommandArgument.ToString(), "0", true) == 0
                                      ? String.Format("default.aspx?id={0}{1}", contact.ID,
                                                      contact is Company
                                                          ? ""
                                                          : String.Format("&{0}=people", UrlConstant.Type))
                                      : String.Format("default.aspx?action=manage{0}",
                                                      contact is Company
                                                          ? ""
                                                          : String.Format("&{0}=people", UrlConstant.Type)), false);
                Context.ApplicationInstance.CompleteRequest();
            }
            catch (Exception ex)
            {
                log4net.LogManager.GetLogger("ASC.CRM").Error(ex);
                var cookie = HttpContext.Current.Request.Cookies.Get(ErrorCookieKey);
                if (cookie == null)
                {
                    cookie = new HttpCookie(ErrorCookieKey)
                    {
                        Value = ex.Message
                    };
                    HttpContext.Current.Response.Cookies.Add(cookie);
                }
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (EditedObject != null)
        {
            ContactInfo ci = (ContactInfo)EditedObject;

            // Check permission
            CheckReadPermission(ci.ContactSiteID);

            bool isGlobal = (ci.ContactSiteID == 0);
            bool isMerged = (ci.ContactMergedWithContactID > 0);

            // Show warning if activity logging is disabled
            string siteName = SiteInfoProvider.GetSiteName(ci.ContactSiteID);

            ucDisabledModule.SettingsKeys = "CMSEnableOnlineMarketing";
            ucDisabledModule.InfoText     = GetString("om.onlinemarketing.disabled");
            ucDisabledModule.ParentPanel  = pnlDis;

            pnlDis.Visible = !isGlobal && !ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(siteName);

            // Show IP addresses if enabled
            listElem.ShowIPAddressColumn = ActivitySettingsHelper.IPLoggingEnabled(siteName);
            listElem.ShowSiteNameColumn  = IsSiteManager && isGlobal;

            // Restrict WHERE condition for activities of current site (if not in site manager)
            if (!IsSiteManager)
            {
                listElem.SiteID = SiteContext.CurrentSiteID;
            }
            else
            {
                // Show all records in Site Manager
                listElem.SiteID = UniSelector.US_ALL_RECORDS;
            }

            listElem.ContactID             = ci.ContactID;
            listElem.IsMergedContact       = isMerged;
            listElem.IsGlobalContact       = isGlobal;
            listElem.ShowContactNameColumn = isGlobal;
            listElem.ShowSiteNameColumn    = IsSiteManager && isGlobal;
            listElem.ShowRemoveButton      = !isMerged && !isGlobal;
            listElem.OrderBy = "ActivityCreated DESC";

            // Init header action for new custom activities only if contact is not global, a custom activity type exists and user is authorized to manage activities
            if (!isGlobal && ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(siteName) && MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ManageActivities"))
            {
                // Disable manual creation of activity if no custom activity type is available
                var activityType = ActivityTypeInfoProvider.GetActivityTypes()
                                   .WhereEquals("ActivityTypeIsCustom", 1)
                                   .WhereEquals("ActivityTypeEnabled", 1)
                                   .WhereEquals("ActivityTypeManualCreationAllowed", 1)
                                   .TopN(1)
                                   .Column("ActivityTypeID")
                                   .FirstOrDefault();

                if (activityType != null)
                {
                    // Prepare target URL
                    string url = ResolveUrl(string.Format("~/CMSModules/ContactManagement/Pages/Tools/Activities/Activity/New.aspx?contactId={0}", ci.ContactID));
                    url = AddSiteQuery(url, ci.ContactSiteID);

                    // Init header action
                    HeaderAction action = new HeaderAction()
                    {
                        Text        = GetString("om.activity.newcustom"),
                        RedirectUrl = url
                    };
                    CurrentMaster.HeaderActions.ActionsList.Add(action);
                }
            }

            if (!RequestHelper.IsPostBack() && QueryHelper.GetBoolean("saved", false))
            {
                // Display 'Save' message after new custom activity was created
                ShowChangesSaved();
            }
        }
    }
 public ContactInfo Add(ContactInfo contactInfo)
 {
     _context.ContactInfos.Add(contactInfo);
     _context.SaveChanges();
     return(contactInfo);
 }
        public override object Save <T>(T entity)
        {
            BO.AdjusterMaster adjusterMasterBO = (BO.AdjusterMaster)(object) entity;
            BO.AddressInfo    addressBO        = adjusterMasterBO.AddressInfo;
            BO.ContactInfo    contactinfoBO    = adjusterMasterBO.ContactInfo;

            AdjusterMaster adjusterMasterDB = new AdjusterMaster();

            using (var dbContextTransaction = _context.Database.BeginTransaction())
            {
                bool IsEditMode = false;
                IsEditMode = (adjusterMasterBO != null && adjusterMasterBO.ID > 0) ? true : false;

                AddressInfo addressDB     = new AddressInfo();
                ContactInfo contactinfoDB = new ContactInfo();

                #region Address
                if (addressBO != null)
                {
                    bool Add_addressDB = false;
                    addressDB = _context.AddressInfoes.Where(p => p.id == addressBO.ID).FirstOrDefault();

                    if (addressDB == null && addressBO.ID <= 0)
                    {
                        addressDB     = new AddressInfo();
                        Add_addressDB = true;
                    }
                    else if (addressDB == null && addressBO.ID > 0)
                    {
                        dbContextTransaction.Rollback();
                        return(new BO.ErrorObject {
                            errorObject = "", ErrorMessage = "Address details dosent exists.", ErrorLevel = ErrorLevel.Error
                        });
                    }

                    addressDB.Name     = IsEditMode == true && addressBO.Name == null ? addressDB.Name : addressBO.Name;
                    addressDB.Address1 = IsEditMode == true && addressBO.Address1 == null ? addressDB.Address1 : addressBO.Address1;
                    addressDB.Address2 = IsEditMode == true && addressBO.Address2 == null ? addressDB.Address2 : addressBO.Address2;
                    addressDB.City     = IsEditMode == true && addressBO.City == null ? addressDB.City : addressBO.City;
                    addressDB.State    = IsEditMode == true && addressBO.State == null ? addressDB.State : addressBO.State;
                    addressDB.ZipCode  = IsEditMode == true && addressBO.ZipCode == null ? addressDB.ZipCode : addressBO.ZipCode;
                    addressDB.Country  = IsEditMode == true && addressBO.Country == null ? addressDB.Country : addressBO.Country;
                    //[STATECODE-CHANGE]
                    // addressDB.StateCode = IsEditMode == true && addressBO.StateCode == null ? addressDB.StateCode : addressBO.StateCode;
                    //[STATECODE-CHANGE]

                    if (Add_addressDB == true)
                    {
                        addressDB = _context.AddressInfoes.Add(addressDB);
                    }
                    _context.SaveChanges();
                }
                else
                {
                    if (IsEditMode == false)
                    {
                        dbContextTransaction.Rollback();
                        return(new BO.ErrorObject {
                            errorObject = "", ErrorMessage = "Please pass valid address details.", ErrorLevel = ErrorLevel.Error
                        });
                    }
                    addressDB = null;
                }
                #endregion

                #region Contact Info
                if (contactinfoBO != null)
                {
                    bool Add_contactinfoDB = false;
                    contactinfoDB = _context.ContactInfoes.Where(p => p.id == contactinfoBO.ID).FirstOrDefault();

                    if (contactinfoDB == null && contactinfoBO.ID <= 0)
                    {
                        contactinfoDB     = new ContactInfo();
                        Add_contactinfoDB = true;
                    }
                    else if (contactinfoDB == null && contactinfoBO.ID > 0)
                    {
                        dbContextTransaction.Rollback();
                        return(new BO.ErrorObject {
                            errorObject = "", ErrorMessage = "Contact details dosent exists.", ErrorLevel = ErrorLevel.Error
                        });
                    }

                    contactinfoDB.Name                   = IsEditMode == true && contactinfoBO.Name == null ? contactinfoDB.Name : contactinfoBO.Name;
                    contactinfoDB.CellPhone              = IsEditMode == true && contactinfoBO.CellPhone == null ? contactinfoDB.CellPhone : contactinfoBO.CellPhone;
                    contactinfoDB.EmailAddress           = IsEditMode == true && contactinfoBO.EmailAddress == null ? contactinfoDB.EmailAddress : contactinfoBO.EmailAddress;
                    contactinfoDB.HomePhone              = IsEditMode == true && contactinfoBO.HomePhone == null ? contactinfoDB.HomePhone : contactinfoBO.HomePhone;
                    contactinfoDB.WorkPhone              = IsEditMode == true && contactinfoBO.WorkPhone == null ? contactinfoDB.WorkPhone : contactinfoBO.WorkPhone;
                    contactinfoDB.FaxNo                  = IsEditMode == true && contactinfoBO.FaxNo == null ? contactinfoDB.FaxNo : contactinfoBO.FaxNo;
                    contactinfoDB.IsDeleted              = contactinfoBO.IsDeleted;
                    contactinfoDB.OfficeExtension        = IsEditMode == true && contactinfoBO.OfficeExtension == null ? contactinfoDB.OfficeExtension : contactinfoBO.OfficeExtension;
                    contactinfoDB.AlternateEmail         = IsEditMode == true && contactinfoBO.AlternateEmail == null ? contactinfoDB.AlternateEmail : contactinfoBO.AlternateEmail;
                    contactinfoDB.PreferredCommunication = IsEditMode == true && contactinfoBO.PreferredCommunication == null ? contactinfoDB.PreferredCommunication : contactinfoBO.PreferredCommunication;

                    if (Add_contactinfoDB == true)
                    {
                        contactinfoDB = _context.ContactInfoes.Add(contactinfoDB);
                    }
                    _context.SaveChanges();
                }
                else
                {
                    if (IsEditMode == false)
                    {
                        dbContextTransaction.Rollback();
                        return(new BO.ErrorObject {
                            errorObject = "", ErrorMessage = "Please pass valid contact details.", ErrorLevel = ErrorLevel.Error
                        });
                    }
                    contactinfoDB = null;
                }
                #endregion

                #region AdjusterMaster

                if (adjusterMasterBO != null)
                {
                    bool Add_adjusterMasterDB = false;
                    adjusterMasterDB = _context.AdjusterMasters.Where(p => p.Id == adjusterMasterBO.ID).FirstOrDefault();

                    if (adjusterMasterDB == null && adjusterMasterBO.ID <= 0)
                    {
                        adjusterMasterDB     = new AdjusterMaster();
                        Add_adjusterMasterDB = true;
                    }
                    else if (adjusterMasterDB == null && adjusterMasterBO.ID > 0)
                    {
                        dbContextTransaction.Rollback();
                        return(new BO.ErrorObject {
                            errorObject = "", ErrorMessage = "Adjuster information dosent exists.", ErrorLevel = ErrorLevel.Error
                        });
                    }

                    adjusterMasterDB.CompanyId         = adjusterMasterBO.CompanyId;
                    adjusterMasterDB.InsuranceMasterId = adjusterMasterBO.InsuranceMasterId;
                    adjusterMasterDB.FirstName         = IsEditMode == true && adjusterMasterBO.FirstName == null ? adjusterMasterDB.FirstName : adjusterMasterBO.FirstName;
                    adjusterMasterDB.MiddleName        = IsEditMode == true && adjusterMasterBO.MiddleName == null ? adjusterMasterDB.MiddleName : adjusterMasterBO.MiddleName;
                    adjusterMasterDB.LastName          = IsEditMode == true && adjusterMasterBO.LastName == null ? adjusterMasterDB.LastName : adjusterMasterBO.LastName;
                    adjusterMasterDB.AddressInfoId     = (addressDB != null && addressDB.id > 0) ? addressDB.id : adjusterMasterDB.AddressInfoId;
                    adjusterMasterDB.ContactInfoId     = (contactinfoDB != null && contactinfoDB.id > 0) ? contactinfoDB.id : adjusterMasterDB.ContactInfoId;

                    if (Add_adjusterMasterDB == true)
                    {
                        adjusterMasterDB = _context.AdjusterMasters.Add(adjusterMasterDB);
                    }
                    _context.SaveChanges();
                }
                else
                {
                    if (IsEditMode == false)
                    {
                        dbContextTransaction.Rollback();
                        return(new BO.ErrorObject {
                            errorObject = "", ErrorMessage = "Please pass valid adjuster information details.", ErrorLevel = ErrorLevel.Error
                        });
                    }
                    adjusterMasterDB = null;
                }

                _context.SaveChanges();
                #endregion

                dbContextTransaction.Commit();

                adjusterMasterDB = _context.AdjusterMasters.Include("AddressInfo")
                                   .Include("ContactInfo").Include("InsuranceMaster").Where(p => p.Id == adjusterMasterDB.Id).FirstOrDefault <AdjusterMaster>();
            }

            var res = Convert <BO.AdjusterMaster, AdjusterMaster>(adjusterMasterDB);
            return((object)res);
        }
Exemplo n.º 37
0
        public Payment Map(Payment payment, Bill bill = null, BillLineItem billLineItem = null,
                           Note note            = null, Attachment attachment = null, Officer officer         = null, Log log = null,
                           Person contactPerson = null, Bank bank             = null, ContactInfo contactInfo = null)
        {
            if (!_cache.TryGetValue(payment.ID, out Payment result))
            {
                if (bank?.ID > 0)
                {
                    payment.Bank = bank;
                }

                result             = payment;
                _cache[payment.ID] = payment;
            }

            Bill outBill = null;

            if ((bill?.ID ?? 0) > 0 &&
                !_billCache.TryGetValue(bill.ID, out outBill))
            {
                _billCache[bill.ID] = bill;
                outBill             = bill;

                if (result.Bills == null)
                {
                    result.Bills = new List <Bill>();
                }
                result.Bills.Add(bill);
            }

            if ((billLineItem?.ID ?? 0) > 0 &&
                !_billLineItemCache.ContainsKey(billLineItem.ID))
            {
                _billLineItemCache[billLineItem.ID] = billLineItem;

                if (outBill.LineItems == null)
                {
                    outBill.LineItems = new List <BillLineItem>();
                }

                outBill.LineItems.Add(billLineItem);
            }

            Note outNote = null;

            if ((note?.ID ?? 0) > 0 &&
                !_noteCache.TryGetValue(note.ID, out outNote))
            {
                if (!string.IsNullOrEmpty(officer?.Name))
                {
                    note.Officer = officer;
                }

                _noteCache[note.ID] = note;
                outNote             = note;

                if (result.Notes == null)
                {
                    result.Notes = new List <Note>();
                }
                result.Notes.Add(note);
            }

            if (attachment?.ID > 0 &&
                !(outNote.Attachments?.Any(e => e.ID == attachment.ID) ?? false))
            {
                if (outNote.Attachments == null)
                {
                    outNote.Attachments = new List <Attachment>();
                }
                outNote.Attachments.Add(attachment);
            }

            if (log?.ID > 0 &&
                !(result.Logs?.Any(e => e.ID == log.ID) ?? false))
            {
                if (result.Logs == null)
                {
                    result.Logs = new List <Log>();
                }
                result.Logs.Add(log);
            }

            Person outContactPerson = null;

            if (contactPerson?.ID != null &&
                contactPerson.ID != Guid.Empty &&
                !_personCache.TryGetValue(contactPerson.ID, out outContactPerson))
            {
                _personCache[contactPerson.ID] = contactPerson;

                outContactPerson      = contactPerson;
                payment.ContactPerson = contactPerson;
            }

            if ((contactInfo?.ID ?? 0L) != 0L &&
                !_contactInfoCache.ContainsKey(contactInfo.ID))
            {
                _contactInfoCache[contactInfo.ID] = contactInfo;

                if (outContactPerson.ContactInfos == null)
                {
                    outContactPerson.ContactInfos = new List <ContactInfo>();
                }
                outContactPerson.ContactInfos.Add(contactInfo);
            }

            return(result);
        }
Exemplo n.º 38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ci = (ContactInfo)EditedObject;
        this.CheckReadPermission(ci.ContactSiteID);

        globalContact = (ci.ContactSiteID <= 0);
        mergedContact = (ci.ContactMergedWithContactID > 0);
        modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false);

        contactId = QueryHelper.GetInteger("contactid", 0);

        string where = null;
        // Filter only site members in CMSDesk (for global contacts)
        if (!this.IsSiteManager && globalContact && AuthorizedForSiteContacts)
        {
            where += " (ContactSiteID IS NULL OR ContactSiteID=" + CMSContext.CurrentSiteID + ")";
        }

        fltElem.ShowContactNameFilter = globalContact;
        fltElem.ShowSiteFilter = this.IsSiteManager && globalContact;

        // Choose correct query according to type of contact
        if (globalContact)
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPGLOBALUSERLIST;
        }
        else if (mergedContact)
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPMERGEDUSERLIST;
        }
        else
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPUSERLIST;
        }

        // Query parameters
        QueryDataParameters parameters = new QueryDataParameters();
        parameters.Add("@ContactId", contactId);

        where = SqlHelperClass.AddWhereCondition(where, fltElem.WhereCondition);
        gridElem.WhereCondition = where;
        gridElem.QueryParameters = parameters;
        gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction);
        gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound);

        // Setup user selector
        selectUser.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton;
        selectUser.UniSelector.OnItemsSelected += new EventHandler(UniSelector_OnItemsSelected);
        selectUser.UniSelector.ReturnColumnName = "UserID";
        selectUser.UniSelector.ButtonImage = GetImageUrl("Objects/CMS_User/add.png");
        selectUser.ImageDialog.CssClass = "NewItemImage";
        selectUser.LinkDialog.CssClass = "NewItemLink";
        selectUser.ShowSiteFilter = false;
        selectUser.ResourcePrefix = "addusers";
        selectUser.DialogButton.CssClass = "LongButton";
        selectUser.IsLiveSite = false;
        selectUser.SiteID = ci.ContactSiteID;

        // Hide header actions for global contact or merged contact
        this.CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact;
    }
Exemplo n.º 39
0
        internal void CacheContacts()
        {
            contactsProfilingState = Profiler.Begin(PhysicsProfilingKeys.ContactsProfilingKey);

            var pastFrameContacts = frameContacts.Select(x => x.ContactPoint).ToList();

            frameContacts.Clear();
            var numManifolds = collisionWorld.Dispatcher.NumManifolds;
            for (var i = 0; i < numManifolds; i++)
            {
                var manifold = collisionWorld.Dispatcher.GetManifoldByIndexInternal(i);
                var numContacts = manifold.NumContacts;
                var bodyA = manifold.Body0;
                var bodyB = manifold.Body1;

                var colA = (PhysicsComponent)bodyA?.UserObject;
                var colB = (PhysicsComponent)bodyB?.UserObject;

                if (colA == null || colB == null)
                {
                    continue;
                }

                if (!colA.ProcessCollisions && !colB.ProcessCollisions)
                {
                    continue;
                }

                for (var y = 0; y < numContacts; y++)
                {
                    var cp = manifold.GetContactPoint(y);

                    if (cp.Distance > 0.0f)
                    {
                        continue;
                    }

                    var info = new ContactInfo
                    {
                        ColA = colA,
                        ColB = colB
                    };

                    //this can be recycled by bullet so its not very correct.. need to figure if it is really new.. comparing life times might help
                    if (!manifoldToContact.TryGetValue(cp, out info.ContactPoint))
                    {
                        info.ContactPoint = new ContactPoint { Collision = null };
                        info.NewContact = true;
                        manifoldToContact[cp] = info.ContactPoint;
                    }

                    if (info.ContactPoint.LifeTime > cp.LifeTime || cp.LifeTime == 1)
                    {
                        RemoveContact(info.ContactPoint);

                        //this is a new contact as well
                        info.ContactPoint.Collision = null;
                        info.NewContact = true;
                    }

                    info.ContactPoint.Valid = true;
                    info.ContactPoint.LifeTime = cp.LifeTime;
                    info.ContactPoint.Distance = cp.Distance;
                    info.ContactPoint.Normal = cp.NormalWorldOnB;
                    info.ContactPoint.PositionOnA = cp.PositionWorldOnA;
                    info.ContactPoint.PositionOnB = cp.PositionWorldOnB;

                    frameContacts.Add(info);
                    pastFrameContacts.Remove(info.ContactPoint);
                }
            }

            foreach (var contact in pastFrameContacts)
            {
                RemoveContact(contact);
            }
        }
Exemplo n.º 40
0
 public IEnumerable <String> GetContactInfoCategory(ContactInfoType infoType)
 {
     return(Enum.GetNames(ContactInfo.GetCategory(infoType)).ToItemList());
 }
Exemplo n.º 41
0
 public void Update_Contact(ContactInfo contact)
 {
     _sqlRepo.ExecuteNonQuery(Set_Values_In_Contact(contact), StoredProcedures.Update_Contact_sp.ToString(), CommandType.StoredProcedure);
 }
Exemplo n.º 42
0
 private ContactInfoWrapper ToContactInfoWrapper(ContactInfo contactInfo)
 {
     return(new ContactInfoWrapper(contactInfo));
 }
Exemplo n.º 43
0
        public ActionResult QQChat()
        {
            ContactInfo m = ContactInfo.GetData();

            return(PartialView("_QQChat", m));
        }
Exemplo n.º 44
0
        public List <MailTemplateTag> GetTags(bool isCompany)
        {
            var result = new List <MailTemplateTag>();

            if (isCompany)
            {
                result.Add(new MailTemplateTag
                {
                    DisplayName = CRMContactResource.CompanyName,
                    SysName     = "common_companyName",
                    Category    = CRMContactResource.GeneralInformation,
                    isCompany   = isCompany,
                    Name        = ToTagName("Company Name", isCompany)
                });
            }
            else
            {
                result.Add(new MailTemplateTag
                {
                    DisplayName = CRMContactResource.FirstName,
                    SysName     = "common_firstName",
                    Category    = CRMContactResource.GeneralInformation,
                    isCompany   = false,
                    Name        = ToTagName("First Name", isCompany)
                });

                result.Add(new MailTemplateTag
                {
                    DisplayName = CRMContactResource.LastName,
                    SysName     = "common_lastName",
                    Category    = CRMContactResource.GeneralInformation,
                    isCompany   = false,
                    Name        = ToTagName("Last Name", isCompany)
                });

                result.Add(new MailTemplateTag
                {
                    DisplayName = CRMContactResource.JobTitle,
                    SysName     = "common_jobTitle",
                    Category    = CRMContactResource.GeneralInformation,
                    isCompany   = false,
                    Name        = ToTagName("Job Title", isCompany)
                });


                result.Add(new MailTemplateTag
                {
                    DisplayName = CRMContactResource.CompanyName,
                    SysName     = "common_companyName",
                    Category    = CRMContactResource.GeneralInformation,
                    isCompany   = false,
                    Name        = ToTagName("Company Name", isCompany)
                });
            }

            #region Contact Infos

            foreach (ContactInfoType infoTypeEnum in Enum.GetValues(typeof(ContactInfoType)))
            {
                var localName  = String.Format("contactInfo_{0}_{1}", infoTypeEnum, ContactInfo.GetDefaultCategory(infoTypeEnum));
                var localTitle = infoTypeEnum.ToLocalizedString();

                if (infoTypeEnum == ContactInfoType.Address)
                {
                    foreach (AddressPart addressPartEnum in Enum.GetValues(typeof(AddressPart)))
                    {
                        result.Add(new MailTemplateTag
                        {
                            SysName     = String.Format(localName + "_{0}_{1}", addressPartEnum, (int)AddressCategory.Work),
                            DisplayName = String.Format(localTitle + " {0}", addressPartEnum.ToLocalizedString()),
                            Category    = CRMContactResource.GeneralInformation,
                            isCompany   = isCompany,
                            Name        = ToTagName(String.Format("{0} {1}", infoTypeEnum.ToString(), addressPartEnum.ToString()), isCompany)
                        });
                    }
                }
                else
                {
                    result.Add(new MailTemplateTag
                    {
                        SysName     = localName,
                        DisplayName = localTitle,
                        Category    = CRMContactResource.GeneralInformation,
                        isCompany   = isCompany,
                        Name        = ToTagName(infoTypeEnum.ToString(), isCompany)
                    });
                }
            }

            #endregion

            #region Custom Fields

            var entityType = isCompany ? EntityType.Company : EntityType.Person;

            var customFieldsDao = _daoFactory.CustomFieldDao;

            var customFields = customFieldsDao.GetFieldsDescription(entityType);

            var category = CRMContactResource.GeneralInformation;

            foreach (var customField in customFields)
            {
                if (customField.FieldType == CustomFieldType.SelectBox)
                {
                    continue;
                }
                if (customField.FieldType == CustomFieldType.CheckBox)
                {
                    continue;
                }

                if (customField.FieldType == CustomFieldType.Heading)
                {
                    if (!String.IsNullOrEmpty(customField.Label))
                    {
                        category = customField.Label;
                    }

                    continue;
                }

                result.Add(new MailTemplateTag
                {
                    SysName     = "customField_" + customField.ID,
                    DisplayName = customField.Label.HtmlEncode(),
                    Category    = category,
                    isCompany   = isCompany,
                    Name        = ToTagName(customField.Label, isCompany)
                });
            }

            #endregion

            return(result);
        }
Exemplo n.º 45
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Contact"/> class.
 /// </summary>
 /// <param name="world">The world on which to place the joint.</param>
 /// <param name="contact">
 /// A structure containing information about the contact point and
 /// colliding surfaces.
 /// </param>
 public Contact(World world, ContactInfo contact)
     : this(world, contact, null)
 {
 }
Exemplo n.º 46
0
 public async Task AddEmail(ContactInfo contact)
 {
     await this.httpClient.PostAsJsonAsync("api/ContactInfoes", contact);
 }
    /// <summary>
    /// Saves the data.
    /// </summary>
    private bool Save(string newsletterName, ContactInfo contact)
    {
        bool toReturn = false;
        int  siteId   = SiteContext.CurrentSiteID;

        // Check if subscriber info object exists
        if (string.IsNullOrEmpty(newsletterName) || (contact == null))
        {
            return(false);
        }

        // Get newsletter info
        NewsletterInfo newsletter = NewsletterInfoProvider.GetNewsletterInfo(newsletterName, siteId);

        if (newsletter != null)
        {
            try
            {
                // Check if contact is not marketable
                if (!mSubscriptionService.IsMarketable(contact, newsletter))
                {
                    toReturn = true;

                    mSubscriptionService.Subscribe(contact, newsletter, new SubscribeSettings()
                    {
                        SendConfirmationEmail = SendConfirmationEmail,
                        AllowOptIn            = true,
                        RemoveUnsubscriptionFromNewsletter         = true,
                        RemoveAlsoUnsubscriptionFromAllNewsletters = true,
                    });

                    // Info message
                    if (!chooseMode)
                    {
                        lblInfo.Visible = true;
                        lblInfo.Text    = GetString("NewsletterSubscription.Subscribed");
                    }

                    // Track successful subscription conversion
                    if (TrackConversionName != string.Empty)
                    {
                        string siteName = SiteContext.CurrentSiteName;

                        if (AnalyticsHelper.AnalyticsEnabled(siteName) && Service.Resolve <IAnalyticsConsentProvider>().HasConsentForLogging() && !AnalyticsHelper.IsIPExcluded(siteName, RequestContext.UserHostAddress))
                        {
                            // Log conversion
                            HitLogProvider.LogConversions(siteName, LocalizationContext.PreferredCultureCode, TrackConversionName, 0, ConversionValue);
                        }
                    }
                }
                else
                {
                    // Info message - subscriber is allready in site
                    if (!chooseMode)
                    {
                        lblInfo.Visible = true;
                        lblInfo.Text    = GetString("NewsletterSubscription.SubscriberIsAlreadySubscribed");
                    }
                    else
                    {
                        lblInfo.Visible = true;
                        lblInfo.Text   += GetString("NewsletterSubscription.SubscriberIsAlreadySubscribedXY") + " " + HTMLHelper.HTMLEncode(newsletter.NewsletterDisplayName) + ".<br />";
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text    = ex.Message;
            }
        }
        else
        {
            lblError.Visible = true;
            lblError.Text    = GetString("NewsletterSubscription.NewsletterDoesNotExist");
        }

        return(toReturn);
    }
Exemplo n.º 48
0
 public static void Contact_Insert(ContactInfo data)
 {
     db.Contact_Insert(data);
 }
Exemplo n.º 49
0
        private SubscriberInfo CreateSubscriber(string email, string firstName, string lastName, string fullName, ContactInfo contact)
        {
            var subscriber = SubscriberInfoProvider.GetSubscriberByEmail(email, site.SiteID);

            if (subscriber != null)
            {
                return(subscriber);
            }

            subscriber = new SubscriberInfo
            {
                SubscriberEmail     = email,
                SubscriberFirstName = firstName,
                SubscriberLastName  = lastName,
                SubscriberSiteID    = site.SiteID,
                SubscriberFullName  = fullName,
                SubscriberRelatedID = contact.ContactID,
                SubscriberType      = PredefinedObjectType.CONTACT
            };
            SubscriberInfo.Provider.Set(subscriber);

            return(subscriber);
        }
Exemplo n.º 50
0
 /// <summary>
 /// Create a candidate and fill in the basic required information.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="jobPosition"></param>
 /// <param name="contactInfo"></param>
 public Candidate(CompoundName name, JobPosition jobPosition, ContactInfo contactInfo)
 {
     Name        = name;
     JobPosition = jobPosition;
     ContactInfo = contactInfo;
 }
 /// <summary>添加记录</summary>
 /// <param name="param">实例<see cref="ContactInfo"/>详细信息</param>
 public void Insert(ContactInfo param)
 {
     ibatisMapper.Insert(StringHelper.ToProcedurePrefix(string.Format("{0}_Insert", tableName)), param);
 }
Exemplo n.º 52
0
    /// <summary>
    /// Creates contact. Called when the "Create contact" button is pressed.
    /// </summary>
    private bool CreateContact()
    {
        // Create new contact object
        ContactInfo newContact = new ContactInfo()
                                     {
                                         ContactLastName = "My New Contact",
                                         ContactFirstName = "My New Firstname",
                                         ContactSiteID = CMSContext.CurrentSiteID,
                                         ContactIsAnonymous = true
                                     };

        // Save the contact
        ContactInfoProvider.SetContactInfo(newContact);

        return true;
    }
Exemplo n.º 53
0
            private void _TryGetContactInfo(string path, string key, out ContactInfo newInfo, ref ContactCollectionChangeType action)
            {
                newInfo = new ContactInfo();

                Assert.IsTrue(_dispatcher.CheckAccess());

                bool failedMissingFile = false;
                bool failedBadData = false;
                bool failedManagerIsGone = false;
                try
                {
                    // We just have a file with this extension, it's not necessarily valid.
                    // If we can't get a contact from it then don't raise a notification.
                    using (Contact contact = _loader.GetByFilePath(path))
                    {
                        newInfo.Id = contact.Id;
                        newInfo.LastWrite = File.GetLastWriteTime(path);
                    }

                    _knownContacts[key] = newInfo;
                }
                // Couldn't load the file.  Whatever...
                catch (FileNotFoundException) { failedMissingFile = true; }
                catch (DirectoryNotFoundException) { failedMissingFile = true; }
                catch (InvalidDataException) { failedBadData = true; }
                catch (ObjectDisposedException) { failedManagerIsGone = true; }
                // Let these propagate to the caller.
                catch (IOException)
                {
                    throw;
                }
                catch (UnauthorizedAccessException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    // Not expecting other exceptions here, but if we hit them then throw away the cached object.
                    Assert.Fail(e.ToString());
                    failedBadData = true;
                }

                // Only care about failures if we're still processing.
                if (_stopProcessing)
                {
                    action = ContactCollectionChangeType.NoChange;
                    return;
                }

                if (failedBadData)
                {
                    // If we couldn't load the file and this was going to be treated as an add, then just do nothing.
                    action = (ContactCollectionChangeType.Added == action)
                        ? ContactCollectionChangeType.NoChange
                        : ContactCollectionChangeType.Removed;
                    _knownContacts.Remove(key);
                }
                else if (failedMissingFile)
                {
                    // If we couldn't load the file and this was going to be treated as an add, then just do nothing.
                    switch (action)
                    {
                        case ContactCollectionChangeType.Added:
                            action = ContactCollectionChangeType.NoChange;
                            break;
                        case ContactCollectionChangeType.Updated:
                            _SetPendingFile(path);
                            _timer.Start();
                            action = ContactCollectionChangeType.NoChange;
                            break;
                        default:
                            action = ContactCollectionChangeType.Removed;
                            _knownContacts.Remove(key);
                            break;
                    }
                }
                else if (failedManagerIsGone)
                {
                    // We should stop processing these...
                    action = ContactCollectionChangeType.NoChange;
                }
            }
Exemplo n.º 54
0
        private void _ReadContactInfo(JProperty jToken, String propertyValue, Contact contact, ref List <ContactInfo> findedContactInfos, ref List <int> primaryFields, String addressTemplateStr)
        {
            var nameParts       = jToken.Name.Split(new[] { '_' }).Skip(1).ToList();
            var contactInfoType =
                (ContactInfoType)Enum.Parse(typeof(ContactInfoType), nameParts[0]);

            if (contactInfoType == ContactInfoType.Email)
            {
                var validEmails = propertyValue
                                  .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                  .Where(email => email.TestEmailRegex()).ToArray();

                if (!validEmails.Any())
                {
                    return;
                }

                propertyValue = string.Join(",", validEmails);
            }

            var category = Convert.ToInt32(nameParts[1]);

            var isPrimary = false;

            if ((contactInfoType == ContactInfoType.Email ||
                 contactInfoType == ContactInfoType.Phone ||
                 contactInfoType == ContactInfoType.Address) &&
                (!primaryFields.Contains((int)contactInfoType)))
            {
                isPrimary = true;

                primaryFields.Add((int)contactInfoType);
            }

            if (contactInfoType == ContactInfoType.Address)
            {
                var addressPart = (AddressPart)Enum.Parse(typeof(AddressPart), nameParts[2]);

                var findedAddress =
                    findedContactInfos.Find(
                        item =>
                        (category == item.Category) && (item.InfoType == ContactInfoType.Address) &&
                        (item.ContactID == contact.ID));

                if (findedAddress == null)
                {
                    findedAddress = new ContactInfo
                    {
                        Category  = category,
                        InfoType  = contactInfoType,
                        Data      = addressTemplateStr,
                        ContactID = contact.ID,
                        IsPrimary = isPrimary
                    };

                    findedContactInfos.Add(findedAddress);
                }

                var addressParts = JObject.Parse(findedAddress.Data);

                addressParts[addressPart.ToString().ToLower()] = propertyValue;

                findedAddress.Data = addressParts.ToString();

                return;
            }

            var items = propertyValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var item in items)
            {
                findedContactInfos.Add(new ContactInfo
                {
                    Category  = category,
                    InfoType  = contactInfoType,
                    Data      = item,
                    ContactID = contact.ID,
                    IsPrimary = isPrimary
                });

                isPrimary = false;
            }
        }
Exemplo n.º 55
0
 /// <summary>
 /// Delete items one by one.
 /// </summary>
 private void DeleteItems()
 {
     while (!DataHelper.DataSourceIsEmpty(ds))
     {
         // Delete the contacts
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             var ci = new ContactInfo(dr);
             AddLog((ci.ContactLastName + " " + ci.ContactFirstName).Trim());
             ContactHelper.Delete(ci, chkChildren.Checked, chkMoveRelations.Checked);
         }
         ds = ContactInfoProvider.GetContacts()
                                 .TopN(500)
                                 .Where(WhereCondition)
                                 .OrderBy("ContactLastName");
     }
 }
Exemplo n.º 56
0
 protected override ContactManager GetInstanceContactManger(ContactInfo contact)
 {
     return(new ContactHttpSimple(this, contact));
 }
Exemplo n.º 57
0
    void UniSelector_OnItemsSelected(object sender, EventArgs e)
    {
        // Check permissions
        if (ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, true))
        {
            string values = ValidationHelper.GetString(selectUser.UniSelector.Value, null);
            if (!String.IsNullOrEmpty(values))
            {
                // Store users one by one
                string[] userIds = values.Split(';');
                foreach (string userId in userIds)
                {
                    // Check if user ID is valid
                    int userIdInt = ValidationHelper.GetInteger(userId, 0);
                    if (userIdInt <= 0)
                    {
                        continue;
                    }
                    // Add new relation
                    int parentId = (ci.ContactMergedWithContactID == 0) ? ci.ContactID : ci.ContactMergedWithContactID;
                    MembershipInfoProvider.SetRelationship(userIdInt, MemberTypeEnum.CmsUser, ci.ContactID, parentId, true);
                    ci = ContactInfoProvider.GetContactInfo(contactId);
                }

                // When contact was merged then refresh complete page
                if ((ci != null) && (ci.ContactMergedWithContactID > 0))
                {
                    Page.Response.Redirect(URLHelper.Url.ToString(), true);
                }
                else
                {
                    gridElem.ReloadData();
                }
            }
        }
    }
Exemplo n.º 58
0
Arquivo: User.cs Projeto: qdjx/C5
        //更新用户信息
        public static UserInfo UserInfoUpload(UserInfo userInfo, List<FileUploadInfo> fileUploadInfo
            , PersonInfo personInfo, ContactInfo contactInfo, bool isRegisters, out AlertMessage alertMessage)
        {
            if (userInfo.ID == 0 && isRegisters) { userInfo.StateID = (int)UserState.提交; }
            else if (Login.GetLoginInfo() == null)
            {
                //登录检查
                alertMessage = new AlertMessage { Message = "未登录不允许更新用户信息", Type = AlertType.warning };
                return null;
            }
            else if (userInfo.ID != Login.GetLoginInfo().UserInfo.ID)
            {
                //权限检查
                if (!AUTH.PermissionCheck(ModuleInfo, ActionInfos.Where(i => i.Name == (userInfo.ID == 0 ? "Create" : "Modify")).FirstOrDefault(), out string Message))
                {
                    alertMessage = new AlertMessage { Message = Message, Type = AlertType.warning };
                    return null;
                }
            }

            //表单检查
            if (string.IsNullOrWhiteSpace(userInfo.Name))
            {
                alertMessage = new AlertMessage { Message = "用户名不能为空。", Type = AlertType.warning };
                return null;
            }
            if (string.IsNullOrWhiteSpace(userInfo.Password))
            {
                alertMessage = new AlertMessage { Message = "密码不能为空。", Type = AlertType.warning };
                return null;
            }

            using (var EF = new EF())
            {
                //检查用户初始化,可略去
                UserInfo user_admin = EF.UserInfos.Where(i => i.Name == "admin").FirstOrDefault();
                if (user_admin == null) { InitUserInfo(); }

                //修改是否存在?用户名唯一?
                UserInfo user_exist = null;
                UserInfo user_name_exist = null;
                if (userInfo.ID == 0)
                {
                    user_name_exist = EF.UserInfos.Where(i => i.StateID != (int)UserState.删除 && i.Name == userInfo.Name).FirstOrDefault();
                }
                else
                {
                    user_exist = EF.UserInfos.Where(i => i.StateID != (int)UserState.删除 && i.ID == userInfo.ID).FirstOrDefault();
                    if (user_exist == null)
                    {
                        alertMessage = new AlertMessage { Message = string.Format("用户编号[{0}]不存在。", userInfo.ID), Type = AlertType.warning };
                        return null;
                    }
                    user_name_exist = EF.UserInfos.Where(i => i.ID != userInfo.ID && i.StateID != (int)UserState.删除
                        && i.Name == userInfo.Name).FirstOrDefault();
                }
                if (user_name_exist != null && user_name_exist.ID > 0)
                {
                    alertMessage = new AlertMessage { Message = string.Format("用户名[{0}]已被ID[{1}]使用。", userInfo.Name, user_name_exist.ID), Type = AlertType.warning };
                    return null;
                }

                //数据保存
                using (TransactionScope TS = new TransactionScope())
                {
                    //日志信息
                    if (user_exist != null)
                    {
                        UserInfo_log userInfo_Log = new UserInfo_log
                        {
                            UserID = user_exist.ID,
                            GUID = user_exist.GUID,
                            Name = user_exist.Name,
                            Password = user_exist.Password,
                            StateID = user_exist.StateID,
                            UpdateTime = user_exist.UpdateTime
                        };
                        EF.UserInfo_logs.Add(userInfo_Log);
                        EF.SaveChanges();
                        var avatar_log = EF.UserAvatars.Where(i => i.UserID == user_exist.ID && i.LogID == null);
                        foreach (var item in avatar_log) { item.LogID = userInfo_Log.ID; }
                        var person_log = EF.UserPersons.Where(i => i.UserID == user_exist.ID && i.LogID == null);
                        foreach (var item in person_log) { item.LogID = userInfo_Log.ID; }
                        var contact_log = EF.UserContacts.Where(i => i.UserID == user_exist.ID && i.LogID == null);
                        foreach (var item in contact_log) { item.LogID = userInfo_Log.ID; }
                        EF.SaveChanges();
                    }

                    //用户信息
                    if (userInfo.ID == 0)
                    {
                        user_exist = EF.UserInfos.Add(new UserInfo
                        {
                            GUID = Guid.NewGuid().ToString(),
                            StateID = (int)UserState.创建,
                        });
                    }
                    user_exist.Name = userInfo.Name;
                    user_exist.Password = userInfo.Password;
                    user_exist.UpdateTime = DateTime.Now;
                    EF.SaveChanges();
                    //头像信息
                    if (fileUploadInfo != null && fileUploadInfo.Count > 0)
                    {
                        long fileID = fileUploadInfo[0].FileInfo.ID;
                        var userAvatar_exist = EF.UserAvatars.Where(i => i.UserID == user_exist.ID && i.FileID == fileID && i.LogID == null).FirstOrDefault();
                        if (userAvatar_exist == null)
                        {
                            EF.UserAvatars.Add(userAvatar_exist = new UserAvatar
                            {
                                UserID = user_exist.ID,
                                FileID = fileID,
                            });
                            EF.SaveChanges();
                        }
                    }
                    //个人信息
                    var person_exist = EF.PersonInfos.Where(i => i.Name == personInfo.Name
                        && i.GenderTypeID == personInfo.GenderTypeID
                        && i.Birthday == personInfo.Birthday
                        && i.IDCardNO == personInfo.IDCardNO).FirstOrDefault();
                    if (person_exist == null)
                    {
                        EF.PersonInfos.Add(person_exist = new PersonInfo
                        {
                            Name = personInfo.Name,
                            GenderTypeID = personInfo.GenderTypeID,
                            Birthday = personInfo.Birthday,
                            IDCardNO = personInfo.IDCardNO,
                        });
                        EF.SaveChanges();
                    }
                    var userPerson_exist = EF.UserPersons.Where(i => i.UserID == user_exist.ID
                        && i.PersonID == person_exist.ID && i.LogID == null).FirstOrDefault();
                    if (userPerson_exist == null)
                    {
                        EF.UserPersons.Add(userPerson_exist = new UserPerson
                        {
                            UserID = user_exist.ID,
                            PersonID = person_exist.ID
                        });
                        EF.SaveChanges();
                    }
                    //联系信息
                    var contact_exist = EF.ContactInfos.Where(i => i.Phone == contactInfo.Phone
                        && i.Mobile == contactInfo.Mobile
                        && i.EMail == contactInfo.EMail
                        && i.Address == contactInfo.Address).FirstOrDefault();
                    if (contact_exist == null)
                    {
                        EF.ContactInfos.Add(contact_exist = new ContactInfo
                        {
                            Phone = contactInfo.Phone,
                            Mobile = contactInfo.Mobile,
                            EMail = contactInfo.EMail,
                            Address = contactInfo.Address,
                        });
                        EF.SaveChanges();
                    }
                    var userContact = EF.UserContacts.Where(i => i.UserID == user_exist.ID
                        && i.ContactID == contact_exist.ID && i.LogID == null).FirstOrDefault();
                    if (userContact == null)
                    {
                        EF.UserContacts.Add(userContact = new UserContact
                        {
                            UserID = user_exist.ID,
                            ContactID = contact_exist.ID
                        });
                        EF.SaveChanges();
                    }

                    //更新完成
                    TS.Complete();
                    alertMessage = null;
                    return user_exist;
                }
            }
        }
Exemplo n.º 59
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Show/hide campaign selector
        fCampaignSelection.Visible = CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.WebAnalytics", "read");

        // Get parent contact
        if (mergedIntoSite)
        {
            parentContact = ContactInfoProvider.GetContactInfo(ValidationHelper.GetInteger(this.EditForm.Data["ContactMergedWithContactID"], 0));
            lblMergedInto.ResourceString = "om.contact.mergedintosite";
        }
        else if (mergedIntoGlobal)
        {
            parentContact = ContactInfoProvider.GetContactInfo(ValidationHelper.GetInteger(this.EditForm.Data["ContactGlobalContactID"], 0));
            lblMergedInto.ResourceString = "om.contact.mergedintoglobal";
        }
        else
        {
            lblMergedInto.Visible = false;
        }

        // Register scripts
        RegisterScripts();

        // Initialize properties
        pnlGeneral.GroupingText = GetString("general.general");
        pnlPersonal.GroupingText = GetString("om.contact.personal");
        pnlSettings.GroupingText = GetString("om.contact.settings");
        pnlAddress.GroupingText = GetString("general.address");
        pnlNotes.GroupingText = GetString("om.contact.notes");
        btnStamp.OnClientClick = "AddStamp('" + htmlNotes.CurrentEditor.ClientID + "'); return false;";

        // Initialize redirection URL
        string url = "Frameset.aspx?contactid={%EditedObject.ID%}&saved=1";
        url = URLHelper.AddParameterToUrl(url, "siteid", this.SiteID.ToString());
        if (ContactHelper.IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "issitemanager", "1");
        }
        EditForm.RedirectUrlAfterCreate = url;

        if (!RequestHelper.IsPostBack() && QueryHelper.GetBoolean("split", false))
        {
            DisplayInfo(GetString("om.contact.splitted"));
        }

        if (userSelector.SiteID <= 0)
        {
            userSelector.WhereCondition = "UserName NOT LIKE N'public'";
            userSelector.ShowSiteFilter = true;
        }
        userSelector.ReloadData();
    }
        public ActionResult Index(string Search_key)
        {
            if (Session["Username"] == null && Session["Password"] == null)
            {
                return(RedirectToAction("Index", "Admin", new { area = "" }));
            }
            else
            {
                if (!string.IsNullOrEmpty(Search_key))
                {
                    List <ContactsInfo> Searched = new Cateloge().SearchContactsInfo(Search_key);

                    if (Searched == null)
                    {
                        ViewBag.StatusMessage = " No Any Data Found ! ";
                    }
                    else
                    {
                        AllClasses Data = new AllClasses();
                        Data.Contact_sInfo_s = new List <ContactInfo>();
                        foreach (var gdfc in Searched)
                        {
                            ContactInfo dbr = new ContactInfo();
                            dbr.Id              = gdfc.db_Id;
                            dbr.Title           = gdfc.Title;
                            dbr.Contact_Cell    = gdfc.Contact_Cell;
                            dbr.Contact_Phone   = gdfc.Contact_Phone;
                            dbr.Contact_Email   = gdfc.Contact_Email;
                            dbr.Contact_Website = gdfc.Contact_Website;
                            dbr.Contact_Address = gdfc.Contact_Address;
                            dbr.Publish         = gdfc.Publish;
                            Data.Contact_sInfo_s.Add(dbr);
                        }
                        Data.Contact_sInfo_s.TrimExcess();
                        return(View(Data));
                    }
                }
                else
                {
                    List <ContactsInfo> contactsinfo = new Cateloge().ContactsInfo();

                    if (contactsinfo == null)
                    {
                        ViewBag.StatusMessage = " No Any Data Found ! ";
                    }
                    else
                    {
                        AllClasses Data = new AllClasses();
                        Data.Contact_sInfo_s = new List <ContactInfo>();
                        foreach (var gdfc in contactsinfo)
                        {
                            ContactInfo dbr = new ContactInfo();
                            dbr.Id              = gdfc.db_Id;
                            dbr.Title           = gdfc.Title;
                            dbr.Contact_Cell    = gdfc.Contact_Cell;
                            dbr.Contact_Phone   = gdfc.Contact_Phone;
                            dbr.Contact_Email   = gdfc.Contact_Email;
                            dbr.Contact_Website = gdfc.Contact_Website;
                            dbr.Contact_Address = gdfc.Contact_Address;
                            dbr.Publish         = gdfc.Publish;
                            Data.Contact_sInfo_s.Add(dbr);
                        }
                        Data.Contact_sInfo_s.TrimExcess();
                        return(View(Data));
                    }
                }
                return(View());
            }
        }