Beispiel #1
0
        public static string ChannelFPageList(string comid, int pageindex, int pagesize, string key, int channelcomid)
        {
            var totalcount = 0;

            if (channelcomid == 0)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "传递参数错误" }));
            }

            try
            {
                var financedata = new B2bFinanceData();
                var orderdata   = new B2bOrderData();
                var channeldata = new MemberChannelcompanyData();


                var         list   = financedata.FinancePageList(comid, pageindex, pagesize, key, out totalcount, channelcomid);
                IEnumerable result = "";
                if (list != null)
                {
                    result = from finance in list
                             select new
                    {
                        Id                = finance.Id,
                        Com_id            = finance.Com_id,
                        ComName           = B2bCompanyData.GetCompany(finance.Com_id).Com_name,
                        Agent_id          = finance.Agent_id,
                        Eid               = finance.Eid,
                        Order_id          = finance.Order_id,
                        Servicesname      = finance.Servicesname,
                        ShortServicesname = finance.Servicesname.Length > 15 ? finance.Servicesname.Substring(0, 15) + "." : finance.Servicesname,
                        SerialNumber      = finance.SerialNumber,
                        Money             = finance.Money,
                        Money_come        = finance.Money_come,
                        Over_money        = finance.Over_money,
                        Payment           = finance.Payment,
                        Payment_type      = finance.Payment_type,
                        Subdate           = finance.Subdate,
                        Con_state         = finance.Con_state,
                        Remarks           = finance.Remarks,
                        PrintscreenUrl    = new FileUploadData().GetFileById(finance.Printscreen.ToString().ConvertTo <int>(0)) == null ? "" : new FileUploadData().GetFileById(finance.Printscreen.ToString().ConvertTo <int>(0)).Relativepath,
                        Pno               = orderdata.GetPnoByOrderId(finance.Order_id),
                        Channelid         = finance.Channelid,
                        ChannelName       = channeldata.GetChannelCompanyNameById(finance.Channelid),
                        Paychannelstate   = finance.Paychannelstate
                    }
                }
                ;

                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Beispiel #2
0
        public static string ComFinancePageList(string comid, int pageindex, int pagesize, string key, int oid = 0, string payment_type = "", string money_come = "", string starttime = "", string endtime = "")
        {
            var totalcount = 0;

            try
            {
                var financedata = new B2bFinanceData();
                var orderdata   = new B2bOrderData();
                var channeldata = new MemberChannelcompanyData();

                B2bPayData  datapay = new B2bPayData();
                var         list    = financedata.FinancePageList(comid, pageindex, pagesize, key, out totalcount, 0, oid, payment_type, money_come, starttime, endtime);
                IEnumerable result  = "";
                if (list != null)
                {
                    result = from finance in list
                             select new
                    {
                        Id                = finance.Id,
                        Com_id            = finance.Com_id,
                        ComName           = B2bCompanyData.GetCompany(finance.Com_id).Com_name,
                        Agent_id          = finance.Agent_id,
                        Eid               = finance.Eid,
                        Order_id          = finance.Order_id,
                        Servicesname      = finance.Servicesname,
                        ShortServicesname = finance.Servicesname.Length > 15 ? finance.Servicesname.Substring(0, 15) + "." : finance.Servicesname,
                        SerialNumber      = finance.SerialNumber,
                        Money             = finance.Money,
                        Money_come        = finance.Money_come,
                        Over_money        = finance.Over_money,
                        Payment           = finance.Payment,
                        Payment_type      = finance.Payment_type,
                        Subdate           = finance.Subdate,
                        Con_state         = finance.Con_state,
                        Remarks           = finance.Remarks,
                        Pno               = orderdata.GetPnoByOrderId(finance.Order_id),
                        Channelid         = finance.Channelid,
                        ChannelName       = channeldata.GetChannelCompanyNameById(finance.Channelid),
                        Paychannelstate   = finance.Paychannelstate,
                        Agentname         = financedata.GetAgentNamebyorderid(finance.Order_id),
                        Payinfo           = datapay.GetPayByoId(finance.Order_id)
                    }
                }
                ;

                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Beispiel #3
0
        //支付方式
        public static string Selmoney_come()
        {
            IList <string> list = new B2bFinanceData().Selmoney_come();

            if (list.Count == 0)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new { type = 100, msg = list }));
            }
        }
Beispiel #4
0
 public static string GetChannelFinanceCount(int comid, int channelcomid)
 {
     try
     {
         B2bFinanceData fdate = new B2bFinanceData();
         var            com   = fdate.GetChannelFinanceCount(comid, channelcomid);
         return(JsonConvert.SerializeObject(new { type = 100, msg = com }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));
     }
 }
Beispiel #5
0
 public static string FinancePayType(int comid)
 {
     try
     {
         B2bFinanceData      fdate = new B2bFinanceData();
         B2b_finance_paytype com   = fdate.FinancePayType(comid);
         return(JsonConvert.SerializeObject(new { type = 100, msg = com }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));
     }
 }
Beispiel #6
0
        public static string ModifyFinancePayWX(B2b_finance_paytype fdateinfo)
        {
            try
            {
                B2bFinanceData fdate = new B2bFinanceData();
                var            id    = fdate.InsertOrUpdateFinancePayWX(fdateinfo);

                return(JsonConvert.SerializeObject(new { type = 100, msg = id }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Beispiel #7
0
        public static string ImprestCount(int comid)
        {
            int totalcount = 0;

            try
            {
                B2bFinanceData fdate = new B2bFinanceData();
                var            list  = fdate.ImprestCount(comid);

                return(JsonConvert.SerializeObject(new { type = 100, msg = list }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, totalCount = 0, msg = ex.Message }));

                throw;
            }
        }
Beispiel #8
0
        public static string IntegralList(int pageindex, int pagesize, int comid, string key = "")
        {
            int totalcount = 0;

            try
            {
                B2bFinanceData fdate   = new B2bFinanceData();
                var            crmdata = new B2bCrmData();
                var            list    = fdate.IntegralList(pageindex, pagesize, comid, out totalcount, 0, key);

                IEnumerable result = "";
                if (list != null)
                {
                    result = from finance in list
                             select new
                    {
                        Id        = finance.Id,
                        OrderId   = finance.OrderId,
                        Mid       = finance.Mid,
                        Money     = finance.Money,
                        OrderName = finance.OrderName,
                        Subdate   = finance.Subdate,
                        Comid     = finance.Comid,
                        Ptype     = finance.Ptype,
                        Admin     = finance.Admin,
                        Ip        = finance.Ip,
                        Crm       = crmdata.GetB2bCrmById(finance.Mid)
                    }
                }
                ;



                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, totalCount = 0, msg = ex.Message }));

                throw;
            }
        }
Beispiel #9
0
        public static string WithdrawConf(int id, int comid, string remarks, int printscreen)
        {
            try
            {
                B2bFinanceData fdate = new B2bFinanceData();
                int            com   = fdate.WithdrawConf(id, comid, remarks, printscreen);

                if (com < 0)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "失败,请重新操作" }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 100, msg = "处理成功" }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));
            }
        }
Beispiel #10
0
        public static string Financecount(string comid, string stardate, string enddate)
        {
            var totalcount = 0;

            try
            {
                var financedata = new B2bFinanceData();
                var orderdata   = new B2bOrderData();
                var channeldata = new MemberChannelcompanyData();


                var list = financedata.Financecount(comid, stardate, enddate);


                return(JsonConvert.SerializeObject(new { type = 100, msg = list }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Beispiel #11
0
        public static string shougongqueren(string trade_no, int order_no, decimal total_fee)
        {
            try
            {
                B2bFinanceData fdate = new B2bFinanceData();
                var            list  = fdate.huoqupayorder(order_no, total_fee);
                if (list == 0)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, totalCount = 0, msg = "没有此订单" }));
                }
                else
                {
                    string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(trade_no, order_no, total_fee, "TRADE_SUCCESS");

                    return(JsonConvert.SerializeObject(new { type = 100, msg = retunstr }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, totalCount = 0, msg = ex.Message }));

                throw;
            }
        }
Beispiel #12
0
        //读取用户信息
        private void Readuser(decimal idcard, int comid)
        {
            Today = DateTime.Now.ToString("yyyy-MM-dd");
            B2bCrmData dateuser = new B2bCrmData();

            var userinfo = dateuser.GetB2bCrmByCardcode(idcard);

            if (userinfo != null)
            {
                Integral = userinfo.Integral.ToString() == "" ? "0" : userinfo.Integral.ToString();
                Imprest  = userinfo.Imprest.ToString() == "" ? "0" : userinfo.Imprest.ToString();

                AccountWeixin = userinfo.Weixin;
                AccountEmail  = userinfo.Email;
                Accountphone  = userinfo.Phone;
                AccountCard   = userinfo.Idcard.ToString();
                string a = AccountCard.Substring(0, 1);
                if (a != null)
                {
                    fcard = int.Parse(a.ToString());
                }

                MemberCardData carddata = new MemberCardData();
                var            cardinfo = carddata.GetCardByCardNumber(decimal.Parse(AccountCard));
                if (cardinfo != null)
                {
                    channelid = Int32.Parse(cardinfo.IssueCard.ToString());
                }



                //获取预付款记录
                B2bFinanceData fdate      = new B2bFinanceData();
                int            totalcount = 0;
                var            list       = fdate.ImprestList(1, 10, comid, out totalcount, userinfo.Id);
                if (list != null)
                {
                    Imprestlist = "<ul>";
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].Money < 0)
                        {
                            Imprestlist += "<li>" + list[i].Subdate + "  支出:" + list[i].Money.ToString("0.00") + "元</li>";
                        }
                        else
                        {
                            Imprestlist += "<li>" + list[i].Subdate + "  获得:" + list[i].Money.ToString("0.00") + "元</li>";
                        }
                    }
                    Imprestlist += "</ul>";
                }


                //获取积分记录
                var integrallist = fdate.IntegralList(1, 10, comid, out totalcount, userinfo.Id);
                if (integrallist != null)
                {
                    Integrallist = "<ul>";
                    for (int i = 0; i < integrallist.Count; i++)
                    {
                        if (integrallist[i].Money < 0)
                        {
                            Integrallist += "<li>" + integrallist[i].Subdate + "  支出:" + integrallist[i].Money.ToString("0") + "</li>";
                        }
                        else
                        {
                            Integrallist += "<li>" + integrallist[i].Subdate + "  获得:" + integrallist[i].Money.ToString("0") + "</li>";
                        }
                    }
                    Integrallist += "</ul>";
                }


                //消费记录
                string       proname    = "";
                string       orderstate = "";
                B2bOrderData dataorder  = new B2bOrderData();
                var          prodata    = new B2bComProData();
                var          order      = dataorder.ConsumerOrderPageList("", 1, 10, userinfo.Id, out totalcount);
                if (order != null)
                {
                    Orderlist = "<ul>";
                    for (int i = 0; i < order.Count; i++)
                    {
                        var promodel = prodata.GetProById(order[i].Pro_id.ToString());
                        if (promodel != null)
                        {
                            proname = promodel.Pro_name;
                        }

                        orderstate = EnumUtils.GetName((OrderStatus)order[i].Order_state);

                        Orderlist += "<li>" + proname + "(" + order[i].U_subdate + ") " + order[i].U_num + "(" + orderstate + ")</li>";
                    }
                    Orderlist += "</ul>";
                }



                //当读取用户信息的时候,判断是否有渠道转发信息
                if (Request.Cookies["ZF_ChanneId"] != null)
                {
                    int ZF_ChanneId = 0;
                    ZF_ChanneId = int.Parse(Request.Cookies["ZF_ChanneId"].Value);
                    if (ZF_ChanneId != 0)
                    { //有转发渠道ID
                        //在这判断 用户渠道是否为微信注册过来的
                        Member_Channel channel2 = new MemberChannelData().GetChannelByOpenId(userinfo.Weixin);
                        if (channel2 != null)
                        {
                            if (channel2.Issuetype == 4)
                            {
                                //如果为微信注册过来的 ,则修改会员渠道即可
                                int upchannel = new MemberCardData().upCardcodeChannel(userinfo.Idcard.ToString(), ZF_ChanneId);
                            }
                        }
                        else
                        {
                            //没有渠道的 ,则修改会员渠道即可
                            int upchannel = new MemberCardData().upCardcodeChannel(userinfo.Idcard.ToString(), ZF_ChanneId);
                        }

                        //清除Cookies
                        HttpCookie aCookie = new HttpCookie("ZF_ChanneId");
                        aCookie.Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies.Add(aCookie);
                    }
                }


                dateuser.WeixinConPass(userinfo.Weixin, comid);//只要包含SESSION登陆成功,清空微信密码
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string oper = Request["oper"].ConvertTo <string>("");

            #region 导出卡号
            if (oper == "outcardno")//导出卡号
            {
                int crid  = Request["crid"].ConvertTo <int>(0);
                int comid = Request["comid"].ConvertTo <int>(0);
                if (crid > 0 && comid > 0)
                {
                    DataTable table = ExcelSqlHelper.ExecuteDataTable("select cardcode from member_card where crid=" + crid + " and com_id=" + comid);

                    ExcelRender.RenderToExcel(table, Context, "卡号列表.xls");
                }
            }
            #endregion
            #region 导出旅游大巴产品结单名单
            if (oper == "outlvyoubusorderlistbyorderstate")//导出旅游大巴产品结单名单
            {
                int    proid      = Request["proid"].ConvertTo <int>(0);
                string gooutdate  = Request["gooutdate"].ConvertTo <string>("");
                int    orderstate = Request["orderstate"].ConvertTo <int>(0);

                object o = ExcelSqlHelper.ExecuteScalar("select pro_name from b2b_com_pro where id=" + proid);

                //DataTable table = ExcelSqlHelper.ExecuteDataTable("select id as 订单号,u_name as 预订人,u_num as 预订人数,CONVERT(varchar(10),u_traveldate,120) as 出行时间,u_subdate as 预订时间 FROM b2b_order where  u_traveldate='" + gooutdate + "' and pro_id=" + proid + " and order_state=" + orderstate);
                //DataTable table = ExcelSqlHelper.ExecuteDataTable("SELECT  [orderid] as 订单号,[name] as 乘车人姓名,[IdCard] as 乘车人身份证,[Nation] as 乘车人民族,CONVERT(varchar(10),[travel_time],120) as 乘车日期,[yuding_name] as 预订人姓名,[yuding_phone] as 预订人电话,[yuding_time] as 预订时间,pickuppoint as 上车地点,dropoffpoint as 下车地点  FROM  [b2b_order_busNamelist] where orderid in (select id  FROM b2b_order where  u_traveldate='" + gooutdate + "' and pro_id=" + proid + " and order_state=" + orderstate + ")");

                DataTable table = ExcelSqlHelper.ExecuteDataTable("SELECT   a.[orderid] as 订单号,a.[name] as 乘车人姓名,a.[contactphone] as 乘车人电话,a.[IdCard] as 乘车人身份证,a.[Nation] as 乘车人民族,CONVERT(varchar(10),a.[travel_time],120) as 乘车日期,a.[yuding_name] as 预订人姓名,a.[yuding_phone] as 预订人电话,a.[yuding_time] as 预订时间,a.pickuppoint as 上车地点,a.dropoffpoint as 下车地点,b.company as 购票地点,a.contactremark  as 备注  FROM  agent_company as b right join [b2b_order_busNamelist] as a on a.agentid=b.id left join b2b_order as c on a.orderid=c.id where a.orderid in (select id  FROM b2b_order where  u_traveldate='" + gooutdate + "' and pro_id=" + proid + " and order_state=" + orderstate + ")");

                ExcelRender.RenderToExcel(table, Context, gooutdate + o.ToString() + "结单名单.xls");
            }
            #endregion
            #region 分销订单导入到excel
            if (oper == "agentordertoexcel")
            {
                var comid       = Request["comid"].ConvertTo <int>(0);
                int agentid     = Request["agentid"].ConvertTo <int>(0);
                var key         = Request["key"].ConvertTo <string>("");
                var account     = Request["account"].ConvertTo <string>("");
                var order_state = Request["order_state"].ConvertTo <int>(0);
                var begindate   = Request["beginDate"].ConvertTo <string>("");
                var enddate     = Request["endDate"].ConvertTo <string>("");
                var servertype  = Request["servertype"].ConvertTo <int>(0);

                object o1 = ExcelSqlHelper.ExecuteScalar("select company from agent_company where id=" + agentid);
                object o2 = ExcelSqlHelper.ExecuteScalar("select com_name from b2b_company where id=" + comid);

                List <B2b_order> agentorderlist = new B2bOrderData().GetAgentOrderList(comid, agentid, key, order_state, begindate, enddate, servertype);
                if (agentorderlist.Count > 0)
                {
                    DataTable  tblDatas = new DataTable("Datas");
                    DataColumn dc       = null;
                    dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32"));
                    dc.AutoIncrement     = true; //自动增加
                    dc.AutoIncrementSeed = 1;    //起始为1
                    dc.AutoIncrementStep = 1;    //步长为1
                    dc.AllowDBNull       = false;

                    dc = tblDatas.Columns.Add("订单号", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("提单时间", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("产品名称", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("提单人", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("单价", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("数量", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("实收", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("状态", Type.GetType("System.String"));

                    DataRow newRow;
                    foreach (B2b_order morder in agentorderlist)
                    {
                        if (morder != null)
                        {
                            newRow         = tblDatas.NewRow();
                            newRow["订单号"]  = morder.Id;
                            newRow["提单时间"] = morder.U_subdate;
                            newRow["产品名称"] = morder.Order_type == 2 ? "预付款充值" : new B2bComProData().GetProById(morder.Pro_id.ToString(), morder.Speciid).Pro_name;
                            newRow["提单人"]  = morder.U_name + "(" + morder.U_phone + ")";
                            newRow["单价"]   = morder.Pay_price;
                            newRow["数量"]   = morder.U_num;
                            newRow["实收"]   = (morder.Pay_price) * (morder.U_num) + morder.Express - morder.Integral1 - morder.Imprest1;
                            newRow["状态"]   = EnumUtils.GetName((OrderStatus)morder.Order_state);
                            tblDatas.Rows.Add(newRow);
                        }
                    }
                    ExcelRender.RenderToExcel(tblDatas, Context, o1.ToString() + "-" + o2.ToString() + "-订单列表.xls");
                }
            }
            #endregion

            #region  商户产品分销销售订单导入到excel
            if (oper == "agentsalescodetoexcel")
            {
                var comid       = Request["comid"].ConvertTo <int>(0);
                var order_state = Request["order_state"].ConvertTo <int>(0);
                var servertype  = Request["servertype"].ConvertTo <int>(0);
                var begindate   = Request["beginDate"].ConvertTo <string>("");
                var enddate     = Request["endDate"].ConvertTo <string>("");
                var key         = Request["key"].ConvertTo <string>("");
                var ordertype   = Request["ordertype"].ConvertTo <int>(0);
                var userid      = Request["userid"].ConvertTo <int>(0);


                int orderIsAccurateToPerson = 0;
                int channelcompanyid        = 0;
                if (userid > 0)
                {
                    Sys_Group group = new Sys_GroupData().GetGroupByUserId(userid);
                    if (group != null)
                    {
                        //判断订单是否要求精确到渠道人
                        orderIsAccurateToPerson = group.OrderIsAccurateToPerson;
                        Member_Channel_company channelcom = new MemberChannelcompanyData().GetChannelCompanyByUserId(userid);
                        if (channelcom != null)
                        {
                            channelcompanyid = channelcom.Id;
                        }
                    }
                }

                object o2 = ExcelSqlHelper.ExecuteScalar("select com_name from b2b_company where id=" + comid);

                List <B2b_order> directorderlist = new B2bOrderData().GetOrderList(comid, order_state, servertype, begindate, enddate, key, userid, orderIsAccurateToPerson, channelcompanyid, ordertype);
                if (directorderlist.Count > 0)
                {
                    DataTable  tblDatas = new DataTable("Datas");
                    DataColumn dc       = null;
                    dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32"));
                    dc.AutoIncrement     = true; //自动增加
                    dc.AutoIncrementSeed = 1;    //起始为1
                    dc.AutoIncrementStep = 1;    //步长为1
                    dc.AllowDBNull       = false;

                    dc = tblDatas.Columns.Add("订单号", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("提单时间", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("产品名称", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("提单人", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("单价", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("数量", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("实收", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("收货地址", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("状态", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("分销商", Type.GetType("System.String"));

                    DataRow newRow;
                    foreach (B2b_order morder in directorderlist)
                    {
                        if (morder != null)
                        {
                            newRow         = tblDatas.NewRow();
                            newRow["订单号"]  = morder.Id;
                            newRow["提单时间"] = morder.U_subdate;
                            newRow["产品名称"] = morder.Order_type == 2 ? "预付款充值" : new B2bComProData().GetProById(morder.Pro_id.ToString(), morder.Speciid).Pro_name;
                            newRow["提单人"]  = morder.U_name + "(" + morder.U_phone + ")";
                            newRow["单价"]   = morder.Pay_price;
                            newRow["数量"]   = morder.U_num;
                            newRow["实收"]   = (morder.Pay_price) * (morder.U_num) + morder.Express - morder.Integral1 - morder.Imprest1;
                            newRow["收货地址"] = morder.Province + "-" + morder.City + "-" + morder.Address;
                            newRow["状态"]   = EnumUtils.GetName((OrderStatus)morder.Order_state);
                            newRow["分销商"]  = new Agent_companyData().GetAgentName(morder.Agentid);
                            tblDatas.Rows.Add(newRow);
                        }
                    }
                    ExcelRender.RenderToExcel(tblDatas, Context, o2.ToString() + "-后台销售订单列表.xls");
                }
            }
            #endregion
            #region  商户产品分销倒码订单导入到excel
            if (oper == "agentbackcodetoexcel")
            {
                var comid       = Request["comid"].ConvertTo <int>(0);
                var order_state = Request["order_state"].ConvertTo <int>(0);
                var servertype  = Request["servertype"].ConvertTo <int>(0);
                var begindate   = Request["beginDate"].ConvertTo <string>("");
                var enddate     = Request["endDate"].ConvertTo <string>("");
                var key         = Request["key"].ConvertTo <string>("");
                var ordertype   = Request["ordertype"].ConvertTo <int>(0);
                var userid      = Request["userid"].ConvertTo <int>(0);


                int orderIsAccurateToPerson = 0;
                int channelcompanyid        = 0;
                if (userid > 0)
                {
                    Sys_Group group = new Sys_GroupData().GetGroupByUserId(userid);
                    if (group != null)
                    {
                        //判断订单是否要求精确到渠道人
                        orderIsAccurateToPerson = group.OrderIsAccurateToPerson;
                        Member_Channel_company channelcom = new MemberChannelcompanyData().GetChannelCompanyByUserId(userid);
                        if (channelcom != null)
                        {
                            channelcompanyid = channelcom.Id;
                        }
                    }
                }

                object o2 = ExcelSqlHelper.ExecuteScalar("select com_name from b2b_company where id=" + comid);

                List <B2b_order> directorderlist = new B2bOrderData().GetOrderList(comid, order_state, servertype, begindate, enddate, key, userid, orderIsAccurateToPerson, channelcompanyid, ordertype);
                if (directorderlist.Count > 0)
                {
                    DataTable  tblDatas = new DataTable("Datas");
                    DataColumn dc       = null;
                    dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32"));
                    dc.AutoIncrement     = true; //自动增加
                    dc.AutoIncrementSeed = 1;    //起始为1
                    dc.AutoIncrementStep = 1;    //步长为1
                    dc.AllowDBNull       = false;

                    dc = tblDatas.Columns.Add("订单号", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("提单时间", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("产品名称", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("提单人", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("单价", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("数量", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("实收", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("收货地址", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("状态", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("分销商", Type.GetType("System.String"));
                    DataRow newRow;
                    foreach (B2b_order morder in directorderlist)
                    {
                        if (morder != null)
                        {
                            newRow         = tblDatas.NewRow();
                            newRow["订单号"]  = morder.Id;
                            newRow["提单时间"] = morder.U_subdate;
                            newRow["产品名称"] = morder.Order_type == 2 ? "预付款充值" : new B2bComProData().GetProById(morder.Pro_id.ToString(), morder.Speciid).Pro_name;
                            newRow["提单人"]  = morder.U_name + "(" + morder.U_phone + ")";
                            newRow["单价"]   = morder.Pay_price;
                            newRow["数量"]   = morder.U_num;
                            newRow["实收"]   = (morder.Pay_price) * (morder.U_num) + morder.Express - morder.Integral1 - morder.Imprest1;
                            newRow["收货地址"] = morder.Province + "-" + morder.City + "-" + morder.Address;
                            newRow["状态"]   = EnumUtils.GetName((OrderStatus)morder.Order_state);
                            newRow["分销商"]  = new Agent_companyData().GetAgentName(morder.Agentid);
                            tblDatas.Rows.Add(newRow);
                        }
                    }
                    ExcelRender.RenderToExcel(tblDatas, Context, o2.ToString() + "-倒码订单列表.xls");
                }
            }
            #endregion

            #region 直销订单导入到excel
            if (oper == "directordertoexcel")
            {
                var comid       = Request["comid"].ConvertTo <int>(0);
                var order_state = Request["order_state"].ConvertTo <int>(0);
                var servertype  = Request["servertype"].ConvertTo <int>(0);
                var begindate   = Request["beginDate"].ConvertTo <string>("");
                var enddate     = Request["endDate"].ConvertTo <string>("");
                var key         = Request["key"].ConvertTo <string>("");
                var ordertype   = Request["ordertype"].ConvertTo <int>(0);
                var userid      = Request["userid"].ConvertTo <int>(0);


                int orderIsAccurateToPerson = 0;
                int channelcompanyid        = 0;
                if (userid > 0)
                {
                    Sys_Group group = new Sys_GroupData().GetGroupByUserId(userid);
                    if (group != null)
                    {
                        //判断订单是否要求精确到渠道人
                        orderIsAccurateToPerson = group.OrderIsAccurateToPerson;
                        Member_Channel_company channelcom = new MemberChannelcompanyData().GetChannelCompanyByUserId(userid);
                        if (channelcom != null)
                        {
                            channelcompanyid = channelcom.Id;
                        }
                    }
                }

                object o2 = ExcelSqlHelper.ExecuteScalar("select com_name from b2b_company where id=" + comid);

                List <B2b_order> directorderlist = new B2bOrderData().GetOrderList(comid, order_state, servertype, begindate, enddate, key, userid, orderIsAccurateToPerson, channelcompanyid, ordertype);
                if (directorderlist.Count > 0)
                {
                    DataTable  tblDatas = new DataTable("Datas");
                    DataColumn dc       = null;
                    dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32"));
                    dc.AutoIncrement     = true; //自动增加
                    dc.AutoIncrementSeed = 1;    //起始为1
                    dc.AutoIncrementStep = 1;    //步长为1
                    dc.AllowDBNull       = false;

                    dc = tblDatas.Columns.Add("订单号", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("提单时间", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("产品名称", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("提单人", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("身份证", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("手机", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("单价", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("数量", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("实收", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("收货地址", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("状态", Type.GetType("System.String"));

                    DataRow newRow;
                    foreach (B2b_order morder in directorderlist)
                    {
                        if (morder != null)
                        {
                            newRow         = tblDatas.NewRow();
                            newRow["订单号"]  = morder.Id;
                            newRow["提单时间"] = morder.U_subdate;
                            newRow["产品名称"] = morder.Order_type == 2 ? "预付款充值" : new B2bComProData().GetProById(morder.Pro_id.ToString(), morder.Speciid).Pro_name;
                            newRow["提单人"]  = morder.U_name;
                            newRow["身份证"]  = morder.U_idcard;
                            newRow["手机"]   = morder.U_phone;
                            newRow["单价"]   = morder.Pay_price;
                            newRow["数量"]   = morder.U_num;
                            newRow["实收"]   = (morder.Pay_price) * (morder.U_num) + morder.Express - morder.Integral1 - morder.Imprest1;
                            newRow["收货地址"] = morder.Province + "-" + morder.City + "-" + morder.Address;
                            newRow["状态"]   = EnumUtils.GetName((OrderStatus)morder.Order_state);
                            tblDatas.Rows.Add(newRow);
                        }
                    }
                    ExcelRender.RenderToExcel(tblDatas, Context, o2.ToString() + "-直销订单列表.xls");
                }
            }
            #endregion
            #region 订房信息导入到excel
            if (oper == "hotelordertoexcel")
            {
                int    comid      = Request["comid"].ConvertTo <int>(0);
                string begindate  = Request["begindate"].ConvertTo <string>("");
                string enddate    = Request["enddate"].ConvertTo <string>("");
                int    productid  = Request["productid"].ConvertTo <int>(0);
                string orderstate = Request["orderstate"].ConvertTo <string>("");
                try
                {
                    object o1 = ExcelSqlHelper.ExecuteScalar("select com_name from b2b_company where id=" + comid);
                    object o2 = ExcelSqlHelper.ExecuteScalar("select pro_name from b2b_com_pro where id=" + productid);
                    object o3 = ExcelSqlHelper.ExecuteScalar("select projectname from b2b_com_project where id=(select projectid from b2b_com_pro where id=" + productid + ")");

                    DataTable tblDatas = new B2bOrderData().HotelOrderlist(comid, begindate, enddate, productid, orderstate, 1);

                    if (begindate == "" || enddate == "")
                    {
                        ExcelRender.RenderToExcel(tblDatas, Context, o1.ToString() + "-" + o2.ToString() + "-" + o3.ToString() + "-订房订单列表.xls");
                    }
                    else
                    {
                        ExcelRender.RenderToExcel(tblDatas, Context, o1.ToString() + "-" + o2.ToString() + "-" + o3.ToString() + "(" + DateTime.Parse(begindate).ToString("yyyy-MM-dd") + "到" + DateTime.Parse(enddate).ToString("yyyy-MM-dd") + ")" + "-订房订单列表.xls");
                    }
                }
                catch { }
            }
            #endregion
            #region  载分销特定项目下的验票记录
            if (oper == "downagentpro_yplist")
            {
                int    proid    = Request["proid"].ConvertTo <int>(0);
                string startime = Request["startime"].ConvertTo <string>("");
                string endtime  = Request["endtime"].ConvertTo <string>("");
                int    agentid  = 0;
                if (Session["Agentid"] != null)
                {
                    agentid = Int32.Parse(Session["Agentid"].ToString());
                }

                object o1 = ExcelSqlHelper.ExecuteScalar("select company from agent_company where id=" + agentid);
                object o2 = ExcelSqlHelper.ExecuteScalar("select pro_name from b2b_com_pro where id=" + proid);


                int comid = new B2bComProData().GetComidByProid(proid);

                var condition = " a.action=1 and a.com_id=" + comid + " and a.a_state=" + (int)ECodeOperStatus.OperSuc + " and a.pno in (select pno from b2b_eticket where 1=1 ";

                if (proid != 0)
                {
                    condition += " and pro_id=" + proid;
                }
                if (agentid != 0)
                {
                    condition += " and pro_id in (select id from b2b_com_pro where projectid in (select projectid from b2b_project_agent where agentid=" + agentid + ") )";
                }
                condition += ")";


                if (startime != "")
                {
                    condition += " and a.actiondate>='" + startime + "'";
                }
                if (endtime != "")
                {
                    endtime    = DateTime.Parse(endtime).AddDays(1).ToString();
                    condition += " and a.actiondate<'" + endtime + "'";
                }

                ExcelRender.RenderToExcel(
                    ExcelSqlHelper.ExecuteDataTable(CommandType.Text, "select b.e_proname [产品名称],a.pno [电子码],b.pnum [订购数量],a.use_pnum [本次使用数量],a.actiondate [验证时间],a.posid [验证pos],b.e_face_price [门市价],b.e_sale_price [结算价],c.company[出票方] from b2b_etcket_log as a  left join b2b_eticket as b on a.com_id=b.com_id and a.pno=b.pno and a.eticket_id=b.id left join agent_company as c on b.agent_id=c.id where  " + condition + " order by a.id desc"),
                    Context, "分销:" + o1.ToString() + "-" + "产品:" + o2.ToString() + "-验证电子票列表(" + startime + "--" + endtime + ")" + ".xls");
            }
            #endregion

            #region 财务导出到excel
            if (oper == "Financelisttoexcel")
            {
                var comid     = Request["comid"].ConvertTo <int>(0);
                var begindate = Request["beginDate"].ConvertTo <string>("");
                var enddate   = Request["endDate"].ConvertTo <string>("");

                var financedata = new B2bFinanceData();


                var directorderlist = financedata.FinanceallList(comid, begindate, enddate);
                if (directorderlist.Count > 0)
                {
                    DataTable  tblDatas = new DataTable("Datas");
                    DataColumn dc       = null;
                    dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32"));
                    dc.AutoIncrement     = true; //自动增加
                    dc.AutoIncrementSeed = 1;    //起始为1
                    dc.AutoIncrementStep = 1;    //步长为1
                    dc.AllowDBNull       = false;

                    dc = tblDatas.Columns.Add("订单号", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("时间", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("产品名称", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("类型", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("金额", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("余额", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("渠道", Type.GetType("System.String"));


                    DataRow newRow;
                    foreach (B2b_Finance morder in directorderlist)
                    {
                        if (morder != null)
                        {
                            newRow         = tblDatas.NewRow();
                            newRow["订单号"]  = morder.Order_id;
                            newRow["时间"]   = morder.Subdate;
                            newRow["产品名称"] = morder.Servicesname;
                            newRow["类型"]   = morder.Payment_type;
                            newRow["金额"]   = morder.Money;
                            newRow["余额"]   = morder.Over_money;
                            newRow["渠道"]   = morder.Money_come == "wx"?"微信支付":morder.Money_come;

                            tblDatas.Rows.Add(newRow);
                        }
                    }
                    ExcelRender.RenderToExcel(tblDatas, Context, comid.ToString() + DateTime.Now.ToString("yyyyMMddHHmmss") + "-财务明细列表.xls");
                }
            }
            #endregion

            #region 注释内容
            //int splitid = Request["splitid"].ConvertTo<int>(0);//微信拆分表id
            //if (splitid == 0)//下载excel导入样例操作,暂时没有用到
            //{
            //    DataTable table = new DataTable();
            //    table.Columns.Add("姓名", typeof(string));
            //    table.Columns.Add("手机", typeof(string));
            //    table.Columns.Add("邮箱", typeof(string));
            //    table.Columns.Add("微信号", typeof(string));

            //    table.Columns.Add("预付款", typeof(string));
            //    table.Columns.Add("积分", typeof(string));
            //    table.Columns.Add("目的地", typeof(string));
            //    table.Columns.Add("年龄段", typeof(string));
            //    table.Columns.Add("会员级别", typeof(string));

            //    for (int i = 0; i < 10; i++)
            //    {
            //        string name = "张三" + i.ToString();
            //        Thread.Sleep(1);
            //        string phone = "手机号" + i.ToString();
            //        Thread.Sleep(1);
            //        string email = "邮箱地址" + i.ToString();
            //        Thread.Sleep(1);
            //        string weixin = "微信" + i.ToString();
            //        Thread.Sleep(1);
            //        string imprest = i.ToString();
            //        Thread.Sleep(1);
            //        string integral = i.ToString();
            //        Thread.Sleep(1);
            //        string destination = "目的地" + i.ToString();
            //        Thread.Sleep(1);
            //        string agegroup = "年龄段" + i.ToString();
            //        Thread.Sleep(1);
            //        string crmlevel = "1";
            //        Thread.Sleep(1);

            //        table.Rows.Add(name, phone, email, weixin, imprest, integral, destination, agegroup, crmlevel);
            //    }

            //    ExcelRender.RenderToExcel(table, Context, "Excel导入样例.xls");
            //}
            //else//下载获取的微信关注用户表 的拆分用户列表,暂时没有到
            //{
            //    ObtainGzListSplit model = new ObtainGzListSplitData().GetObtainGzListSplit(splitid);
            //    if (model != null)
            //    {
            //        string openidstr = model.Splitopenid;
            //        string[] str = openidstr.Split(',');

            //        DataTable table = new DataTable();
            //        table.Columns.Add("姓名", typeof(string));
            //        table.Columns.Add("手机", typeof(string));
            //        table.Columns.Add("邮箱", typeof(string));
            //        table.Columns.Add("微信号", typeof(string));


            //        for (int i = 0; i < str.Length; i++)
            //        {
            //            string name = "";
            //            Thread.Sleep(1);
            //            string phone = "";
            //            Thread.Sleep(1);
            //            string email = "";
            //            Thread.Sleep(1);
            //            string weixin = str[i];
            //            Thread.Sleep(1);

            //            table.Rows.Add(name, phone, email, weixin);
            //        }

            //        ExcelRender.RenderToExcel(table, Context, model.Comid + "-" + splitid + ".xls");
            //    }
            //    else
            //    {
            //        Label1.Text = "获取拆分用户列表为空";
            //    }
            //}
            #endregion
        }
Beispiel #14
0
        public Config()
        {
            //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


            ////----------------------------------------易城默认支付宝参数-----------------------------------------------
            //合作身份者ID,以2088开头由16位纯数字组成的字符串
            partner = "2088601265635235";
            //交易安全检验码,由数字和字母组成的32位字符串
            key = "ebkuy760nslctp2kd1ixcuvxn1c4e2vy";
            //签约支付宝账号或卖家支付宝帐户
            seller_email = "*****@*****.**";
            //页面跳转同步返回页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数

            if (Requestfile == "/ui/vasui/alipay/subpay.aspx")
            {
                return_url = "http://" + RequestUrl + "/ui/vasui/PaySuc.aspx";
            }
            else
            {
                return_url = "http://" + RequestUrl + "/H5/pay_by/call_back_kuaijie.aspx";
            }


            //服务器通知的页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            notify_url = "http://" + RequestUrl + "/ui/vasui/alipay/notify_url.aspx";
            //notify_url = "";


            //支付宝账户
            //根据域名读取商户ID,如果没有绑定域名直接跳转后台
            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);

            if (companyinfo != null)
            {
                B2bFinanceData comfindate    = new B2bFinanceData();
                var            comfinaceinfo = comfindate.FinancePayType(companyinfo.Com_id);
                if (comfinaceinfo != null)
                {
                    if (comfinaceinfo.Paytype == 2)
                    {
                        //合作身份者ID,以2088开头由16位纯数字组成的字符串
                        partner = comfinaceinfo.Alipay_id.ToString().Trim().ToLower();
                        //交易安全检验码,由数字和字母组成的32位字符串
                        key = comfinaceinfo.Alipay_key.ToString().Trim().ToLower();
                        //签约支付宝账号或卖家支付宝帐户
                        seller_email = comfinaceinfo.Alipay_account.ToString().Trim().ToLower();
                    }
                }
                else
                {
                    ////合作身份者ID,以2088开头由16位纯数字组成的字符串
                    partner = "2088601265635235";
                    ////交易安全检验码,由数字和字母组成的32位字符串
                    key = "ebkuy760nslctp2kd1ixcuvxn1c4e2vy";
                    ////签约支付宝账号或卖家支付宝帐户
                    seller_email = "*****@*****.**";
                }
            }
            else
            {
                // 判定是否为自助域名规则按 shop1.etown.cn
                if (Domain_def.Domain_yanzheng(RequestUrl))
                {
                    B2bFinanceData comfindate    = new B2bFinanceData();
                    var            comfinaceinfo = comfindate.FinancePayType(Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl)));
                    if (comfinaceinfo != null)
                    {
                        if (comfinaceinfo.Paytype == 2)
                        {
                            //合作身份者ID,以2088开头由16位纯数字组成的字符串
                            partner = comfinaceinfo.Alipay_id.ToString().Trim().ToLower();
                            //交易安全检验码,由数字和字母组成的32位字符串
                            key = comfinaceinfo.Alipay_key.ToString().Trim().ToLower();
                            //签约支付宝账号或卖家支付宝帐户
                            seller_email = comfinaceinfo.Alipay_account.ToString().Trim().ToLower();
                        }
                    }
                    else
                    {
                        ////合作身份者ID,以2088开头由16位纯数字组成的字符串
                        partner = "2088601265635235";
                        ////交易安全检验码,由数字和字母组成的32位字符串
                        key = "ebkuy760nslctp2kd1ixcuvxn1c4e2vy";
                        ////签约支付宝账号或卖家支付宝帐户
                        seller_email = "*****@*****.**";
                    }
                }
            }

            ////----------------------------------------易城默认支付宝参数-----------------------------------------------
            ////合作身份者ID,以2088开头由16位纯数字组成的字符串
            //partner = "2088601265635235";
            ////交易安全检验码,由数字和字母组成的32位字符串
            //key = "ebkuy760nslctp2kd1ixcuvxn1c4e2vy";
            ////签约支付宝账号或卖家支付宝帐户
            //seller_email = "*****@*****.**";
            ////页面跳转同步返回页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            //return_url = "http://shop.etown.cn/ui/vasui/PaySuc.aspx";
            ////服务器通知的页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            //notify_url = "http://shop.etown.cn/ui/vasui/alipay/notify_url.aspx";


            //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

            //字符编码格式 目前支持 gbk 或 utf-8
            input_charset = "utf-8";

            //签名方式 不需修改
            sign_type = "MD5";
        }
Beispiel #15
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string oper = context.Request["oper"].ConvertTo <string>("");

            if (oper != "")
            {
                if (oper == "selhotelprojectlist")
                {
                    var    comid = context.Request["comid"].ConvertTo <int>(0);
                    string data  = FinanceJsonData.Selhotelprojectlist(comid);
                    context.Response.Write(data);
                }

                if (oper == "selhotelproductlist")
                {
                    var    comid     = context.Request["comid"].ConvertTo <int>(0);
                    var    projectid = context.Request["projectid"].ConvertTo <int>(0);
                    string data      = FinanceJsonData.Selhotelproductlist(comid, projectid);
                    context.Response.Write(data);
                }
                if (oper == "selprojectlist")
                {
                    var    comid = context.Request["comid"].ConvertTo <int>(0);
                    string data  = FinanceJsonData.Selprojectlist(comid);
                    context.Response.Write(data);
                }
                if (oper == "HotelOrderlist")
                {
                    var    comid      = context.Request["comid"].ConvertTo <int>(0);
                    var    begindate  = context.Request["begindate"].ConvertTo <string>("");
                    var    enddate    = context.Request["enddate"].ConvertTo <string>("");
                    var    productid  = context.Request["productid"].ConvertTo <int>(0);
                    var    orderstate = context.Request["orderstate"].ConvertTo <string>("");
                    string data       = FinanceJsonData.HotelOrderlist(comid, begindate, enddate, productid, orderstate);
                    context.Response.Write(data);
                }

                if (oper == "HotelOrderStat")
                {
                    var    comid      = context.Request["comid"].ConvertTo <int>(0);
                    var    begindate  = context.Request["begindate"].ConvertTo <string>("");
                    var    enddate    = context.Request["enddate"].ConvertTo <string>("");
                    var    projectid  = context.Request["projectid"].ConvertTo <int>(0);
                    var    productid  = context.Request["productid"].ConvertTo <int>(0);
                    var    key        = context.Request["key"].ConvertTo <string>("");
                    var    orderstate = context.Request["orderstate"].ConvertTo <string>("");
                    string data       = FinanceJsonData.HotelOrderStat(comid, begindate, enddate, projectid, productid, key, orderstate);
                    context.Response.Write(data);
                }
                if (oper == "FinanceStat")
                {
                    var    comid     = context.Request["comid"].ConvertTo <int>(0);
                    var    begindate = context.Request["begindate"].ConvertTo <string>("");
                    var    enddate   = context.Request["enddate"].ConvertTo <string>("");
                    var    projectid = context.Request["projectid"].ConvertTo <int>(0);
                    var    productid = context.Request["productid"].ConvertTo <int>(0);
                    string data      = FinanceJsonData.FinanceStat(comid, begindate, enddate, projectid, productid);
                    context.Response.Write(data);
                }
                if (oper == "Selpayment_type")
                {
                    string data = FinanceJsonData.Selpayment_type();

                    context.Response.Write(data);
                }
                if (oper == "Selmoney_come")
                {
                    string data = FinanceJsonData.Selmoney_come();

                    context.Response.Write(data);
                }
                if (oper == "issetfinancepaytype")
                {
                    var comid = context.Request["comid"].ConvertTo <int>(0);

                    var data = "{\"type\":\"1\",\"msg\":\"\"}";
                    if (comid == 0)
                    {
                        data = "{\"type\":\"1\",\"msg\":\"传参数失败\"}";
                    }
                    B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid);

                    if (model != null)
                    {
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                        //商家微信支付的所有参数都存在
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            data = "{\"type\":\"100\",\"msg\":\"\"}";
                        }
                        else
                        {
                            data = "{\"type\":\"1\",\"msg\":\"微信财务参数设置不完全\"}";
                        }
                    }
                    else
                    {
                        data = "{\"type\":\"1\",\"msg\":\"微信财务参数没有设置\"}";
                    }
                    TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", data);
                    context.Response.Write(data);
                }
                if (oper == "Financelist")
                {
                    var    comid     = context.Request["comid"];
                    var    pageindex = context.Request["pageindex"].ConvertTo <int>(1);
                    var    pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    var    key       = context.Request["key"].ConvertTo <string>("");
                    string data      = FinanceJsonData.FinancePageList(comid, pageindex, pagesize, key);

                    context.Response.Write(data);
                }
                if (oper == "Financecount")
                {
                    var    comid    = context.Request["comid"];
                    var    stardate = context.Request["stardate"].ConvertTo <string>(DateTime.Now.ToString("yyyy-MM-dd"));
                    var    enddate  = context.Request["enddate"].ConvertTo <string>(DateTime.Now.ToString("yyyy-MM-dd"));
                    string data     = FinanceJsonData.Financecount(comid, stardate, enddate);

                    context.Response.Write(data);
                }

                if (oper == "ChannelFlist")
                {
                    var    comid            = context.Request["comid"];
                    var    pageindex        = context.Request["pageindex"].ConvertTo <int>(1);
                    var    pagesize         = context.Request["pagesize"].ConvertTo <int>(10);
                    var    channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0);
                    var    key  = context.Request["key"].ConvertTo <string>("");
                    string data = FinanceJsonData.ChannelFPageList(comid, pageindex, pagesize, key, channelcompanyid);

                    context.Response.Write(data);
                }
                if (oper == "ChannelFcount")
                {
                    var    comid            = context.Request["comid"].ConvertTo <int>(0);
                    var    channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0);
                    string data             = FinanceJsonData.GetChannelFinanceCount(comid, channelcompanyid);

                    context.Response.Write(data);
                }

                if (oper == "MasterFinancelist")
                {
                    var    comid     = "999999";
                    var    pageindex = context.Request["pageindex"].ConvertTo <int>(1);
                    var    pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    var    key       = context.Request["key"].ConvertTo <string>("");
                    string data      = FinanceJsonData.FinancePageList(comid, pageindex, pagesize, key);

                    context.Response.Write(data);
                }

                //获取所有财务记录,并获取 支付宝财务通对账号
                if (oper == "ComFinancelist")
                {
                    var comid     = "999999";
                    var pageindex = context.Request["pageindex"].ConvertTo <int>(1);
                    var pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    var key       = context.Request["key"].ConvertTo <string>("");
                    var oid       = context.Request["oid"].ConvertTo <int>(0);

                    var payment_type = context.Request["payment_type"].ConvertTo <string>("");
                    var money_come   = context.Request["money_come"].ConvertTo <string>("");
                    var starttime    = context.Request["starttime"].ConvertTo <string>("");
                    var endtime      = context.Request["endtime"].ConvertTo <string>("");


                    string data = FinanceJsonData.ComFinancePageList(comid, pageindex, pagesize, key, oid, payment_type, money_come, starttime, endtime);

                    context.Response.Write(data);
                }


                if (oper == "WithdrawConf")
                {
                    int    comid   = context.Request["comid"].ConvertTo <int>(0);
                    int    id      = context.Request["id"].ConvertTo <int>(0);
                    string remarks = context.Request["remarks"].ConvertTo <string>("");

                    int printscreen = context.Request["printscreen"].ConvertTo <int>(0);

                    string data = "";
                    try
                    {
                        data = FinanceJsonData.WithdrawConf(id, comid, remarks, printscreen);
                    }
                    catch
                    {
                        data = "";
                    }
                    context.Response.Write(data);
                }
                if (oper == "getpaytype")
                {
                    int    comid = context.Request["comid"].ConvertTo <int>(0);
                    string data  = "";//获取公司基本信息和扩展信息
                    try
                    {
                        data = FinanceJsonData.FinancePayType(comid);
                    }
                    catch
                    {
                        data = "";
                    }
                    context.Response.Write(data);
                }

                //修改支付方式
                if (oper == "editpaytype")
                {
                    int id      = context.Request["id"].ConvertTo <int>(0);
                    int comid   = context.Request["comid"].ConvertTo <int>(0);
                    int act     = context.Request["act"].ConvertTo <int>(0);
                    int paytype = Int32.Parse(context.Request["paytype"]);

                    B2b_Finance findate = new B2b_Finance()
                    {
                        Id      = id,
                        Com_id  = comid,
                        Act     = act,
                        Paytype = paytype
                    };

                    var data = FinanceJsonData.ModifyFinancePayType(findate);
                    context.Response.Write(data);
                }

                //提现
                if (oper == "Withdraw")
                {
                    int     id           = context.Request["id"].ConvertTo <int>(0);
                    int     comid        = context.Request["comid"].ConvertTo <int>(0);
                    decimal money        = 0 - context.Request["money"].ConvertTo <decimal>(0);//提现直接为负数
                    string  bank_account = context.Request["bank_account"];
                    string  bank_card    = context.Request["bank_card"];
                    string  bank_name    = context.Request["bank_name"];

                    //得到商家信息,账户余额
                    B2b_company modelcom   = B2bCompanyData.GetCompany(comid);
                    decimal     Over_money = modelcom.Imprest + money;

                    B2b_Finance findate = new B2b_Finance()
                    {
                        Id           = id,
                        Com_id       = comid,
                        Money        = money,
                        Money_come   = bank_account,
                        Servicesname = bank_account + ":" + bank_card + ":" + bank_name,
                        Payment      = 1,
                        SerialNumber = DateTime.Now.ToString("yyyyMMddhhmmssfff"),
                        Payment_type = "商家提现",
                        Over_money   = Over_money
                    };

                    var data = FinanceJsonData.ModifyFinanceWithdraw(findate);
                    context.Response.Write(data);
                }
                //修改支付银行状态
                if (oper == "Upbanktype")
                {
                    int                 comid = context.Request["comid"].ConvertTo <int>(0);
                    int                 type  = context.Request["type"].ConvertTo <int>(0);
                    var                 data  = "";
                    B2bFinanceData      fdate = new B2bFinanceData();
                    B2b_finance_paytype com   = fdate.FinancePayType(comid);
                    if (com != null)
                    {
                        com.Uptype = type;
                        data       = FinanceJsonData.ModifyFinancePayBank(com);
                    }
                    context.Response.Write(data);
                }

                //修改支付银行
                if (oper == "editpaybank")
                {
                    int    id             = context.Request["id"].ConvertTo <int>(0);
                    int    comid          = context.Request["comid"].ConvertTo <int>(0);
                    int    paytype        = Int32.Parse(context.Request["paytype"]);
                    string bank_account   = context.Request["bank_account"];
                    string bank_card      = context.Request["bank_card"];
                    string bank_name      = context.Request["bank_name"];
                    string alipay_account = context.Request["alipay_account"];
                    string alipay_id      = context.Request["alipay_id"];
                    string alipay_key     = context.Request["alipay_key"];
                    bool   type           = context.Request["type"].ConvertTo <bool>(false);
                    int    Uptype         = 0;
                    if (type == true)
                    {
                        Uptype = 1;
                    }

                    B2b_finance_paytype findate = new B2b_finance_paytype()
                    {
                        Id             = id,
                        Com_id         = comid,
                        Bank_account   = bank_account,
                        Bank_card      = bank_card,
                        Bank_name      = bank_name,
                        Alipay_account = alipay_account,
                        Alipay_id      = alipay_id,
                        Alipay_key     = alipay_key,
                        Paytype        = paytype,
                        Uptype         = Uptype,
                    };

                    var data = FinanceJsonData.ModifyFinancePayBank(findate);
                    context.Response.Write(data);
                }

                //修改微信支付设置
                if (oper == "editpaywx")
                {
                    int id    = context.Request["id"].ConvertTo <int>(0);
                    int comid = context.Request["comid"].ConvertTo <int>(0);

                    string appid      = context.Request["appid"];
                    string appkey     = context.Request["appkey"];
                    string paysignkey = context.Request["paysignkey"];
                    string partnerid  = context.Request["partnerid"];
                    string partnerkey = context.Request["partnerkey"];

                    string wx_SSLCERT_PATH     = context.Request["wx_SSLCERT_PATH"].ConvertTo <string>("");
                    string wx_SSLCERT_PASSWORD = context.Request["wx_SSLCERT_PASSWORD"].ConvertTo <string>("");

                    B2b_finance_paytype findate2 = new B2b_finance_paytype()
                    {
                        Id                  = id,
                        Com_id              = comid,
                        Wx_appid            = appid,
                        Wx_appkey           = appkey,
                        Wx_partnerid        = partnerid,
                        Wx_paysignkey       = paysignkey,
                        Wx_partnerkey       = partnerkey,
                        wx_SSLCERT_PATH     = wx_SSLCERT_PATH,
                        wx_SSLCERT_PASSWORD = wx_SSLCERT_PASSWORD
                    };

                    var data = FinanceJsonData.ModifyFinancePayWX(findate2);
                    context.Response.Write(data);
                }



                if (oper == "integrallist")
                {
                    var    comid     = context.Request["comid"].ConvertTo <int>(0);
                    int    pageindex = context.Request["pageindex"].ConvertTo <int>(1);
                    int    pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    string key       = context.Request["key"].ConvertTo <string>("");

                    string data = FinanceJsonData.IntegralList(pageindex, pagesize, comid, key);

                    context.Response.Write(data);
                    //context.Response.Write("Hello World");
                }

                if (oper == "integralcount")
                {
                    var    comid = context.Request["comid"].ConvertTo <int>(0);
                    string data  = FinanceJsonData.IntegralCount(comid);
                    context.Response.Write(data);
                    //context.Response.Write("Hello World");
                }


                if (oper == "imprestlist")
                {
                    var    comid     = context.Request["comid"].ConvertTo <int>(0);
                    int    pageindex = context.Request["pageindex"].ConvertTo <int>(1);
                    int    pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    string key       = context.Request["key"].ConvertTo <string>("");

                    string data = FinanceJsonData.ImprestList(pageindex, pagesize, comid, key);

                    context.Response.Write(data);
                    //context.Response.Write("Hello World");
                }

                if (oper == "imprestcount")
                {
                    var    comid = context.Request["comid"].ConvertTo <int>(0);
                    string data  = FinanceJsonData.ImprestCount(comid);
                    context.Response.Write(data);
                    //context.Response.Write("Hello World");
                }

                if (oper == "shougongqueren")
                {
                    var    trade_no  = context.Request["trade_no"].ConvertTo <string>("");
                    var    order_no  = context.Request["order_no"].ConvertTo <int>(0);
                    var    total_fee = context.Request["total_fee"].ConvertTo <decimal>(0);
                    string data      = FinanceJsonData.shougongqueren(trade_no, order_no, total_fee);
                    context.Response.Write(data);
                    //context.Response.Write("Hello World");
                }
            }
        }