protected void Page_Load(object sender, EventArgs e)
 {
     if (Common.CheckPermission(Common.Module_Promotion, Common.Permission_View, HttpContext.Current))
     {
         string idstr = Request.QueryString["id"];
         int    id    = 0;
         int.TryParse(idstr, out id);
         if (id > 0)
         {
             PromotionBLL          pb    = new PromotionBLL();
             int                   total = 0;
             List <PromotionModel> list  = new List <PromotionModel>();
             pb.GetPromotionList(1, 1, id, null, null, null, out total, out list);
             if (list.Count == 1)
             {
                 PromotionModel model = list[0];
                 title_txt.Text   = model.Title;
                 content_txt.Text = model.Content;
                 date_txt.Text    = string.Format("{0:yyyy-MM-dd}", model.CreateTime);
             }
         }
     }
     else
     {
         Response.Redirect("nopermission.aspx");
     }
 }
Exemple #2
0
    protected string JsonInfo()
    {
        //获取同一线路,并且做促销的团
        List <GroupCurtInfo> list = new List <GroupCurtInfo>();

        foreach (V_Promotion_GroupInfo group in PromotionsGroups)
        {
            GroupCurtInfo model = new GroupCurtInfo();
            model.Date  = group.GoDate.ToDateOnlyString();
            model.Pos   = group.TotalNum.ToString();
            model.Price = PromotionBLL.CaculatePromotionPrice(group.RawOuterPrice, group.PromotionType, group.Discount, group.TotalPayOneTime, group.TotalPayOneTimeJoinNum).ToString();
            list.Add(model);
        }
        return(Arrow.Framework.JsonHelper.JsonSerializer(list));
    }
Exemple #3
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        int promotionID = GetUrlInt("PromotionID");
        int groupID     = GetUrlInt("GroupID");
        int lineID      = GetUrlInt("LineID");

        if (promotionID > 0)
        {
            MyPromotion = PromotionBLL.Select(promotionID);
        }
        if (groupID > 0)
        {
            MyGroup = GroupBLL.SelectGroup(groupID);
        }
        if (lineID > 0)
        {
            MyLine = LineBLL.SelectLine(lineID);
        }

        if (MyLine == null || MyGroup == null)
        {
            Arrow.Framework.MessageBox.Jump("-1");
        }
        BindBuyNum();

        if (promotionID == 0)
        {
            ltPrice.Text = MyGroup.InnerPrice.ToString();
            ltTotal.Text = (MyGroup.InnerPrice * ddlBuyNum.SelectedValue.ToArrowInt()).ToString();
        }
        else
        {
            if (MyPromotion.PromotionType == PromotionType.Discount)
            {
                ltPrice.Text = decimal.Round(MyGroup.InnerPrice * MyPromotion.Discount, 2).ToString();
                ltTotal.Text = (ltPrice.Text.ToArrowDecimal() * ddlBuyNum.SelectedValue.ToArrowInt()).ToString();
            }
            else if (MyPromotion.PromotionType == PromotionType.Bundle)
            {
                ltPrice.Text            = MyPromotion.TotalPayOneTime.ToString();
                ddlBuyNum.SelectedValue = MyPromotion.TotalPayOneTimeJoinNum.ToString();
                ddlBuyNum.Enabled       = false;
                ltTotal.Text            = MyPromotion.TotalPayOneTime.ToString();
            }
        }
    }
Exemple #4
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string commandName = e.CommandName;
        int    id          = e.CommandArgument.ToArrowInt();

        if (e.CommandName == "AddData")
        {
            GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent));
            int         num = (gvData.Rows[drv.RowIndex].FindControl("tbNum") as TextBox).Text.Trim().ToArrowInt();
            if ((num == 0).ValidateSuccess("促销的团位数无效!"))
            {
                BindData();
                return;
            }

            int     lineID        = (gvData.Rows[drv.RowIndex].FindControl("hfLineID") as HiddenField).Value.Trim().ToArrowInt();
            decimal rawInnerPrice = (gvData.Rows[drv.RowIndex].FindControl("hfInnerPrice") as HiddenField).Value.Trim().ToArrowDecimal();
            decimal rawOuterPrice = (gvData.Rows[drv.RowIndex].FindControl("hfOuterPrice") as HiddenField).Value.Trim().ToArrowDecimal();

            //判断该团是否已加入
            if (PromotionBLL.GroupIsInPromotion(id, MyPromotion.ID).ValidateSuccess("该团已在促销内!"))
            {
                BindData();
                return;
            }

            //开始加入
            var model = new TMS.PromotionGroupInfo();
            model.AddTime       = DateTime.Now;
            model.GroupID       = id;
            model.LineID        = lineID;
            model.PromotionID   = MyPromotion.ID;
            model.SelledNum     = 0;
            model.TotalNum      = num;
            model.RawInnerPrice = rawInnerPrice;
            model.RawOuterPrice = rawOuterPrice;
            model.BeginTime     = DateTime.Now;
            model.RemainNum     = model.TotalNum - model.SelledNum;

            PromotionBLL.AddGroupToPromotion(model);
            BindData();
            MessageBox.Show("添加成功!");
        }
    }
Exemple #5
0
    private void LoadPromo()
    {
        PromotionBLL          pb    = new PromotionBLL();
        int                   total = 0;
        List <PromotionModel> list  = new List <PromotionModel>();

        if (Common.CheckPermission(Common.Module_Promotion, Common.Permission_View, HttpContext.Current))
        {
            promohead = "<tr><th>日期</th><th>标题</th></tr>";
            try
            {
                if (user.Type == AdminType.Dealer)
                {
                    pb.GetPromotionList(1, 5, null, null, user.AdminId, null, out total, out list);
                }
                else if (user.Type == AdminType.Stores)
                {
                    pb.GetPromotionList(1, 5, null, null, null, user.AdminId, out total, out list);
                }
                else
                {
                    pb.GetPromotionList(1, 5, null, null, null, null, out total, out list);
                }

                if (list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        PromotionModel model = list[i];
                        promobody = promobody + "<tr><td>" + model.CreateTime + "</td><td><a target=\"_blank\" href=\"promotion.aspx?id=" + model.PromotionId + "\">" + model.Title + "</a></td></tr>";
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteExceptionLog("LoadPromo", ex);
            }
        }
        else
        {
            promopl.Visible = false;
        }
    }
Exemple #6
0
    protected override void OnInit(EventArgs e)
    {
        BindBuyNum();
        base.OnInit(e);
        int promotionID = GetUrlInt("PromotionID");
        int groupID     = GetUrlInt("GroupID");
        int lineID      = GetUrlInt("LineID");

        if (promotionID > 0)
        {
            MyPromotion = PromotionBLL.Select(promotionID);
        }
        if (groupID > 0)
        {
            MyGroup = GroupBLL.SelectGroup(groupID);
        }
        if (lineID > 0)
        {
            MyLine = LineBLL.SelectLine(lineID);
        }

        if (promotionID == 0)
        {
            ltPrice.Text = MyGroup.InnerPrice.ToString();
            ltTotal.Text = ltPrice.Text;
        }
        else
        {
            if (MyPromotion.PromotionType == PromotionType.Discount)
            {
                ltPrice.Text = decimal.Round(MyGroup.InnerPrice * MyPromotion.Discount, 2).ToString();
                ltTotal.Text = ltPrice.Text;
            }
            else if (MyPromotion.PromotionType == PromotionType.Bundle)
            {
                ltPrice.Text            = MyPromotion.TotalPayOneTime.ToString();
                ddlBuyNum.SelectedValue = MyPromotion.TotalPayOneTimeJoinNum.ToString();
                ddlBuyNum.Enabled       = false;
                ltTotal.Text            = MyPromotion.TotalPayOneTime.ToString();
            }
        }
    }
    protected void BindModel()
    {
        var model = PromotionBLL.Select(PromotionID);

        if (model == null)
        {
            return;
        }

        tbName.Text           = model.Name;
        tbBegin.Text          = model.StartTime.ToDateOnlyString();
        tbEnd.Text            = model.EndTime.ToDateOnlyString();
        ddlType.SelectedValue = model.PromotionType;
        SetControlStatus();
        tbDiscount.Text  = model.Discount.ToString();
        tbTotalPay.Text  = model.TotalPayOneTime.ToString();
        tbJoinNum.Text   = model.TotalPayOneTimeJoinNum.ToString();
        tbCoverPath.Text = model.CoverPath;
        tbRemarks.Text   = model.PromotionDesc;
    }
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string commandName = e.CommandName;
        int    id          = e.CommandArgument.ToArrowInt();

        if (e.CommandName == "UpdateData")
        {
            GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent));
            int         num = (gvData.Rows[drv.RowIndex].FindControl("tbNum") as TextBox).Text.Trim().ToArrowInt();
            if ((num == 0).ValidateSuccess("促销的团位数无效!"))
            {
                BindData();
                return;
            }
            PromotionBLL.UpdateTotalNumOfPromotionGroup(num, id);
            BindData();
            MessageBox.Show("修改成功!");
        }
        else if (e.CommandName == "DelData")
        {
            //删除,判断是否已经有人报名
            PromotionGroupInfo model = PromotionBLL.SelectGroupOfPromotion(id);
            if (model == null)
            {
                BindData();
                return;
            }
            if ((model.SelledNum > 0).ValidateSuccess("已经有人报名了,不可删除该促销!"))
            {
                BindData();
                return;
            }
            PromotionBLL.DelGroupOfPromotion(id);
            BindData();
            MessageBox.Show("删除成功!");
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (CurrentMember == null)
     {
         Response.Redirect("Login.aspx");
     }
     ShowTitle("编辑参团人");
     if (!Page.IsPostBack)
     {
         BindData();
         TravelOrderInfo order = OrderBLL.SelectOrder(OrderNum);
         if (order != null)
         {
             LineInfo line = LineBLL.SelectLine(order.LineID);
             if (line != null)
             {
                 TravelGroupInfo group = GroupBLL.SelectGroup(order.GroupID);
                 if (group != null)
                 {
                     ltBuyNum.Text   = order.BuyNum.ToString();
                     ltLineName.Text = line.Name.ToString();
                     ltPrice.Text    = group.InnerPrice.ToString();
                     ltTotal.Text    = order.TotalMoney.ToString();
                     PromotionInfo promotion = PromotionBLL.Select(order.PromotionID);
                     if (promotion != null)
                     {
                         ltPromotionName.Text = promotion.Name;
                     }
                     else
                     {
                         ltPromotionName.Text = "无";
                     }
                 }
             }
         }
     }
 }
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int id = e.CommandArgument.ToArrowInt();

        if (e.CommandName == "UpdateData")
        {
            Response.Redirect("PromotionEdit.aspx?id=" + id + CreateReturnUrl("&"));
        }
        else if (e.CommandName == "DelData")
        {
            //删除
            PromotionBLL.SetIsDel(id, 1);
            BindData();
            MessageBox.Show("删除成功!");
        }
        else if (e.CommandName == "AddPromotion")
        {
            Response.Redirect("GroupList.aspx?PromotionID=" + id + CreateReturnUrl("&"));
        }
        else if (e.CommandName == "GroupManager")
        {
            Response.Redirect("PromotionGroupManager.aspx?PromotionID=" + id + CreateReturnUrl("&"));
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string   name          = tbName.Text.Trim();
        string   cover         = tbCoverPath.Text.Trim();
        string   promotionType = ddlType.SelectedValue.ToArrowString();
        decimal  discount      = tbDiscount.Text.Trim().ToArrowDecimal();
        decimal  totalOneTime  = tbTotalPay.Text.Trim().ToArrowDecimal();
        int      joinNum       = tbJoinNum.Text.Trim().ToArrowInt();
        string   desc          = tbRemarks.Text.Trim();
        DateTime dtBegin       = tbBegin.Text.Trim().ToArrowDateTime();
        DateTime dtEnd         = tbEnd.Text.Trim().ToArrowDateTime();

        #region 验证数据
        if (name.ValidateIsNullOrEmpty("请输入促销名称!"))
        {
            return;
        }

        if ((dtBegin == DateTime.MinValue || dtEnd == DateTime.MinValue).ValidateSuccess("开始时间和结束时间不正确!"))
        {
            return;
        }

        if ((dtBegin >= dtEnd).ValidateSuccess("结束时间必须大于开始时间!"))
        {
            return;
        }

        if (promotionType.IsEqualTo(PromotionType.Discount))
        {
            if (discount >= 1 || discount <= 0)
            {
                MessageBox.Show("折扣输入错误!");
                return;
            }
        }
        else if (promotionType.IsEqualTo(PromotionType.Bundle))
        {
            if ((totalOneTime <= 0).ValidateSuccess("一次性支付金额不正确!"))
            {
                return;
            }

            if ((joinNum <= 0).ValidateSuccess("购买团位个数不正确!"))
            {
                return;
            }
        }

        #endregion

        PromotionInfo model = null;

        if (PromotionID == 0)
        {
            //添加
            model = new PromotionInfo();
        }
        else
        {
            model = PromotionBLL.Select(PromotionID);
            if (model == null)
            {
                return;
            }
        }
        model.CoverPath              = cover;
        model.Discount               = discount;
        model.EndTime                = dtEnd;
        model.FullCutMinus           = 0M;
        model.FullCutTotal           = 0M;
        model.IsDel                  = 0;
        model.Name                   = name;
        model.PromotionDesc          = desc;
        model.PromotionType          = promotionType;
        model.Remarks                = "";
        model.SecondKillPrice        = 0M;
        model.StartTime              = dtBegin;
        model.Tag                    = "";
        model.TotalPayOneTime        = totalOneTime;
        model.TotalPayOneTimeJoinNum = joinNum;
        if (PromotionID == 0)
        {
            model.AddTime         = DateTime.Now;
            model.AddUserName     = CurrentAdmin.UserName;
            model.AddUserRealName = CurrentAdmin.RealName;
            PromotionBLL.Add(model);
            MessageBox.Show("添加成功!", CurrentUrl);
        }
        else
        {
            PromotionBLL.Update(model);
            MessageBox.Show("修改成功!");
        }
    }
Exemple #12
0
        /// <summary>
        /// 读取数据
        /// </summary>
        private void GetData()
        {
            Thread.Sleep(1000);

            #region 更新主档信息
            //商品主档和商品变化主档同时存在时,先读取商品主档,再读取变化主档
            if (File.Exists(GlobalParams.spmxServerPath))
            {
                int ret;
                ret = new GoodsBLL().DeleteGoods();

                if (ret >= 0)
                {
                    DataOperator.UpdateData(GlobalParams.spmxServerPath, GlobalParams.spmxLocalPath, "goods_spmx", false);
                }
                else
                {
                    MessageBox.Show("商品表更新异常,请重新登录");
                    Log.WriteErrorLog("清空商品表出现异常,中断更新");
                }
            }
            DataOperator.UpdateSpit();

            if (File.Exists(GlobalParams.ygkServerPath))
            {
                int ret;
                ret = new StaffBLL().DeleteStaff();

                if (ret >= 0)
                {
                    DataOperator.UpdateData(GlobalParams.ygkServerPath, GlobalParams.ygkLocalPath, "staff_ygk", false);
                }
                else
                {
                    MessageBox.Show("员工表更新异常,请重新登录");
                    Log.WriteErrorLog("清空员工表出现异常,中断更新");
                }
            }

            if (File.Exists(GlobalParams.jsfsServerPath))
            {
                int ret;
                ret = new CardBLL().DeleteCard();

                if (ret >= 0)
                {
                    DataOperator.UpdateData(GlobalParams.jsfsServerPath, GlobalParams.jsfsLocalPath, "paymentmethod_jsfs", false);
                }
                else
                {
                    MessageBox.Show("结算方式表更新异常,请重新登录");
                    Log.WriteErrorLog("清空结算方式表出现异常,中断更新");
                }
            }

            if (File.Exists(GlobalParams.yhxsServerPath))
            {
                int ret;
                ret = new DiscountBLL().DeleteDiscount();

                if (ret >= 0)
                {
                    DataOperator.UpdateData(GlobalParams.yhxsServerPath, GlobalParams.yhxsLocalPath, "discount_yhxs", false);
                }
                else
                {
                    MessageBox.Show("时段折扣表更新异常,请重新登录");
                    Log.WriteErrorLog("清空时段折扣表出现异常,中断更新");
                }
            }

            //促销没有主键,采用先清空,再导入的策略
            if (File.Exists(GlobalParams.ptServerPath))
            {
                int ret;
                ret = new PromotionBLL().DeletePromotion();

                if (ret >= 0)
                {
                    DataOperator.UpdateData(GlobalParams.ptServerPath, GlobalParams.ptLocalPath, "promotion_pt", false);
                }
                else
                {
                    MessageBox.Show("促销表更新异常,请重新登录");
                    Log.WriteErrorLog("清空促销表出现异常,中断更新");
                }
            }
            #endregion

            Staff loginStaff = new StaffBLL().GetStaffByID(txtStaffID.Text);

            //记录登录的员工
            staff = loginStaff;
        }
Exemple #13
0
 protected List <V_Promotion_GroupInfo> GetPromotionGroups()
 {
     return(PromotionBLL.SelectPromotionGroups(GetUrlInt("PromotionID")));
 }