コード例 #1
0
        /// <summary>
        /// 导出销售员
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ActionResult ExportToExcelDistributor(DistributorQuery query)
        {
            query.IsIncludeMember = false;
            if (query.StartTime.HasValue)
            {
                query.StartTime = query.StartTime.Value.Date;
            }
            if (query.EndTime.HasValue)
            {
                query.EndTime = query.EndTime.Value.AddDays(1).Date;
            }
            if (query.Sort.ToLower() == "ShowApplyTime".ToLower())
            {
                query.Sort = "ApplyTime";
            }

            var results = DistributionApplication.GetDistributorsAll(query);

            if (results != null && results.Count() > 0)
            {
                results[0].DistributionMaxLevel = SiteSettings.DistributionMaxLevel;//最大分销级数,这里实体第一个保存值是导出方便取值
            }

            return(ExcelView("ExportDistributor", "平台销售员列表", results));
        }
コード例 #2
0
        public SortedDictionary <string, string> GetDistriubots(DistributorQuery query)
        {
            SortedDictionary <string, string> dictionary = new SortedDictionary <string, string>();

            if (query.GradeId.HasValue)
            {
                dictionary.Add("GradeId", query.GradeId.Value.ToString());
            }
            if (query.LineId.HasValue)
            {
                dictionary.Add("LineId", query.LineId.Value.ToString());
            }
            dictionary.Add("SortBy", query.SortBy);
            if (query.SortOrder == SortAction.Desc)
            {
                dictionary.Add("SortOrder", "0");
            }
            else
            {
                dictionary.Add("SortOrder", "1");
            }
            dictionary.Add("RealName", query.RealName);
            dictionary.Add("Username", query.Username);
            dictionary.Add("PageIndex", query.PageIndex.ToString());
            dictionary.Add("PageSize", query.PageSize.ToString());
            return(dictionary);
        }
コード例 #3
0
        /// <summary>
        /// 获取销售员列表(忽略分页)
        /// </summary>
        public static List <DistributorListDTO> GetDistributorsAll(DistributorQuery query)
        {
            var result = new List <DistributorListDTO>();
            var data   = _iDistributionService.GetDistributorsAll(query);

            result = data.Map <List <DistributorListDTO> >();
            return(result);
        }
コード例 #4
0
        /// <summary>
        /// 获取销售员列表
        /// </summary>
        public static QueryPageModel <DistributorListDTO> GetDistributors(DistributorQuery query)
        {
            var result = new QueryPageModel <DistributorListDTO>();
            var data   = _iDistributionService.GetDistributors(query);

            result.Models = data.Models.Map <List <DistributorListDTO> >();
            result.Total  = data.Total;
            return(result);
        }
コード例 #5
0
        public void GetBalance()
        {
            DistributorQuery query = new DistributorQuery();

            query.Username  = searchKey;
            query.RealName  = realName;
            query.PageIndex = pager.PageIndex;
            query.PageSize  = pager.PageSize;
            DbQueryResult distributorBalance = DistributorHelper.GetDistributorBalance(query);

            grdDistributorAccountList.DataSource = distributorBalance.Data;
            grdDistributorAccountList.DataBind();
            pager.TotalRecords  = distributorBalance.TotalRecords;
            pager1.TotalRecords = distributorBalance.TotalRecords;
        }
コード例 #6
0
        private void BindDistributorRequest()
        {
            DistributorQuery query = new DistributorQuery();

            query.IsApproved = false;
            query.PageIndex  = this.pager.PageIndex;
            query.PageSize   = this.pager.PageSize;
            query.Username   = this.Keywords;
            query.RealName   = this.RealName;
            query.SortBy     = "CreateDate";
            query.SortOrder  = SortAction.Desc;
            DbQueryResult distributors = DistributorHelper.GetDistributors(query);

            this.grdDistributorRequests.DataSource = distributors.Data;
            this.grdDistributorRequests.DataBind();
            this.pager.TotalRecords  = distributors.TotalRecords;
            this.pager1.TotalRecords = distributors.TotalRecords;
        }
コード例 #7
0
        public JsonResult GetCanSuperDistributorList(string MemberName, long memberId
                                                     , int rows, int page)
        {
            //查询条件
            DistributorQuery query = new DistributorQuery();

            query.MemberName       = MemberName;
            query.ExcludeMemberIds = new List <long>();
            query.ExcludeMemberIds.Add(memberId);
            query.SuperiorMemberId = 0;
            query.Level            = 1;

            query.PageSize        = rows;
            query.PageNo          = page;
            query.IsIncludeMember = false;

            var data   = DistributionApplication.GetDistributors(query);
            var result = new { rows = data.Models, total = data.Total };

            return(Json(result));
        }
コード例 #8
0
        public JsonResult GetDistributorList(string MemberName, string shopname, string SuperiorMemberName
                                             , int rows, int page
                                             , DateTime?StartTime = null, DateTime?EndTime         = null
                                             , long?GradeId       = null, DistributorStatus?status = null
                                             , string Sort        = "", bool IsAsc = false)
        {
            //查询条件
            DistributorQuery query = new DistributorQuery();

            query.MemberName         = MemberName;
            query.ShopName           = shopname;
            query.SuperiorMemberName = SuperiorMemberName;
            query.StartTime          = StartTime;
            query.EndTime            = EndTime;
            query.GradeId            = GradeId;
            query.Status             = status;

            query.PageSize        = rows;
            query.PageNo          = page;
            query.Sort            = Sort;
            query.IsAsc           = IsAsc;
            query.IsIncludeMember = false;
            if (query.StartTime.HasValue)
            {
                query.StartTime = query.StartTime.Value.Date;
            }
            if (query.EndTime.HasValue)
            {
                query.EndTime = query.EndTime.Value.AddDays(1).Date;
            }
            if (query.Sort.ToLower() == "ShowApplyTime".ToLower())
            {
                query.Sort = "ApplyTime";
            }

            var data   = DistributionApplication.GetDistributors(query);
            var result = new { rows = data.Models, total = data.Total };

            return(Json(result));
        }
コード例 #9
0
        private void BindDistributors()
        {
            DistributorQuery query = new DistributorQuery();

            query.IsApproved = true;
            query.PageIndex  = pager.PageIndex;
            query.PageSize   = pager.PageSize;
            query.GradeId    = gradeId;
            query.LineId     = lineId;
            query.Username   = userName;
            query.RealName   = realName;
            query.SortBy     = grdDistributorList.SortOrderBy;
            if (grdDistributorList.SortOrder.ToLower() == "desc")
            {
                query.SortOrder = SortAction.Desc;
            }
            DbQueryResult distributors = DistributorHelper.GetDistributors(query);

            grdDistributorList.DataSource = distributors.Data;
            grdDistributorList.DataBind();
            pager.TotalRecords  = distributors.TotalRecords;
            pager1.TotalRecords = distributors.TotalRecords;
        }
コード例 #10
0
        private void BindDistributors()
        {
            DistributorQuery distributorQuery = new DistributorQuery();

            distributorQuery.IsApproved = true;
            distributorQuery.PageIndex  = this.pager.PageIndex;
            distributorQuery.PageSize   = this.pager.PageSize;
            distributorQuery.GradeId    = this.gradeId;
            distributorQuery.LineId     = this.lineId;
            distributorQuery.Username   = this.userName;
            distributorQuery.RealName   = this.realName;
            distributorQuery.SortBy     = this.grdDistributorList.SortOrderBy;
            if (this.grdDistributorList.SortOrder.ToLower() == "desc")
            {
                distributorQuery.SortOrder = SortAction.Desc;
            }
            DbQueryResult distributors = DistributorHelper.GetDistributors(distributorQuery);

            this.grdDistributorList.DataSource = distributors.Data;
            this.grdDistributorList.DataBind();
            this.pager.TotalRecords  = distributors.TotalRecords;
            this.pager1.TotalRecords = distributors.TotalRecords;
        }
コード例 #11
0
 public abstract DbQueryResult GetDistributors(DistributorQuery query);
コード例 #12
0
        public void ProcessRequest(HttpContext context)
        {
            string       str            = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
            string       str2           = "";
            string       str3           = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
            string       str4           = "";
            string       s              = "";
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            new StringBuilder();
            str2 = context.Request.QueryString["action"].ToString();
            string      sign      = context.Request.Form["sign"];
            string      str7      = context.Request.Form["format"];
            string      checkCode = masterSettings.CheckCode;
            XmlDocument node      = new XmlDocument();

            new Dictionary <string, string>();
            SortedDictionary <string, string> tmpParas = new SortedDictionary <string, string>();

            try
            {
                string str11;
                if (((str11 = str2) != null) && (str11 == "distribution_list"))
                {
                    string str9 = context.Request.Form["parma"].Trim();
                    str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "parma");
                    if (!string.IsNullOrEmpty(str9))
                    {
                        str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                        DistributorQuery query = new DistributorQuery();
                        query    = (DistributorQuery)JavaScriptConvert.DeserializeObject(str9, typeof(DistributorQuery));
                        tmpParas = this.GetDistriubots(query);
                        tmpParas.Add("action", "distribution_list");
                        tmpParas.Add("format", str7);
                        if (APIHelper.CheckSign(tmpParas, checkCode, sign))
                        {
                            DbQueryResult distributors = DistributorHelper.GetDistributors(query);
                            string        format       = str + "<response_distributors>{0}<totalcount>{1}</totalcount></response_distributors>";
                            if (distributors.Data != null)
                            {
                                s = string.Format(format, this.ConvertTableToXml((DataTable)distributors.Data), distributors.TotalRecords.ToString());
                            }
                            else
                            {
                                s = string.Format(format, "", "0");
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                str4 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, exception.Message);
            }
            if (s == "")
            {
                s = s + str3 + str4;
            }
            context.Response.ContentType = "text/xml";
            if (str7 == "json")
            {
                s = s.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", "");
                node.Load(new MemoryStream(Encoding.GetEncoding("UTF-8").GetBytes(s)));
                s = JavaScriptConvert.SerializeXmlNode(node);
                context.Response.ContentType = "text/json";
            }
            context.Response.Write(s);
        }
コード例 #13
0
 public static DbQueryResult GetDistributors(DistributorQuery query)
 {
     return(DistributorProvider.Instance().GetDistributors(query));
 }
コード例 #14
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            string str  = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
            string str2 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
            string str3 = "";
            string text = "";

            Hidistro.Membership.Context.SiteSettings masterSettings = Hidistro.Membership.Context.SettingsManager.GetMasterSettings(false);
            new System.Text.StringBuilder();
            string text2     = context.Request.QueryString["action"].ToString();
            string sign      = context.Request.Form["sign"];
            string text3     = context.Request.Form["format"];
            string checkCode = masterSettings.CheckCode;

            System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
            new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.SortedDictionary <string, string> sortedDictionary = new System.Collections.Generic.SortedDictionary <string, string>();
            try
            {
                string a;
                if ((a = text2) != null && a == "distribution_list")
                {
                    string text4 = context.Request.Form["parma"].Trim();
                    str3 = MessageInfo.ShowMessageInfo(ApiErrorCode.Empty_Error, "parma");
                    if (!string.IsNullOrEmpty(text4))
                    {
                        str3 = MessageInfo.ShowMessageInfo(ApiErrorCode.Signature_Error, "sign");
                        DistributorQuery query = new DistributorQuery();
                        query            = (DistributorQuery)JavaScriptConvert.DeserializeObject(text4, typeof(DistributorQuery));
                        sortedDictionary = this.GetDistriubots(query);
                        sortedDictionary.Add("action", "distribution_list");
                        sortedDictionary.Add("format", text3);
                        if (APIHelper.CheckSign(sortedDictionary, checkCode, sign))
                        {
                            DbQueryResult distributors = DistributorHelper.GetDistributors(query);
                            string        format       = str + "<response_distributors>{0}<totalcount>{1}</totalcount></response_distributors>";
                            if (distributors.Data != null)
                            {
                                text = string.Format(format, this.ConvertTableToXml((System.Data.DataTable)distributors.Data), distributors.TotalRecords.ToString());
                            }
                            else
                            {
                                text = string.Format(format, "", "0");
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                str3 = MessageInfo.ShowMessageInfo(ApiErrorCode.Unknown_Error, ex.Message);
            }
            if (text == "")
            {
                text = text + str2 + str3;
            }
            context.Response.ContentType = "text/xml";
            if (text3 == "json")
            {
                text = text.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", "");
                xmlDocument.Load(new System.IO.MemoryStream(System.Text.Encoding.GetEncoding("UTF-8").GetBytes(text)));
                text = JavaScriptConvert.SerializeXmlNode(xmlDocument);
                context.Response.ContentType = "text/json";
            }
            context.Response.Write(text);
        }
コード例 #15
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     if (this.exportFieldsCheckBoxList.SelectedItem == null)
     {
         this.ShowMsg("请选择需要导出的分销商信息", false);
     }
     else
     {
         IList <string> fields = new List <string>();
         IList <string> list2  = new List <string>();
         foreach (ListItem item in this.exportFieldsCheckBoxList.Items)
         {
             if (item.Selected)
             {
                 fields.Add(item.Value);
                 list2.Add(item.Text);
             }
         }
         DistributorQuery query = new DistributorQuery();
         query.GradeId  = this.gradeId;
         query.Username = this.userName;
         query.RealName = this.realName;
         DataTable     distributorsNopage = DistributorHelper.GetDistributorsNopage(query, fields);
         StringBuilder builder            = new StringBuilder();
         foreach (string str in list2)
         {
             builder.Append(str + ",");
             if (str == list2[list2.Count - 1])
             {
                 builder = builder.Remove(builder.Length - 1, 1);
                 builder.Append("\r\n");
             }
         }
         foreach (DataRow row in distributorsNopage.Rows)
         {
             foreach (string str2 in fields)
             {
                 builder.Append(row[str2]).Append(",");
                 if (str2 == fields[list2.Count - 1])
                 {
                     builder = builder.Remove(builder.Length - 1, 1);
                     builder.Append("\r\n");
                 }
             }
         }
         this.Page.Response.Clear();
         this.Page.Response.Buffer  = false;
         this.Page.Response.Charset = "GB2312";
         if (this.exportFormatRadioButtonList.SelectedValue == "csv")
         {
             this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=DistributorInfo.csv");
             this.Page.Response.ContentType = "application/octet-stream";
         }
         else
         {
             this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=DistributorInfo.txt");
             this.Page.Response.ContentType = "application/vnd.ms-word";
         }
         this.Page.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
         this.Page.EnableViewState          = false;
         this.Page.Response.Write(builder.ToString());
         this.Page.Response.End();
     }
 }
コード例 #16
0
 public abstract System.Data.DataTable GetDistributorsNopage(DistributorQuery query, IList <string> fields);
コード例 #17
0
 public abstract DbQueryResult GetDistributorBalance(DistributorQuery query);
コード例 #18
0
 public static System.Data.DataTable GetDistributorsNopage(DistributorQuery query, IList <string> fields)
 {
     return(DistributorProvider.Instance().GetDistributorsNopage(query, fields));
 }