protected static string BuildFullColumnName(string columnName, TranslationBase translation)
 {
     return(string.Format("{0}{1}{2}",
                          !string.IsNullOrEmpty(translation.TranslationSettings.ColumnNamePrefix) ? translation.TranslationSettings.ColumnNamePrefix : translation.TranslationProfile.ColumnNamePrefix,
                          columnName,
                          !string.IsNullOrEmpty(translation.TranslationSettings.ColumnNameSuffix) ? translation.TranslationSettings.ColumnNameSuffix : translation.TranslationProfile.ColumnNameSuffix));
 }
 protected static DataColumn BuildDataColumn(TranslationBase translation, NonIdentityColumnConfiguration colConfig)
 {
     return(new DataColumn(
                BuildFullColumnName(colConfig.ColumnName, translation),
                colConfig.ColumnDataType.GetPureType()) // will get the "underlying" type for nullable valye types (e.g. int?) if needed
     {
         AllowDBNull = colConfig.ColumnDataType.IsNullAssignable()
     });
 }
        private static DataTableNewRowEventHandler AssignTableNewRowEvent(TranslationBase translation)
        {
            if (translation.TranslationSettings.IdentityColumnConfiguration == null || translation.TranslationSettings.IdentityColumnConfiguration.IsAutoGenerated)
            {
                return(null);
            }

            return((sender, args) =>
            {
                var table = ((DataTable)sender);
                var rowCount = table.Rows.Count;
                var columnName = BuildFullColumnName(translation.TranslationSettings.IdentityColumnConfiguration.ColumnName, translation);
                var previousValue = rowCount > 0
                    ? table.Rows[table.Rows.Count - 1][columnName]
                    : null;
                args.Row[columnName] = translation.TranslationSettings.IdentityColumnConfiguration.GetNextValue(previousValue);
            });
        }
Beispiel #4
0
        /// <summary>
        /// 高级查询
        /// </summary>
        /// <param name="rate"></param>
        /// <returns></returns>
        public static ArrayList getList(double rate)
        {
            TranslationBase tlb = new TranslationBase();

            ArrayList coll = new ArrayList();

            string columns = "";

            object obj = DBHelper.ExecuteScalar("select ColumnName from QueryColumnsInfo where Number='" + System.Web.HttpContext.Current.Session["Company"].ToString() + "'");

            if (obj != null)
            {
                columns = obj.ToString();
            }

            //添加会员基本信息表的字段
            coll.Add(new QueryKey("mi.Number", tlb.GetTran("000024", "会员编号"), true, "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Placement", tlb.GetTran("000706", "安置人编号"), oldColumn(tlb.GetTran("000706", "安置人编号"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mp.Name", tlb.GetTran("000097", "安置人姓名"), oldColumn(tlb.GetTran("000097", "安置人姓名"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Direct", tlb.GetTran("000043", "推荐人编号"), oldColumn(tlb.GetTran("000043", "推荐人编号"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("d.Name", tlb.GetTran("000192", "推荐人姓名"), oldColumn(tlb.GetTran("000192", "推荐人姓名"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Name", tlb.GetTran("000025", "会员姓名"), oldColumn(tlb.GetTran("000025", "会员姓名"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.PetName", tlb.GetTran("000063", "会员昵称"), oldColumn(tlb.GetTran("000063", "会员昵称"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("lv.levelstr", tlb.GetTran("000903", "会员级别"), oldColumn(tlb.GetTran("000903", "会员级别"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.RegisterDate", tlb.GetTran("000057", "注册日期"), oldColumn(tlb.GetTran("000057", "注册日期"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("dateadd(hh,8,mi.advtime)", tlb.GetTran("007301", "激活日期"), oldColumn(tlb.GetTran("007301", "激活日期"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Birthday", tlb.GetTran("000105", "出生日期"), oldColumn(tlb.GetTran("000105", "出生日期"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.Sex", tlb.GetTran("000085", "性别"), oldColumn(tlb.GetTran("000085", "性别"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.PostalCode", tlb.GetTran("000073", "邮编"), oldColumn(tlb.GetTran("000073", "邮编"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.HomeTele", tlb.GetTran("000065", "家庭电话"), oldColumn(tlb.GetTran("000065", "家庭电话"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.OfficeTele", tlb.GetTran("000044", "办公电话"), oldColumn(tlb.GetTran("000044", "办公电话"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.MobileTele", tlb.GetTran("000069", "移动电话"), oldColumn(tlb.GetTran("000069", "移动电话"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.FaxTele ", tlb.GetTran("000071", "传真电话"), oldColumn(tlb.GetTran("000071", "传真电话"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.CPCCode", tlb.GetTran("000916", "国家省份城市"), oldColumn(tlb.GetTran("000916", "国家省份城市"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Address", tlb.GetTran("000920", "详细地址"), oldColumn(tlb.GetTran("000920", "详细地址"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("p.PaperType", tlb.GetTran("000081", "证件类型"), oldColumn(tlb.GetTran("000081", "证件类型"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.PaperNumber", tlb.GetTran("000083", "证件号码"), oldColumn(tlb.GetTran("000083", "证件号码"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.bankcode", tlb.GetTran("000087", "开户银行"), oldColumn(tlb.GetTran("000087", "开户银行"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.bankBook", tlb.GetTran("000086", "开户名"), oldColumn(tlb.GetTran("000086", "开户名"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.bankbranchname", tlb.GetTran("006046", "支行名称"), oldColumn(tlb.GetTran("006046", "支行名称"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.BankBook ", tlb.GetTran("000111", "银行账号"), oldColumn(tlb.GetTran("000111", "银行账号"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.BankCard ", tlb.GetTran("000923", "卡号"), oldColumn(tlb.GetTran("000923", "卡号"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.ExpectNum", tlb.GetTran("000090", "个人期数"), oldColumn(tlb.GetTran("000090", "个人期数"), columns), "text", false, new Unit(100)));

            //添加会员结算表的字段
            //coll.Add(new QueryKey("mn.LayerBit1", tlb.GetTran("000928", "安置层位"), oldColumn(tlb.GetTran("000928", "安置层位"), columns), "text", false, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.LayerBit2", tlb.GetTran("000929", "推荐层位"), oldColumn(tlb.GetTran("000929", "推荐层位"), columns), "text", false, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.Ordinal1", tlb.GetTran("000930", "安置序号"), oldColumn(tlb.GetTran("000930", "安置序号"), columns), "text", false, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.Ordinal2", tlb.GetTran("000932", "推荐序号"), oldColumn(tlb.GetTran("000932", "推荐序号"), columns), "text", false, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.TotalNetNum", tlb.GetTran("000933", "总网人数"), oldColumn(tlb.GetTran("000933", "总网人数"), columns), "text", true, "int", new Unit(100)));
            coll.Add(new QueryKey("mn.CurrentNewNetNum", tlb.GetTran("000934", "新网人数"), oldColumn(tlb.GetTran("000934", "新网人数"), columns), "text", true, "int", new Unit(100)));
            coll.Add(new QueryKey("mn.CurrentTotalNetRecord ", tlb.GetTran("000936", "新网分数"), oldColumn(tlb.GetTran("000936", "新网分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.TotalNetRecord", tlb.GetTran("000937", "总网分数"), oldColumn(tlb.GetTran("000937", "总网分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.CurrentOneMark ", tlb.GetTran("000939", "新个分数"), oldColumn(tlb.GetTran("000939", "新个分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.TotalOneMark ", tlb.GetTran("000940", "总个分数"), oldColumn(tlb.GetTran("000940", "总个分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.NotTotalMark ", tlb.GetTran("000942", "未付款的总个分数"), oldColumn(tlb.GetTran("000942", "未付款的总个分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.TotalNotNetRecord ", tlb.GetTran("000944", "未付款的总网分数"), oldColumn(tlb.GetTran("000944", "未付款的总网分数"), columns), "text", true, "double", new Unit(100)));
            //------------------------------------------------------------------------------------------------------------
            //coll.Add(new QueryKey("mn.Bonus0 * " + rate.ToString() + " ", tlb.GetTran("7577", "无"), oldColumn(tlb.GetTran("7577", "无"), columns), "text", true,"double", new Unit(100)));
            coll.Add(new QueryKey("mn.Bonus0 * " + rate.ToString() + " ", tlb.GetTran
                                      ("010002", "业绩奖"), oldColumn(tlb.GetTran
                                                                       ("010002", "业绩奖"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Bonus2 * " + rate.ToString() + " ", tlb.GetTran
//("007579", "回本奖"), oldColumn(tlb.GetTran
//("007579", "回本奖"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Bonus3 * " + rate.ToString() + " ", tlb.GetTran
//("007580", "大区奖"), oldColumn(tlb.GetTran
//("007580", "大区奖"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Bonus4 * " + rate.ToString() + " ", tlb.GetTran
//("007581", "小区奖"), oldColumn(tlb.GetTran
//("007581", "小区奖"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Bonus5 * " + rate.ToString() + " ", tlb.GetTran
//("007582", "永续奖"), oldColumn(tlb.GetTran
//("007582", "永续奖"), columns), "text", true, "double", new Unit(100)));

//            coll.Add(new QueryKey("mn.Bonus6 * " + rate.ToString() + " ", tlb.GetTran
//("009128", "进步奖"), oldColumn(tlb.GetTran
//("009128", "进步奖"), columns), "text", true, "double", new Unit(100)));
//            //------------------------------------------------------------------------------------------------------------
//            coll.Add(new QueryKey("mn.Kougl * " + rate.ToString() + " ", tlb.GetTran("001352", "网平台综合管理费"), oldColumn(tlb.GetTran("001352", "网平台综合管理费"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Koufl * " + rate.ToString() + " ", tlb.GetTran("001353", "网扣福利奖金"), oldColumn(tlb.GetTran("001353", "网扣福利奖金"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Koufx * " + rate.ToString() + " ", tlb.GetTran("001355", "网扣重复消费"), oldColumn(tlb.GetTran("001355", "网扣重复消费"), columns), "text", true, "double", new Unit(100)));

            coll.Add(new QueryKey("mn.CurrentTotalMoney * " + rate.ToString() + " ", tlb.GetTran("000247", "总计"), oldColumn(tlb.GetTran("000247", "总计"), columns), "text", true, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.DeductTax * " + rate.ToString() + " ", tlb.GetTran("000249", "扣税"), oldColumn(tlb.GetTran("000249", "扣税"), columns), "text", true, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.DeductMoney * " + rate.ToString() + " ", tlb.GetTran("000251", "扣款"), oldColumn(tlb.GetTran("000251", "扣款"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.CurrentSolidSend * " + rate.ToString() + " ", tlb.GetTran("000254", "实发"), oldColumn(tlb.GetTran("000254", "实发"), columns), "text", true, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.BonusAccumulation * " + rate.ToString() + " ", tlb.GetTran("000951", "总计累计"), oldColumn(tlb.GetTran("000951", "总计累计"), columns), "text", true, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.SolidSendAccumulation * " + rate.ToString() + " ", tlb.GetTran("000953", "实发累计"), oldColumn(tlb.GetTran("000953", "实发累计"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("cfg.[Date]", tlb.GetTran("000954", "期数日期"), oldColumn(tlb.GetTran("000954", "期数日期"), columns), "text", true, "text", new Unit(100)));

            #region  除不能显示的
            if (System.Web.HttpContext.Current.Session["dian"] != null)
            {
                Hashtable htb = new Hashtable();
                System.Data.SqlClient.SqlDataReader sdr = DBHelper.ExecuteReader("SELECT FieldExtend,StoreSelect FROM QueryField");
                while (sdr.Read())
                {
                    if (htb[sdr["FieldExtend"].ToString().Trim()] == null)
                    {
                        htb.Add(sdr["FieldExtend"].ToString().Trim(), Convert.ToInt32(sdr["StoreSelect"]));
                    }
                }
                sdr.Close();
                for (int i = coll.Count - 1; i >= 0; i--)
                {
                    string key = ((QueryKey)coll[i]).Name.Trim();
                    if (htb[key] != null && (int)htb[key] == 0)
                    {
                        coll.RemoveAt(i);
                    }
                }
            }
            else
            {
                if (System.Web.HttpContext.Current.Session["bh"] != null)
                {
                    Hashtable htb = new Hashtable();
                    System.Data.SqlClient.SqlDataReader sdr = DBHelper.ExecuteReader("SELECT FieldExtend,MemberSelect FROM QueryField");
                    while (sdr.Read())
                    {
                        if (htb[sdr["FieldExtend"].ToString().Trim()] == null)
                        {
                            htb.Add(sdr["FieldExtend"].ToString().Trim(), Convert.ToInt32(sdr["MemberSelect"]));
                        }
                    }
                    sdr.Close();
                    for (int i = coll.Count - 1; i >= 0; i--)
                    {
                        string key = ((QueryKey)coll[i]).Name.Trim();
                        if (htb[key] != null && (int)htb[key] == 0)
                        {
                            coll.RemoveAt(i);
                        }
                    }
                }
            }
            #endregion

            return(coll);
        }