Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Service_SystemModuleSetMeal.SystemModuleSetMealClient bll = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
        switch (GetRequest.GetRequestValue("action"))
        {
        case "del":
            bll.Del(GetRequest.GetInt32("id"));
            bll.Abort();
            bll.Close();
            Success();
            break;

        default:
            int page     = GetRequest.GetInt32("page");
            int pageSize = 20;
            int record   = 0;
            list  = bll.List(page, pageSize, out record);
            Pager = InitPageView(page, record);
            bll.Abort();
            bll.Close();
            break;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = GetRequest.GetInt32("id", Method.All, 0);

        if (Request.HttpMethod.ToLower() == "post")
        {
            Service_SystemModuleSetMeal.SystemModuleSetMealClient bll = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
            if (id > 0)
            {
                __SetMeal = bll.Info(id);
            }
            else
            {
                __SetMeal.AddDate = DateTime.Now;
            }
            __SetMeal.Enable = GetRequest.GetRequestValue("Enable", Method.Post) == "1";
            __SetMeal.Name   = GetRequest.GetRequestValue("Name", Method.Post);
            __SetMeal.Day    = GetRequest.GetInt32("Day", Method.Post, 0);
            __SetMeal.Price  = GetRequest.GetDecimal("Price", Method.Post, 0);
            bll.Edit(__SetMeal, GetRequest.GetRequestValue("Module"));
            Response.Write("ok");
            Response.End();
        }
        else
        {
            Service_SystemModule.SystemModuleClient moduleBll = new Service_SystemModule.SystemModuleClient();
            __ModuleList = moduleBll.List();
            if (id > 0)
            {
                Service_SystemModuleSetMeal.SystemModuleSetMealClient             setMealBll       = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
                Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient setMealDetailBll = new Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient();
                __SetMeal       = setMealBll.Info(id);
                __SetMealDetail = setMealDetailBll.List(id);
                foreach (V_SystemModuleSetMealDetail item in __SetMealDetail)
                {
                    __setMealIds += item.SystemModuleId + ",";
                }
                setMealBll.Abort();
                setMealBll.Close();
                setMealDetailBll.Abort();
                setMealDetailBll.Close();
            }
            moduleBll.Abort();
            moduleBll.Close();
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Service_Company.CompanyServiceClient companyBll = new Service_Company.CompanyServiceClient();
        __IsCompany = companyBll.CompanyValid(LoginCompanyId);
        //Service_Company.Company
        companyBll.Abort();
        companyBll.Close();

        Service_SystemModuleSetMeal.SystemModuleSetMealClient bll = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
        switch (GetRequest.GetRequestValue("action"))
        {
        case "pay":
            string   payId    = GetRequest.GetRequestValue("id");
            decimal  sum      = 0;
            string[] payIdArr = payId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            Service_SystemModuleSetMeal.SystemModuleSetMealClient setMealBll = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
            foreach (string item in payIdArr)
            {
                SystemModuleSetMeal setMealInfo = setMealBll.Info(Convert.ToInt32(item));
                if (setMealInfo == null)
                {
                    continue;
                }
                sum += setMealInfo.Price;
            }

            Service_PlanAgentOrder.PlanAgentOrderClient orderBll = new Service_PlanAgentOrder.PlanAgentOrderClient();
            PlanAgentOrder orderInfo = new PlanAgentOrder()
            {
                CompanyId  = LoginCompanyId,
                Price      = sum,
                RelationId = payId,
                Sn         = string.Format("{0}{1:yyyyMMddHHmmss}", LoginCompanyId, DateTime.Now),
                State      = 0,
                Type       = 1
            };
            orderBll.Add(orderInfo);
            orderBll.Abort();
            orderBll.Close();
            Response.Redirect("SystemModule_GoPay.aspx?sn=" + orderInfo.Sn);
            break;

        default:
            int page     = GetRequest.GetInt32("page");
            int pageSize = 20;
            int record   = 0;
            list = bll.ListByEnable(true, page, pageSize, out record);
            Service_SystemModuleSetMealLevelPrice.SystemModuleSetMealLevelPriceClient levelBll = new Service_SystemModuleSetMealLevelPrice.SystemModuleSetMealLevelPriceClient();
            foreach (SystemModuleSetMeal item in list)
            {
                SystemModuleSetMealLevelPrice levelPriceInfo = levelBll.InfoByLevel(item.id, __PlanAgent.LevelId == null?0:((int)__PlanAgent.LevelId));
                if (levelPriceInfo != null)
                {
                    item.Price = levelPriceInfo.Price;
                }
            }
            Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient           setMealDetialBll = new Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient();
            Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient logBll           = new Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient();
            __logList = logBll.ListByCompany(LoginCompanyId);
            foreach (SystemModuleSetMeal item in list)
            {
                item.ModuleList = setMealDetialBll.List(item.id);
                SystemModuleSetMealValidityLog[] currentLog = __logList.Where(m => m.SetMealId == item.id).ToArray();
                if (currentLog.Length > 0)                                                            //已购买
                {
                    if (currentLog.Where(m => m.ValidityDateEnd > DateTime.Now).ToArray().Length > 0) //未过期
                    {
                        item.OverDate     = currentLog.Where(m => m.ValidityDateEnd > DateTime.Now).OrderByDescending(m => m.ValidityDateEnd).ToArray()[0].ValidityDateEnd;
                        item.CompanyState = 0;
                    }
                    else    //已过期
                    {
                        item.OverDate     = currentLog.OrderByDescending(m => m.ValidityDateEnd).ToArray()[0].ValidityDateEnd;
                        item.CompanyState = 1;
                    }
                }
                else
                {
                    item.CompanyState = -1;
                }
            }
            levelBll.Abort();
            levelBll.Close();
            Pager = InitPageView(page, record);
            bll.Abort();
            bll.Close();
            break;
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SortedDictionary <string, string> sPara = GetRequestGet();
        string types = "1", sn = "";

        if (sPara.Count > 0)//判断是否有带返回参数
        {
            //BLL.Recharge bll = new BLL.Recharge();
            //BLL.Users userBll = new BLL.Users();
            string order_no = Request.QueryString["out_trade_no"];          //获取订单号

            //Model.Recharge info = bll.GetModel("Sn='" + order_no + "'");
            //if (info != null)
            //{
            //    RechType = info.RechType;//用来区分的
            //    types = (RechType == 0 ? "1" : "2");
            //    sn = info.Sn;
            //}
            Notify aliNotify = new Notify(types);
            Service_PlanAgentOrder.PlanAgentOrderClient bll = new Service_PlanAgentOrder.PlanAgentOrderClient();
            __OrderInfo = bll.Info(0, order_no);
            bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);
            Service_SystemModuleSetMeal.SystemModuleSetMealClient             setMealBLL       = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
            Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient setMealDetailBll = new Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient();
            __SetMealList = setMealBLL.ListByIds(__OrderInfo.RelationId);
            foreach (SystemModuleSetMeal item in __SetMealList)
            {
                V_SystemModuleSetMealDetail[] moduleList = setMealDetailBll.List(item.id);
                foreach (V_SystemModuleSetMealDetail moduleItem in moduleList)
                {
                    moduleItem.Day = item.Day;
                    if (__ModuleList.Where(m => m.SystemModuleId == moduleItem.SystemModuleId).ToArray().Length > 0)
                    {
                        __ModuleList.Where(m => m.SystemModuleId == moduleItem.SystemModuleId).ToArray()[0].Day += moduleItem.Day;
                    }
                    else
                    {
                        __ModuleList.Add(moduleItem);
                    }
                }
                __SetMealNames += item.Name + ",";
            }

            if (verifyResult && __OrderInfo.State == 0)//验证成功
            {
                if (__OrderInfo.Type == 1)
                {
                    string[] setMealIdArr = __OrderInfo.RelationId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    Service_Message.MessageClient msgBll = new Service_Message.MessageClient();
                    Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient logBll = new Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient();
                    foreach (string idItem in setMealIdArr)
                    {
                        string moduleIds = "", moduleNames = "";
                        SystemModuleSetMeal                       setMealInfo = setMealBLL.Info(Convert.ToInt32(idItem));
                        V_SystemModuleSetMealDetail[]             detailList = setMealDetailBll.List(setMealInfo.id);
                        Service_CompanyModule.CompanyModuleClient companyModuleBll = new Service_CompanyModule.CompanyModuleClient();
                        foreach (V_SystemModuleSetMealDetail item in detailList)
                        {
                            CompanyModule moduleInfo = companyModuleBll.InfoByModule(__OrderInfo.CompanyId, item.SystemModuleId);
                            moduleNames += Enum.GetName(typeof(ModuleType), item.SystemModuleId) + ",";
                            moduleIds   += moduleInfo.id + ",";
                            if (moduleInfo == null)
                            {
                                moduleInfo = new CompanyModule()
                                {
                                    CompanyId         = __OrderInfo.CompanyId,
                                    ModuleId          = item.SystemModuleId,
                                    ValidityDateStart = DateTime.Now,
                                    ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day)
                                };
                            }
                            else
                            {
                                if (moduleInfo.ValidityDateEnd.CompareTo(DateTime.Now) == -1)//已过期
                                {
                                    moduleInfo.ValidityDateStart = DateTime.Now;
                                    moduleInfo.ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day);
                                }
                                else
                                {
                                    if (moduleInfo.ValidityDateEnd.CompareTo(DateTime.Now.AddDays(setMealInfo.Day)) == -1)
                                    {
                                        moduleInfo.ValidityDateEnd = DateTime.Now.AddDays(setMealInfo.Day);
                                    }
                                }
                            }
                            companyModuleBll.Edit(moduleInfo);
                        }
                        logBll.Add(new SystemModuleSetMealValidityLog()
                        {
                            CompanyId         = __OrderInfo.CompanyId,
                            ModuleIds         = moduleIds,
                            OrderId           = __OrderInfo.id,
                            ModuleNames       = moduleNames,
                            SetMealName       = setMealInfo.Name,
                            SetMealId         = setMealInfo.id,
                            ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day),
                            ValidityDateStart = DateTime.Now
                        });
                        msgBll.AddSystemMessage(LoginUserId, "套餐购买", string.Format("成功购买{0}套餐", __SetMealNames.TrimEnd(',')));
                    }
                    logBll.Abort();
                    logBll.Close();
                }
                bll.UpdateState(__OrderInfo.Sn, 1);
            }
            setMealBLL.Abort();
            setMealBLL.Close();
        }
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SortedDictionary <string, string> sPara = GetRequestPost();
        int    RechType = 0;
        string types = "1", sn = "";

        if (sPara.Count > 0)                                           //判断是否有带返回参数
        {
            string order_no = Request.Form["out_trade_no"].ToString(); //获取订单号


            Notify aliNotify    = new Notify(types);
            bool   verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]);


            if (verifyResult)//验证成功
            {
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //请在这里加上商户的业务逻辑程序代码

                //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
                string trade_no = Request.Form["trade_no"];         //支付宝交易号
                if (string.IsNullOrEmpty(trade_no))
                {
                    HttpContext.Current.Response.Write("参数错误");
                    HttpContext.Current.Response.End();
                }
                string total_fee    = Request.Form["total_fee"];    //获取总金额
                string subject      = Request.Form["subject"];      //商品名称、订单名称
                string body         = Request.Form["body"];         //商品描述、订单备注、描述
                string buyer_email  = Request.Form["buyer_email"];  //买家支付宝账号
                string trade_status = Request.Form["trade_status"]; //交易状态
                Service_PlanAgentOrder.PlanAgentOrderClient bll = new Service_PlanAgentOrder.PlanAgentOrderClient();
                PlanAgentOrder orderInfo = bll.Info(0, order_no);
                if (orderInfo.State == 0)
                {
                    if (orderInfo.Type == 1)
                    {
                        Service_SystemModuleSetMeal.SystemModuleSetMealClient setMealBLl = new Service_SystemModuleSetMeal.SystemModuleSetMealClient();
                        string[] setMealIdArr = orderInfo.RelationId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient logBll = new Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient();
                        foreach (string idItem in setMealIdArr)
                        {
                            SystemModuleSetMeal setMealInfo = setMealBLl.Info(Convert.ToInt32(idItem));
                            string moduleIds = "", moduleNames = "";
                            Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient setMealDetailBll = new Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient();
                            V_SystemModuleSetMealDetail[]             detailList = setMealDetailBll.List(setMealInfo.id);
                            Service_CompanyModule.CompanyModuleClient companyModuleBll = new Service_CompanyModule.CompanyModuleClient();
                            foreach (V_SystemModuleSetMealDetail item in detailList)
                            {
                                moduleIds   += item.SystemModuleId + ",";
                                moduleNames += Enum.GetName(typeof(ModuleType), item.SystemModuleId) + ",";
                                CompanyModule moduleInfo = companyModuleBll.InfoByModule(orderInfo.CompanyId, item.SystemModuleId);
                                if (moduleInfo == null)
                                {
                                    moduleInfo = new CompanyModule()
                                    {
                                        CompanyId         = orderInfo.CompanyId,
                                        ModuleId          = item.SystemModuleId,
                                        ValidityDateStart = DateTime.Now,
                                        ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day)
                                    };
                                }
                                else
                                {
                                    if (moduleInfo.ValidityDateEnd.CompareTo(DateTime.Now) == -1)//已过期
                                    {
                                        moduleInfo.ValidityDateStart = DateTime.Now;
                                        moduleInfo.ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day);
                                    }
                                    else
                                    {
                                        if (moduleInfo.ValidityDateEnd.CompareTo(DateTime.Now.AddDays(setMealInfo.Day)) == -1)
                                        {
                                            moduleInfo.ValidityDateEnd = DateTime.Now.AddDays(setMealInfo.Day);
                                        }
                                    }
                                }
                                companyModuleBll.Edit(moduleInfo);
                            }
                            logBll.Add(new SystemModuleSetMealValidityLog()
                            {
                                CompanyId         = orderInfo.CompanyId,
                                ModuleIds         = moduleIds,
                                ModuleNames       = moduleNames,
                                SetMealName       = setMealInfo.Name,
                                OrderId           = orderInfo.id,
                                SetMealId         = setMealInfo.id,
                                ValidityDateEnd   = DateTime.Now.AddDays(setMealInfo.Day),
                                ValidityDateStart = DateTime.Now
                            });
                        }
                        logBll.Abort();
                        logBll.Close();
                        setMealBLl.Abort();
                        setMealBLl.Close();
                    }
                    bll.UpdateState(order_no, 1);
                    bll.Abort();
                    bll.Close();
                }

                Response.Write("success");  //请不要修改或删除

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
            }
            else//验证失败
            {
                Response.Write("fail");
            }
        }
        else
        {
            Response.Write("无通知参数");
        }
        //context.Response.Write("Hello World");
    }