//public int accountlevel = 0;//账户级别:0开户账户;1添加账户 protected void Page_Load(object sender, EventArgs e) { //int accountid = Request["accountid"].ConvertTo<int>(0); //Agent_regiinfo m_account = AgentCompanyData.GetAgentAccountByid(accountid); //if (m_account == null)//没有分销账户直接退出 //{ // Response.Redirect("login.aspx"); //} //accountlevel = m_account.AccountLevel; if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); //查询此分销是否为开户账户如果不是则返回登录页,此页面只有开户账户才能管理 var agentdate = AgentCompanyData.GetAgentByid(Agentid); if (agentdate == null) { Response.Redirect("/Agent/login.aspx"); } if (agentdate.AccountLevel != 0) { Response.Redirect("/Agent/login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Agentid"] != null) { try { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); if (Agentid != 0) { var agentdata = AgentCompanyData.GetAgentByid(Agentid); if (agentdata != null) { Agentsort = agentdata.Agentsort; } } } catch { Response.Redirect("/Agent/login.aspx"); } } }
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; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Agentid"] != null) { //账户信息 var aget = Session["Agentid"].ToString(); if (aget != "") { Agentid = Int32.Parse(aget); Account = Session["Account"].ToString(); } if (Agentid != 0) { var agentdata = AgentCompanyData.GetAgentByid(Agentid); if (agentdata != null) { Agentsort = agentdata.Agentsort; } } //微信渠道 if (Agentsort == 1) { Response.Redirect("Agent_Com_list.aspx"); } //项目账户 if (Agentsort == 2) { Response.Redirect("Project.aspx"); } } }
/// <summary> /// 编辑注册信息 by:xiaoliu /// </summary> /// <param name="b2b_company"></param> /// <param name="B2b_Company_Info"></param> /// <param name="manageuser"></param> /// <returns></returns> public static string InsertOrUpdateRegister(B2b_company b2b_company, B2b_company_info B2b_Company_Info, B2b_company_manageuser manageuser) { using (var sql = new SqlHelper()) { try { //判断登录账户是否存在 B2b_company_manageuser model2 = B2bCompanyManagerUserData.GetManageUserByAccount(manageuser.Accounts); if (model2 != null) { return(JsonConvert.SerializeObject(new { type = 1, msg = "账户已经被注册" })); } //判断商家注册公司名称是否存在 B2b_company model1 = B2bCompanyManagerUserData.GetB2bCompanyByCompanyName(b2b_company.Com_name); if (model1 != null) { return(JsonConvert.SerializeObject(new { type = 1, msg = "商家公司已经被注册" })); } int result = new InternalB2bCompany(sql).EditB2bCompanyInfo(b2b_company, B2b_Company_Info, manageuser);//编辑注册公司全部信息 if (result > 0) { //当注册成功 后,对绑定分销判断,如果有绑定分销直接进行绑定 if (b2b_company.Bindingagent != 0) { var bangdinginfo = AgentCompanyData.BindingAgent(result, b2b_company.Bindingagent);//商户和分销绑定 var prodata = new B2bCompanyInfoData(); var kaitong = prodata.UpComstate(result, "已暂停");//对暂停的 自动开通 //分配权限 int createmasterid = 0; string createmastername = "分销开商户自动分配微信负责人(1024)"; DateTime createdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //获取 string masterid = B2bCompanyManagerUserData.GetFirstIDUser(result).ToString(); string data = PermissionJsonData.EditMasterGroup(masterid, manageuser.Accounts, "1024", createmasterid, createmastername, createdate); } return(JsonConvert.SerializeObject(new { type = 100, msg = "商家注册成功", result = result })); } else { return(JsonConvert.SerializeObject(new { type = 100, msg = "商家注册出现错误" })); } } catch { //sql.Rollback(); return(JsonConvert.SerializeObject(new { type = 1, msg = "商家注册出现意外错误" })); throw; } } }
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"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); if (Agentid != 0) { var com = B2bCompanyData.GetAllComMsgbyAgentid(Agentid); if (com != null) { //返回登陆成功 loginstate = 1; } else { var agentinfo = AgentCompanyData.GetAgentByid(Agentid); if (agentinfo != null) { var mobile = agentinfo.Mobile; phone = agentinfo.Mobile; if (mobile != "") { var com_id = B2bCompanyData.GetAllComMsgbyphone(mobile); if (com_id > 0) { phonestate = com_id; var cominfo = B2bCompanyData.GetAllComMsg(com_id); if (cominfo != null) { comname = cominfo.Com_name; } } else if (com_id < 0) { phonestate = com_id; } } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Agentid"] != null) { //账户信息 var aget = Session["Agentid"].ToString(); if (aget != "") { Agentid = Int32.Parse(aget); Account = Session["Account"].ToString(); } if (Agentid != 0) { var agentdata = AgentCompanyData.GetAgentByid(Agentid); if (agentdata != null) { Agentsort = agentdata.Agentsort; } } } }
protected void Page_Load(object sender, EventArgs e) { comaccount = Request["comaccount"].ConvertTo <string>(""); if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); if (Agentid != 0) { var agentdata = AgentCompanyData.GetAgentByid(Agentid); if (agentdata != null) { Agentsort = agentdata.Agentsort; } } } }
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"); } } }
public string inter_sendmethod = "post"; //分销商验证通知发送方式 protected void Page_Load(object sender, EventArgs e) { Agentid = Request["agentid"].ConvertTo <int>(0); //根据机构号获得机构(分销商)信息 Agent_company agentcompany = new AgentCompanyData().GetAgentCompany(Agentid); if (agentcompany != null) { agent_no = agentcompany.Id + 1000000000; deskey = agentcompany.Inter_deskey; if (deskey == "") { //随机生成6位随机秘钥 deskey = CommonFunc.RandCode(8).ToUpper(); //把新生成的秘钥录入数据库 int r = new AgentCompanyData().UpAgentip(agentcompany.Id, deskey); } agent_updateurl = agentcompany.Agent_updateurl; agentbind_ip = new AgentCompanyData().GetAgentBind_ip(Agentid); inter_sendmethod = agentcompany.inter_sendmethod; } }
protected void Page_Load(object sender, EventArgs e) { Id = Request["id"].ConvertTo <int>(0); //判断登录账户是否为分销开户账户 if (Session["Agentid"] != null) { Agentid = Int32.Parse(Session["Agentid"].ToString()); } var agentdate = AgentCompanyData.GetAgentByid(Agentid); if (agentdate == null) { Response.Redirect("/Agent/login.aspx"); } if (agentdate.AccountLevel != 0) { Response.Redirect("/Agent/login.aspx"); } }
//验证通知 protected void Button4_Click(object sender, EventArgs e) { string pno = TextBox2.Text.Trim(); if (pno == "") { Label1.Text = "电子码不可为空"; return; } if (pno.Length == 12 || pno.Length == 13) { } else { Label1.Text = "电子码格式有误"; return; } int bindorderid = new B2bOrderData().GetOrderidbypno(pno); if (bindorderid == 0) { Label1.Text = "电子码输入有误"; return; } //a订单:原分销向指定商户提交的订单;b订单:指定商户下的绑定分销向拥有产品的商户提交的订单 //电子票表中记录的Oid是b订单 //判断b订单 是否 属于某个a订单 B2b_order loldorder = new B2bOrderData().GetOldorderBybindingId(bindorderid); if (loldorder != null) { //得到a订单的分销信息 if (loldorder.Agentid > 0) { Agent_company acompany = new AgentCompanyData().GetAgentCompany(loldorder.Agentid); if (acompany != null) { string agent_updateurl = acompany.Agent_updateurl; string agent_Inter_deskey = acompany.Inter_deskey; int a_comid = loldorder.Comid; int a_orderid = loldorder.Id; int a_agentid = loldorder.Agentid; if (agent_updateurl.Trim() != "" && agent_Inter_deskey != "") { //根据bingorderid 得到验证成功日志列表 List <B2b_eticket_log> loglist = new B2bEticketLogData().GeteticketloglistByorderid(bindorderid); if (loglist.Count > 0) { foreach (B2b_eticket_log log in loglist) { if (log != null) { AsyncSend(agent_updateurl, log.Pno, log.Use_pnum, log.Actiondate.ToString("yyyy-MM-dd HH:mm:ss"), a_agentid, a_comid, log.Id); } } Label1.Text = "验证通知发送成功"; return; } else { Label1.Text = "根据订单得到验证日志出错"; return; } } } else { Label1.Text = "分销订单查询出错"; return; } } else { Label1.Text = "不是分销订单"; return; } } }
//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"); } } }
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"); } } }
delegate void AsyncsendEventHandler(string updateurl, string pno, int confirmnum, string confirmtime, int agentcomid, int comid, int validateticketlogid, int aorderid);//发送验证同步发送请求委托 public void ProcessRequest(HttpContext context) { //B2b_company commanage = B2bCompanyData.GetAllComMsg(112); WlGetProInfoDealRequestData wldata = new WlGetProInfoDealRequestData("1", "key");//核销数据时不需要读取商户 int comid = 0; context.Response.ContentType = "application/x-www-form-urlencoded"; Stream stream = context.Request.InputStream; if (stream.Length != 0) { try { StreamReader streamreader = new StreamReader(stream); string json = streamreader.ReadToEnd(); //var OnlineMsg = StreamToString(stream); // context.Response.Write(OnlineMsg); // context.Response.End(); var json_hexiao = (wlhexiao)JsonConvert.DeserializeObject(json, typeof(wlhexiao)); int partnerId = json_hexiao.partnerId; string wlOrderId = json_hexiao.body.wlOrderId; int usedQuantity = json_hexiao.body.usedQuantity; int quantity = json_hexiao.body.quantity; int refundedQuantity = json_hexiao.body.refundedQuantity; int lastCount = 0; string credence = ""; var orderdata = wldata.getWlOrderidData(wlOrderId); if (orderdata != null) { comid = orderdata.comid; credence = orderdata.vouchers; int orderid = orderdata.orderid; //orderid int partnerdealid = orderdata.partnerdealid; //产品id int shengyuq = orderdata.quantity - orderdata.usedQuantity; lastCount = shengyuq - usedQuantity; //剩余数量看是否大于0 //插入万龙核销日志插入 var wluselog = wldata.InsertWlUseLog(comid, wlOrderId, usedQuantity, partnerId, quantity, orderid, partnerdealid); if (shengyuq >= usedQuantity) { orderdata.usedQuantity = orderdata.usedQuantity + usedQuantity;//库里的剩余数量加上传递过来使用数量 var hexiao = wldata.UpdateWlOrderPaySC(orderdata); var wlhexiaore = wldata.wlhexiaotongzhi_json(200, "成功");// context.Response.Write(wlhexiaore); #region 验证后订单及通知发放 //易城系统订单 处理 B2b_order morder = new B2bOrderData().GetOrderById(orderid); if (morder != null) { if (lastCount > 0) { morder.service_usecount = usedQuantity; morder.service_lastcount = lastCount; morder.Servicepro_v_state = ((int)Product_V_State.PartValidate).ToString(); //验证部分 morder.Order_state = (int)OrderStatus.HasUsed; //已消费 new B2bOrderData().InsertOrUpdate(morder); } else { //如果剩余数量为0就,使都使用了,剩余数量为0 morder.service_usecount = usedQuantity; morder.service_lastcount = 0; morder.Servicepro_v_state = ((int)Product_V_State.AllValidate).ToString(); //验证全部 morder.Order_state = (int)OrderStatus.HasUsed; //已消费 new B2bOrderData().InsertOrUpdate(morder); } //根据b单判断是否有a单存在 B2b_order aorder = new B2bOrderData().GetOldorderBybindingId(morder.Id); if (aorder != null) { aorder.Order_state = morder.Order_state; new B2bOrderData().InsertOrUpdate(aorder); } //如果是分销订单,则需要给分销发送验证通知 //判断b订单 是否 属于某个a订单 if (aorder != null) { //得到a订单的分销信息 if (aorder.Agentid > 0) { Agent_company acompany = new AgentCompanyData().GetAgentCompany(aorder.Agentid); if (acompany != null) { //异步发送验证同步请求 AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend); mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), credence, usedQuantity, DateTime.Now.ToString(), aorder.Agentid, aorder.Comid, 0, aorder.Id, new AsyncCallback(Completed), null); } } } else { if (morder.Agentid > 0) { Agent_company acompany = new AgentCompanyData().GetAgentCompany(morder.Agentid); if (acompany != null) { //异步发送验证同步请求 AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend); mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), credence, usedQuantity, DateTime.Now.ToString(), morder.Agentid, morder.Comid, 0, morder.Id, new AsyncCallback(Completed), null); } } } } #endregion } else { var wlhexiaore = wldata.wlhexiaotongzhi_json(1, "剩余数量不符");// context.Response.Write(wlhexiaore); } } else { //context.Response.Write("{code:200,describe:\"成功\"}"); var wlhexiaore = wldata.wlhexiaotongzhi_json(1, "未查询到订单");// context.Response.Write(wlhexiaore); } } catch (Exception ex) { var wlhexiaore = wldata.wlhexiaotongzhi_json(1, "异常" + ex.Message);// context.Response.Write(wlhexiaore); } } else { var wlhexiaore = wldata.wlhexiaotongzhi_json(2, "未接收到数据");// context.Response.Write(wlhexiaore); } }
public int Agentsort = 1;//0为票务分销,1为微站渠道,2为项目商户 protected void Page_Load(object sender, EventArgs e) { if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); if (Session["Account"] == null) { Response.Redirect("login.aspx"); } account = Session["Account"].ToString(); if (Agentid != 0) { var agentdata = AgentCompanyData.GetAgentByid(Agentid); if (agentdata != null) { Agentsort = agentdata.Agentsort; } } var agentdate = AgentCompanyData.GetAgentAccountByUid(account, Agentid); if (agentdate == null)//没有分销账户直接退出 { Response.Redirect("login.aspx"); } accountid = agentdate.Id; AccountLevel = agentdate.AccountLevel; } else { if (Request.Cookies["Agentid"] != null) { string accountmd5 = ""; string Account = ""; int Agentid_temp = int.Parse(Request.Cookies["Agentid"].Value); if (Request.Cookies["AgentKey"] != null) { accountmd5 = Request.Cookies["AgentKey"].Value; } if (Request.Cookies["Account"] != null) { Account = Request.Cookies["Account"].Value; } var agentdata = AgentCompanyData.GetAgentByid(Agentid_temp); if (agentdata != null) { var returnmd5 = EncryptionHelper.ToMD5(Account + "lixh1210" + Agentid_temp, "UTF-8"); if (returnmd5 == accountmd5) { Session["Agentid"] = Agentid_temp; Session["Account"] = Account; Response.Redirect(Request.Url.ToString()); } else { Response.Redirect("login.aspx"); } } else { Response.Redirect("login.aspx"); } } else { Response.Redirect("login.aspx"); } } }
public static void AsyncSend(string updateurl, string pno, int confirmnum, string confirmtime, int agentcomid, int comidd1, int validateticketlogid, int aorderid) { Agent_asyncsendlog log = new Agent_asyncsendlog { Id = 0, Pno = pno, Num = confirmnum, Sendtime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), Confirmtime = DateTime.Parse(confirmtime), Issendsuc = 0,//0失败;1成功 Agentupdatestatus = (int)AgentUpdateStatus.Fail, Agentcomid = agentcomid, Comid = comidd1, Remark = "", Issecondsend = 0, Platform_req_seq = (1000000000 + agentcomid).ToString() + DateTime.Now.ToString("yyyyMMddhhssmm") + CommonFunc.CreateNum(6),//请求流水号 Request_content = "", Response_content = "", b2b_etcket_logid = validateticketlogid }; int inslog = new Agent_asyncsendlogData().EditLog(log); log.Id = inslog; try { //获得分销商信息 Agent_company agentinfo = new AgentCompanyData().GetAgentCompany(agentcomid); if (agentinfo != null) { string agent_updateurl = agentinfo.Agent_updateurl; #region 糯米分销 if (agentinfo.Agent_type == (int)AgentCompanyType.NuoMi)//糯米分销 { string re = new GetUrlData().HttpPost(updateurl, ""); XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + re + "}"); XmlElement root = doc.DocumentElement; string info = root.SelectSingleNode("info").InnerText; //只要返回了数据,则是发送成功 log.Id = inslog; log.Issendsuc = 1; log.Request_content = updateurl; log.Response_content = re; if (info == "success") { string errCode = root.SelectSingleNode("res/errCode").InnerText;//分销商更新结果 if (errCode == "0") { log.Agentupdatestatus = (int)AgentUpdateStatus.Suc; new Agent_asyncsendlogData().EditLog(log); } else { log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); } } else { log.Remark = info; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); } } #endregion #region 一般分销 else //一般分销 { /*根据订单号得到分销商订单请求记录(当前需要得到原订单请求流水号)*/ List <Agent_requestlog> listagent_rlog = new Agent_requestlogData().GetAgent_requestlogByOrdernum(aorderid.ToString(), "add_order", "1"); if (listagent_rlog == null) { log.Remark = "根据订单号得到分销商订单请求记录失败";//单引号替换为'',双引号不用处理; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return; } if (listagent_rlog.Count == 0) { log.Remark = "根据订单号得到分销商订单请求记录失败.";//单引号替换为'',双引号不用处理; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return; } /*验证通知发送内容*/ string sbuilder = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<business_trans>" + "<request_type>sync_order</request_type>" + //<!--验证同步--> "<req_seq>{0}</req_seq>" + //<!--原订单请求流水号--> "<platform_req_seq>{1}</platform_req_seq>" + //<!--平台请求流水号--> "<order>" + //<!--订单信息--> "<code>{5}</code>" + //<!-- 验证电子码 y--> "<order_num>{2}</order_num>" + //<!-- 订单号 y--> "<num>{3}</num>" + //<!-- 使用张数 --> "<use_time>{4}</use_time>" + //<!-- 使用时间 --> "</order>" + "</business_trans>", listagent_rlog[0].Req_seq, log.Platform_req_seq, aorderid, confirmnum, CommonFunc.ConvertDateTimeInt(DateTime.Parse(confirmtime)), pno); #region 分销通知发送方式post if (agentinfo.inter_sendmethod.ToLower() == "post") { string re = ""; if (agentcomid == 6490) { re = new GetUrlData().HttpPost(updateurl, sbuilder); updateurl += "?xml=" + sbuilder;//只为记录 } else { updateurl += "?xml=" + sbuilder; re = new GetUrlData().HttpPost(updateurl, ""); } //只要返回了数据,则是发送成功 log.Id = inslog; log.Issendsuc = 1; log.Request_content = updateurl; log.Response_content = re; log.Remark = re.Replace("'", "''");//单引号替换为'',双引号不用处理; if (re.Length >= 7) { re = re.Substring(0, 7); } if (re == "success") { log.Agentupdatestatus = (int)AgentUpdateStatus.Suc; new Agent_asyncsendlogData().EditLog(log); } else { log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); } } #endregion #region 分销通知发送方式get else { if (updateurl.IndexOf('?') > -1) { updateurl += "&xml=" + sbuilder; } else { updateurl += "?xml=" + sbuilder; } string re = new GetUrlData().HttpGet(updateurl); //只要返回了数据,则是发送成功 log.Id = inslog; log.Issendsuc = 1; log.Request_content = updateurl; log.Response_content = re; log.Remark = re.Replace("'", "''");//单引号替换为'',双引号不用处理; if (re.Length >= 7) { re = re.Substring(0, 7); } if (re == "success") { log.Agentupdatestatus = (int)AgentUpdateStatus.Suc; new Agent_asyncsendlogData().EditLog(log); } else { log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); } } #endregion } #endregion } else { log.Remark = "分销商获取失败"; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); } } catch (Exception e) { log.Id = inslog; log.Remark = e.Message.Replace("'", "''");//单引号替换为'',双引号不用处理 new Agent_asyncsendlogData().EditLog(log); } }
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.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态 } } }
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"); } } }
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)); } } }
protected void Page_Load(object sender, EventArgs e) { Email = Request["Email"].ConvertTo <string>(""); //获得comid:为0则进入登录页面;非0则进入下面流程 string RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower(); comid = GeneralFunc.GetComid(RequestUrl); if (comid == 0) { return; } //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "RequestUrl:" + RequestUrl); //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "comid:" + comid); //以下3个参数用于获取微信号,并且通过判断实现手机分销系统免登陆 string code = Request["code"].ConvertTo <string>(""); //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "code:" + code); string openid = Request["openid"].ConvertTo <string>(""); string weixinpass = Request["weixinpass"].ConvertTo <string>(""); //如果3个参数都为空,则进入登录页面 if (code == "" && openid == "" && weixinpass == "") { return; } //如果以上3个参数中有参数传递过来,则进入手机分销系统免登陆判断 if (code != "")//根据微信端code获取微信号 { openid = GetOpenId(code, comid); //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "openid:" + openid); } else//根据微信一次性密码获取微信号 { if (openid != "" && weixinpass != "")//微信端发送来的请求 { bool isavailable = VerifyOneOffPass(openid, weixinpass); if (isavailable == false) { //微信一次性密码失效,判断传递过来的openid 和 客户端cookie中openid 是否相同(防止转发):相同直接免登陆进入手机分销后台;否则进入登录手机分销页面 HttpCookie cookie = Request.Cookies["openid"]; if (cookie != null) { string cookieValue = cookie.Value; if (cookieValue != openid) { openid = ""; } } //else { openid = openid; } //微信一次性密,可以不操作 } //else { openid = openid; } //传递过来的openid 和 客户端cookie中openid相符,可以不操作 } else//非微信端发送来的请求,需要进入登录页面 { openid = ""; } } if (openid != "")//如果微信号 获取成功,则获取当前微信号 微信免登陆 对应的分销商:有则免登陆;没有则需要登录 { Agent_company freelandingagentuser = new AgentCompanyData().GetFreeLandingAgentUserByOpenId(openid); if (freelandingagentuser != null) { Session["Agentid"] = freelandingagentuser.Id;//分销公司id,并不是分销员工id Session["Account"] = freelandingagentuser.Account; //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "agentid:" + freelandingagentuser.Id + ",account:" + freelandingagentuser.Account); HttpCookie cookie = new HttpCookie("Agentid"); //实例化HttpCookie类并添加值 cookie.Value = freelandingagentuser.Id.ToString(); //分销公司id,并不是分销员工id cookie.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie); var returnmd5 = EncryptionHelper.ToMD5(freelandingagentuser.Account + "lixh1210" + freelandingagentuser.Id.ToString(), "UTF-8"); cookie = new HttpCookie("AgentKey"); //实例化HttpCookie类并添加值 cookie.Value = returnmd5; cookie.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie); cookie = new HttpCookie("Account"); //分销账户 cookie.Value = freelandingagentuser.Account; cookie.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie); Response.Redirect("default.aspx"); } } }
public string AsyncSend(Agent_asyncsendlog log1) { lock (lockobj) { Agent_asyncsendlog log = new Agent_asyncsendlog { Id = 0, Pno = log1.Pno, Num = log1.Num, Sendtime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), Confirmtime = log1.Confirmtime, Issendsuc = 0,//0失败;1成功 Agentupdatestatus = (int)AgentUpdateStatus.Fail, Agentcomid = log1.Agentcomid, Comid = log1.Comid, Remark = "", Issecondsend = 1, Platform_req_seq = log1.Platform_req_seq,//平台流水号,同一次验证的平台流水号相同,分销商根据平台流水号判断是否是同一次验证 Request_content = "", Response_content = "", b2b_etcket_logid = log1.b2b_etcket_logid }; int inslog = new Agent_asyncsendlogData().EditLog(log); log.Id = inslog; try { var eticketinfo = new B2bEticketData().GetEticketDetail(log1.Pno); if (eticketinfo.Agent_id > 0)//分销商电子票,需要发送验证同步请求 { //获得分销商信息 Agent_company agentinfo = new AgentCompanyData().GetAgentCompany(log1.Agentcomid); if (agentinfo != null) { string agent_updateurl = agentinfo.Agent_updateurl; #region 糯米分销 if (agentinfo.Agent_type == (int)AgentCompanyType.NuoMi)//糯米分销 { //查询站外码状态 string username = agentinfo.Agent_auth_username; //百度糯米用户名 string token = agentinfo.Agent_auth_token; //百度糯米token string code = eticketinfo.Pno; //券码 string bindcomname = agentinfo.Agent_bindcomname; //供应商名称 string updateurl = agent_updateurl + "?auth={\"userName\":\"" + username + "\",\"token\":\"" + token + "\"}&code=" + code + "&userName="******"&dealId=&phone=";; string re = new GetUrlData().HttpPost(updateurl, ""); XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + re + "}"); XmlElement root = doc.DocumentElement; string info = root.SelectSingleNode("info").InnerText; //只要返回了数据,则是发送成功 log.Id = inslog; log.Issendsuc = 1; log.Request_content = updateurl; log.Response_content = re; if (info == "success") { string errCode = root.SelectSingleNode("res/errCode").InnerText;//分销商更新结果 if (errCode == "0") { log.Agentupdatestatus = (int)AgentUpdateStatus.Suc; new Agent_asyncsendlogData().EditLog(log); return("糯米成功"); } else { log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return("糯米失败:" + log.Agentupdatestatus); } } else { log.Remark = info; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return("糯米失败:" + log.Remark); } } #endregion #region 一般分销推送验证同步请求 else { //一般分销推送验证同步请求 if (agent_updateurl.Trim() == "" || agentinfo.Inter_deskey == "") { log.Remark = "分销商验证同步通知或秘钥没提供";//单引号替换为'',双引号不用处理; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return(log.Remark); } if (eticketinfo.Oid == 0) { log.Remark = "电子票对应的订单号为0";//单引号替换为'',双引号不用处理; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return(log.Remark); } //a订单:原分销向指定商户提交的订单;b订单:指定商户下的绑定分销向拥有产品的商户提交的订单 //电子票表中记录的Oid是b订单 //判断b订单 是否 属于某个a订单 B2b_order loldorder = new B2bOrderData().GetOldorderBybindingId(eticketinfo.Oid); if (loldorder != null) { eticketinfo.Oid = loldorder.Id; } /*根据订单号得到分销商订单请求记录(当前需要得到原订单请求流水号)*/ List <Agent_requestlog> listagent_rlog = new Agent_requestlogData().GetAgent_requestlogByOrdernum(eticketinfo.Oid.ToString(), "add_order", "1"); if (listagent_rlog == null) { log.Remark = "根据订单号得到分销商订单请求记录失败";//单引号替换为'',双引号不用处理; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return(log.Remark); } if (listagent_rlog.Count == 0) { log.Remark = "根据订单号得到分销商订单请求记录失败.";//单引号替换为'',双引号不用处理; log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return(log.Remark); } /*验证通知发送内容*/ string sbuilder = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<business_trans>" + "<request_type>sync_order</request_type>" + //<!--验证同步--> "<req_seq>{0}</req_seq>" + //<!--原订单请求流水号--> "<platform_req_seq>{1}</platform_req_seq>" + //<!--平台请求流水号--> "<order>" + //<!--订单信息--> "<order_num>{2}</order_num>" + //<!-- 订单号 y--> "<num>{3}</num>" + //<!-- 使用张数 --> "<use_time>{4}</use_time>" + //<!-- 使用时间 --> "</order>" + "</business_trans>", listagent_rlog[0].Req_seq, log.Platform_req_seq, eticketinfo.Oid, log.Num, ConvertDateTimeInt(log.Confirmtime)); string updateurl = agent_updateurl + "?xml=" + sbuilder; string re = new GetUrlData().HttpPost(updateurl, ""); //只要返回了数据,则是发送成功 log.Id = inslog; log.Issendsuc = 1; log.Request_content = updateurl; log.Response_content = re; log.Remark = re.Replace("'", "''");//单引号替换为'',双引号不用处理; if (re.Length >= 7) { re = re.Substring(0, 7); } if (re == "success") { log.Agentupdatestatus = (int)AgentUpdateStatus.Suc; new Agent_asyncsendlogData().EditLog(log); return("成功"); } else { log.Agentupdatestatus = (int)AgentUpdateStatus.Fail; new Agent_asyncsendlogData().EditLog(log); return(re); } } #endregion } else { return("分销商信息获取失败"); } } else { return("直销订单无需发送验证通知"); } } catch (Exception e) { log.Id = inslog; log.Remark = e.Message.Replace("'", "''");//单引号替换为'',双引号不用处理 new Agent_asyncsendlogData().EditLog(log); return(log.Remark); } } }
protected void Page_Load(object sender, EventArgs e) { comid_temp = Request["comid"].ConvertTo <int>(0); if (Session["Agentid"] != null) { //账户信息 Agentid = (Session["Agentid"].ToString()).ConvertTo <int>(0); B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; } if (Session["Account"] == null) { Response.Redirect("login.aspx"); } account = Session["Account"].ToString(); if (Agentid != 0) { var agentdata = AgentCompanyData.GetAgentByid(Agentid); if (agentdata != null) { Agentsort = agentdata.Agentsort; if (Agentsort == 1) { Response.Redirect("default.aspx"); } } } var agentdate = AgentCompanyData.GetAgentAccountByUid(account, Agentid); if (agentdate == null)//没有分销账户直接退出 { Response.Redirect("login.aspx"); } AccountLevel = agentdate.AccountLevel; } else { if (Request.Cookies["Agentid"] != null) { string accountmd5 = ""; string Account = ""; int Agentid_temp = (Request.Cookies["Agentid"].Value).ConvertTo <int>(0); if (Request.Cookies["AgentKey"] != null) { accountmd5 = Request.Cookies["AgentKey"].Value; } if (Request.Cookies["Account"] != null) { Account = Request.Cookies["Account"].Value; } var agentdata = AgentCompanyData.GetAgentByid(Agentid_temp); if (agentdata != null) { var returnmd5 = EncryptionHelper.ToMD5(Account + "lixh1210" + Agentid_temp, "UTF-8"); if (returnmd5 == accountmd5) { Session["Agentid"] = Agentid_temp; Session["Account"] = Account; Response.Redirect(Request.Url.ToString()); } else { Response.Redirect("login.aspx"); } } else { Response.Redirect("login.aspx"); } } else { Response.Redirect("login.aspx"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string oper = context.Request["oper"].ConvertTo <string>(""); if (oper != "") { if (oper == "verifyimgcode") { string getcode = context.Request["imgcode"]; string ret = ""; if (context.Session["SomeValidateCode"] == null) { ret = "{\"type\":1,\"msg\":\"【图形验证码错误】\"}"; } else { string initcode = context.Session["SomeValidateCode"].ToString(); if (getcode != initcode) { ret = "{\"type\":1,\"msg\":\"【图形验证码错误】\"}"; } else { ret = "{\"type\":100,\"msg\":\"\"}"; } } context.Response.Write(ret); } if (oper == "login") { string username = context.Request["username"]; string pwd = context.Request["pwd"]; string getcode = context.Request["getcode"]; string logindata = ""; try { if (context.Session["SomeValidateCode"] == null) { logindata = "{\"type\":1,\"msg\":\"【用户验证码错误】\"}"; } else { string initcode = context.Session["SomeValidateCode"].ToString(); if (getcode != initcode) { logindata = "{\"type\":1,\"msg\":\"【用户验证码错误】\"}"; } else { logindata = RegisterUserJsonData.Login(username, pwd); } } } catch (Exception e) { logindata = "{\"type\":1,\"msg\":\"登录超时,请重新登录\"}"; } context.Response.Write(logindata); } if (oper == "agnetlogincom") { int agentid = context.Request["agentid"].ConvertTo <int>(0); if (context.Session["Agentid"] != null) { if (agentid != Int32.Parse(context.Session["Agentid"].ToString())) { var data1 = "{\"type\":1,\"msg\":\"登陆信息丢失,请重新登录\"}"; context.Response.Write(data1); return; } } else { var data2 = "{\"type\":1,\"msg\":\"登陆信息丢失,请重新登录\"}"; context.Response.Write(data2); return; } string logindata = ""; try { if (agentid == 0) { logindata = "{\"type\":1,\"msg\":\"登陆出错,请重新登录!\"}"; context.Response.Write(logindata); return; } var com = B2bCompanyData.GetAllComMsgbyAgentid(agentid); if (com != null) { var com_user = B2bCompanyManagerUserData.GetFirstIDUser(com.ID); if (com_user != 0) { logindata = RegisterUserJsonData.AgentLoginCom(com_user, com.ID); context.Session["Agent_Com_Login"] = com_user; } else { logindata = "{\"type\":1,\"msg\":\"登录超时,请重新登录!\"}"; } //logindata = RegisterUserJsonData.Login(username, pwd); } else { logindata = "{\"type\":1,\"msg\":\"登录超时,请重新登录!\"}"; } } catch (Exception e) { logindata = "{\"type\":1,\"msg\":\"登录超时,请重新登录!\"}"; } context.Response.Write(logindata); } if (oper == "findpass") { string Account = context.Request["Account"]; string phone = context.Request["phone"]; string getcode = context.Request["getcode"]; string findway = context.Request["findway"]; string accounttype = context.Request["accounttype"]; int comid = context.Request["comid"].ConvertTo <int>(0); string logindata = ""; try { if (context.Session["SomeValidateCode"] == null) { logindata = "{\"type\":1,\"msg\":\"【验证码错误】\"}"; } else { string initcode = context.Session["SomeValidateCode"].ToString(); if (getcode != initcode) { logindata = "{\"type\":1,\"msg\":\"【验证码错误】\"}"; } else { if (accounttype == "1") {//商家重置密码 logindata = RegisterUserJsonData.FindPass(Account, phone, findway); } else if (accounttype == "2")//分销重置密码 { if (comid == 0) { logindata = "{\"type\":1,\"msg\":\"参数错误,请刷新后重新操作\"}"; } else { logindata = AgentJosnData.FindPass(Account, phone, findway, comid); } } else { logindata = "{\"type\":1,\"msg\":\"参数错误,请刷新后重新操作\"}"; } } } } catch (Exception e) { logindata = "{\"type\":1,\"msg\":\"超时,请重新操作\"}"; } context.Response.Write(logindata); } if (oper == "edit") { int id = context.Request["id"].ConvertTo <int>(0); //商家id //商家员工登录信息 int staffid = context.Request["staffid"].ConvertTo <int>(0); //商家员工id string Account = context.Request["Account"]; string passwords = context.Request["passwords"]; int atype = context.Request["atype"].ConvertTo <int>(0); //商家基本信息 int com_type = context.Request["com_type"].ConvertTo <int>(0); string com_name = context.Request["com_name"]; string Scenic_name = context.Request["Scenic_name"].ConvertTo <string>(""); int Com_state = context.Request["com_state"].ConvertTo <int>(0); decimal imprest = context.Request["imprest"].ConvertTo <decimal>(0); //商家扩展信息 int com_extid = context.Request["com_extid"].ConvertTo <int>(0); string com_city = context.Request["city"].ConvertTo <string>(""); string com_add = context.Request["com_add"].ConvertTo <string>(""); int com_class = context.Request["com_class"].ConvertTo <int>(0); string com_code = context.Request["com_code"].ConvertTo <string>(""); string com_sitecode = context.Request["com_sitecode"].ConvertTo <string>(""); string com_license = context.Request["com_license"].ConvertTo <string>(""); string sale_Agreement = context.Request["sale_Agreement"].ConvertTo <string>(""); string agent_Agreement = context.Request["agent_Agreement"].ConvertTo <string>(""); string Scenic_address = context.Request["Scenic_address"].ConvertTo <string>(""); string Scenic_intro = context.Request["Scenic_intro"].ConvertTo <string>(""); string Scenic_Takebus = context.Request["Scenic_Takebus"].ConvertTo <string>(""); string Scenic_Drivingcar = context.Request["Scenic_Drivingcar"].ConvertTo <string>(""); string Contact = context.Request["Contact"].ConvertTo <string>(""); string tel = context.Request["tel"].ConvertTo <string>(""); string phone = context.Request["phone"].ConvertTo <string>(""); string qq = context.Request["qq"].ConvertTo <string>(""); string email = context.Request["email"].ConvertTo <string>(""); string Defaultprint = context.Request["Defaultprint"].ConvertTo <string>(""); string Domainname = context.Request["Domainname"].ConvertTo <string>(""); string province = context.Request["province"].ConvertTo <string>(""); int agentid = 0; string RequestUrl = context.Request.ServerVariables["SERVER_NAME"].ToLower(); agentid = AgentCompanyData.DomainGetAgentid(RequestUrl); int bindingagentid = context.Request["bindingagentid"].ConvertTo <int>(0); if (phone == "") { if (tel.Length == 11) { phone = tel; } } B2b_company b2b_company = new B2b_company() { ID = id, Com_name = com_name, Com_type = com_type, Scenic_name = Scenic_name, Com_state = 2, //默认暂停 Imprest = 0, //默认预付款0 Agentid = agentid, Bindingagent = bindingagentid }; B2b_company_info B2b_Company_Info = new B2b_company_info() { Id = com_extid, Com_id = id, Com_city = com_city, Com_class = com_class, Com_add = com_add, Com_code = com_code, Com_sitecode = com_sitecode, Com_license = com_license, Sale_Agreement = sale_Agreement, Agent_Agreement = agent_Agreement, Scenic_address = Scenic_address, Scenic_intro = Scenic_intro, Scenic_Takebus = Scenic_Takebus, Scenic_Drivingcar = Scenic_Drivingcar, Contact = Contact, Tel = tel, Phone = phone, Qq = qq, Email = email, Defaultprint = Defaultprint, //新加的 Serviceinfo = "", Coordinate = "", Coordinatesize = 0, Domainname = Domainname, Province = province }; B2b_company_manageuser manageuser = new B2b_company_manageuser { Id = staffid, Accounts = Account, Atype = atype, Com_id = id, Createuserid = UserHelper.ValidateLogin() == true?UserHelper.CurrentUserId() : 0, Employeename = Account, Employeestate = (int)EmployeeStatus.Open,//开通, Job = "", Passwords = passwords, Tel = tel, //新加的 Channelcompanyid = 0, Channelsource = 0 }; string data = "";//注册信息返回结果 try { data = RegisterUserJsonData.InsertOrUpdateRegister(b2b_company, B2b_Company_Info, manageuser); } catch (Exception ex) { data = ""; } context.Response.Write(data); } if (oper == "GetAccountInfo") { //北青总社获得用户登录信息 if (context.Session["AccountId"] != null) { int AccountId = Int32.Parse(context.Session["AccountId"].ToString()); string AccountName = context.Session["AccountName"].ToString(); string AccountCard = context.Session["AccountCard"].ToString(); context.Response.Write("{\"type\":100,\"msg\":{\"AccountId\":" + AccountId + ",\"AccountName\":" + AccountName + ",\"AccountCard\":" + AccountCard + "}"); } else { context.Response.Write("{\"type\":100,\"msg\":\"\"}"); } } } }
delegate void AsyncsendEventHandler(string updateurl, string pno, int confirmnum, string confirmtime, int agentcomid, int comid, int validateticketlogid, int aorderid);//发送验证同步发送请求委托 /// <summary> /// 阳光验证通知接口 /// </summary> /// <param name="context"></param> public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string xml = context.Request["xml"].ConvertTo <string>(""); if (xml == "") { context.Response.Write("fail 接收参数为空");//参数为空 return; } if (xml != "") { //录入交互日志 ApiLog mapilog = new ApiLog { Id = 0, request_type = "sync_order", Serviceid = 1, Str = xml.Trim(), Subdate = DateTime.Now, ReturnStr = "", ReturnSubdate = DateTime.Now, Errmsg = "", }; int ins = new ApiLogData().EditLog(mapilog); mapilog.Id = ins; try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XmlElement root = doc.DocumentElement; string request_type = root.SelectSingleNode("request_type").InnerText; string req_seq = root.SelectSingleNode("req_seq").InnerText; //原订单流水号 string platform_req_seq = root.SelectSingleNode("platform_req_seq").InnerText; //平台请求流水号 string order_num = root.SelectSingleNode("order/order_num").InnerText; //订单号 string num = root.SelectSingleNode("order/num").InnerText; //使用张数 string use_time = root.SelectSingleNode("order/use_time").InnerText; //使用时间 //根据平台订单号得到易城订单号 int orderid = new B2bOrderData().GetOrderidByServiceOrderNum(order_num); if (orderid == 0) { //"老系统订单,服务商订单信息获取不到"===只有阳光订单才有这种可能,其他接口则直接返回错误 //把验票记录 记入 验证同步日志表 Api_yg_Syncordernotice notice = new Api_yg_Syncordernotice { id = 0, req_seq = req_seq, platform_req_seq = platform_req_seq, order_num = order_num, num = num.ConvertTo <int>(0), use_time = use_time.ConvertTo <DateTime>(), rcontent = "老系统订单,服务商订单信息获取不到", orderid = 0 }; int insnotice = new Api_yg_SyncordernoticeData().EditNotice(notice); notice.id = insnotice; mapilog.ReturnStr = "success"; mapilog.ReturnSubdate = DateTime.Now; mapilog.Errmsg = notice.rcontent; new ApiLogData().EditLog(mapilog); context.Response.Write("success"); return; } //根据平台流水号 得到正确处理的验证通知记录 Api_yg_Syncordernotice sucnotice = new Api_yg_SyncordernoticeData().GetSucNotice(platform_req_seq); if (sucnotice == null) { //把验票记录 记入 验证同步日志表 Api_yg_Syncordernotice notice = new Api_yg_Syncordernotice { id = 0, req_seq = req_seq, platform_req_seq = platform_req_seq, order_num = order_num, num = num.ConvertTo <int>(0), use_time = use_time.ConvertTo <DateTime>(), rcontent = "", orderid = orderid }; int insnotice = new Api_yg_SyncordernoticeData().EditNotice(notice); notice.id = insnotice; //易城系统订单 处理 B2b_order morder = new B2bOrderData().GetOrderById(orderid); if (morder != null) { int incount = morder.U_num; //总数量 int usecount = morder.service_usecount + num.ConvertTo <int>(0); //验证数量 if (incount == usecount) //全部验证 { morder.service_usecount = usecount; morder.service_lastcount = incount - usecount - morder.Cancelnum; morder.Servicepro_v_state = ((int)Product_V_State.AllValidate).ToString(); //验证全部 morder.Order_state = (int)OrderStatus.HasUsed; //已消费 new B2bOrderData().InsertOrUpdate(morder); } else //部分验证 { morder.service_usecount = usecount; morder.service_lastcount = incount - usecount - morder.Cancelnum; morder.Servicepro_v_state = ((int)Product_V_State.PartValidate).ToString(); //验证部分 morder.Order_state = (int)OrderStatus.HasUsed; //已消费 new B2bOrderData().InsertOrUpdate(morder); } //根据b单判断是否有a单存在 B2b_order aorder = new B2bOrderData().GetOldorderBybindingId(morder.Id); if (aorder != null) { aorder.Order_state = morder.Order_state; new B2bOrderData().InsertOrUpdate(aorder); } notice.rcontent = "success"; new Api_yg_SyncordernoticeData().EditNotice(notice); //如果是分销订单,则需要给分销发送验证通知 //判断b订单 是否 属于某个a订单 if (aorder != null) { //得到a订单的分销信息 if (aorder.Agentid > 0) { Agent_company acompany = new AgentCompanyData().GetAgentCompany(aorder.Agentid); if (acompany != null) { //异步发送验证同步请求 AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend); mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), morder.Pno, morder.service_usecount, use_time, aorder.Agentid, aorder.Comid, 0, aorder.Id, new AsyncCallback(Completed), null); } } } else { if (morder.Agentid > 0) { Agent_company acompany = new AgentCompanyData().GetAgentCompany(morder.Agentid); if (acompany != null) { //异步发送验证同步请求 AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend); mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), morder.Pno, morder.service_usecount, use_time, morder.Agentid, morder.Comid, 0, morder.Id, new AsyncCallback(Completed), null); } } } mapilog.ReturnStr = "success"; mapilog.ReturnSubdate = DateTime.Now; mapilog.Errmsg = "成功"; new ApiLogData().EditLog(mapilog); context.Response.Write("success"); return; } else { mapilog.ReturnStr = "fail 获取订单失败"; mapilog.ReturnSubdate = DateTime.Now; mapilog.Errmsg = "fail 获取订单失败"; new ApiLogData().EditLog(mapilog); notice.rcontent = "fail 获取订单失败"; new Api_yg_SyncordernoticeData().EditNotice(notice); context.Response.Write("fail 获取订单失败"); return; } } else { mapilog.ReturnStr = "success"; mapilog.ReturnSubdate = DateTime.Now; mapilog.Errmsg = "已经成功处理过,不在处理"; new ApiLogData().EditLog(mapilog); context.Response.Write("success"); return; } } catch { context.Response.Write("fail 意外错误");//意外错误 return; } } }
delegate void AsyncsendEventHandler(string updateurl, string pno, int confirmnum, string confirmtime, int agentcomid, int comid, int validateticketlogid, int aorderid);//发送验证同步发送请求委托 protected void Page_Load(object sender, EventArgs e) { try { string xml = Request["xml"].ToString(); //string xml = "rzChHB2sU9ld7U8YJm+ehw3aukqIGDM4BtqU0aUKqsh0Wlv7lE7QY0h+6TyATqOKSH7pPIBOo4pIfuk8gE6jikh+6TyATqOK88GTsYxHp+jxFjUWFoOLabGkQCK4I/78+O3AIZim06QMwlqxUloGSwUMhENjECcrzbztXnARK88eCV0nzDbYTSXGBvHHQSpCtYsGXg/lwRreR77JNU04PrnA/lhi3vGqrkNT1h37aYFq1/tYQ1Xz/ZZH12+3kc7eN5HVgtJCsazTnwU3IXzBtgTaJ2ESK0/X0ncZdJ1sFl4cdnO/KompxrjYGhqFw7FIjsFUOFy3n1dNbNhZIFe8Y78Lir83nuy1W7A/bsAjwDoqCCTzSMhu4i1fpj0wiwQw2BdtiUN3SUQvOPw+mKMgINlGNcH6G0/KSglfJdF6P3DNfmxtL8FfbNt6uk7GCtoKHZD21Lc7H95at7dJ0msz8Y+YwVrIaCGc"; //string xml = "<?xml version='1.0' encoding='UTF-8'?><Body><type>use_info</type><orderId>22221</orderId><outOrderId>126079</outOrderId><credence>991553361205</credence><useCount>1</useCount><lastCount>0</lastCount><useTime>2015-10-21 17:31:42</useTime><exchangeId>16504001</exchangeId><postTime>2015-10-21 17:33:00</postTime></Body>"; if (xml == "") { TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", "xml空"); Response.Write("fail 接收参数为空"); return; } if (xml != "") { TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", xml); ApiService mapiservice = new ApiServiceData().GetApiservice(3); if (mapiservice == null) { TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", "获取服务商信息失败-" + xml); Response.Write("fail 获取服务商信息失败"); return; } xml = Mjld_TCodeServiceCrypt.Decrypt3DESFromBase64(xml, mapiservice.Deskey); try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xml.Trim()); XmlElement root = doc.DocumentElement; string type = root.SelectSingleNode("type").InnerText; //验证推送 if (type == "use_info") { TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", "use_info: " + xml); //录入交互日志 ApiLog mapilog = new ApiLog { Id = 0, request_type = "use_info", Serviceid = 3, Str = xml.Trim(), Subdate = DateTime.Now, ReturnStr = "", ReturnSubdate = DateTime.Now, Errmsg = "", }; int ins = new ApiLogData().EditLog(mapilog); //平台订单号 string MjldorderId = root.SelectSingleNode("orderId").InnerText; //合作伙伴订单号 string orderid = root.SelectSingleNode("outOrderId").InnerText; //验证码 string credence = root.SelectSingleNode("credence").InnerText; //使用数量 string useCount = root.SelectSingleNode("useCount").InnerText; //剩余数量 string lastCount = root.SelectSingleNode("lastCount").InnerText; //验证使用时间 string useTime = root.SelectSingleNode("useTime").InnerText; //验证ID string exchangeId = root.SelectSingleNode("exchangeId").InnerText; //景区ID //string ScenicId = root.SelectSingleNode("ScenicId").InnerText; string ScenicId = ""; //推送时间 string postTime = root.SelectSingleNode("postTime").InnerText; //根据验证id判断是否已经成功处理过该验证推送 Api_mjld_AsyncUsenotice sucnotice = new Api_mjld_AsyncUsenoticeData().GetSucUseNoticeByExchangeId(exchangeId); if (sucnotice == null) { Api_mjld_AsyncUsenotice usenotice = new Api_mjld_AsyncUsenotice { id = 0, type = type, mjldOrderId = MjldorderId, credence = credence, useCount = useCount.ConvertTo <int>(0), lastCount = lastCount.ConvertTo <int>(0), useTime = useTime, exchangeId = exchangeId, ScenicId = ScenicId, postTime = postTime, rcontent = "", orderId = orderid.ConvertTo <int>(0), }; int insUsenotice = new Api_mjld_AsyncUsenoticeData().EditUsenotice(usenotice); usenotice.id = insUsenotice; //易城系统订单 处理 B2b_order morder = new B2bOrderData().GetOrderById(orderid.ConvertTo <int>(0)); if (morder != null) { if (lastCount.ConvertTo <int>(0) > 0) { int usecount = morder.service_usecount + usenotice.useCount; morder.service_usecount = usecount; morder.service_lastcount = usenotice.lastCount; morder.Servicepro_v_state = ((int)Product_V_State.PartValidate).ToString(); //验证部分 morder.Order_state = (int)OrderStatus.HasUsed; //已消费 new B2bOrderData().InsertOrUpdate(morder); } else { int usecount = morder.service_usecount + usenotice.useCount; morder.service_usecount = usecount; morder.service_lastcount = usenotice.lastCount; morder.Servicepro_v_state = ((int)Product_V_State.AllValidate).ToString(); //验证全部 morder.Order_state = (int)OrderStatus.HasUsed; //已消费 new B2bOrderData().InsertOrUpdate(morder); } //根据b单判断是否有a单存在 B2b_order aorder = new B2bOrderData().GetOldorderBybindingId(morder.Id); if (aorder != null) { aorder.Order_state = morder.Order_state; new B2bOrderData().InsertOrUpdate(aorder); } usenotice.rcontent = "1"; new Api_mjld_AsyncUsenoticeData().EditUsenotice(usenotice); //如果是分销订单,则需要给分销发送验证通知 //判断b订单 是否 属于某个a订单 if (aorder != null) { //得到a订单的分销信息 if (aorder.Agentid > 0) { Agent_company acompany = new AgentCompanyData().GetAgentCompany(aorder.Agentid); if (acompany != null) { //异步发送验证同步请求 AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend); mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), credence, int.Parse(useCount), useTime, aorder.Agentid, aorder.Comid, 0, aorder.Id, new AsyncCallback(Completed), null); } } } else { if (morder.Agentid > 0) { Agent_company acompany = new AgentCompanyData().GetAgentCompany(morder.Agentid); if (acompany != null) { //异步发送验证同步请求 AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend); mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), credence, int.Parse(useCount), useTime, morder.Agentid, morder.Comid, 0, morder.Id, new AsyncCallback(Completed), null); } } } Response.Write("1"); return; } else { usenotice.rcontent = "fail 获取订单失败"; new Api_mjld_AsyncUsenoticeData().EditUsenotice(usenotice); Response.Write("fail"); return; } } else { Response.Write("1"); return; } } //退票推送 if (type == "back_order") { TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", "back_order: " + xml); //录入交互日志 ApiLog mapilog = new ApiLog { Id = 0, request_type = "back_order", Serviceid = 3, Str = xml.Trim(), Subdate = DateTime.Now, ReturnStr = "", ReturnSubdate = DateTime.Now, Errmsg = "", }; int ins = new ApiLogData().EditLog(mapilog); //2为退单成功 3为拒绝 string backStatus = root.SelectSingleNode("backStatus").InnerText; //外部退单id string outBackId = root.SelectSingleNode("outBackId").InnerText; //成功退货数量 string backCount = root.SelectSingleNode("backCount").InnerText; //本平台退单id string backId = root.SelectSingleNode("backId").InnerText; //推送时间 string postTime = root.SelectSingleNode("postTime").InnerText; //根据mjldorderid判断是否成功处理过 Api_mjld_AsyncBacknotice sucnotice = new Api_mjld_AsyncBacknoticeData().GetSucApi_mjld_AsyncBacknotice(backId); if (sucnotice == null) { Api_mjld_AsyncBacknotice backnotice = new Api_mjld_AsyncBacknotice { id = 0, mjldorderid = backId, orderid = outBackId.ConvertTo <int>(0), backCount = backCount.ConvertTo <int>(0), backStatus = backStatus.ConvertTo <int>(0), postTime = postTime, rcontent = "", type = type }; int insBacknotice = new Api_mjld_AsyncBacknoticeData().EditBacknotice(backnotice); backnotice.id = insBacknotice; //易城系统订单 B2b_order morder = new B2bOrderData().GetOrderById(outBackId.ConvertTo <int>(0)); if (morder != null) { //只有订单状态 为"退票处理中",才会进行退款操作 if (morder.Order_state == (int)OrderStatus.WaitQuitOrder) { if (backStatus == "2") { OrderJsonData.QuitOrder(0, outBackId.ConvertTo <int>(0), morder.Pro_id, backCount.ConvertTo <int>(0), ""); } //拒绝退款 则还原原来订单状态;订单备注中 提示“拒绝退款” if (backStatus == "3") { //判断是否有订单 绑定传入的订单 B2b_order d_loldorder = new B2bOrderData().GetOldorderBybindingId(outBackId.ConvertTo <int>(0)); if (d_loldorder != null) { d_loldorder.Order_state = (morder.Order_remark).ConvertTo <int>(0); d_loldorder.Order_remark = "美景联动拒绝退票"; new B2bOrderData().UpOrderStateAndRemark(d_loldorder.Id, d_loldorder.Order_state, d_loldorder.Order_remark); } morder.Order_state = (morder.Order_remark).ConvertTo <int>(0);; morder.Order_remark = "美景联动拒绝退票"; new B2bOrderData().UpOrderStateAndRemark(morder.Id, morder.Order_state, morder.Order_remark); } backnotice.rcontent = "1"; new Api_mjld_AsyncBacknoticeData().EditBacknotice(backnotice); Response.Write("1"); return; } else { backnotice.rcontent = "fail 订单状态应该为(退票处理中),可是现在为:" + EnumUtils.GetName((OrderStatus)morder.Order_state); new Api_mjld_AsyncBacknoticeData().EditBacknotice(backnotice); Response.Write("fail"); return; } } else { backnotice.rcontent = "fail 获取订单失败"; new Api_mjld_AsyncBacknoticeData().EditBacknotice(backnotice); Response.Write("fail"); return; } } else { Response.Write("1"); return; } } } catch { Response.Write("fail"); return; } } } catch { Response.Write("fail 接收参数为空"); return; } }
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 }
protected void Page_Load(object sender, EventArgs e) { comid_temp = Request["comid"].ConvertTo <int>(0); DateTime ViewEndtime = DateTime.Now.AddMonths(-1); try { if (Request.Cookies["agentmessage" + comid_temp] != null) { ViewEndtime = DateTime.Parse(Request.Cookies["agentmessage" + comid_temp].Value); } } catch { ViewEndtime = DateTime.Now.AddMonths(-1); } if (comid_temp != 0) { 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()); B2b_comagentmessageData messagedata = new B2b_comagentmessageData(); messagenew = messagedata.AgentMessageNew(Agentid, comid_temp, ViewEndtime); B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; } if (Session["Account"] == null) { Response.Redirect("login.aspx"); } account = Session["Account"].ToString(); if (Agentid != 0) { var agentdata = AgentCompanyData.GetAgentByid(Agentid); if (agentdata != null) { Agentsort = agentdata.Agentsort; AgentCompany = agentdata.Company; } } var agentdate = AgentCompanyData.GetAgentAccountByUid(account, Agentid); if (agentdate == null)//没有分销账户直接退出 { Response.Redirect("login.aspx"); } accountid = agentdate.Id; AccountLevel = agentdate.AccountLevel; } else { if (Request.Cookies["Agentid"] != null) { string accountmd5 = ""; string Account = ""; int Agentid_temp = int.Parse(Request.Cookies["Agentid"].Value); if (Request.Cookies["AgentKey"] != null) { accountmd5 = Request.Cookies["AgentKey"].Value; } if (Request.Cookies["Account"] != null) { Account = Request.Cookies["Account"].Value; } var agentdata = AgentCompanyData.GetAgentByid(Agentid_temp); if (agentdata != null) { var returnmd5 = EncryptionHelper.ToMD5(Account + "lixh1210" + Agentid_temp, "UTF-8"); if (returnmd5 == accountmd5) { Session["Agentid"] = Agentid_temp; Session["Account"] = Account; Response.Redirect(Request.Url.ToString()); } else { Response.Redirect("login.aspx"); } } else { Response.Redirect("login.aspx"); } } else { Response.Redirect("login.aspx"); } } }