Пример #1
0
        public static void AssociateEntities(IOrganizationService service, string relationshipName, string entityName1, Guid entity1id, string entityName2, Guid entity2id)
        {
            if (entityName1 == "campaign" || entityName2 == "campaign")
            {
                AddItemCampaignRequest addItemCampaignRequest = new AddItemCampaignRequest();
                if (entityName1 == "campaign")
                {
                    addItemCampaignRequest.CampaignId = entity1id;
                    addItemCampaignRequest.EntityName = entityName2;
                    addItemCampaignRequest.EntityId   = entity2id;
                }
                else
                {
                    addItemCampaignRequest.CampaignId = entity2id;
                    addItemCampaignRequest.EntityName = entityName1;
                    addItemCampaignRequest.EntityId   = entity1id;
                }
                service.Execute(addItemCampaignRequest);
            }
            else
            {
                AssociateEntitiesRequest associateEntitiesRequest = new AssociateEntitiesRequest();
                associateEntitiesRequest.RelationshipName = relationshipName;
                associateEntitiesRequest.Moniker1         = new EntityReference(entityName1, entity1id);
                associateEntitiesRequest.Moniker2         = new EntityReference(entityName2, entity2id);

                service.Execute(associateEntitiesRequest);
            }
        }
Пример #2
0
        public void Associar(Domain.Model.ExtratoFidelidade extrato, Domain.Model.Resgate resgate)
        {
            var request = new AssociateEntitiesRequest();

            request.RelationshipName = "new_extrato_fidelidade_new_resgate_premio";
            request.Moniker1         = new EntityReference("new_extrato_fidelidade", extrato.Id);
            request.Moniker2         = new EntityReference("new_resgate_premio_fidelidade", resgate.Id);
            base.Provider.Execute(request);
        }
Пример #3
0
        public void AssociateTo(Guid Id, EntityReferenceWrapper targetEntity, string relationShipName)
        {
            IOrganizationService service = _msCrmAccess.GetCrmService();

            AssociateEntitiesRequest request = new AssociateEntitiesRequest();

            request.Moniker1         = new EntityReference("new_attachment", Id);
            request.Moniker2         = targetEntity.ToCrmEntityReference();
            request.RelationshipName = relationShipName;

            service.Execute(request);
        }
        private void Associate(string relationshipName, string entity1LogicalName, Guid entity1Id, string entity2LogicalName, Guid entity2Id)
        {
            var request = new AssociateEntitiesRequest();

            request.Moniker1 = new EntityReference {
                Id = entity1Id, LogicalName = entity1LogicalName
            };
            request.Moniker2 = new EntityReference {
                Id = entity2Id, LogicalName = entity2LogicalName
            };
            request.RelationshipName = relationshipName;

            targetService.Execute(request);
        }
Пример #5
0
        public void AssociateManyToMany(EntityReference moniker1, EntityReference moniker2, string strEntityRelationshipName)
        {
            AssociateEntitiesRequest request = new AssociateEntitiesRequest();

            // Set the ID of Moniker1 to the ID of the lead.
            request.Moniker1 = new EntityReference {
                Id = moniker1.Id, LogicalName = moniker1.Name
            };
            // Set the ID of Moniker2 to the ID of the contact.
            request.Moniker2 = new EntityReference {
                Id = moniker2.Id, LogicalName = moniker2.Name
            };
            // Set the relationship name to associate on.
            request.RelationshipName = strEntityRelationshipName;

            // Execute the request.
            this.Execute(request);
        }
Пример #6
0
        public static MsCrmResult AssociateAttachmentToEntity(Guid attachmentId, EntityReference entity, string relationShipName, IOrganizationService service)
        {
            MsCrmResult returnValue = new MsCrmResult();

            try
            {
                #region | ASSOCIATE PROCESS |
                AssociateEntitiesRequest request = new AssociateEntitiesRequest();
                request.Moniker1         = new EntityReference("new_attachment", attachmentId);
                request.Moniker2         = entity;
                request.RelationshipName = relationShipName;
                service.Execute(request);
                #endregion

                returnValue.Success = true;
                returnValue.Result  = "Dosya eki ilişkilendirme başarıyla gerçekleşti.";
            }
            catch (Exception ex)
            {
                returnValue.Success = false;
                returnValue.Result  = ex.Message;
            }
            return(returnValue);
        }
Пример #7
0
        public static MsCrmResult AssociateEntityToEntity(Guid entityId, string entityName, EntityReference entity, string relationShipName, IOrganizationService service)
        {
            MsCrmResult returnValue = new MsCrmResult();

            try
            {
                #region | ASSOCIATE PROCESS |
                AssociateEntitiesRequest request = new AssociateEntitiesRequest();
                request.Moniker1         = new EntityReference(entityName, entityId);
                request.Moniker2         = entity;
                request.RelationshipName = relationShipName;
                service.Execute(request);
                #endregion

                returnValue.Success = true;
                returnValue.Result  = "İlişkilendirme tamamlandı.";
            }
            catch (Exception ex)
            {
                returnValue.Success = false;
                returnValue.Result  = ex.Message;
            }
            return(returnValue);
        }
Пример #8
0
        public MsCrmResult CreateWebForm(Webform form)
        {
            IOrganizationService service = MSCRM.AdminOrgService;
            MsCrmResult          result  = new MsCrmResult();
            Guid contactId                = Guid.Empty;
            Guid channelOfAwarenessId     = Guid.Empty;
            Guid subParticipationSourceId = Guid.Empty;
            Guid projectId                = Guid.Empty;
            Guid utm_mediumid             = Guid.Empty;
            Guid utm_campaignid           = Guid.Empty;

            #region | FIND CONTACT |

            if (!string.IsNullOrEmpty(form.CustomerEmail))
            {
                contactId = GetContact("emailaddress1", form.CustomerEmail, service);
            }
            else
            {
                result.Success = false;
                result.Message = "Lütfen e-posta adresinizi yazınız";
                return(result);
            }
            if (!string.IsNullOrEmpty(form.CustomerMobilePhone) && contactId == Guid.Empty)
            {
                contactId = GetContact("mobilephone", form.CustomerMobilePhone, service);
            }
            else if (string.IsNullOrEmpty(form.CustomerMobilePhone))
            {
                result.Success = false;
                result.Message = "Lütfen cep telefonu numaranızı yazınız";
                return(result);
            }
            #endregion

            #region | FORMAT CHECK MOBILE |
            TelephoneNumber number = GeneralHelper.CheckTelephoneNumber(form.CustomerMobilePhone);
            if (!number.isFormatOK)
            {
                result.Success = false;
                result.Message = "Lütfen cep telefonu numaranızı geçerli formatta yazınız";
                return(result);
            }

            #endregion

            #region | Haberdar olma kanalı|
            if (!string.IsNullOrEmpty(form.ChannelOfAwareness))
            {
                channelOfAwarenessId = GetChannelOfAwareness(form.ChannelOfAwareness, service);
            }
            else
            {
                result.Success = false;
                result.Message = "Lütfen haberdar olma kanalını seçiniz";
                return(result);
            }
            #endregion

            #region | Alt Katılım Kaynağı |
            if (!string.IsNullOrEmpty(form.SubParticipationSource))
            {
                subParticipationSourceId = GetSubParticipationSource(form.SubParticipationSource, service);
            }
            #endregion

            #region | İletişim Tercihi |
            if (form.ContactPreferences == null || !form.ContactPreferences.HasValue)
            {
                result.Success = false;
                result.Message = "Lütfen iletişim tercihinizi seçiniz";
                return(result);
            }
            #endregion

            #region | İlgilendiği Proje |
            if (!string.IsNullOrEmpty(form.InterestOfProjectCode))
            {
                projectId = GetProject(form.InterestOfProjectCode, service);
            }
            #endregion

            #region | UPDATE-CREATE CONTACT |
            if (contactId != Guid.Empty)
            {
                Entity contactRecord = service.Retrieve("contact", contactId, new ColumnSet(true));
                Entity c             = new Entity("contact");
                c.Id = contactId;
                if (!contactRecord.Contains("new_subsourceofparticipationid"))//Yoksa Güncelle
                {
                    if (subParticipationSourceId != Guid.Empty)
                    {
                        c.Attributes["new_subsourceofparticipationid"] = new EntityReference("new_subsourceofparticipation", subParticipationSourceId);//Alt katılım kaynağı
                    }
                }
                if (!contactRecord.Contains("new_sourceofparticipationid"))                                                                                   //Yoksa Güncelle
                {
                    c.Attributes["new_sourceofparticipationid"] = new EntityReference("new_sourceofparticipation", new Guid(Globals.WebFormParticipationId)); //Katılım kaynağı
                }
                if (!contactRecord.Contains("new_channelofawarenessid"))                                                                                      //Yoksa Güncelle
                {
                    c.Attributes["new_channelofawarenessid"] = new EntityReference("new_channelofawareness", channelOfAwarenessId);                           //Haber Olma Kanalı
                }

                if (!contactRecord.Contains("new_investmentrange"))
                {
                    if (form.CustomerInvestmentRange.HasValue)
                    {
                        if (form.CustomerInvestmentRange.Value == InvestmentRange.optionOne)
                        {
                            c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionOne);
                        }
                    }
                    if (form.CustomerInvestmentRange.HasValue)
                    {
                        if (form.CustomerInvestmentRange.Value == InvestmentRange.optionTwo)
                        {
                            c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionTwo);
                        }
                    }
                    if (form.CustomerInvestmentRange.HasValue)
                    {
                        if (form.CustomerInvestmentRange.Value == InvestmentRange.optionThree)
                        {
                            c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionThree);
                        }
                    }
                    if (form.CustomerInvestmentRange.HasValue)
                    {
                        if (form.CustomerInvestmentRange.Value == InvestmentRange.optionFour)
                        {
                            c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionFour);
                        }
                    }
                    if (form.CustomerInvestmentRange.HasValue)
                    {
                        if (form.CustomerInvestmentRange.Value == InvestmentRange.optionFive)
                        {
                            c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionFive);
                        }
                    }
                    if (form.CustomerInvestmentRange.HasValue)
                    {
                        if (form.CustomerInvestmentRange.Value == InvestmentRange.optionSix)
                        {
                            c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionSix);
                        }
                    }
                }

                if (!contactRecord.Contains("new_preferenceoffice"))
                {
                    if (form.FlatTypeChoose.HasValue)
                    {
                        if (form.FlatTypeChoose.Value == FlatType.optionFive)
                        {
                            c.Attributes["new_preferenceoffice"] = true;
                        }
                    }
                }

                if (!contactRecord.Contains("new_preferencestore"))
                {
                    if (form.FlatTypeChoose.HasValue)
                    {
                        if (form.FlatTypeChoose.Value == FlatType.optionSix)
                        {
                            c.Attributes["new_preferencestore"] = true;
                        }
                    }
                }

                if (!contactRecord.Contains("new_1plus1"))
                {
                    if (form.FlatTypeChoose.HasValue)
                    {
                        if (form.FlatTypeChoose.Value == FlatType.optionOne)
                        {
                            c.Attributes["new_1plus1"] = true;
                        }
                    }
                }

                if (!contactRecord.Contains("new_2plus1"))
                {
                    if (form.FlatTypeChoose.HasValue)
                    {
                        if (form.FlatTypeChoose.Value == FlatType.optionTwo)
                        {
                            c.Attributes["new_2plus1"] = true;
                        }
                    }
                }
                if (!contactRecord.Contains("new_3plus1"))
                {
                    if (form.FlatTypeChoose.HasValue)
                    {
                        if (form.FlatTypeChoose.Value == FlatType.optionThree)
                        {
                            c.Attributes["new_3plus1"] = true;
                        }
                    }
                }
                if (!contactRecord.Contains("new_4plus1"))
                {
                    if (form.FlatTypeChoose.HasValue)
                    {
                        if (form.FlatTypeChoose.Value == FlatType.optionFour)
                        {
                            c.Attributes["new_4plus1"] = true;
                        }
                    }
                }
                try
                {
                    service.Update(c);
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Message = ex.Message;
                    return(result);
                }
            }
            else if (contactId == Guid.Empty)
            {
                Entity c = new Entity("contact");
                if (string.IsNullOrEmpty(form.CustomerName))
                {
                    result.Success = false;
                    result.Message = "Lütfen adınızı yazınız";
                    return(result);
                }
                if (string.IsNullOrEmpty(form.CustomerSurname))
                {
                    result.Success = false;
                    result.Message = "Lütfen soyadınızı yanız";
                    return(result);
                }
                c.Attributes["firstname"]     = form.CustomerName;
                c.Attributes["lastname"]      = form.CustomerSurname;
                c.Attributes["mobilephone"]   = form.CustomerMobilePhone;
                c.Attributes["emailaddress1"] = form.CustomerEmail;
                c.Attributes["new_countrycodemobilephone"] = number.countryCode;
                c.Attributes["new_cellphonenumber"]        = number.phoneNo;
                c.Attributes["new_customertype"]           = new OptionSetValue(100000002);//Potansiyel Müşteri

                if (form.CustomerInvestmentRange == InvestmentRange.optionOne)
                {
                    c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionOne);
                }
                if (form.CustomerInvestmentRange == InvestmentRange.optionTwo)
                {
                    c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionTwo);
                }
                if (form.CustomerInvestmentRange == InvestmentRange.optionThree)
                {
                    c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionThree);
                }
                if (form.CustomerInvestmentRange == InvestmentRange.optionFour)
                {
                    c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionFour);
                }
                if (form.CustomerInvestmentRange == InvestmentRange.optionFive)
                {
                    c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionFive);
                }
                if (form.CustomerInvestmentRange == InvestmentRange.optionSix)
                {
                    c.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionSix);
                }
                if (form.FlatTypeChoose == FlatType.optionFive)
                {
                    c.Attributes["new_preferenceoffice"] = true;
                }

                if (form.FlatTypeChoose == FlatType.optionSix)
                {
                    c.Attributes["new_preferencestore"] = true;
                }
                if (form.FlatTypeChoose == FlatType.optionOne)
                {
                    c.Attributes["new_1plus1"] = true;
                }
                if (form.FlatTypeChoose == FlatType.optionTwo)
                {
                    c.Attributes["new_2plus1"] = true;
                }
                if (form.FlatTypeChoose == FlatType.optionThree)
                {
                    c.Attributes["new_3plus1"] = true;
                }
                if (form.FlatTypeChoose == FlatType.optionFour)
                {
                    c.Attributes["new_4plus1"] = true;
                }
                if (subParticipationSourceId != Guid.Empty)
                {
                    c.Attributes["new_subsourceofparticipationid"] = new EntityReference("new_subsourceofparticipation", subParticipationSourceId);       //Alt katılım kaynağı
                }
                c.Attributes["new_sourceofparticipationid"] = new EntityReference("new_sourceofparticipation", new Guid(Globals.WebFormParticipationId)); //Katılım kaynağı
                c.Attributes["new_channelofawarenessid"]    = new EntityReference("new_channelofawareness", channelOfAwarenessId);                        //Haber Olma Kanalı


                try
                {
                    c.Attributes["ownerid"] = new EntityReference("systemuser", new Guid(Globals.WebFormSytemUserId));//Web Form Sahibi
                    contactId = service.Create(c);
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Message = ex.Message;
                    return(result);
                }
            }

            #endregion

            #region | AssociateEntitiesRequest To Project |
            if (projectId != Guid.Empty && contactId != Guid.Empty)
            {
                try
                {
                    AssociateEntitiesRequest request = new AssociateEntitiesRequest();
                    request.Moniker1         = new EntityReference("contact", contactId);
                    request.Moniker2         = new EntityReference("new_project", projectId);
                    request.RelationshipName = "new_contact_new_project";
                    service.Execute(request);
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Message = ex.Message;
                }
            }
            #endregion

            #region |Get UTMS|
            if (!string.IsNullOrEmpty(form.UTM_Campaign))
            {
                utm_campaignid = GetUtmCampaign("new_name", form.UTM_Campaign, service);
            }
            if (!string.IsNullOrEmpty(form.UTM_Medium))
            {
                utm_mediumid = GetUtmMedium("new_name", form.UTM_Medium, service);
            }
            #endregion

            #region | CREATE WEB FORM |
            if (contactId != Guid.Empty)
            {
                Entity w = new Entity("new_webform");
                w.Attributes["new_name"]                    = form.CustomerName + " " + form.CustomerSurname + " - " + DateTime.Now.ToString("dd/MM/yyyy");
                w.Attributes["new_firstname"]               = form.CustomerName;
                w.Attributes["new_lastname"]                = form.CustomerSurname;
                w.Attributes["new_mobilephone"]             = form.CustomerMobilePhone;
                w.Attributes["new_emailadress"]             = form.CustomerEmail;
                w.Attributes["new_sourceofparticipationid"] = new EntityReference("new_sourceofparticipation", new Guid(Globals.WebFormParticipationId));

                if (utm_mediumid != Guid.Empty)
                {
                    w.Attributes["new_utmmediumid"] = new EntityReference("new_utmmedium", utm_mediumid);
                }
                if (utm_campaignid != Guid.Empty)
                {
                    w.Attributes["new_utmcampaignid"] = new EntityReference("new_utmcampaign", utm_campaignid);
                }
                if (subParticipationSourceId != Guid.Empty)
                {
                    w.Attributes["new_subsourceofparticipationid"] = new EntityReference("new_subsourceofparticipation", subParticipationSourceId);
                }
                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionOne)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionOne);
                    }
                }
                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionTwo)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionTwo);
                    }
                }
                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionThree)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionThree);
                    }
                }
                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionFour)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionFour);
                    }
                }
                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionFive)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionFive);
                    }
                }
                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionSix)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionSix);
                    }
                }
                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionSeven)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionSeven);
                    }
                }
                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionEight)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionEight);
                    }
                }

                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionNine)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionNine);
                    }
                }

                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionTen)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionTen);
                    }
                }

                if (form.CustomerInvestmentRange.HasValue)
                {
                    if (form.CustomerInvestmentRange.Value == InvestmentRange.optionEleven)
                    {
                        w.Attributes["new_investmentrange"] = new OptionSetValue((int)InvestmentRange.optionEleven);
                    }
                }

                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionOne)
                    {
                        w.Attributes["new_1plus1"] = true;
                    }
                }
                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionTwo)
                    {
                        w.Attributes["new_2plus1"] = true;
                    }
                }
                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionThree)
                    {
                        w.Attributes["new_3plus1"] = true;
                    }
                }
                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionFour)
                    {
                        w.Attributes["new_4plus1"] = true;
                    }
                }


                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionSeven)
                    {
                        w.Attributes["new_2plus1r"] = true;
                    }
                }
                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionEight)
                    {
                        w.Attributes["new_3plus1r"] = true;
                    }
                }
                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionNine)
                    {
                        w.Attributes["new_4plus1r"] = true;
                    }
                }

                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionTen)
                    {
                        w.Attributes["new_2plus1v"] = true;
                    }
                }
                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionEleven)
                    {
                        w.Attributes["new_3plus1v"] = true;
                    }
                }
                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionTwelve)
                    {
                        w.Attributes["new_4plus1v"] = true;
                    }
                }


                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionFive)
                    {
                        w.Attributes["new_preferenceoffice"] = true;
                    }
                }
                if (form.FlatTypeChoose.HasValue)
                {
                    if (form.FlatTypeChoose.Value == FlatType.optionSix)
                    {
                        w.Attributes["new_preferencestore"] = true;
                    }
                }
                w.Attributes["new_contactid"] = new EntityReference("contact", contactId);
                if (channelOfAwarenessId != Guid.Empty)
                {
                    w.Attributes["new_channelofawarenessid"] = new EntityReference("new_channelofawareness", channelOfAwarenessId);//Haber Olma Kanalı
                }
                if (form.ContactPreferences == ContactPreferences.Phone)
                {
                    w.Attributes["new_onphonecall"] = true;
                }
                else if (form.ContactPreferences == ContactPreferences.EMail)
                {
                    w.Attributes["new_isemailadress"] = true;
                }
                if (form.NefInformation)
                {
                    w.Attributes["new_istakeinfo"] = true;
                }
                if (!string.IsNullOrEmpty(form.Message))
                {
                    w.Attributes["new_message"] = form.Message;
                }
                if (projectId != Guid.Empty)
                {
                    w.Attributes["new_projectid"] = new EntityReference("new_project", projectId);
                }
                if (form.Location.HasValue)
                {
                    w.Attributes["new_location"] = new OptionSetValue((int)form.Location.Value);
                }
                if (form.ProcessType.HasValue)
                {
                    w.Attributes["new_processtype"] = new OptionSetValue((int)form.ProcessType.Value);
                }
                try
                {
                    w.Attributes["ownerid"] = new EntityReference("systemuser", new Guid(Globals.WebFormSytemUserId));//Web Form Sahibi
                    service.Create(w);
                    result.Success = true;
                    result.Message = "Kaydınız başarıyla alınmıştır. Teşekkür ederiz";
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Message = ex.Message;
                }
            }
            return(result);

            #endregion
        }