Exemple #1
0
        private void InitD()
        {
            var limit = IncomeGroupLimitService.QueryIncomeGroupLimitGroupByGroupId(Guid.Parse(Request.QueryString["id"]));

            hidincomgroupId.Value = Request.QueryString["id"];
            if (limit != null)
            {
                var    type = CompanyService.QueryLimitationType(CurrentCompany.CompanyId);
                string str = "", strPeriod = "", strG = "", strT = "";
                remark.Value = limit.Remark;
                foreach (var item in limit.Limitation)
                {
                    var currStr = (item.IsOwnerPolicy ? "1" : "0") + "," + item.Airlines + "," + (byte)item.Type;
                    var str1    = "";
                    foreach (var period in item.Period)
                    {
                        if (strPeriod != "")
                        {
                            strPeriod += ";";
                        }
                        if (item.Type == Common.Enums.PeriodType.Interval)
                        {
                            str1      += "[" + item.Airlines + "]" + " 区域:" + "[" + (period.StartPeriod * 100).TrimInvaidZero() + "," + (period.EndPeriod * 100).TrimInvaidZero() + "];扣点:" + (period.Period * 100).TrimInvaidZero() + "% <br />";
                            strPeriod += (period.StartPeriod * 100).TrimInvaidZero() + "|" + (period.EndPeriod * 100).TrimInvaidZero() + "|" + (period.Period * 100).TrimInvaidZero();
                        }
                        else
                        {
                            strPeriod += (period.Period * 100).TrimInvaidZero();
                            str1      += "[" + item.Airlines + "]" + " 统一返点:" + (period.Period * 100).TrimInvaidZero() + "%";
                        }
                    }
                    currStr += "," + strPeriod + "," + item.Price;
                    if (str != "")
                    {
                        str += "^";
                    }
                    str      += currStr;
                    strPeriod = "";
                    if (item.IsOwnerPolicy)
                    {
                        strG += " <p curr=" + currStr + ">" + str1 + " 每张票加价:" + item.Price + " 元 <a href='#' class='remove' curr=" + currStr + ">删除</a> </p>";
                    }
                    else
                    {
                        strT += " <p curr=" + currStr + ">" + str1 + " 每张票加价:" + item.Price + " 元 <a href='#' class='remove' curr=" + currStr + ">删除</a> </p>";
                    }
                }
                hidShouyishezhi.Value = str;
                bengongsi.InnerHtml   = strG;
                tonghang.InnerHtml    = strT;
            }
        }
Exemple #2
0
        private void InitD()
        {
            var limit = IncomeGroupLimitService.QueryIncomeGroupLimitGroupByCompanyId(CurrentCompany.CompanyId);
            var type  = CompanyService.QueryGlobalPurchaseIncome(CurrentCompany.CompanyId);

            radFenzu.Checked    = type == Common.Enums.IncomeGroupLimitType.Each;
            radQuanju.Checked   = type == Common.Enums.IncomeGroupLimitType.Global;
            radBuxianzi.Checked = type == Common.Enums.IncomeGroupLimitType.None;
            string str = "", strPeriod = "", strG = "", strT = "";

            remark.Value = limit.Remark;
            foreach (var item in limit.Limitation)
            {
                var currStr = (item.IsOwnerPolicy ? "1" : "0") + "," + item.Airlines + "," + (byte)item.Type;
                var str1    = "";
                foreach (var period in item.Period)
                {
                    if (strPeriod != "")
                    {
                        strPeriod += ";";
                    }
                    if (item.Type == Common.Enums.PeriodType.Interval)
                    {
                        str1      += "[" + item.Airlines + "]" + " 区域:" + "[" + (period.StartPeriod * 100).TrimInvaidZero() + "," + (period.EndPeriod * 100).TrimInvaidZero() + "];扣点:" + (period.Period * 100).TrimInvaidZero() + "% <br />";
                        strPeriod += (period.StartPeriod * 100).TrimInvaidZero() + "|" + (period.EndPeriod * 100).TrimInvaidZero() + "|" + (period.Period * 100).TrimInvaidZero();
                    }
                    else
                    {
                        strPeriod += (period.Period * 100).TrimInvaidZero();
                        str1      += "[" + item.Airlines + "]" + " 统一返点:" + (period.Period * 100).TrimInvaidZero() + "%";
                    }
                }
                currStr += "," + strPeriod + "," + item.Price;
                if (str != "")
                {
                    str += "^";
                }
                str      += currStr;
                strPeriod = "";
                if (item.IsOwnerPolicy)
                {
                    strG += " <p curr=" + currStr + ">" + str1 + " 每张票加价:" + item.Price + " 元 <a href='#' class='remove' curr=" + currStr + ">删除</a> </p>";
                }
                else
                {
                    strT += " <p curr=" + currStr + ">" + str1 + " 每张票加价:" + item.Price + " 元 <a href='#' class='remove' curr=" + currStr + ">删除</a> </p>";
                }
            }
            hidShouyishezhi.Value = str;
            bengongsi.InnerHtml   = strG;
            tonghang.InnerHtml    = strT;
        }
        public bool InsertIncomeLimitGroupGobal(byte type, string str, string remark)
        {
            IncomeGroupLimitGroup g = new IncomeGroupLimitGroup()
            {
                Id            = Guid.NewGuid(),
                CompanyId     = CurrentCompany.CompanyId,
                IncomeGroupId = null,
                Remark        = remark,
                Limitation    = new List <IncomeGroupLimit>()
            };
            var limitStr = str.Split('^');

            if (type == 2)
            {
                for (int i = 0; i < limitStr.Length; i++)
                {
                    var currLimit = limitStr[i].Split(',');
                    var limit     = new IncomeGroupLimit();
                    limit.Id            = Guid.NewGuid();
                    limit.IncomeId      = g.Id;
                    limit.IsOwnerPolicy = currLimit[0] == "1";
                    limit.Airlines      = currLimit[1];
                    limit.Type          = (PeriodType)byte.Parse(currLimit[2]);
                    limit.Price         = int.Parse(currLimit[4]);
                    limit.Period        = new List <IncomeGroupPeriod>();
                    if (limit.Type == PeriodType.Interval)
                    {
                        var currPeriod = currLimit[3].Split(';');
                        for (int j = 0; j < currPeriod.Length; j++)
                        {
                            var currValue = currPeriod[j].Split('|');
                            limit.Period.Add(new IncomeGroupPeriod {
                                DeductId = limit.Id, StartPeriod = decimal.Parse(currValue[0]), EndPeriod = decimal.Parse(currValue[1]), Period = decimal.Parse(currValue[2])
                            });
                        }
                    }
                    else
                    {
                        limit.Period.Add(new IncomeGroupPeriod {
                            DeductId = limit.Id, StartPeriod = 0, EndPeriod = 1, Period = decimal.Parse(currLimit[3])
                        });
                    }
                    g.Limitation.Add(limit);
                }
            }
            IncomeGroupLimitService.InsertIncomeGroupLimitGlobal((IncomeGroupLimitType)type, g);
            return(true);
        }