Exemplo n.º 1
0
 public OrderMasterMgr(string connectionStr)
 {
     _orderMasterDao = new OrderMasterDao(connectionStr);
     //orderMasterDao = new OrderMasterDao(connectionStr);
     bonusMasterDao = new BonusMasterDao(connectionStr);
     _bonusMasterMgr = new BonusMasterMgr(connectionStr);
     _happyGoMgr = new HappyGoMgr(connectionStr);
     _serialDao = new SerialDao(connectionStr);
     _mysqlDao = new MySqlDao(connectionStr);
     _orsDao = new OrderReturnStatusDao(connectionStr);
     _parametersrcDao = new ParametersrcDao(connectionStr);
     conn = connectionStr;
 }
Exemplo n.º 2
0
        public HttpResponseBase UsersList()
        {
            List<UsersListQuery> stores = new List<UsersListQuery>();
            List<SiteConfig> configs = new List<SiteConfig>();
            SiteConfig con = new SiteConfig();
            string json = string.Empty;
            try
            {
                string path = Server.MapPath(xmlPath);
                if (System.IO.File.Exists(path))
                {
                    siteConfigMgr = new SiteConfigMgr(path);
                    configs = siteConfigMgr.Query();
                }
                foreach (SiteConfig site in configs)
                {
                    if (site.Name == "DoMain_Name")
                    {
                        con = site;
                        break;
                    }
                }
                UsersListQuery query = new UsersListQuery();

                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//用於分頁的變量

                //todo:分页汇出会员信息,由于不能确定是按分页汇出还是汇出全部会员信息,暂且保留汇出全部会员信息
                //start = query.Start;
                //limit = query.Limit;
                if (!string.IsNullOrEmpty(Request.Params["serchs"]))
                {
                    query.serchtype = Request.Params["serchs"];
                }
                if (!string.IsNullOrEmpty(Request.Params["timestart"]))
                {

                    query.serchstart = Convert.ToDateTime(Request.Params["timestart"]);
                    query.serchstart = Convert.ToDateTime(query.serchstart.ToString("yyyy-MM-dd HH:mm:ss"));
                }
                if (!string.IsNullOrEmpty(Request.Params["timeend"]))
                {
                    query.serchend = Convert.ToDateTime(Request.Params["timeend"]);
                    query.serchend = Convert.ToDateTime(query.serchend.ToString("yyyy-MM-dd HH:mm:ss"));
                }

                query.content = Request.Params["serchcontent"];
                query.types = Request.Params["bonus_type"];
                query.checks = Request.Params["checkbox1"];
                if (!string.IsNullOrEmpty(Request.Params["relation_id"]))//待回覆
                {
                    query.user_id = Convert.ToUInt32(Request.Params["relation_id"]);
                }
                _uslmpgr = new UsersListMgr(mySqlConnectionString);
                _paraMgr = new ParameterMgr(mySqlConnectionString);
                int totalCount = 0;
                stores = _uslmpgr.Query(query, out totalCount);
                Parametersrc pa = new Parametersrc();
                foreach (var item in stores)
                {
                    string[] url = con.Value.Split('/');
                    item.user_url = "http://" + url[0] + "/ecservice_jump.php";//?uid=" + item.user_id;
                    if (Convert.ToBoolean(Request.Params["isSecret"]))
                    {
                        if (!string.IsNullOrEmpty(item.user_name))
                        {
                            item.user_name = item.user_name.Substring(0, 1) + "**";
                        }
                        item.user_email = item.user_email.Split('@')[0] + "@***";
                        //if (!string.IsNullOrEmpty(item.user_mobile))
                        //{
                        //    if (item.user_phone.ToString().Length > 3)
                        //    {
                        //        item.user_phone = item.user_phone.Substring(0, 3) + "***";
                        //    }
                        //    else
                        //    {
                        //        item.user_phone = item.user_phone + "***";
                        //    }
                        //}
                        if (!string.IsNullOrEmpty(item.user_mobile))
                        {
                            item.user_mobile = UnSecretMobile(item);
                            if (item.user_mobile.ToString().Length > 3)
                            {
                                item.user_mobile = item.user_mobile.Substring(0, 3) + "***";
                            }
                            else
                            {
                                item.user_mobile = item.user_mobile + "***";
                            }

                        }
                        if (item.user_address.ToString().Length > 3)
                        {
                            item.user_address = item.user_address.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.user_address = item.user_address + "***";
                        }
                    }
                    else
                    {
                        if (item.user_mobile.Length == 48)
                        {
                            item.user_mobile = EncryptComputer.EncryptDecryptTextByApi(item.user_mobile, false);
                        }
                    }
                    //獲取時間
                    item.reg_date = CommonFunction.GetNetTime(item.user_reg_date);
                    item.sfirst_time = CommonFunction.GetNetTime(item.first_time);
                    item.slast_time = CommonFunction.GetNetTime(item.last_time);
                    item.sbe4_last_time = CommonFunction.GetNetTime(item.be4_last_time);

                    pa = _paraMgr.QueryUsed(new Parametersrc { Used = 1, ParameterCode = item.user_level.ToString(), ParameterType = "UserLevel" }).FirstOrDefault();
                    if (pa != null)
                    {
                        item.userLevel = pa.parameterName;
                    }
                    #region 購物金欄位修改 add by yafeng0715j 20150924
                    BonusMasterMgr bmMgr = new BonusMasterMgr(mySqlConnectionString);
                    BonusMasterQuery bmQuery = new BonusMasterQuery();
                    bmQuery.user_id = item.user_id;
                    bmQuery.bonus_type = 1;
                    DataTable table = bmMgr.GetBonusMasterList(bmQuery);
                    uint master_total = 0;
                    int master_balance = 0;
                    if (table.Rows[0][0].ToString() != "")
                    {
                        master_total = Convert.ToUInt32(table.Rows[0][0]);
                        master_balance = Convert.ToInt32(table.Rows[0][1]);
                    }
                    item.bonus_type = 1;
                    item.bonus_typename = string.Format("購物金(剩餘{0}/總{1})", master_balance, master_total);

                    master_total = 0;
                    master_balance = 0;
                    bmQuery.bonus_type = 2;
                    table = bmMgr.GetBonusMasterList(bmQuery);
                    if (table.Rows[0][0].ToString() != "")
                    {
                        master_total = Convert.ToUInt32(table.Rows[0][0]);
                        master_balance = Convert.ToInt32(table.Rows[0][1]);
                    }
                    item.bonus_type1 = 2;
                    item.bonus_typenamequan = string.Format("抵用券(剩餘{0}/總{1})", master_balance, master_total);
                    #endregion

                }
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                //listUser是准备转换的对象
                json = "{success:true,'msg':'user',totalCount:" + totalCount + ",start:" + query.Start + ",limit:" + query.Limit + ",data:" + JsonConvert.SerializeObject(stores, Formatting.Indented, timeConverter) + "}";//返回json數據

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:true,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }