예제 #1
0
        public JsonResult GetContactInfo(string pk)
        {
            Durados.Web.Mvc.Specifics.Shade.CRM.BusinessLogic.Contact vendor =
                new Durados.Web.Mvc.Specifics.Shade.CRM.BusinessLogic.Contact();

            try
            {
                Durados.Web.Mvc.Specifics.Shade.CRM.BusinessLogic.Json.ContactInfo contactInfo = vendor.GetContactInfo(pk);
                if (contactInfo == null)
                {
                    return(Json(""));
                }
                else
                {
                    return(Json(contactInfo));
                }
            }
            catch (Exception exception)
            {
                Durados.Web.Mvc.Logging.Logger.Log(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), exception.Source, exception, 3, pk);

                return(Json(""));
            }
        }
예제 #2
0
파일: Contact.cs 프로젝트: yarivat/Admin
        public Json.ContactInfo GetContactInfo(string pk)
        {
            View contactView = (View)Durados.Web.Mvc.Map.Database.Views[ShadeViews.V_Contact.ToString()];

            Json.ContactInfo contactInfo = new Durados.Web.Mvc.Specifics.Shade.CRM.BusinessLogic.Json.ContactInfo();

            DataRow contactRow = contactView.GetDataRow(pk);

            ColumnField field = (ColumnField)contactView.Fields[V_Contact.Cellular.ToString()];
            string      val   = field.GetValue(contactRow);

            contactInfo.ClientCellular = val ?? string.Empty;

            field = (ColumnField)contactView.Fields[V_Contact.Email.ToString()];
            val   = field.GetValue(contactRow);
            contactInfo.ClientEmail = val ?? string.Empty;

            field = (ColumnField)contactView.Fields[V_Contact.FullName.ToString()];
            val   = field.GetValue(contactRow);
            contactInfo.ClientName = val ?? string.Empty;

            field = (ColumnField)contactView.Fields[V_Contact.Phone.ToString()];
            val   = field.GetValue(contactRow);
            contactInfo.ClientPhone = val ?? string.Empty;

            View        addressView  = (View)Durados.Web.Mvc.Map.Database.Views[ShadeViews.Address.ToString()];
            ParentField addressField = (ParentField)contactView.Fields[V_Contact.FK_AddressOther_V_Contact_Parent.ToString()];

            val = addressField.GetValue(contactRow);
            if (string.IsNullOrEmpty(val))
            {
                addressField          = (ParentField)contactView.Fields[V_Contact.FK_Address_V_Contact_Parent.ToString()];
                val                   = addressField.GetValue(contactRow);
                contactInfo.AddressID = val ?? string.Empty;

                DataRow addressRow = contactRow.GetParentRow(addressField.DataRelation.RelationName);
                if (addressRow != null)
                {
                    field = (ColumnField)addressView.Fields[Address.FullAddress.ToString()];
                    val   = field.GetValue(addressRow);
                    contactInfo.AddressText = val ?? string.Empty;
                }
                else
                {
                    contactInfo.AddressText = string.Empty;
                }
            }
            else
            {
                contactInfo.AddressID = val ?? string.Empty;

                DataRow addressRow = contactRow.GetParentRow(addressField.DataRelation.RelationName);
                if (addressRow != null)
                {
                    field = (ColumnField)addressView.Fields[Address.FullAddress.ToString()];
                    val   = field.GetValue(addressRow);
                    contactInfo.AddressText = val ?? string.Empty;
                }
                else
                {
                    contactInfo.AddressText = string.Empty;
                }
            }

            //field = (ColumnField)contactView.Fields[V_Contact.MailingCountry.ToString()];
            //val = field.GetValue(contactRow);
            //contactInfo.JobCountry = val ?? string.Empty;

            //field = (ColumnField)contactView.Fields[V_Contact.MailingState.ToString()];
            //val = field.GetValue(contactRow);
            //contactInfo.JobState = val ?? string.Empty;


            //field = (ColumnField)contactView.Fields[V_Contact.MailingStreet.ToString()];
            //val = field.GetValue(contactRow);
            //contactInfo.JobStreet = val ?? string.Empty;

            //field = (ColumnField)contactView.Fields[V_Contact.MailingZip.ToString()];
            //val = field.GetValue(contactRow);
            //contactInfo.JobZip = val ?? string.Empty;

            return(contactInfo);
        }