示例#1
0
        public static bool AddPerformance(Model.Adjust book)                            //添加业绩提交单
        {
            string sql = "insert into U_Performance(U_No,U_Product,U_Custom,N_Number,U_Clerk,U_Note,U_LoginTime,U_Custom2) values(@U_Number,@U_Adjust,@U_Custom,@U_Amount,@U_ClerkType,@U_Note,@U_LoginTime,@U_Custom2)";

            /*构建sql参数*/
            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@U_Number", SqlDbType.Int),
                new SqlParameter("@U_Adjust", SqlDbType.Int),
                new SqlParameter("@U_Custom", SqlDbType.Int),
                new SqlParameter("@U_Amount", SqlDbType.Decimal),
                new SqlParameter("@U_ClerkType", SqlDbType.Int),
                new SqlParameter("@U_Note", SqlDbType.NVarChar, 200),
                new SqlParameter("@U_LoginTime", SqlDbType.DateTime),
                new SqlParameter("@U_Custom2", SqlDbType.NVarChar, 20)
            };
            /*给参数赋值*/
            parm[0].Value = book.No;
            parm[1].Value = book.product;
            parm[2].Value = book.custom;
            parm[3].Value = book.amount;
            parm[4].Value = book.clerk;
            parm[5].Value = book.note;
            parm[6].Value = book.publishDate;
            parm[7].Value = book.custom2;
            foreach (SqlParameter p in parm)   //没有对传入的数据作空值的处理
            {
                if (p.Value == null)
                {
                    p.Value = DBNull.Value;
                }
            }
            /*执行sql进行添加*/
            return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false);
        }
示例#2
0
        public static bool AddGrade2(Model.Adjust book)
        {
            string sql = "update U_Custom set U_Grade=@U_Adjust where U_Id=@U_Custom";

            /*构建sql参数*/
            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@U_Adjust", SqlDbType.Int),
                new SqlParameter("@U_Custom", SqlDbType.Int),
            };
            /*给参数赋值*/
            parm[0].Value = book.product;
            parm[1].Value = book.custom;

            /*执行更新*/
            return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false);
        }
示例#3
0
        public static int AddPerformance3(Model.Adjust book) //添加业绩核算单3
        {
            decimal count  = 0;                              // 总金额,业绩1,业绩2,系数1,系数2
            int     Pro    = book.product;                   //产品类别
            decimal Amout  = book.amount;                    //产品数量
            int     Uid    = book.custom;                    //会员ID
            int     Result = 0;

            switch (Pro)
            {
            case 4:
                count = P_A_4 * Amout;
                break;

            case 5:
                count = P_A_5 * Amout;
                break;

            case 6:
                count = P_A_6;
                break;

            case 7:
                count = P_A_7;
                break;
            }

            // 更新所有上一级团队业绩
            int IntrN = getInt("U_Introduce", Uid);

            while (IntrN != 0 && Pro != 6 && Pro != 7)
            {
                decimal Team2 = getDecimal("U_TeamSum", IntrN);
                Team2 += count;
                string STeam2 = Team2.ToString();
                UpdateC("U_TeamSum", STeam2, IntrN);
                Result += 1;

                IntrN = getInt("U_Introduce", IntrN);
            }
            return(Result);
        }
示例#4
0
        public static bool AddPay2(Model.Adjust book)                               //添加兑现单2
        {
            int     Uid     = book.custom;
            decimal Uamount = book.amount;
            decimal Upay    = getDecimal("U_Pay", Uid);
            decimal Usum    = getDecimal("U_Sum", Uid);

            Upay = Upay + Uamount;
            Usum = Usum - Uamount;
            string U_Pay = Upay.ToString();
            string U_Sum = Usum.ToString();
            int    num   = UpdateC("U_Pay", U_Pay, Uid) + UpdateC("U_Sum", U_Sum, Uid);

            if (num == 2)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        public static void AddPerfRank(Model.Adjust book)                            //业绩提交单更改会员级别
        {
            int Uid = book.custom;
            int Pro = book.product;

            switch (Pro)
            {
            case 4:
                UpdateRank("11", Uid);
                break;

            case 6:
                UpdateRank("14", Uid);
                break;

            case 7:
                UpdateRank("15", Uid);
                break;

            default:
                break;
            }
        }
示例#6
0
        public static bool AddSettle(Model.Adjust book)                         //添加月结单
        {
            string sql = "insert into U_Settle(R_Month,R_Clerk,R_LoginDate) values(@U_Adjust,@U_ClerkType,@U_LoginTime)";

            /*构建sql参数*/
            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@U_Adjust", SqlDbType.NVarChar, 20),
                new SqlParameter("@U_ClerkType", SqlDbType.Int),
                new SqlParameter("@U_LoginTime", SqlDbType.DateTime)
            };
            /*给参数赋值*/
            parm[0].Value = book.note;
            parm[1].Value = book.clerk;
            parm[2].Value = book.publishDate;
            foreach (SqlParameter p in parm)   //没有对传入的数据作空值的处理
            {
                if (p.Value == null)
                {
                    p.Value = DBNull.Value;
                }
            }
            /*执行sql进行添加*/
            return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false);
        }
示例#7
0
        public static int AddSettle2(Model.Adjust book)            //添加月结单2
        {
            decimal count = 0, reward1, reward2, rate1, rate2 = 0; // 总金额,业绩1,业绩2,系数1,系数2
            int     Pro   = book.product;                          //产品类别
            decimal Amout = book.amount;                           //产品数量
            int     Uid   = book.custom;                           //会员ID

            switch (Pro)
            {
            case 4:
                count = P_A_4 * Amout;
                break;

            case 5:
                count = P_A_5 * Amout;
                break;

            case 6:
                count = P_A_6;
                break;

            case 7:
                count = P_A_7;
                break;
            }
            int IntrN = Uid, Time = 0;

            while (IntrN != 0 && Pro != 6 && Pro != 7)
            {
                int CRankN = getInt("U_Grade", IntrN);
                if (CRankN == 10 || CRankN == 11)             //提交人级别是代理商就结束
                {
                    IntrN = getInt("U_Introduce", IntrN);
                }
                else
                {
                    break;
                }
                Time = +1;
            }

            if (IntrN != 0 && Time != 0)
            {
                int CRank0 = getInt("U_Grade", IntrN);
                if (CRank0 == 12)
                {
                    rate1 = C_R_12;
                }
                else
                {
                    rate1 = C_R_13 + C_R_12;
                }

                reward1 = count * rate1;
                Reward rew = new Reward();
                rew.No          = book.No;
                rew.count       = count;
                rew.custom      = IntrN;
                rew.rate        = (rate1 * 100).ToString() + "%";
                rew.reward      = reward1;
                rew.publishDate = DateTime.Now;
                AddReward(rew);

                decimal count_P = getDecimal("U_Count", IntrN);
                count_P += reward1;
                string Scount_P = count_P.ToString();
                UpdateC("U_Count", Scount_P, IntrN);

                decimal Pay2 = getDecimal("U_Sum", IntrN);
                Pay2 += reward1;
                string SPay2 = Pay2.ToString();
                UpdateC("U_Sum", SPay2, IntrN);

                int Intr1 = getInt("U_Introduce", IntrN);
                if (Intr1 != 0)
                {
                    int CRank1 = getInt("U_Grade", Intr1);
                    if (CRank1 == 13 && CRank0 == 12)
                    {
                        rate2 = C_R_13;
                    }
                    if (Time == 1)
                    {
                        rate2 += 0.01m;
                    }
                    if (rate2 != 0)
                    {
                        reward2 = count * rate2;//
                        Reward rew2 = new Reward();
                        rew2.No          = book.No;
                        rew2.count       = count;
                        rew2.custom      = Intr1;
                        rew2.rate        = (rate2 * 100).ToString() + "%";
                        rew2.reward      = reward2;
                        rew2.publishDate = DateTime.Now;
                        AddReward(rew2);

                        decimal count_P2 = getDecimal("U_Count", Intr1);
                        count_P += reward2;
                        string Scount_P2 = count_P2.ToString();
                        UpdateC("U_Count", Scount_P2, Intr1);

                        decimal Pay22 = getDecimal("U_Sum", Intr1);
                        Pay22 += reward2;
                        string SPay22 = Pay22.ToString();
                        UpdateC("U_Sum", SPay22, Intr1);
                        return(2);
                    }
                    else
                    {
                        return(1);
                    }
                }
                else
                {
                    return(1);
                }
            }
            else
            {
                return(0);
            }
        }
示例#8
0
        public static int AddPerformance4(Model.Adjust book) //添加业绩核算单4
        {
            int Pro = book.product;                          //产品类别
            int Uid = book.custom;                           //会员ID

            if (Pro != 5)
            {
                int Intrn = Uid, time = 0;
                while (Intrn != 0)
                {
                    Intrn = getInt("U_Introduce", Intrn);
                    if (Intrn != 0)
                    {
                        time += 1;
                    }
                }
                if (time > 4)
                {
                    int i = 0, n = 0;
                    int Intrx = Uid;
                    for (i = 0; i < time; i++)
                    {
                        int type = 0;
                        if (Intrx != 0)
                        {
                            type  = getInt("U_Grade", Intrx);
                            Intrx = getInt("U_Introduce", Intrx);
                        }
                        if (type != 10)
                        {
                            n += 1;
                        }
                        if (n == 5)
                        {
                            break;
                        }
                    }
                    bool team = false;
                    int  Type = 0;
                    if (Intrx != 0)
                    {
                        team = getBool("U_Team", Intrx);
                        Type = getInt("U_Grade", Intrx);
                    }
                    if (n == 5 && team == false && Type != 10)
                    {
                        Reward rew = new Reward();
                        rew.No          = book.No;
                        rew.count       = 0;
                        rew.custom      = Intrx;
                        rew.rate        = "";
                        rew.reward      = 3000;
                        rew.publishDate = DateTime.Now;
                        AddReward(rew);

                        decimal count_P = getDecimal("U_Count", Intrx);
                        count_P += 3000;
                        string Scount_P = count_P.ToString();
                        UpdateC("U_Count", Scount_P, Intrx);

                        decimal Pay2 = getDecimal("U_Sum", Intrx);
                        Pay2 += 3000;
                        string SPay2 = Pay2.ToString();
                        UpdateC("U_Sum", SPay2, Intrx);

                        UpdateBit("U_Team", Intrx);//未获得 改为 已领取
                        return(Intrx);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
示例#9
0
        public static int AddPerformance2(Model.Adjust book)   //添加业绩核算单2
        {
            decimal count = 0, reward1, reward2, rate1, rate2; // 总金额,业绩1,业绩2,系数1,系数2
            int     Pro   = book.product;                      //产品类别
            decimal Amout = book.amount;                       //产品数量
            int     Uid   = book.custom;                       //会员ID

            switch (Pro)
            {
            case 4:
                count = P_A_4 * Amout;
                break;

            case 5:
                count = P_A_5 * Amout;
                break;

            case 6:
                count = P_A_6;
                break;

            case 7:
                count = P_A_7;
                break;
            }
            decimal total0 = getDecimal("U_Total", Uid);

            total0 += count;
            string Stotal0 = total0.ToString();

            UpdateC("U_Total", Stotal0, Uid);

            decimal Team20 = getDecimal("U_TeamSum", Uid);

            Team20 += count;
            string STeam20 = Team20.ToString();

            UpdateC("U_TeamSum", STeam20, Uid);

            //第一步 算上一级业绩
            int Intr1  = getInt("U_Introduce", Uid);
            int CRank0 = getInt("U_Grade", Uid);           //提交人级别

            if (Intr1 != 0 && Pro != 6 && Pro != 7)        //0是第一级 或 百万代理商就结束
            {
                int CRank1 = getInt("U_Grade", Intr1);     //上一级会员级别

                if (CRank0 == 10 || CRank0 == 11)          //提交人级别是代理商就结束
                {
                    if (CRank1 == 10)                      //上一级级别决定系数
                    {
                        rate1 = P_R1_5;
                    }
                    else
                    {
                        rate1 = P_R1_4;
                    }
                    reward1 = count * rate1;
                    Reward rew = new Reward();
                    rew.No          = book.No;
                    rew.count       = count;
                    rew.custom      = Intr1;
                    rew.rate        = (rate1 * 100).ToString() + "%";
                    rew.reward      = reward1;
                    rew.publishDate = DateTime.Now;
                    AddReward(rew);

                    decimal total = getDecimal("U_Total", Intr1);
                    total += count;
                    string Stotal = total.ToString();
                    UpdateC("U_Total", Stotal, Intr1);

                    decimal count_P = getDecimal("U_Count", Intr1);
                    count_P += reward1;
                    string Scount_P = count_P.ToString();
                    UpdateC("U_Count", Scount_P, Intr1);

                    decimal Pay2 = getDecimal("U_Sum", Intr1);
                    Pay2 += reward1;
                    string SPay2 = Pay2.ToString();
                    UpdateC("U_Sum", SPay2, Intr1);

                    int Intr2 = getInt("U_Introduce", Intr1);
                    if (Intr2 != 0)
                    {
                        int CRank2 = getInt("U_Grade", Intr2);     //上二级级别
                        if (CRank1 == 10 || CRank1 == 11)          //上一级级别是代理商就结束
                        {
                            if (CRank2 == 10)                      //上二级级别决定系数
                            {
                                rate2 = P_R2_5;
                            }
                            else
                            {
                                rate2 = P_R2_4;
                            }
                            reward2 = count * rate2;
                            Reward rew2 = new Reward();
                            rew2.No          = book.No;
                            rew2.count       = count;
                            rew2.custom      = Intr2;
                            rew2.rate        = (rate2 * 100).ToString() + "%";
                            rew2.reward      = reward2;
                            rew2.publishDate = DateTime.Now;
                            AddReward(rew2);

                            decimal count_P2 = getDecimal("U_Count", Intr2);
                            count_P2 += reward2;
                            string Scount_P2 = count_P2.ToString();
                            UpdateC("U_Count", Scount_P2, Intr2);

                            decimal Pay22 = getDecimal("U_Sum", Intr2);
                            Pay22 += reward2;
                            string SPay22 = Pay22.ToString();
                            UpdateC("U_Sum", SPay22, Intr2);
                            return(2);
                        }
                        else
                        {
                            return(1);
                        }
                    }
                    else
                    {
                        return(1);
                    }
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
示例#10
0
        public static bool AddAdjust2(Model.Adjust book)                         //添加调整单2
        {
            int     Uid     = book.custom;
            decimal Uamount = book.amount;
            string  Uadjust = book.adjust;
            string  Utype   = book.rank;
            decimal Ucount;
            decimal Usum;
            int     num = 0;

            switch (Utype)
            {
            case "业绩核算调整":
            {
                Ucount = getDecimal("U_Count", Uid);
                Usum   = getDecimal("U_Sum", Uid);
                if (Uadjust == "增加")
                {
                    Ucount += Uamount;
                    Usum   += Uamount;
                }
                else
                {
                    Ucount -= Uamount;
                    Usum   -= Uamount;
                }
                string U_Count = Ucount.ToString();
                string U_Sum   = Usum.ToString();
                num = UpdateC("U_Count", U_Count, Uid) + UpdateC("U_Sum", U_Sum, Uid);
                break;
            }

            case "业绩合计调整":
            {
                Ucount = getDecimal("U_Total", Uid);
                if (Uadjust == "增加")
                {
                    Ucount += Uamount;
                }
                else
                {
                    Ucount -= Uamount;
                }
                string U_Count = Ucount.ToString();
                num = UpdateC("U_Total", U_Count, Uid) + 1;
                break;
            }

            case "团队业绩调整":
            {
                Ucount = getDecimal("U_TeamSum", Uid);
                if (Uadjust == "增加")
                {
                    Ucount += Uamount;
                }
                else
                {
                    Ucount -= Uamount;
                }
                string U_Count = Ucount.ToString();
                num = UpdateC("U_TeamSum", U_Count, Uid) + 1;
                break;
            }
            }
            if (num == 2)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#11
0
        public static int AddSettle3(Model.Adjust book) //代理商核算
        {
            decimal count = 0, reward1, reward2;        // 总金额,业绩1,业绩2,系数1,系数2
            int     Pro   = book.product;               //产品类别
            decimal Amout = book.amount;                //产品数量
            int     Uid   = book.custom;                //会员ID
            int     Cust  = book.custom1;

            switch (Pro)
            {
            case 4:
                count = P_A_4 * Amout;
                break;

            case 5:
                count = P_A_5 * Amout;
                break;

            case 6:
                count = P_A_6;
                break;

            case 7:
                count = P_A_7;
                break;
            }

            if (Cust != 0)
            {
                int No = book.No;
                reward2 = getAmount(No);
                reward1 = count - reward2;

                Reward rew = new Reward();
                rew.No          = book.No;
                rew.count       = 0;
                rew.custom      = Cust;
                rew.rate        = "0";
                rew.reward      = reward1;
                rew.publishDate = DateTime.Now;
                AddReward(rew);

                decimal count_P = getDecimal("U_Count", Cust);
                count_P += reward1;
                string Scount_P = count_P.ToString();
                UpdateC("U_Count", Scount_P, Cust);

                decimal Pay2 = getDecimal("U_Sum", Cust);
                Pay2 += reward1;
                string SPay2 = Pay2.ToString();
                UpdateC("U_Sum", SPay2, Cust);

                return(1);
            }
            else
            {
                return(0);
            }

            /*int count = getCount();
             * int i = 1, n = 0, Uid;
             * decimal rate;
             * for (i = 1; i <= count; i++)
             * {
             *  Uid = getUId(i);
             *  bool type = getBool("U_Type", Uid);
             *  int rank = getInt("U_Grade", Uid);
             *  if (rank == 12)
             *  {
             *      rate = C_R_12;
             *  }
             *  else
             *      rate = C_R_11;
             *
             *  decimal total = getDecimal("U_TeamSum", Uid);
             *  if (type && rank != 10)
             *  {
             *      decimal reward = total * rate;
             *      Reward rew = new Reward();
             *      rew.No = 99;
             *      rew.count = total;
             *      rew.custom = Uid;
             *      rew.rate = (rate * 100).ToString() + "%";
             *      rew.reward = reward;
             *      rew.publishDate = DateTime.Now;
             *      AddReward(rew);
             *
             *      decimal count_P = getDecimal("U_Count", Uid);
             *      count_P += reward;
             *      string Scount_P = count_P.ToString();
             *      UpdateC("U_Count", Scount_P, Uid);
             *
             *      decimal Pay2 = getDecimal("U_Sum", Uid);
             *      Pay2 += reward;
             *      string SPay2 = Pay2.ToString();
             *      UpdateC("U_Sum", SPay2, Uid);
             *      n += 1;
             *  }
             * }
             * return n;*/
        }