示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 分页参数

            pageIndex = Utils.GetInt(Utils.GetQueryStringValue("page"), 1);;
            #endregion
            type = (CrmType)Utils.GetInt(Utils.GetQueryStringValue("currType"));

            MLBCrmSearchInfo queryString = new MLBCrmSearchInfo();
            queryString.CityId     = Utils.GetIntNull(Utils.GetQueryStringValue("cId"));
            queryString.ProvinceId = Utils.GetIntNull(Utils.GetQueryStringValue("pId"));
            queryString.CrmName    = Utils.GetQueryStringValue("currName");
            queryString.SellerName = Utils.GetQueryStringValue("txtSellers");
            if (!string.IsNullOrEmpty(queryString.SellerName) && queryString.SellerName == SiteUserInfo.Name)
            {
                queryString.SellerId = SiteUserInfo.UserId;
            }

            IList <EyouSoft.Model.CrmStructure.MLBCrmXuanYongInfo> ls = new EyouSoft.BLL.CrmStructure.BCrm().GetCrmsXuanYong(CurrentUserCompanyID, pageSize, pageIndex, ref recordCount, type, queryString);
            if (ls != null && ls.Count > 0)
            {
                this.lbemptymsg.Visible = false;
                rpt_list.DataSource     = ls;
                rpt_list.DataBind();
                BindPage(pageSize, pageIndex);
            }
            else
            {
                this.lbemptymsg.Visible = true;
                this.phdPages.Visible   = false;
            }
        }
示例#2
0
 public static void valType(this Entity entity, CrmType type, string entityAttr, object entityValue, string nullMessage, string entityName = "")
 {
     //必填属性属性值为空 异常
     if (entityValue == null)
     {
         throw new NullReferenceException(nullMessage + "参数不能为空");
     }
     entity.valType(type, entityAttr, entityValue, entityName);
 }
示例#3
0
        public static void valType(this Entity entity, CrmType type, string entityAttr, object entityValue, string entityName = "")

        {
            //属性值为空 不处理
            if (entityValue == null)
            {
                return;
            }
            if (entityValue is string && string.IsNullOrEmpty(entityValue.ToString()))
            {
                entity[entityAttr] = null;
                return;
            }
            //判断类型为其赋值
            switch (type)
            {
            case CrmType.MainId:

                entity.Id = Guid.Parse(entityValue.ToString());
                break;

            case CrmType.LookUp:
                var id = Guid.Empty;
                if (entityValue is string)
                {
                    id = new Guid(entityValue.ToString());
                }
                else if (entityValue is Guid)
                {
                    id = (Guid)entityValue;
                }
                if (id != Guid.Empty)
                {
                    entity[entityAttr] = new EntityReference(entityName, id);
                }

                break;

            case CrmType.OptionValue:
                entity[entityAttr] = new OptionSetValue(Convert.ToInt32(entityValue));
                break;

            case CrmType.Int:
                entity[entityAttr] = Convert.ToInt32(Convert.ToDouble(entityValue));
                break;

            case CrmType.Money:
                entity[entityAttr] = new Money(Convert.ToDecimal(entityValue));
                break;

            case CrmType.Double:
                entity[entityAttr] = Convert.ToDouble(entityValue);
                break;

            case CrmType.Decimal:
                entity[entityAttr] = Convert.ToDecimal(entityValue);
                break;

            case CrmType.String:
                entity[entityAttr] = Convert.ToString(entityValue);
                break;

            case CrmType.DateTime:
                DateTime date = DateTime.MinValue;
                if (entityValue is DateTime)
                {
                    date = (DateTime)entityValue;
                    if ((DateTime)entityValue == DateTime.MinValue)
                    {
                        break;
                    }
                }
                else
                {
                    date = Convert.ToDateTime(entityValue);
                }
                entity[entityAttr] = date.ToUniversalTime();
                break;

            case CrmType.Boolean:
                //特殊处理bool  0 1也可表示bool
                int result = 0;
                if (int.TryParse(entityValue.ToString(), out result))
                {
                    entity[entityAttr] = Convert.ToBoolean(result);
                }
                else
                {
                    entity[entityAttr] = Convert.ToBoolean(entityValue);
                }
                break;
            }
        }