Exemplo n.º 1
0
        public System.Data.DataSet GetCustomers(CustomerQueryEntity filter)
        {
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (!string.IsNullOrEmpty(filter.Name.Trim()))
            {
                strSql1.AppendFormat(" Name like '%{0}%' ", filter.Name);
            }
            if (!string.IsNullOrEmpty(filter.MobileNo.Trim()))
            {
                strSql1.AppendFormat(" And MobileNO like '%{0}%' ", filter.MobileNo);
            }
            if (!string.IsNullOrEmpty(filter.ICNo.Trim()))
            {
                strSql1.AppendFormat(" And ICNo like '%{0}%' ", filter.ICNo);
            }
            strSql1.AppendFormat(" And CardFlag = {0} ", filter.CardFlag);

            if (!string.IsNullOrEmpty(filter.SortName.Trim()))
            {
                strSql2.Append(filter.SortName);
                strSql2.Append(" ");
                strSql2.Append(filter.SortOrder.Trim());
            }
            string strWhere = strSql1.ToString();
            string orderby = strSql2.ToString();
            int startIndex = filter.Start;
            int endIndex = startIndex + filter.Length;
            return _daoCustomer.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }
Exemplo n.º 2
0
        public List<CustomerVO> GetCustomers(CustomerQueryEntity filter)
        {
            CustomerData customerData = new CustomerData();
            List<CustomerVO> customerVOList = new List<CustomerVO>();

            DataSet ds = customerData.GetCustomers(filter);
            List<CustomerPO> customerPOList = ds.GetEntity<List<CustomerPO>>();

            customerPOList.ForEach(i =>
            {
                customerVOList.Add(Mapper.Map<CustomerPO, CustomerVO>(i));
            });

            return customerVOList;
        }
Exemplo n.º 3
0
 public int GetRecordCount(CustomerQueryEntity filter)
 {
     CustomerData custdata = new CustomerData();
     return custdata.GetRecordCount(filter);
 }
Exemplo n.º 4
0
        public JsonResult GetCustomers()
        {
            DatatablesResult<CustomerVO> result = new DatatablesResult<CustomerVO>();

            try
            {
                int start = NullHelper.Convert<int>(Request[Constants.PAGE_START], 0);
                int length = NullHelper.Convert<int>(Request[Constants.PAGE_LENGTH], 10);
                int draw = NullHelper.Convert<int>(Request[Constants.REQ_DRAW], 1);
                string sortOrder = NullHelper.Convert<string>(Request[Constants.SORT_ORDER], "asc");
                int sortIdx = NullHelper.Convert<int>(Request[Constants.SORT_IDX], 0);
                string columnKey = string.Format(Constants.SORT_NAME, sortIdx);
                string sortName = NullHelper.Convert<string>(Request[columnKey], "Name");

                string name = NullHelper.Convert<string>(Request["Name"], "");
                string icNo = NullHelper.Convert<string>(Request["ICNo"], "");
                string mobileNo = NullHelper.Convert<string>(Request["MobileNo"], "");
                int cardFlag = NullHelper.Convert<int>(Request["CardFlag"], -1);

                CustomerQueryEntity filter = new CustomerQueryEntity(){
                    Start = start,
                    Length = length,
                    SortOrder = sortOrder,
                    SortName = sortName,
                    Name = name,
                    ICNo = icNo,
                    MobileNo = mobileNo,
                    CardFlag = cardFlag
                };

                var mocker = new BizMocker();
                var list = mocker.GetCustomers(filter);
                int recordsTotal = list.Count;

                foreach (var item in list)
                {
                    item.DT_RowId = item.CustomerID.ToString();
                    if (item.CardFlag == 1)
                    {
                        item.CardFlagDesc = "<i class='fa fa-check fa-lg' style='color:green;'></i>";
                        item.ClubCardDesc = "<a href='javascript:void(0)'><i class='fa fa-search'></i> 查看</a>";
                    }
                    else
                    {
                        item.CardFlagDesc = "<i class='fa fa-times fa-lg red' style='color:red;'></i>";
                        item.ClubCardDesc = "<a href='javascript:void(0)'> <i class='fa fa-credit-card'></i> 开卡</a>";
                    }
                    item.CarDesc = "<a href='javascript:void(0)'><i class='fa fa-search'></i> 查看</a>";
                    item.Operation = "<a href='javascript:void(0)' onclick='Customer.Edit("
                        + item.DT_RowId + ")'><i class='fa fa-pencil'></i> 编辑</a>  | <a href='javascript:void(0)' onclick='Package.Del("
                        + item.DT_RowId + ")'><i class='fa fa-times'></i> 删除</a>";
                }

                result.draw = draw;
                result.recordsTotal = recordsTotal;
                result.recordsFiltered = recordsTotal;
                result.data = list;
            }
            catch (Exception ex)
            {
                LogHandler.Error(ex.Message.ToString());
            }

            return Json(result, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 5
0
        public List<CustomerVO> GetCustomers(CustomerQueryEntity filter)
        {
            List<CustomerVO> result = new List<CustomerVO>();

            #region Mock
            CustomerVO item1 = new CustomerVO(){
                CardFlag = 1,
                CustomerID = 1,
                MobileNO = "15852659874",
                Name = "田志良"
            };
            CustomerVO item2 = new CustomerVO()
            {
                CardFlag = 0,
                CustomerID = 2,
                MobileNO = "12687458596",
                Name = "郭艳艳"
            };
            CustomerVO item3 = new CustomerVO()
            {
                CardFlag = 1,
                CustomerID = 3,
                MobileNO = "16358748965",
                Name = "程彩琪"
            };
            CustomerVO item4 = new CustomerVO()
            {
                CardFlag = 0,
                CustomerID = 4,
                MobileNO = "15234951965",
                Name = "任东东"
            };
            CustomerVO item5 = new CustomerVO()
            {
                CardFlag = 1,
                CustomerID = 5,
                MobileNO = "12365847596",
                Name = "刘勇"
            };
            result.Add(item1);
            result.Add(item2);
            result.Add(item3);
            result.Add(item4);
            result.Add(item5);
            #endregion

            return result;
        }
Exemplo n.º 6
0
 List<CustomerVO> ICustomerMgm.GetCustomers(CustomerQueryEntity filter)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public int GetRecordCount(CustomerQueryEntity filter)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
        public int GetRecordCount(CustomerQueryEntity filter)
        {
            StringBuilder strSql1 = new StringBuilder();

            if (!string.IsNullOrEmpty(filter.Name.Trim()))
            {
                strSql1.AppendFormat(" Name like '%{0}%' ", filter.Name);
            }
            if (!string.IsNullOrEmpty(filter.MobileNo.Trim()))
            {
                if (strSql1.Length > 0)
                    strSql1.AppendFormat(" And ");
                strSql1.AppendFormat(" MobileNO like '%{0}%' ", filter.MobileNo);
            }
            if (!string.IsNullOrEmpty(filter.ICNo.Trim()))
            {
                if (strSql1.Length > 0)
                    strSql1.AppendFormat(" And ");
                strSql1.AppendFormat(" ICNo like '%{0}%' ", filter.ICNo);
            }
            if (filter.CardFlag != -1)
            {
                if (strSql1.Length > 0)
                    strSql1.AppendFormat(" And ");
                strSql1.AppendFormat(" CardFlag = {0} ", filter.CardFlag);
            }

            string strWhere = strSql1.ToString();
            return _daoCustomer.GetRecordCount(strWhere);
        }