Ejemplo n.º 1
0
        public void Arrive_Add(M_Arrive avMod)
        {
            M_Store_Info storeMod = storeBll.SelModelByUser(mu.UserID);

            if (Mid < 1)//添加优惠券
            {
                avMod.CUser   = mu.UserID;
                avMod.StoreID = storeMod.ID;
                avMod.State   = DataConvert.CLng(Request.Form["state_chk"]);
                int          num    = DataConverter.CLng(Request.Form["txtCreateNum"]);
                CommonReturn retMod = avBll.CreateArrive(avMod, num, "1", Request.Form["UserID_Hid"]);
                if (retMod.isok)
                {
                    function.WriteSuccessMsg("批量添加成功!", "ArriveManage");
                }
                else
                {
                    function.WriteErrMsg(retMod.err);
                }
            }
            else
            {
                avMod            = avBll.SelReturnModel(Mid);
                avMod.ArriveName = Request.Form["ArriveName"];
                avMod.Amount     = DataConvert.CLng(Request.Form["Amount"]);
                avMod.MinAmount  = Convert.ToDouble(Request.Form["MinAmount"]);
                avMod.MaxAmount  = Convert.ToDouble(Request.Form["MaxAmount"]);
                avMod.AgainTime  = DataConvert.CDate(Request.Form["AgainTime"]);
                avMod.EndTime    = DataConvert.CDate(Request.Form["EndTime"]);
                avBll.GetUpdate(avMod);
                function.WriteSuccessMsg("修改成功!", "ArriveManage");
            }
        }
Ejemplo n.º 2
0
        public IActionResult ArriveAdd_Submit()
        {
            M_Arrive avMod = new M_Arrive();

            if (Mid > 0)
            {
                avMod = avBll.SelReturnModel(Mid);
            }
            avMod.ArriveName = GetParam("txtName");
            avMod.MinAmount  = DataConverter.CDouble(GetParam("minAmount_T"));
            avMod.MaxAmount  = DataConverter.CDouble(GetParam("maxAmount_T"));
            avMod.Amount_Max = DataConverter.CDouble(GetParam("Amount2_Max"));

            avMod.DateDays  = DataConverter.CLng(GetParam("DateDays_T"));
            avMod.AgainTime = DataConverter.CDate(GetParam("AgainTime_T"));
            avMod.EndTime   = DataConverter.CDate(GetParam("EndTime_T"));

            avMod.Type     = DataConverter.CLng(Request.Form["Type_Rad"]);
            avMod.DateType = DataConverter.CLng(Request.Form["date_rad"]);
            avMod.ProIDS   = GetParam("UProIDS_Hid");
            avMod.StoreID  = DataConverter.CLng(GetParam("Store_DP"));
            avMod.State    = DataConvert.CLng(GetParam("state_chk"));
            avMod.CAdmin   = adminMod.AdminId;
            switch (avMod.Type)
            {
            case 1:
                avMod.Amount = DataConverter.CDouble(GetParam("Amount2_T"));
                break;

            default:
                avMod.Amount = DataConverter.CDouble(GetParam("Amount_T"));
                break;
            }
            //----------------------------------------
            if (avMod.ID < 1)//添加优惠券
            {
                int          num    = DataConverter.CLng(GetParam("txtCreateNum"));
                CommonReturn retMod = avBll.CreateArrive(avMod, num, GetParam("EcodeType"), GetParam("UserID_Hid"));
                if (retMod.isok)
                {
                    return(WriteOK("批量添加成功!", "ArriveManage?name=" + avMod.ArriveName));
                }
                else
                {
                    return(WriteErr(retMod.err));
                }
            }
            else
            {
                avMod.ArriveNO  = GetParam("txtNo");
                avMod.ArrivePwd = GetParam("txtPwd");
                avBll.GetUpdate(avMod);
                return(WriteOK("操作成功", "ArriveManage"));
            }
        }
Ejemplo n.º 3
0
        //制作抵用劵
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            M_Arrive avMod = new M_Arrive();

            if (Mid > 0)
            {
                avMod = avBll.SelReturnModel(Mid);
            }
            avMod.ArriveName = txtName.Text;
            avMod.MinAmount  = DataConverter.CDouble(minAmount_T.Text);
            avMod.MaxAmount  = DataConverter.CDouble(maxAmount_T.Text);
            avMod.AgainTime  = DataConverter.CDate(AgainTime_T.Text);
            avMod.EndTime    = DataConverter.CDate(EndTime_T.Text);
            avMod.Amount     = DataConverter.CDouble(Amount_T.Text);
            avMod.Type       = DataConverter.CLng(Magclass.SelectedItem.Value);
            if (avMod.EndTime <= DateTime.Now)
            {
                function.WriteErrMsg("到期时间不能早于当前时间");
            }
            if (avMod.AgainTime >= avMod.EndTime)
            {
                function.WriteErrMsg("到期时间不能晚于发布时间");
            }
            if (avMod.MaxAmount < 0 || avMod.MinAmount < 0)
            {
                function.WriteErrMsg("使用范围数值不正确");
            }
            if (avMod.MaxAmount != 0 && avMod.MinAmount > avMod.MaxAmount)
            {
                function.WriteErrMsg("使用范围不正确,最小值不能大于最大值");
            }
            if (avMod.Amount < 1)
            {
                function.WriteErrMsg("优惠金额不正确,最小值为1");
            }
            //----------------------------------------
            if (avMod.ID < 1)//添加优惠券
            {
                avMod.Flow = Guid.NewGuid().ToString();
                int num = DataConverter.CLng(txtCreateNum.Text);
                for (int i = 0; i < num; i++)
                {
                    switch (EcodeType.SelectedItem.Value)
                    {
                    case "0":    //纯数字
                        avMod.ArriveNO = function.GetRandomString(9, 2);
                        break;

                    case "1":    //字母
                        avMod.ArriveNO = "ZL" + function.GetRandomString(9, 3).ToLower();
                        break;

                    case "2":    //混淆
                        avMod.ArriveNO = "ZL" + function.GetRandomString(9, 3).ToLower();
                        break;

                    default:
                        break;
                    }
                    avMod.ArrivePwd = "ZL" + function.GetRandomString(9);
                    avMod.State     = isValid_Chk.Checked ? 1 : 0;
                    avMod.UserID    = 0;
                    avBll.GetInsert(avMod);
                }
                function.WriteSuccessMsg("批量添加成功!", "ArriveManage.aspx?name=" + avMod.ArriveName);
            }
            else
            {
                avMod.ArriveNO  = txtNo.Text;
                avMod.ArrivePwd = txtPwd.Text;
                avMod.State     = txtState.Text == "未使用" ? 0 : 1;
                avMod.UserID    = DataConverter.CLng(hfid.Value);
                avBll.GetUpdate(avMod);
                function.WriteSuccessMsg("修改成功!", "ArriveManage.aspx");
            }
        }