Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comid_temp = Request["comid"].ConvertTo <int>(0);

            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company = companyinfo.Com_name;
            }



            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();

                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                }
            }
        }
Esempio n. 2
0
        public string contact_phone      = ""; //联系人电话
        protected void Page_Load(object sender, EventArgs e)
        {
            comid_temp = Request["comid"].ConvertTo <int>(0);
            projectid  = Request["projectid"].ConvertTo <int>(0);

            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company       = companyinfo.Com_name;
                contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel;
            }

            if (projectid != 0)
            {
                B2b_com_projectData projectdata = new B2b_com_projectData();
                var projectinfo = projectdata.GetProject(projectid, comid_temp);
                if (projectinfo != null)
                {
                    projectname = projectinfo.Projectname + ": ";
                }
            }

            // ishaslvyoubusproorder = new B2bOrderData().IsHasLvyoubusProOrder(comid_temp, (int)ProductServer_Type.LvyouBus);



            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();



                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
        public string contact_phone      = ""; //联系人电话
        protected void Page_Load(object sender, EventArgs e)
        {
            DateTime gooutdate = Request["gooutdate"].ConvertTo <DateTime>(DateTime.Now);

            nowdate   = gooutdate.ToString("yyyy-MM-dd");
            monthdate = DateTime.Parse(nowdate).AddDays(6).ToString("yyyy-MM-dd");

            servertype = (int)ProductServer_Type.LvyouBus;

            comid_temp = Request["comid"].ConvertTo <int>(0);
            if (comid_temp == 0)
            {
                Response.Redirect("/Agent/Default.aspx");
            }
            ishaslvyoubusproorder = new B2bOrderData().IsHasLvyoubusProOrder(comid_temp, (int)ProductServer_Type.LvyouBus);

            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company       = companyinfo.Com_name;
                contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel;
            }
            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();
                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
Esempio n. 4
0
        public string contact_phone      = ""; //联系人电话
        protected void Page_Load(object sender, EventArgs e)
        {
            comid_temp = Request["comid"].ConvertTo <int>(0);

            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company       = companyinfo.Com_name;
                contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel;
            }



            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();

                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
Esempio n. 5
0
        //str4=电话,str7=预订热线

        protected void Page_Load(object sender, EventArgs e)
        {
            id = Request["orderid"].ConvertTo <int>(0);

            B2bOrderData orderdata = new B2bOrderData();
            var          orderinfo = orderdata.GetOrderById(id);

            if (orderinfo == null)
            {
                Response.Redirect("Order.aspx");//未查询到订单
                return;
            }
            //订单数量
            ordernum = orderinfo.U_num;
            subtime  = orderinfo.U_subdate;

            B2bEticketData eticketdata = new B2bEticketData();

            //已打印数量
            printnum   = eticketdata.AlreadyPrintNumbyOrderid(id);
            unprintnum = ordernum - printnum;


            B2bComProData prodate = new B2bComProData();
            var           proinfo = prodate.GetProById(orderinfo.Pro_id.ToString());

            if (proinfo != null)
            {
                comid_temp = proinfo.Com_id;
                proname    = proinfo.Pro_name;
                Face_price = proinfo.Face_price;
                pro_end    = proinfo.Pro_end.ToString("yyyy年MM月dd日");
                pro_start  = proinfo.Pro_start.ToString("yyyy年MM月dd日");
                Pro_Remark = "备注: " + proinfo.pro_note;

                B2b_com_projectData projectdate = new B2b_com_projectData();
                var projectinfo = projectdate.GetProject(proinfo.Projectid, proinfo.Com_id);
                if (projectinfo != null)
                {
                    address = "地址:" + projectinfo.Address;
                    mobile  = projectinfo.Mobile;
                    //proname = projectinfo.Projectname + proname;//不增加项目信息
                }

                if (orderinfo.Agentid != 0)
                {
                    var agentinfo = AgentCompanyData.GetAgentByid(orderinfo.Agentid);
                    if (agentinfo != null)
                    {
                        mobile       = agentinfo.Mobile;//读取分销电话
                        agentcompany = agentinfo.Company;
                    }
                }
            }
            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company = companyinfo.Com_name;
            }

            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();

                if (Agentid != orderinfo.Agentid)
                {
                    //订单与分销不匹配
                    Response.Redirect("order.aspx");
                }


                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
Esempio n. 6
0
        public int issetidcard = 0; //是否需要填写身份证
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Request["id"].ConvertTo <int>(0);
            B2bComProData prodate = new B2bComProData();
            var           proinfo = prodate.GetProById(id.ToString());

            if (proinfo != null)
            {
                comid_temp   = proinfo.Com_id;
                pickuppoint  = proinfo.pickuppoint;
                dropoffpoint = proinfo.dropoffpoint;
                Server_type  = proinfo.Server_type;
                manyspeci    = proinfo.Manyspeci;
                face_price   = proinfo.Face_price;
                price        = proinfo.Advise_price;
                issetidcard  = proinfo.issetidcard;
                //如果多规格读取规格
                if (manyspeci == 1)
                {
                    gglist = new B2b_com_pro_SpeciData().Getgglist(proinfo.Id);
                }


                //作废超时未支付订单,完成回滚操作
                int rs = new B2bComProData().CancelOvertimeOrder(proinfo);
                if (proinfo.Source_type == 4)
                {
                    iscanbook = 1;
                }
                else
                {
                    iscanbook = new B2bComProData().IsYouxiao(proinfo.Id, proinfo.Server_type, proinfo.Pro_start, proinfo.Pro_end, proinfo.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                }
            }
            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company       = companyinfo.Com_name;
                contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel;
            }

            B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid_temp.ToString());

            if (pro != null)
            {
                if (pro.Smalllogo != null && pro.Smalllogo != "")
                {
                    comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                }
            }


            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();

                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                    Agentlevel = agenginfo.Warrant_level;;

                    //if (proinfo != null)
                    //{
                    //    if (Agentlevel == 1)
                    //    {
                    //        hotel_agent = proinfo.Agent1_price;
                    //    }
                    //    if (Agentlevel == 2)
                    //    {
                    //        hotel_agent = proinfo.Agent2_price;
                    //    }
                    //    if (Agentlevel == 3)
                    //    {
                    //        hotel_agent = proinfo.Agent3_price;
                    //    }
                    //}


                    //重新给分销按 级别默认标注,
                    if (gglist != null)
                    {
                        price      = 0;
                        face_price = 0;
                        for (int i = 0; i < gglist.Count(); i++)
                        {
                            if (Server_type == 9)//订房
                            {
                                if (Agentlevel == 1)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                }
                                if (Agentlevel == 2)
                                {
                                }
                                if (Agentlevel == 3)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                }

                                if (price == 0 || price > gglist[i].speci_advise_price)
                                {
                                    price      = gglist[i].speci_advise_price;
                                    face_price = gglist[i].speci_face_price;
                                }
                            }
                            else if (Server_type == 10)//大巴
                            {
                                if (Agentlevel == 1)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                }
                                if (Agentlevel == 2)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                }
                                if (Agentlevel == 3)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                }

                                if (price == 0 || price > gglist[i].speci_advise_price)
                                {
                                    price      = gglist[i].speci_advise_price;
                                    face_price = gglist[i].speci_face_price;
                                }
                            }
                            else
                            {
                                if (Agentlevel == 1)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                }
                                if (Agentlevel == 2)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                }
                                if (Agentlevel == 3)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                }

                                if (price == 0 || price > gglist[i].speci_advise_price)
                                {
                                    price      = gglist[i].speci_advise_price;
                                    face_price = gglist[i].speci_face_price;
                                }
                            }
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
Esempio n. 7
0
        internal int EditB2b_com_pro_Speci(B2b_com_pro_Speci m)
        {
            string sql = "select  id  from b2b_com_pro_Speci where proid=" + m.proid + " and speci_type_nameid_Array='" + m.speci_type_nameid_Array + "'";
            var    cmd = sqlHelper.PrepareTextSqlCommand(sql);
            var    id  = 0;

            using (var reader = cmd.ExecuteReader())
            {
                if (reader.Read())
                {
                    id = reader.GetValue <int>("id");
                }
            }


            #region 编辑
            if (id > 0)
            {
                string sql1 = "update b2b_com_pro_Speci set speci_name='" + m.speci_name + "',speci_face_price='" + m.speci_face_price + "',speci_advise_price='" + m.speci_advise_price + "',speci_agent1_price='" + m.speci_agent1_price + "',speci_agent2_price='" + m.speci_agent2_price + "',speci_agent3_price='" + m.speci_agent3_price + "',speci_agentsettle_price='" + m.speci_agentsettle_price + "',speci_pro_weight='" + m.speci_pro_weight + "',speci_totalnum='" + m.speci_totalnum + "',speci_type_nameid_Array='" + m.speci_type_nameid_Array + "' where id=" + id;
                var    cmd1 = sqlHelper.PrepareTextSqlCommand(sql1);
                cmd1.ExecuteNonQuery();


                #region  步修改导入产品规格的成本价:获得导入产品id 和 导入产品规格的成本价
                IList <B2b_com_pro> drprolist = new List <B2b_com_pro>();//导入产品列表
                string s1 = "select id,com_id from b2b_com_pro where bindingid=" + m.proid;
                var    c1 = sqlHelper.PrepareTextSqlCommand(s1);
                using (var reader = c1.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        drprolist.Add(new B2b_com_pro
                        {
                            Id     = reader.GetValue <int>("id"),
                            Com_id = reader.GetValue <int>("com_id")
                        });
                    }
                }
                if (drprolist != null)
                {
                    if (drprolist.Count > 0)
                    {
                        foreach (B2b_com_pro drpro in drprolist)
                        {
                            if (drpro != null)
                            {
                                #region 获得导入产品成本价
                                int drbinding_Agentid      = 0; //导入产品公司的绑定分销
                                int drbinding_Warrant_type = 0; //导入产品公司的绑定分销的分销类型(验证扣款;出票扣款)
                                int drbinding_Agentlevel   = 3; //导入产品公司的绑定分销 在原始公司下的分销级别

                                var comdata = B2bCompanyData.GetCompany(drpro.Com_id);
                                if (comdata != null)
                                {
                                    drbinding_Agentid = comdata.Bindingagent;
                                }

                                var agentmodel = AgentCompanyData.GetAgentWarrant(drbinding_Agentid, m.comid);
                                if (agentmodel != null)
                                {
                                    drbinding_Agentlevel   = agentmodel.Warrant_level;
                                    drbinding_Warrant_type = agentmodel.Warrant_type;
                                }

                                decimal aprice = 0;
                                if (drbinding_Agentlevel == 1)
                                {
                                    aprice = m.speci_agent1_price;
                                }
                                else if (drbinding_Agentlevel == 2)
                                {
                                    aprice = m.speci_agent2_price;
                                }
                                else if (drbinding_Agentlevel == 3)
                                {
                                    aprice = m.speci_agent3_price;
                                }
                                //修改绑定规格的成本价格
                                string s2 = "update b2b_com_pro_Speci set speci_agentsettle_price='" + aprice + "' where proid=" + drpro.Id + " and binding_id=" + id;
                                var    c2 = sqlHelper.PrepareTextSqlCommand(s2);
                                c2.ExecuteNonQuery();
                                #endregion
                            }
                        }
                    }
                }
                #endregion


                #region 库存变化日志
                try
                {
                    B2b_com_pro_kucunlog kucunlog = new B2b_com_pro_kucunlog
                    {
                        id         = 0,
                        orderid    = 0,
                        proid      = m.proid,
                        servertype = new B2bComProData().GetServertypeByProid(m.proid),
                        daydate    = DateTime.Parse("1970-01-01"),
                        proSpeciId = id,
                        surplusnum = m.speci_totalnum,
                        operor     = "",
                        opertime   = DateTime.Now,
                        opertype   = "编辑规格",
                        oper       = "多规格"
                    };
                    new B2b_com_pro_kucunlogData().Editkucunlog(kucunlog);
                }
                catch { }
                #endregion


                return(id);
            }
            #endregion
            #region 添加
            else
            {
                string sql2       = "INSERT INTO  [b2b_com_pro_Speci] (speci_name,speci_face_price,speci_advise_price,speci_agent1_price,speci_agent2_price,speci_agent3_price,speci_agentsettle_price,speci_pro_weight,speci_totalnum,comid,proid,speci_type_nameid_Array)  VALUES  ('" + m.speci_name + "','" + m.speci_face_price + "','" + m.speci_advise_price + "','" + m.speci_agent1_price + "','" + m.speci_agent2_price + "','" + m.speci_agent3_price + "','" + m.speci_agentsettle_price + "','" + m.speci_pro_weight + "','" + m.speci_totalnum + "','" + m.comid + "','" + m.proid + "','" + m.speci_type_nameid_Array + "');select @@identity;";
                var    cmd2       = sqlHelper.PrepareTextSqlCommand(sql2);
                object o          = cmd2.ExecuteScalar();
                int    newspeciid = int.Parse(o.ToString());

                #region  步修改导入产品规格的成本价:获得导入产品id 和 导入产品规格的成本价
                IList <B2b_com_pro> drprolist = new List <B2b_com_pro>();//导入产品列表
                string s1 = "select id,com_id from b2b_com_pro where bindingid=" + m.proid;
                var    c1 = sqlHelper.PrepareTextSqlCommand(s1);
                using (var reader = c1.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        drprolist.Add(new B2b_com_pro
                        {
                            Id     = reader.GetValue <int>("id"),
                            Com_id = reader.GetValue <int>("com_id")
                        });
                    }
                }
                if (drprolist != null)
                {
                    if (drprolist.Count > 0)
                    {
                        foreach (B2b_com_pro drpro in drprolist)
                        {
                            if (drpro != null)
                            {
                                #region 获得导入产品成本价
                                int drbinding_Agentid      = 0; //导入产品公司的绑定分销
                                int drbinding_Warrant_type = 0; //导入产品公司的绑定分销的分销类型(验证扣款;出票扣款)
                                int drbinding_Agentlevel   = 3; //导入产品公司的绑定分销 在原始公司下的分销级别

                                var comdata = B2bCompanyData.GetCompany(drpro.Com_id);
                                if (comdata != null)
                                {
                                    drbinding_Agentid = comdata.Bindingagent;
                                }

                                var agentmodel = AgentCompanyData.GetAgentWarrant(drbinding_Agentid, m.comid);
                                if (agentmodel != null)
                                {
                                    drbinding_Agentlevel   = agentmodel.Warrant_level;
                                    drbinding_Warrant_type = agentmodel.Warrant_type;
                                }

                                decimal aprice = 0;
                                if (drbinding_Agentlevel == 1)
                                {
                                    aprice = m.speci_agent1_price;
                                }
                                else if (drbinding_Agentlevel == 2)
                                {
                                    aprice = m.speci_agent2_price;
                                }
                                else if (drbinding_Agentlevel == 3)
                                {
                                    aprice = m.speci_agent3_price;
                                }
                                //修改绑定规格的成本价格
                                string sqlTxt = @"insert into b2b_com_pro_Speci (comid,speci_name,speci_face_price,speci_advise_price,speci_agentsettle_price,speci_pro_weight,speci_totalnum,proid,speci_type_nameid_array,binding_id)
select " + drpro.Com_id + ",speci_name,speci_face_price,speci_advise_price," + aprice + ",speci_pro_weight,speci_totalnum," + drpro.Id + ",speci_type_nameid_array,id  from b2b_com_pro_Speci where id=" + newspeciid + "";
                                var    c2     = sqlHelper.PrepareTextSqlCommand(sqlTxt);
                                c2.ExecuteNonQuery();

                                #endregion
                            }
                        }
                    }
                }
                #endregion

                #region 库存变化日志
                try
                {
                    B2b_com_pro_kucunlog kucunlog = new B2b_com_pro_kucunlog
                    {
                        id         = 0,
                        orderid    = 0,
                        proid      = m.proid,
                        servertype = new B2bComProData().GetServertypeByProid(m.proid),
                        daydate    = DateTime.Parse("1970-01-01"),
                        proSpeciId = newspeciid,
                        surplusnum = m.speci_totalnum,
                        operor     = "",
                        opertime   = DateTime.Now,
                        opertype   = "新加规格",
                        oper       = "多规格"
                    };
                    new B2b_com_pro_kucunlogData().Editkucunlog(kucunlog);
                }
                catch { }
                #endregion

                return(newspeciid);
            }
            #endregion
        }
Esempio n. 8
0
        public int Agentlevel = 0;     //分销级别
        protected void Page_Load(object sender, EventArgs e)
        {
            unum   = Request["unum"].ConvertTo <int>(1);
            addrid = Request["addrid"].ConvertTo <int>(0);
            id     = Request["id"].ConvertTo <int>(0);
            B2bComProData prodate = new B2bComProData();
            var           pro     = prodate.GetProById(id.ToString());

            if (pro != null)
            {
                servertype   = pro.Server_type;
                comid_temp   = pro.Com_id;
                pickuppoint  = pro.pickuppoint;
                dropoffpoint = pro.dropoffpoint;
                price        = pro.Advise_price;
                face_price   = pro.Face_price;
                manyspeci    = pro.Manyspeci;
                issetidcard  = pro.issetidcard;
                //如果多规格读取规格
                if (manyspeci == 1)
                {
                    gglist = new B2b_com_pro_SpeciData().Getgglist(pro.Id);
                }


                if (Session["Agentid"] != null)
                {
                    //账户信息
                    Agentid = Int32.Parse(Session["Agentid"].ToString());
                    Account = Session["Account"].ToString();
                    var           Warrant_type_str = "";
                    Agent_company agenginfo        = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                    if (agenginfo != null)
                    {
                        var yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                        var Warrant_type = agenginfo.Warrant_type;
                        if (Warrant_type == 1)
                        {
                            Warrant_type_str = "销售扣款";
                        }
                        if (Warrant_type == 2)
                        {
                            Warrant_type_str = "验证扣款";
                        }
                        Agentlevel = agenginfo.Warrant_level;;
                        //if (pro != null)
                        //{
                        //    if (Agentlevel == 1)
                        //    {
                        //        hotel_agent = pro.Agent1_price;
                        //    }
                        //    if (Agentlevel == 2)
                        //    {
                        //        hotel_agent = pro.Agent2_price;
                        //    }
                        //    if (Agentlevel == 3)
                        //    {
                        //        hotel_agent = pro.Agent3_price;
                        //    }
                        //}

                        //重新给分销按 级别默认标注,
                        if (gglist != null)
                        {
                            for (int i = 0; i < gglist.Count(); i++)
                            {
                                if (servertype == 9)//订房
                                {
                                    if (Agentlevel == 1)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                    }
                                    if (Agentlevel == 2)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                    }
                                    if (Agentlevel == 3)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                    }

                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                                else if (servertype == 10)//大巴
                                {
                                    if (Agentlevel == 1)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                    }
                                    if (Agentlevel == 2)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                    }
                                    if (Agentlevel == 3)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                    }

                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                                else
                                {
                                    if (Agentlevel == 1)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                    }
                                    if (Agentlevel == 2)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                    }
                                    if (Agentlevel == 3)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                    }

                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("/Agent/Default.aspx");
                    }
                }



                ////如果含有规格读取规格价格中最低价
                //if (manyspeci == 1)
                //{
                //    if (gglist != null)
                //    {
                //        price = 0;
                //        face_price = 0;
                //        for (int i = 0; i < gglist.Count(); i++)
                //        {

                //            if (price == 0 || price > gglist[i].speci_advise_price)
                //            {
                //                price = gglist[i].speci_advise_price;
                //                face_price = gglist[i].speci_face_price;
                //            }
                //        }
                //    }
                //}

                //作废超时未支付订单,完成回滚操作
                int rs = new B2bComProData().CancelOvertimeOrder(pro);
                if (pro.Source_type == 4)
                {
                    iscanbook = 1;
                }
                else
                {
                    iscanbook = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                }
            }
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cartid = Request["cartid"].ConvertTo <string>("");


            //去除最右侧,号
            if (cartid != "")
            {
                if (cartid.Substring(cartid.Length - 1, 1) == ",")
                {
                    cartid = cartid.Substring(0, cartid.Length - 1);
                }
            }

            var cartid_arr = cartid.Split(',');

            //如果包含规格产品
            var prospeciid = new B2bOrderData().SearchCartListBycartid(cartid);

            if (prospeciid != null)
            {
                for (int i = 0; i < prospeciid.Count; i++)
                {
                    id         += prospeciid[i].Id + ",";
                    id_speciid += prospeciid[i].Speciid + ",";

                    temp_id         = prospeciid[i].Id.ToString();
                    temp_id_speciid = prospeciid[i].Speciid.ToString();

                    num += prospeciid[i].U_num + ",";
                }
            }

            if (num != "")
            {
                if (num.Substring(num.Length - 1, 1) == ",")
                {
                    num = num.Substring(0, num.Length - 1);
                }
            }
            if (id != "")
            {
                if (id.Substring(id.Length - 1, 1) == ",")
                {
                    id = id.Substring(0, id.Length - 1);
                }
            }
            if (id_speciid != "")
            {
                if (id_speciid.Substring(id_speciid.Length - 1, 1) == ",")
                {
                    id_speciid = id_speciid.Substring(0, id_speciid.Length - 1);
                }
            }


            B2bComProData prodate = new B2bComProData();
            var           proinfo = prodate.GetProById(temp_id);

            if (proinfo != null)
            {
                comid_temp   = proinfo.Com_id;
                pickuppoint  = proinfo.pickuppoint;
                dropoffpoint = proinfo.dropoffpoint;

                //作废超时未支付订单,完成回滚操作
                int rs = new B2bComProData().CancelOvertimeOrder(proinfo);
            }



            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company = companyinfo.Com_name;
            }



            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();

                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
Esempio n. 10
0
      public string Getordercreate(Lvmama_reqlog mlog, Agent_company agentinfo)
      {
          lock (lockobj)
          {
              var response = new apply_codeRefund();
              try
              {
                  var data = JsonConvert.DeserializeObject <apply_codemodel>(_requestParam);
                  if (data.contacts == null)
                  {
                      response.uid    = agentinfo.Lvmama_uid;
                      response.status = "2";
                      response.msg    = "数据解析失败";
                      return(EditLvmamalog_Order(response, mlog));
                  }
                  else
                  {
                      contacts body = data.contacts;

                      string num             = data.num;
                      string timestamp       = data.timestamp;
                      string visitTime       = data.visitTime;
                      string supplierGoodsId = data.supplierGoodsId;
                      string settlePrice     = data.settlePrice;
                      string serialNo        = data.serialNo;
                      string idNum           = body.idNum;
                      string name            = body.name;
                      string mobile          = body.mobile;
                      string idType          = body.idType;

                      //结算价核对
                      decimal jiesuanjia = 0;

                      ////todo 根据请求参数查询产品返回结果
                      B2b_com_pro pro = new B2bComProData().GetProById(supplierGoodsId);
                      #region 产品信息
                      if (pro != null)
                      {
                          #region 分销授权信息判断
                          Agent_company agentwarrantinfo = AgentCompanyData.GetAgentWarrant(agentinfo.Id, pro.Com_id);

                          if (agentwarrantinfo != null)
                          {
                              int warrantid     = agentwarrantinfo.Warrantid;
                              int Warrant_type  = agentwarrantinfo.Warrant_type; //支付类型分销 1出票扣款 2验码扣款
                              int Warrant_level = agentwarrantinfo.Warrant_level;

                              if (Warrant_level == 1)
                              {
                                  jiesuanjia = pro.Agent1_price;
                              }
                              if (Warrant_level == 2)
                              {
                                  jiesuanjia = pro.Agent2_price;
                              }

                              if (Warrant_level == 3)
                              {
                                  jiesuanjia = pro.Agent3_price;
                              }



                              if (agentwarrantinfo.Warrant_state == 0)
                              {
                                  response.uid     = agentinfo.Lvmama_uid;
                                  response.orderId = "0";
                                  response.status  = "3";
                                  response.msg     = "商户关闭授权";
                                  return(EditLvmamalog_Order(response, mlog));
                              }
                          }
                          else
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "商户未授权开通分销";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region 暂时对外接口只支持票务产品
                          //if (pro.Server_type != 1)
                          //{
                          //    response.status = 300;
                          //    response.msg = "暂时对外接口只支持票务产品,其他产品请到分销后台提单";
                          //    return EditLvmamalog_Order(response, mlog);
                          //}
                          #endregion

                          #region 结算价,保证价格是最新价格
                          decimal advice_price = Convert.ToDecimal(settlePrice);
                          if (jiesuanjia != advice_price)
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "结算价格不同,请联系供应商要去新的价格。驴妈妈价:" + advice_price + " 系统价:" + jiesuanjia;
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion



                          #region 产品编码格式有误
                          if (supplierGoodsId.ConvertTo <int>(0) == 0)
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "产品编码格式有误";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region  购买数量格式有误
                          if (num.ConvertTo <int>(0) == 0)
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "购买数量格式有误";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region  产品限购则需要判断 限购数量 是否足够
                          if (pro.Ispanicbuy != 0)
                          {
                              //最多可购买数量
                              int zuiduo_canbuynum = pro.Limitbuytotalnum;
                              if (int.Parse(num) > zuiduo_canbuynum)
                              {
                                  response.uid     = agentinfo.Lvmama_uid;
                                  response.orderId = "0";
                                  response.status  = "3";
                                  response.msg     = "产品库存不足";
                                  return(EditLvmamalog_Order(response, mlog));
                              }
                          }
                          #endregion

                          #region 产品已暂停
                          if (pro.Pro_state == 0)
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "产品已下线,请联系商家";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region 产品已过期
                          if (pro.Pro_end < DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")))
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "产品已过期";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region   产品是否需要预约:需要预约则最晚预约时间是 游玩前一天的18点
                          //if (pro.isneedbespeak == 1)
                          //{
                          //    if (timestamp != "")
                          //    {
                          //        DateTime visitdate = DateTime.Parse(timestamp);
                          //        DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));

                          //        //必须提前一天预约
                          //        if (bookdate >= visitdate)
                          //        {
                          //             response.orderId = "0";
                          //response.status = "300";
                          //response.msg = "产品未预约产品";
                          //            return EditLvmamalog_Order(response, mlog);
                          //        }
                          //    }
                          //}
                          #endregion

                          #region  是否有使用限制
                          //if (pro.Iscanuseonsameday == 0)//1:当天出票可用 ;2:2小时内出票不可用;0:当天出票不可用
                          //{
                          //    if (body.travelDate != "")
                          //    {
                          //        DateTime visitdate = DateTime.Parse(body.travelDate);//游玩日期:2012-12-12 格式要求:yyyy-MM-dd

                          //        DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                          //        if (bookdate >= visitdate)
                          //        {
                          //            response.code = 300;
                          //            response.describe = "预定日期至少在游玩日期之前一天";
                          //            return EditMTlog_Order(response, mlog);
                          //        }
                          //    }

                          //}
                          #endregion



                          Lvmama_reqlog mtOrderCrateSucLog = new lvmama_reqlogData().GetLvmamaOrderCreateLogByLvmamaorder(serialNo, "0");
                          #region 查询驴妈妈吗 是否 创建订单日志
                          if (mtOrderCrateSucLog != null)
                          {
                              string pno = "";
                              if (pro.Source_type == 3)  //如果是接口产品,按接口方式读码selservice,接口产品只读取了wl的码
                              {
                                  if (pro.Serviceid == 4)
                                  {   //如果是接口产品
                                      B2b_company commanage = B2bCompanyData.GetAllComMsg(pro.Com_id);
                                      WlGetProInfoDealRequestData wldata = new WlGetProInfoDealRequestData(commanage.B2bcompanyinfo.wl_PartnerId, commanage.B2bcompanyinfo.wl_userkey);
                                      var wlorderinfo = wldata.SearchWlOrderData(pro.Com_id, 0, "", int.Parse(mtOrderCrateSucLog.ordernum));
                                      if (wlorderinfo != null)
                                      {
                                          pno = wlorderinfo.vouchers;
                                      }
                                  }
                              }
                              else
                              {  //如果不是借口,则按自己规则读码
                                  SendEticketData sendate = new SendEticketData();
                                  pno = sendate.HuoQuEticketPno(int.Parse(mtOrderCrateSucLog.ordernum));
                              }

                              response.uid      = agentinfo.Lvmama_uid;
                              response.orderId  = mtOrderCrateSucLog.ordernum;
                              response.status   = "0";
                              response.authCode = pno;
                              response.serialNo = serialNo;
                              response.msg      = "订单创建成功";
                              mlog.ordernum     = mtOrderCrateSucLog.ordernum;
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion
                          #region 此驴妈妈订单号 ,没有成功创建过
                          else
                          {
                              int    isInterfaceSub = 1;   //是否是电子票接口提交的订单:0.否;1.是
                              string ordertype      = "1"; //1.出票2.充值
                              int    orderid        = 0;
                              int    speciid        = 0;
                              //string real_name = "";
                              //string mobile = "";

                              string use_date = timestamp.Substring(0, 4) + "-" + timestamp.Substring(4, 2) + "-" + timestamp.Substring(6, 2);

                              //real_name = name;
                              //mobile = mobile;

                              //创建一笔未支付订单
                              string      rdata   = OrderJsonData.AgentOrder(agentinfo.Id, supplierGoodsId, ordertype, num, name, mobile, use_date, "", isInterfaceSub, out orderid);
                              XmlDocument retdoc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + rdata + "}");
                              XmlElement  retroot = retdoc.DocumentElement;
                              string      rtype   = retroot.SelectSingleNode("type").InnerText;
                              string      rmsg    = retroot.SelectSingleNode("msg").InnerText;
                              if (rtype == "100")  //创建订单成功
                              {
                                  response.uid      = agentinfo.Lvmama_uid;
                                  response.status   = "0";
                                  response.msg      = "订单创建成功";
                                  response.orderId  = orderid.ToString();
                                  response.serialNo = serialNo;
                                  response.authCode = retroot.SelectSingleNode("pno").InnerText;   //只有成功的订单才有pno项;
                                  mlog.ordernum     = orderid.ToString();
                                  return(EditLvmamalog_Order(response, mlog));
                              }
                              else
                              {
                                  response.uid    = agentinfo.Lvmama_uid;
                                  response.status = "3";
                                  response.msg    = "创建订单失败" + rmsg;
                                  return(EditLvmamalog_Order(response, mlog));
                              }
                          }
                          #endregion
                      }
                      else
                      {
                          response.uid    = agentinfo.Lvmama_uid;
                          response.uid    = "0";
                          response.status = "4";
                          response.msg    = "产品不存在";
                          return(EditLvmamalog_Order(response, mlog));
                      }
                      #endregion
                  }
              }
              catch (Exception ex)
              {
                  response.uid    = agentinfo.Lvmama_uid;
                  response.status = "8";
                  response.msg    = "异常错误" + ex;

                  return(EditLvmamalog_Order(response, mlog));
              }
          }
      }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //返回订单号
            orderid      = Request["orderid"].ConvertTo <int>(0);
            agentorderid = Request["agentorderid"].ConvertTo <int>(0);
            act          = Request["act"].ConvertTo <string>("");


            if (orderid != 0)
            {
                //根据订单id得到订单信息
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);

                //根据产品id得到产品信息
                B2bComProData datapro     = new B2bComProData();
                B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());

                //如果订单“未付款”现实支付及订单信息
                if ((int)modelb2border.Order_state == (int)OrderStatus.WaitPay)
                {
                    u_name   = modelb2border.U_name.Substring(0, 1) + "**";
                    u_mobile = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3);

                    ;
                    travel_date  = modelb2border.U_traveldate.ToString();
                    buy_num      = modelb2border.U_num;
                    p_totalprice = (int)(modelb2border.U_num * modelb2border.Pay_price);
                    ordertype    = modelb2border.Order_type;
                    if (ordertype == 2)
                    {
                        proname     = "预付款充值";
                        u_youxiaoqi = "";
                    }
                    else
                    {
                        proname     = modelcompro.Pro_name;
                        u_youxiaoqi = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString();
                    }
                }

                comid_temp = Request["comid"].ConvertTo <int>(0);

                B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);
                if (companyinfo != null)
                {
                    company = companyinfo.Com_name;
                }



                if (Session["Agentid"] != null)
                {
                    //账户信息
                    Agentid = Int32.Parse(Session["Agentid"].ToString());
                    Account = Session["Account"].ToString();

                    Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                    if (agenginfo != null)
                    {
                        yufukuan     = "您预付款:" + agenginfo.Imprest + " 元";
                        Warrant_type = agenginfo.Warrant_type;
                    }
                }
            }
        }
Esempio n. 12
0
        ///     产品订单创建
        public string Getordercreate(Meituan_reqlog mlog)
        {
            lock (lockobj)
            {
                var response = new OrderCreateResponse();
                response.partnerId = int.Parse(agentinfo.mt_partnerId);
                try
                {
                    var data = JsonConvert.DeserializeObject <OrderCreateRequest>(_requestParam);
                    if (data.body == null)
                    {
                        response.code     = 499;
                        response.describe = "Body数据解析失败";
                        return(EditMTlog_Order(response, mlog));
                    }
                    else
                    {
                        OrderCreateRequestBody body = data.body;

                        string product_num = body.partnerDealId;
                        string num         = body.quantity.ToString();
                        mlog.mtorderid = body.orderId.ToString();

                        //todo 根据请求参数查询产品返回结果
                        B2b_com_pro pro = new B2bComProData().GetProById(product_num);
                        #region 产品信息
                        if (pro != null)
                        {
                            #region 分销授权信息判断
                            Agent_company agentwarrantinfo = AgentCompanyData.GetAgentWarrant(agentinfo.Id, pro.Com_id);

                            if (agentwarrantinfo != null)
                            {
                                int warrantid     = agentwarrantinfo.Warrantid;
                                int Warrant_type  = agentwarrantinfo.Warrant_type;//支付类型分销 1出票扣款 2验码扣款
                                int Warrant_level = agentwarrantinfo.Warrant_level;
                                if (agentwarrantinfo.Warrant_state == 0)
                                {
                                    response.code     = 499;
                                    response.describe = "商户尚未授权此分销";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            else
                            {
                                response.code     = 499;
                                response.describe = "分销还没有得到商户授权";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region 暂时对外接口只支持票务产品
                            if (pro.Server_type != 1)
                            {
                                response.code     = 499;
                                response.describe = "暂时对外接口只支持票务产品,其他产品请到分销后台提单";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region 价格(建议价)效验,保证美团抓到的是最新价格
                            string advice_price = body.unitPrice.ToString("f0");
                            if (pro.Advise_price.ToString("f0") != advice_price)
                            {
                                response.code     = 410;
                                response.describe = "价格(建议价)效验失败,请重新拉取价格库存日历";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region 价格(分销价)效验,保证美团抓到的是最新的结算价
                            if (agentwarrantinfo.Warrant_level == 1)
                            {
                                if (body.buyPrice.ToString("f0") != pro.Agent1_price.ToString("f0"))
                                {
                                    response.code     = 410;
                                    response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            if (agentwarrantinfo.Warrant_level == 2)
                            {
                                if (body.buyPrice.ToString("f0") != pro.Agent2_price.ToString("f0"))
                                {
                                    response.code     = 410;
                                    response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            if (agentwarrantinfo.Warrant_level == 3)
                            {
                                if (body.buyPrice.ToString("f0") != pro.Agent3_price.ToString("f0"))
                                {
                                    response.code     = 410;
                                    response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            #endregion

                            #region 多规格产品编码格式验证
                            int speciid = 0;
                            //判断产品编号是否符合多规格产品特点:例如 2503-1
                            if (product_num.IndexOf("-") > -1)
                            {
                                speciid = product_num.Substring(product_num.IndexOf("-") + 1).ConvertTo <int>(0);
                                if (speciid == 0)
                                {
                                    response.code     = 410;
                                    response.describe = "多规格产品编码格式有误";
                                    return(EditMTlog_Order(response, mlog));
                                }
                                product_num = product_num.Substring(0, product_num.IndexOf("-"));
                            }
                            #endregion

                            #region 产品编码格式有误
                            if (product_num.ConvertTo <int>(0) == 0)
                            {
                                response.code     = 410;
                                response.describe = "产品编码格式有误";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region  购买数量格式有误
                            if (num.ConvertTo <int>(0) == 0)
                            {
                                response.code     = 410;
                                response.describe = "购买数量格式有误";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region  产品限购则需要判断 限购数量 是否足够
                            if (pro.Ispanicbuy != 0)
                            {
                                //最多可购买数量
                                int zuiduo_canbuynum = pro.Limitbuytotalnum;
                                if (int.Parse(num) > zuiduo_canbuynum)
                                {
                                    response.code     = 420;
                                    response.describe = "产品库存不足";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            #endregion

                            #region 产品已暂停
                            if (pro.Pro_state == 0)
                            {
                                response.code     = 421;
                                response.describe = "产品已暂停";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region 产品已过期
                            if (pro.Pro_end < DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")))
                            {
                                response.code     = 421;
                                response.describe = "产品已过期";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region   产品是否需要预约:需要预约则最晚预约时间是 游玩前一天的18点
                            if (pro.isneedbespeak == 1)
                            {
                                if (body.travelDate != "")
                                {
                                    DateTime visitdate = DateTime.Parse(body.travelDate);
                                    DateTime bookdate  = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));

                                    //必须提前一天预约
                                    if (bookdate >= visitdate)
                                    {
                                        response.code     = 422;
                                        response.describe = "产品需要提前一天预约";
                                        return(EditMTlog_Order(response, mlog));
                                    }
                                }
                            }
                            #endregion

                            #region  是否有使用限制
                            if (pro.Iscanuseonsameday == 0)//1:当天出票可用 ;2:2小时内出票不可用;0:当天出票不可用
                            {
                                if (body.travelDate != "")
                                {
                                    DateTime visitdate = DateTime.Parse(body.travelDate);//游玩日期:2012-12-12 格式要求:yyyy-MM-dd

                                    DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                                    if (bookdate >= visitdate)
                                    {
                                        response.code     = 422;
                                        response.describe = "预定日期至少在游玩日期之前一天";
                                        return(EditMTlog_Order(response, mlog));
                                    }
                                }
                            }
                            #endregion



                            Meituan_reqlog mtOrderCrateSucLog = new Meituan_reqlogData().GetMtOrderCrateLogByMtorder(body.orderId.ToString(), "200");
                            #region 美团订单成功创建过
                            if (mtOrderCrateSucLog != null)
                            {
                                response.code      = 200;
                                response.describe  = "订单创建成功";
                                response.partnerId = int.Parse(agentinfo.mt_partnerId);
                                response.body      = new OrderCreateResponseBody
                                {
                                    partnerOrderId = mtOrderCrateSucLog.ordernum
                                };

                                mlog.ordernum = mtOrderCrateSucLog.ordernum;
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion
                            #region 美团订单没有成功创建过
                            else
                            {
                                int    isInterfaceSub = 1;   //是否是电子票接口提交的订单:0.否;1.是
                                string ordertype      = "1"; //1.出票2.充值
                                int    orderid        = 0;

                                string             real_name   = "";
                                string             mobile      = "";
                                string             use_date    = body.travelDate;
                                List <BaseVisitor> visitorlist = body.visitors;
                                if (visitorlist.Count > 0)
                                {
                                    foreach (BaseVisitor info in visitorlist)
                                    {
                                        if (info != null)
                                        {
                                            real_name = info.name;
                                            mobile    = info.mobile;
                                            break;
                                        }
                                    }
                                }
                                //创建一笔未支付订单
                                string      rdata   = OrderJsonData.CreateNopayOrder(agentinfo.Id, product_num, ordertype, num, real_name, mobile, use_date, isInterfaceSub, out orderid, speciid);
                                XmlDocument retdoc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + rdata + "}");
                                XmlElement  retroot = retdoc.DocumentElement;
                                string      rtype   = retroot.SelectSingleNode("type").InnerText;
                                string      rmsg    = retroot.SelectSingleNode("msg").InnerText;
                                if (rtype == "100")//创建订单成功
                                {
                                    //针对美团因为创建未支付订单 是单写的,所以同时创建一笔wl订单
                                    #region 万龙接口订单
                                    if (pro.Source_type == 3 && pro.Serviceid == 4)
                                    {
                                        try
                                        {
                                            B2b_company commanage = B2bCompanyData.GetAllComMsg(pro.Com_id);
                                            WlGetProInfoDealRequestData wldata = new WlGetProInfoDealRequestData(commanage.B2bcompanyinfo.wl_PartnerId, commanage.B2bcompanyinfo.wl_userkey);

                                            WlDealResponseBody WlDealinfo = wldata.SelectonegetWlProDealData(pro.Service_proid, pro.Com_id);
                                            if (WlDealinfo == null)
                                            {
                                                response.code     = 499;
                                                response.describe = "订单创建失败1";
                                                return(EditMTlog_Order(response, mlog));
                                            }
                                            double toal     = WlDealinfo.marketPrice * int.Parse(num);
                                            string tavedate = "";


                                            var createwlorder = wldata.wlOrderCreateRequest_json(int.Parse(commanage.B2bcompanyinfo.wl_PartnerId), real_name, mobile, orderid.ToString(), product_num.ToString(), WlDealinfo.proID, WlDealinfo.settlementPrice, WlDealinfo.marketPrice, toal, int.Parse(num), tavedate);//

                                            var wlcreate = wldata.wlOrderCreateRequest_data(createwlorder, pro.Com_id);
                                            if (wlcreate.IsSuccess == true)
                                            {
                                                //wl订单创建成功
                                            }
                                            else
                                            {
                                                //return JsonConvert.SerializeObject(new { type = 1, msg = "wl接口创建订单失败1" });
                                                response.code     = 499;
                                                response.describe = "订单创建失败1";
                                                return(EditMTlog_Order(response, mlog));
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            response.code     = 499;
                                            response.describe = "订单创建失败" + ex.Message;
                                            return(EditMTlog_Order(response, mlog));
                                        }
                                    }
                                    #endregion


                                    response.code      = 200;
                                    response.describe  = "订单创建成功";
                                    response.partnerId = int.Parse(agentinfo.mt_partnerId);
                                    response.body      = new OrderCreateResponseBody
                                    {
                                        partnerOrderId = orderid.ToString()
                                    };

                                    mlog.ordernum = orderid.ToString();
                                    return(EditMTlog_Order(response, mlog));
                                }
                                else
                                {
                                    response.code     = 499;
                                    response.describe = "订单创建失败";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            response.code     = 421;
                            response.describe = "产品不存在";
                            return(EditMTlog_Order(response, mlog));
                        }
                        #endregion
                    }
                }
                catch (Exception ex)
                {
                    response.code     = 499;
                    response.describe = "异常错误" + ex;

                    return(EditMTlog_Order(response, mlog));
                }
            }
        }