예제 #1
0
 protected void btnSubmitIncomeGroup_Click(object sender, EventArgs e)
 {
     if (valiate())
     {
         try
         {
             var incomeGroup = new IncomeGroup();
             incomeGroup.Id          = Guid.NewGuid();
             incomeGroup.Company     = this.CurrentCompany.CompanyId;
             incomeGroup.CreateTime  = DateTime.Now;
             incomeGroup.Creator     = this.CurrentUser.UserName;
             incomeGroup.Name        = this.txtIncomeGroupName.Text.Trim();
             incomeGroup.Description = this.txtIncomeGroupDescription.Text.Trim();
             IncomeGroupService.RegisterIncomeGroup(incomeGroup, this.CurrentUser.UserName);
             string companyId      = Request.QueryString["CompanyId"];
             string incomeGroupId  = Request.QueryString["IncomeGroupId"];
             string strAccountType = Request.QueryString["AccountType"];
             if (!string.IsNullOrWhiteSpace(companyId))
             {
                 RegisterScript("alert('添加成功');window.location.href='DistributionOEMUserUpdate.aspx?CompanyId=" + companyId + "&IncomeGroupId=" + incomeGroupId + "&AccountType=" + strAccountType + "'", false);
             }
             else
             {
                 RegisterScript("alert('添加成功');window.location.href='IncomeGroupList.aspx';", false);
             }
         }
         catch (Exception ex)
         {
             ShowExceptionMessage(ex, "添加用户组");
         }
     }
 }
예제 #2
0
        private void initData()
        {
            var incomeGroup = IncomeGroupService.QueryIncomeGroup(this.CurrentCompany.CompanyId, null);

            this.ddlIncomeGroup.DataSource     = incomeGroup;
            this.ddlIncomeGroup.DataTextField  = "Name";
            this.ddlIncomeGroup.DataValueField = "Id";
            this.ddlIncomeGroup.DataBind();
            this.ddlIncomeGroup.Items.Insert(0, new ListItem("-请选择-", ""));

            string incomeGroupId = Request.QueryString["id"];

            if (!string.IsNullOrWhiteSpace(incomeGroupId))
            {
                var global = IncomeGroupService.QueryIncomeGroupView(Guid.Parse(incomeGroupId));
                if (global != null)
                {
                    lblName.Text                       = lblGroupName.Text = global.Name;
                    this.lblUserCount.Text             = global.UserCount.ToString();
                    this.lblGroupDescription.Text      = global.Description;
                    this.hfdCurrentIncomeGroupId.Value = global.IncomeGroupId.ToString();
                    this.queryUsrList.HRef             = "DistributionOEMUserList.aspx?IncomeGroupId=" + global.IncomeGroupId.ToString();
                }
            }
        }
        private void BindCompanyInfo(DistribtionOEMUserCompanyDetailInfo info)
        {
            this.ddlIncomeGroup.DataSource     = IncomeGroupService.QueryIncomeGroup(this.CurrentCompany.CompanyId, null);
            this.ddlIncomeGroup.DataTextField  = "Name";
            this.ddlIncomeGroup.DataValueField = "Id";
            this.ddlIncomeGroup.DataBind();
            this.ddlIncomeGroup.Items.Insert(0, new ListItem("-请选择-", ""));
            string incomeGroupId = Request.QueryString["IncomeGroupId"];

            if (info.IncomeGroupId.HasValue)
            {
                this.ddlIncomeGroup.SelectedValue = info.IncomeGroupId.Value.ToString();
            }
            this.lblAccountNo.Text     = info.UserName;
            this.lblCompanyType.Text   = info.CompanyType.GetDescription() + "(" + info.AccountType.GetDescription() + ")";
            this.hfldAddressCode.Value = AddressShow.GetAddressJson(info.Area, info.Province, info.City, info.District);
            this.txtAddress.Text       = info.Address;
            this.txtPostCode.Text      = info.ZipCode;
            this.txtCompanyPhone.Text  = info.OfficePhones;
            this.txtFaxes.Text         = info.Faxes;
            this.txtLinkman.Text       = info.Contact;
            this.txtLinkManPhone.Text  = info.ContactPhone;
            this.txtEmail.Text         = info.ContactEmail;
            this.txtQQ.Text            = info.ContactQQ;
            BindEnterprise(info);
        }
예제 #4
0
        private void initData()
        {
            this.incomeGroup.Visible  = false;
            this.hfdCompanyType.Value = this.CurrentCompany.CompanyType.ToString();
            txtPurchaseCompany.SetCompanyType(CompanyType.Provider | CompanyType.Purchaser | CompanyType.Supplier, true);
            var purchase = DistributionOEMService.QueryDistributionOEMUserList(new DistributionOEMUserCondition
            {
                CompanyId = this.CurrentCompany.CompanyId
            }, new Pagination
            {
                PageIndex = 1,
                PageSize  = int.MaxValue
            });

            this.ddlPurchaseCompany.DataSource = from item in purchase
                                                 select new
            {
                Text  = item.Login + "-" + item.AbbreviateName,
                Value = item.CompanyId
            };
            this.ddlPurchaseCompany.DataTextField  = "Text";
            this.ddlPurchaseCompany.DataValueField = "Value";
            this.ddlPurchaseCompany.DataBind();
            this.ddlPurchaseCompany.Items.Insert(0, new ListItem("全部", ""));
            this.hfdCompanyId.Value = this.CurrentCompany.CompanyId.ToString();
            this.txtStartDate.Text  = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
            this.txtEndDate.Text    = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
            if (this.CurrentCompany.CompanyType == CompanyType.Platform)
            {
                this.royalty.Visible            = true;
                this.txtPurchaseCompany.Visible = true;
                this.ddlPurchaseCompany.Visible = false;
                var royaltyCompany = DistributionOEMService.QueryDistributionOEM();
                this.ddlRoyaltyCompany.DataSource = from item in royaltyCompany
                                                    select new
                {
                    Text  = item.UserNo + "-" + item.AbbreivateName,
                    Value = item.CompanyId
                };
                this.ddlRoyaltyCompany.DataTextField  = "Text";
                this.ddlRoyaltyCompany.DataValueField = "Value";
                this.ddlRoyaltyCompany.DataBind();
                this.ddlRoyaltyCompany.Items.Insert(0, new ListItem("全部", ""));
            }
            else
            {
                this.incomeGroup.Visible        = true;
                this.txtPurchaseCompany.Visible = false;
                this.ddlPurchaseCompany.Visible = true;
                var incomeGroup = IncomeGroupService.QueryIncomeGroup(this.CurrentCompany.CompanyId, null);
                this.ddlIncomeGroup.DataSource     = incomeGroup;
                this.ddlIncomeGroup.DataTextField  = "Name";
                this.ddlIncomeGroup.DataValueField = "Id";
                this.ddlIncomeGroup.DataBind();
                this.ddlIncomeGroup.Items.Insert(0, new ListItem("全部", ""));
                this.royalty.Visible = false;
            }
        }
예제 #5
0
        public void UpdateIncomeGroup(Guid groupId, string name, string description)
        {
            var incomeGroup = new IncomeGroup();

            incomeGroup.Id          = groupId;
            incomeGroup.Name        = name;
            incomeGroup.Description = description;
            IncomeGroupService.UpdateIncomeGroup(incomeGroup, this.CurrentUser.UserName);
        }
예제 #6
0
        private void InitData()
        {
            var incomeGroup = IncomeGroupService.QueryIncomeGroup(this.CurrentCompany.CompanyId, null);

            this.ddlIncomeGroup.DataSource     = incomeGroup;
            this.ddlIncomeGroup.DataTextField  = "Name";
            this.ddlIncomeGroup.DataValueField = "Id";
            this.ddlIncomeGroup.DataBind();
            this.ddlIncomeGroup.Items.Insert(0, new ListItem("-请选择-", ""));
        }
예제 #7
0
        public void OpenIncomeGroup(string name, string description)
        {
            var incomeGroup = new IncomeGroup();

            incomeGroup.Id          = Guid.NewGuid();
            incomeGroup.Company     = this.CurrentCompany.CompanyId;
            incomeGroup.CreateTime  = DateTime.Now;
            incomeGroup.Creator     = this.CurrentUser.UserName;
            incomeGroup.Name        = name;
            incomeGroup.Description = description;
            IncomeGroupService.RegisterIncomeGroup(incomeGroup, this.CurrentUser.UserName);
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterOEMSkins("form.css");
            RegisterOEMSkins("page.css");
            RegisterOEMSkins("register.css");

            if (!IsPostBack)
            {
                chkAirlist.DataSource     = from item in FoundationService.Airlines select new { Text = item.ShortName, Value = item.Code.Value };
                chkAirlist.DataTextField  = "Text";
                chkAirlist.DataValueField = "Value";
                chkAirlist.DataBind();
                //txtDepartureAirports.InitData();
                var setting = IncomeGroupService.QueryIncomeGroupDeductSetting(Guid.Parse(Request.QueryString["id"]));
                if (setting != null)
                {
                    hidSettingId.Value = setting.Id.ToString();
                    foreach (var item in setting.Airlines.Split('/'))
                    {
                        foreach (ListItem it in chkAirlist.Items)
                        {
                            if (item == it.Value)
                            {
                                it.Selected = true;
                                break;
                            }
                        }
                    }
                    txtDepartureAirports.InitData(true, setting.Departure.Split('/').ToList());
                    radQujian.Checked = setting.Type == PeriodType.Interval;
                    radTongyi.Checked = setting.Type == PeriodType.Unite;
                    txtPrice.Text     = setting.Price.ToString();
                    txtRemark.Text    = setting.Remark;
                    if (setting.Period.Any())
                    {
                        txtTongyi.Text = (setting.Period.FirstOrDefault().Period * 100).TrimInvaidZero();
                        string ranges = setting.Period.OrderBy(item => item.StartPeriod)
                                        .Join(",", item => (item.StartPeriod * 100).TrimInvaidZero() + "|" + (item.EndPeriod * 100).TrimInvaidZero() + "|" + (item.Period * 100).TrimInvaidZero());
                        hidRanges.Value = ranges;
                        if (setting.Type == PeriodType.Interval)
                        {
                            qujian.Style.Add("display", "");
                            tongyi.Style.Add("display", "none");
                        }
                        else
                        {
                            qujian.Style.Add("display", "none");
                            tongyi.Style.Add("display", "");
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterOEMSkins("form.css");
            RegisterOEMSkins("page.css");
            RegisterOEMSkins("register.css");

            if (!IsPostBack)
            {
                var setting = IncomeGroupService.QueryIncomeGroupDeductGlobalByCompanyId(CurrentCompany.CompanyId);
                if (setting != null)
                {
                    hidVId.Value       = setting.Id.ToString();
                    hidIsFirst.Value   = "0";
                    hidSettingId.Value = setting.Id.ToString();
                    radQujian.Checked  = setting.Type == PeriodType.Interval;
                    radTongyi.Checked  = setting.Type == PeriodType.Unite;
                    if (!setting.IsGlobal.Value)
                    {
                        divGlobal.Style.Add("display", "none"); rbnPurchaseEach.Checked = true;
                    }
                    else
                    {
                        rbnPurchaseGlobal.Checked = true;
                    }
                    txtPrice.Text  = setting.Price.ToString();
                    txtRemark.Text = setting.Remark;
                    if (setting.Period.Any())
                    {
                        txtTongyi.Text = (setting.Period.FirstOrDefault().Period * 100).TrimInvaidZero();
                        string ranges = setting.Period.OrderBy(item => item.StartPeriod)
                                        .Join(",", item => (item.StartPeriod * 100).TrimInvaidZero() + "|" + ((item.EndPeriod == 0 ? 1 : item.EndPeriod) * 100).TrimInvaidZero() + "|" + (item.Period * 100).TrimInvaidZero());
                        hidRanges.Value = ranges;
                        if (setting.Type == PeriodType.Interval)
                        {
                            qujian.Style.Add("display", "");
                            tongyi.Style.Add("display", "none");
                        }
                        else
                        {
                            qujian.Style.Add("display", "none");
                            tongyi.Style.Add("display", "");
                        }
                    }
                }
                else
                {
                    hidIsFirst.Value = "1";
                }
            }
        }
예제 #10
0
        private void initData()
        {
            var incomeGroup = IncomeGroupService.QueryIncomeGroup(this.CurrentCompany.CompanyId, null);

            this.ddlIncomeGroup.DataSource     = incomeGroup;
            this.ddlIncomeGroup.DataTextField  = "Name";
            this.ddlIncomeGroup.DataValueField = "Id";
            this.ddlIncomeGroup.DataBind();
            this.ddlIncomeGroup.Items.Insert(0, new ListItem("-请选择-", ""));


            string strAirlines = "";
            int    i           = 0;

            foreach (var item in FoundationService.Airlines)
            {
                i++;
                strAirlines += "<input type='checkbox' id='checkbox_" + i + "' value='" + item.Code.Value + "' /><label for='checkbox_" + i + "'>" + item.ShortName + "</label>&nbsp;&nbsp;";
                if (i % 15 == 0)
                {
                    strAirlines += "<br />";
                }
            }
            divAirlinelist.InnerHtml = strAirlines;


            txtDepartureAirports.InitData(true, Service.FoundationService.Airports.Where(item => item.Valid));

            string incomeGroupId = Request.QueryString["IncomeGroupId"];

            if (!string.IsNullOrWhiteSpace(incomeGroupId))
            {
                var incomeGroupView = IncomeGroupService.QueryIncomeGroupView(Guid.Parse(incomeGroupId));
                lblGroupNameTitle.Text             = this.lblGroupName.Text = incomeGroupView.Name;
                this.lblUserCount.Text             = incomeGroupView.UserCount.ToString();
                this.lblGroupDescription.Text      = incomeGroupView.Description;
                this.hfdCurrentIncomeGroupId.Value = incomeGroupId;
                this.queryUsrList.HRef             = "DistributionOEMUserList.aspx?IncomeGroupId=" + incomeGroupId;
                var global = PurchaseLimitationService.QueryPurchaseLimitationGroupInfo(Guid.Parse(incomeGroupId));
                if (global != null)
                {
                    string strLimitation     = "";
                    JavaScriptSerializer jss = new JavaScriptSerializer();
                    strLimitation            = jss.Serialize(global.Limitation);
                    strLimitation            = "var limitation=" + strLimitation;
                    this.hfdLimitation.Value = strLimitation;
                }
            }
        }
예제 #11
0
        private void initData()
        {
            var incomeGroup = IncomeGroupService.QueryIncomeGroup(this.CurrentCompany.CompanyId, null);

            this.ddlIncomeGroup.DataSource     = incomeGroup;
            this.ddlIncomeGroup.DataTextField  = "Name";
            this.ddlIncomeGroup.DataValueField = "Id";
            this.ddlIncomeGroup.DataBind();
            this.ddlIncomeGroup.Items.Insert(0, new ListItem("所有", ""));
            var companyParameter = CompanyService.GetCompanyParameter(CurrentCompany.CompanyId);

            btnCreateSubCompany.PostBackUrl = companyParameter == null || !companyParameter.CanHaveSubordinate
                                                  ? "/OrganizationModule/CommonContent/AddAccount/ExtendOpenAccount.aspx?Type=Purchaser"
                                                  : "/OrganizationModule/RoleModule/ExtendCompanyManage/AddLower.aspx";
            LoadCondition("DistributionOEMUserList");
        }
예제 #12
0
        public IEnumerable <IncomeGroupView> QueryIncomeGroupList(string groupIds)
        {
            var ids    = new List <Guid>();
            var strIds = groupIds.Split(',');

            foreach (var item in strIds)
            {
                ids.Add(Guid.Parse(item));
            }
            if (ids.Count > 0)
            {
                return(IncomeGroupService.QueryIncomeGroup(ids));
            }
            else
            {
                return(new List <IncomeGroupView>());
            }
        }
예제 #13
0
        private void queryIncomeGroup(Pagination pagination)
        {
            try
            {
                var global = CompanyService.QueryLimitationType(this.CurrentCompany.CompanyId);
                var type   = CompanyService.QueryGlobalPurchaseIncome(this.CurrentCompany.CompanyId);

                var setting = IncomeGroupService.QueryIncomeGroupDeductGlobalByCompanyId(CurrentCompany.CompanyId);

                var incomeGroup = from item in IncomeGroupService.QueryIncomeGroup(this.CurrentCompany.CompanyId, pagination)
                                  select new
                {
                    item.Id,
                    item.Company,
                    item.Name,
                    item.Description,
                    item.CreateTime,
                    item.UserCount,
                    purchaseRestriction = global == Common.Enums.PurchaseLimitationType.Each ? " <a href='PurchaseRestrictionSetting.aspx?IncomeGroupId=" + item.Id + "'>采买设置</a> | " : "",
                    incomeGlobal        = type == Common.Enums.IncomeGroupLimitType.Each ? " <a href='Shouyishezhi.aspx?id=" + item.Id + "'>收益设置</a> | " : ""
                };
                this.rptIncomeGroup.DataSource = incomeGroup;
                this.rptIncomeGroup.DataBind();
                if (incomeGroup.Count() > 0)
                {
                    this.pager.Visible      = true;
                    this.showOrHide.Visible = true;
                    if (pagination.GetRowCount)
                    {
                        this.pager.RowCount = pagination.RowCount;
                    }
                }
                else
                {
                    this.showOrHide.Visible     = false;
                    this.rptIncomeGroup.Visible = false;
                    this.pager.Visible          = false;
                }
            }
            catch (Exception ex)
            {
                ShowExceptionMessage(ex, "加载");
            }
        }
예제 #14
0
        public void DeleteIncomeGroupList(string groupIds)
        {
            var ids    = new List <Guid>();
            var strIds = groupIds.Split(',');

            foreach (var item in strIds)
            {
                ids.Add(Guid.Parse(item));
            }
            if (ids.Count > 0)
            {
                try
                {
                    IncomeGroupService.DeleteIncomeGroupList(ids, this.CurrentUser.Name);
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #15
0
        public void UpdateIncomeGroupRelation(Guid newIncomeGroupId, string companyIds)
        {
            var ids    = new List <Guid>();
            var strIds = companyIds.Split(',');

            foreach (var item in strIds)
            {
                ids.Add(Guid.Parse(item));
            }
            if (ids.Count > 0)
            {
                try
                {
                    IncomeGroupService.UpdateIncomeGroupRelation(newIncomeGroupId, ids);
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterOEMSkins("form.css");
            RegisterOEMSkins("page.css");
            RegisterOEMSkins("register.css");
            initData();
            if (!IsPostBack)
            {
                var setting = IncomeGroupService.QueryIncomeGroupDeductGlobalSetting(Guid.Parse(Request.QueryString["id"]));
                if (setting != null)
                {
                    hidSettingId.Value = setting.Id.ToString();
                    radQujian.Checked  = setting.Type == PeriodType.Interval;
                    radTongyi.Checked  = setting.Type == PeriodType.Unite;

                    txtPrice.Text  = setting.Price.ToString();
                    txtRemark.Text = setting.Remark;
                    if (setting.Period.Any())
                    {
                        txtTongyi.Text = (setting.Period.FirstOrDefault().Period * 100).TrimInvaidZero();
                        string ranges = setting.Period.OrderBy(item => item.StartPeriod)
                                        .Join(",", item => (item.StartPeriod * 100).TrimInvaidZero() + "|" + ((item.EndPeriod == 0 ? 1 : item.EndPeriod) * 100).TrimInvaidZero() + "|" + (item.Period * 100).TrimInvaidZero());
                        hidRanges.Value = ranges;
                        if (setting.Type == PeriodType.Interval)
                        {
                            qujian.Style.Add("display", "");
                            tongyi.Style.Add("display", "none");
                        }
                        else
                        {
                            qujian.Style.Add("display", "none");
                            tongyi.Style.Add("display", "");
                        }
                    }
                }
            }
        }
예제 #17
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            IncomeGroupDeductGlobal set = new IncomeGroupDeductGlobal();

            set.CompanyId = CurrentCompany.CompanyId;
            set.IsGlobal  = false;
            set.CompanyId = CurrentCompany.CompanyId;
            set.Price     = int.Parse(txtPrice.Text == "" ? "0" : txtPrice.Text);
            set.Remark    = txtRemark.Text;
            set.Type      = radQujian.Checked ? PeriodType.Interval : PeriodType.Unite;
            set.Id        = string.IsNullOrEmpty(hidSettingId.Value) ? Guid.NewGuid() : Guid.Parse(hidSettingId.Value);
            if (radQujian.Checked)
            {
                var rangeList = this.hidRanges.Value.Split(',');
                var ranges    = new List <IncomeGroupPeriod>();
                foreach (var item in rangeList)
                {
                    string[]          range  = item.Split('|');
                    IncomeGroupPeriod period = new IncomeGroupPeriod();
                    if (!string.IsNullOrWhiteSpace(range[0]))
                    {
                        period.StartPeriod = decimal.Parse(range[0]) / 100;
                    }
                    if (!string.IsNullOrWhiteSpace(range[1]))
                    {
                        period.EndPeriod = decimal.Parse(range[1]) / 100;
                    }

                    if (!string.IsNullOrWhiteSpace(range[2]))
                    {
                        period.Period = decimal.Parse(range[2]) / 100;
                    }
                    period.DeductId = set.Id;
                    ranges.Add(period);
                }
                set.Period = ranges;
            }
            else
            {
                var ranges = new List <IncomeGroupPeriod>();
                IncomeGroupPeriod period = new IncomeGroupPeriod();
                period.StartPeriod = 0;
                period.EndPeriod   = 0;
                period.Period      = txtTongyi.Text == "" ? 0 : decimal.Parse(txtTongyi.Text) / 100;
                period.DeductId    = set.Id;
                ranges.Add(period);
                set.Period = ranges;
            }
            set.IncomeGroupId = Guid.Parse(Request.QueryString["id"]);

            try
            {
                IncomeGroupService.InsertIncomeGroupDeductSetting(set, CurrentUser.UserName);
            }
            catch (Exception ex)
            {
                ShowExceptionMessage(ex, "设置收益信息");
                return;
            }
            ////刷新缓存
            //var oem = OEMService.QueryOEM(CurrentCompany.CompanyId);
            //if (oem != null)
            //    FlushRequester.TriggerOEMFlusher(oem.Id);
            RegisterScript("alert('设置收益信息成功!');window.location.href='IncomeGroupList.aspx';", true);
        }
예제 #18
0
 public void DeleteIncomeGroup(Guid groupId)
 {
     IncomeGroupService.DeleteIncomeGroup(groupId, this.CurrentUser.UserName);
 }
예제 #19
0
 public IncomeGroupView QueryIncomeGroup(Guid groupId)
 {
     return(IncomeGroupService.QueryIncomeGroupView(groupId));
 }