public static string GetUnitListselected(int actid) { try { var list = new MemberChannelcompanyData().GetUnitListselected(actid); //IEnumerable result = ""; //if (list != null) //{ // result = from order in list // select new // { // Id = order.Id, // }; //} return(JsonConvert.SerializeObject(new { type = 100, msg = list })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
//判断是否跳转 private void GetMenshiDetail(string openid, int comid) { Member_Channel channel = new MemberChannelData().GetChannelByOpenId(openid); if (channel == null) { //errlog = "获得渠道为空"; } else { //渠道单位类型:0:内部渠道;1:外部渠道;3:网站注册;4:微信注册 if (channel.Issuetype == 0 || channel.Issuetype == 1)//会员属于门店 { //根据微信号得到会员所在的门市信息 Member_Channel_company menshi = new MemberChannelcompanyData().GetMenShiByJumpId(openid, comid); if (menshi != null) { if (menshi.Whetherdepartment == 0) { //如果不是内部部门,显示门店列表 Response.Redirect("/H5/storedetail.aspx?menshiid=" + menshi.Id); } } } else//会员属于公司 { // channelcompanyid = 0; } } }
//判断是否跳转 private void GetMenshiDetail(string openid, int comid) { Member_Channel channel = new MemberChannelData().GetChannelByOpenId(openid); if (channel == null) { errlog = "获得渠道为空"; } else { //渠道单位类型:0:内部渠道;1:外部渠道;3:网站注册;4:微信注册 if (channel.Issuetype == 0)//会员属于门店 { channelcompanytype = channel.Issuetype.ToString(); //根据微信号得到会员所在的门市信息 Member_Channel_company menshi = new MemberChannelcompanyData().GetMenShiByJumpId(openid, comid); if (menshi != null) { if (menshi.Whetherdepartment == 0) { //如果不是内部部门,显示门店列表 channelcompanyid = menshi.Id; //Response.Redirect("StoreDefault.aspx?menshiid=" + channelcompanyid); } } } else//会员属于公司 { channelcompanytype = Request["issuetype"].ConvertTo <string>("0,3,4"); channelcompanyid = 0; } } }
public static string GetChannelCompanyList(int comid, string channeltype, int pageindex, int pagesize) { var totalcount = 0; try { var prodata = new MemberChannelcompanyData(); var list = prodata.GetChannelCompanyList(comid, channeltype, pageindex, pagesize, out totalcount); IEnumerable result = ""; if (list != null) { result = from pro in list select new { Id = pro.Id, Companyname = pro.Companyname, Issuetype = pro.Issuetype == 0 ? "内部门市" : pro.Issuetype == 1 ? "合作公司" : pro.Issuetype.ToString() } } ; return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
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; } }
public static string LoadingList(string comid, int pageindex, int pagesize, int userid) { var totalcount = 0; try { var list = new List <Member_Activity_Log>(); B2b_company_manageuser userr = B2bCompanyManagerUserData.GetUser(userid); if (userr != null) { if (userr.Channelcompanyid == 0)//总公司账户 { list = new B2bCrmData().LoadingList(comid, pageindex, pagesize, out totalcount); } else //总公司下面渠道 { list = new B2bCrmData().LoadingList(comid, pageindex, pagesize, int.Parse(userr.Channelcompanyid.ToString()), out totalcount); } IEnumerable result = ""; var memcompany = new MemberChannelcompanyData(); if (list != null) { result = from pro in list select new { ID = pro.ID, CardID = MemberCardData.GetCardId(pro.CardID).Cardcode.ToString(), //CardID =pro.CardID, ACTID = MemberActivityData.GetActById(pro.ACTID).Title.ToString(), OrderId = pro.OrderId, ServerName = pro.ServerName, Sales_admin = pro.Sales_admin, Num_people = pro.Num_people, Usesubdate = pro.Usesubdate, Per_capita_money = pro.Per_capita_money * pro.Num_people, Member_return_money = pro.Member_return_money, username = B2bCrmData.GetCrmCardcode(MemberCardData.GetCardId(pro.CardID).Cardcode) == null ? "--" : B2bCrmData.GetCrmCardcode(MemberCardData.GetCardId(pro.CardID).Cardcode).Name.ToString(), channel = memcompany.UpCompanyById(MemberCardData.GetCardId(pro.CardID).Cardcode.ToString()) } } ; return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result })); } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public int md_subscribenum = 0; //门店关注总数 protected void Page_Load(object sender, EventArgs e) { //图片上传 绑定控件 headPortrait.uploadFileInfo.ObjType = (int)FileObjType.Photo; headPortrait.displayImgId = "headPortraitImg"; channelcompanytype = Request["channelcompanytype"].ConvertTo <string>("inner"); int userid = UserHelper.CurrentUserId(); IsParentCompanyUser = new B2bCompanyManagerUserData().IsParentCompanyUser(userid); if (IsParentCompanyUser == false)//如果是门市账户 { B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(userid); if (user != null) { channelcompanyid = user.Channelcompanyid.ToString(); } Member_Channel_company ccompay = new MemberChannelcompanyData().GetChannelCompany(channelcompanyid); if (ccompay != null) { if (ccompay.Issuetype == 0) { channelcompanytype = "inner"; } if (ccompay.Issuetype == 1) { channelcompanytype = "out"; } } } //根据登录公司显示门店关注总数 md_subscribenum = new WxSubscribeDetailData().GetMd_Subscribenum(UserHelper.CurrentCompany.ID); isrun = Request["isrun"].ConvertTo <string>("1,0"); if (!IsPostBack) { hid_key.Value = ""; if (channelcompanytype == "inner") //如果是 所属门店/合作单位,则需要把总公司信息加上 { DataSet ds1 = GetHeadOffice(); //得到总公司信息 DataSet ds2 = GetAllTerms(channelcompanytype, channelcompanyid); ds1.Merge(ds2, false, MissingSchemaAction.Ignore); GridView2.DataSource = ds1;//获得 渠道单位 列表 GridView2.DataBind(); } else { GridView2.DataSource = GetAllTerms(channelcompanytype, channelcompanyid);//获得 渠道单位 列表 GridView2.DataBind(); } } }
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; } }
public static string Upchannelcompanproject(int channelcompanyid, string companyproject) { try { var channelobj = new MemberChannelcompanyData().Upchannelcompanproject(channelcompanyid, companyproject); return(JsonConvert.SerializeObject(new { type = 100, msg = channelobj })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); } }
//读取用户信息 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) { //当读取用户信息的时候,判断是否有渠道转发信息 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); } } //读取渠道商户名称 var channelcompany = new MemberChannelcompanyData().GetChannelCompanyByCrmId(userinfo.Id); if (channelcompany != null) { tel = channelcompany.Companyphone; } dateuser.WeixinConPass(userinfo.Weixin, comid);//只要包含SESSION登陆成功,清空微信密码 } }
public static string MasterpagelistByComId(string employstate, int pageindex, int pagesize, string comid, int userid, string key = "") { var totalcount = 0; var memberdata = new MemberChannelData(); MemberChannelcompanyData channel = new MemberChannelcompanyData(); try { var list = new B2bCompanyManagerUserData().Manageuserpagelist(employstate, comid, pageindex, pagesize, out totalcount, userid, key); IEnumerable result = ""; if (list != null) { result = from model in list select new { model.Id, Accounts = model.Accounts, PassWord = model.Passwords, MasterId = model.Id, MasterName = model.Employeename, CompanyName = channel.GetCompanyById(Int32.Parse(model.Channelcompanyid.ToString())) != null?channel.GetCompanyById(Int32.Parse(model.Channelcompanyid.ToString())).Companyname : "", Tel = model.Tel, GroupName = new Sys_MasterGroupData().GetGroupNameStrByMasterId(model.Id), Employstate = model.Employeestate, weixinstate = memberdata.GetChannelListByComidState(int.Parse(comid), model.Id), Peoplelistview = model.Peoplelistview, Workdays = model.Workdays, Isdefaultkf = model.Isdefaultkf, Channelid = new MemberChannelData().GetChannelid(model.Com_id, model.Tel), //渠道id rebatenum = new Member_channel_rebatelogData().Getrebatenum(model.Com_id, model.Tel), //返佣次数 rebateapplytotal = new Member_channel_rebateApplylogData().Getrebateapplytotal(model.Com_id, model.Tel), //返佣申请总额 rebatehastixian = new Member_channel_rebateApplylogData().Getrebatehastixian(model.Com_id, model.Tel), //返佣申请已提现金额 rebatenottixian = new Member_channel_rebateApplylogData().Getrebatenottixian(model.Com_id, model.Tel), //返佣申请尚未提现金额 restrebate = new MemberChannelData().Getrestrebate(model.Com_id, model.Tel), //剩余可申请返佣金额 } } ; return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public static string Getchannelcompanyname(int channelcompanyid, int comid = 0) { if (comid == 0) { if (channelcompanyid == 0) { return(JsonConvert.SerializeObject(new { type = 1, msg = "" })); } else { Member_Channel_company company = new MemberChannelcompanyData().GetChannelCompany(channelcompanyid.ToString()); if (company == null) { return(JsonConvert.SerializeObject(new { type = 1, msg = "" })); } else { return(JsonConvert.SerializeObject(new { type = 100, msg = company.Companyname })); } } } else { if (channelcompanyid == 0) { B2b_company company = B2bCompanyData.GetCompany(comid); if (company == null) { return(JsonConvert.SerializeObject(new { type = 1, msg = "" })); } else { return(JsonConvert.SerializeObject(new { type = 100, msg = company.Com_name })); } } else { Member_Channel_company company = new MemberChannelcompanyData().GetChannelCompany(channelcompanyid.ToString()); if (company == null) { return(JsonConvert.SerializeObject(new { type = 1, msg = "" })); } else { return(JsonConvert.SerializeObject(new { type = 100, msg = company.Companyname })); } } } }
protected void Page_Load(object sender, EventArgs e) { comid = Request["comid"].ConvertTo <int>(0); md5info = Request["md5info"].ConvertTo <string>(""); string companyName = new B2bCompanyData().GetCompanyNameById(comid); string Returnmd5 = EncryptionHelper.ToMD5(comid.ToString() + "lixh1210", "UTF-8"); if (Returnmd5 == md5info)//验证MD5 { //ExcelRender.RenderToExcel( // ExcelSqlHelper.ExecuteDataTable(CommandType.Text, "select idcard [会员卡号], name [姓名],phone [手机],email [邮件],imprest [预付款],Integral [积分],regidate [注册时间] from b2b_crm where com_id=" + comid), // Context, companyName + "会员信息" + ".xls"); DataTable crmdt = ExcelSqlHelper.ExecuteDataTable(CommandType.Text, "select idcard [会员卡号], name [姓名],phone [手机],email [邮件],imprest [预付款],Integral [积分],regidate [注册时间] from b2b_crm where com_id=" + comid); DataTable dt = new DataTable(); dt.Columns.Add("会员卡号"); dt.Columns.Add("姓名"); dt.Columns.Add("手机"); dt.Columns.Add("邮件"); dt.Columns.Add("预付款"); dt.Columns.Add("积分"); dt.Columns.Add("注册时间"); dt.Columns.Add("渠道单位"); dt.Columns.Add("推荐人"); DataRow dr = dt.NewRow(); foreach (DataRow rr in crmdt.Rows) { dr = dt.NewRow(); dr["会员卡号"] = rr["会员卡号"].ToString(); dr["姓名"] = rr["姓名"].ToString(); dr["手机"] = rr["手机"].ToString(); dr["邮件"] = rr["邮件"].ToString(); dr["预付款"] = rr["预付款"].ToString(); dr["积分"] = rr["积分"].ToString(); dr["注册时间"] = rr["注册时间"].ToString(); dr["渠道单位"] = new MemberChannelcompanyData().UpCompanyById(rr["会员卡号"].ToString()); dr["推荐人"] = MemberChannelData.SearchNamestring(rr["会员卡号"].ToString()); dt.Rows.Add(dr); } ExcelRender.RenderToExcel(dt, Context, companyName + "会员信息" + ".xls"); } }
public static string GetUnitList(int unittype) { try { var list = new MemberChannelcompanyData().GetUnitList(unittype); return(JsonConvert.SerializeObject(new { type = 100, msg = list })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public static string GetChannelCompany(string channelcompanyid) { try { Member_Channel_company company = new MemberChannelcompanyData().GetChannelCompany(channelcompanyid); List <Member_Channel_company> list = new List <Member_Channel_company>(); list.Add(company); IEnumerable result = ""; if (list != null) { result = from pro in list select new { Id = pro.Id, Com_id = pro.Com_id, Companyname = pro.Companyname, Issuetype = pro.Issuetype, Whethercreateqrcode = pro.Whethercreateqrcode, Companyaddress = pro.Companyaddress, Companyphone = pro.Companyphone, CompanyCoordinate = pro.CompanyCoordinate, CompanyimgID = pro.Companyimg, CompanyImgUrl = FileSerivce.GetImgUrl(pro.Companyimg), Companyintro = pro.Companyintro, Companyproject = pro.Companyproject, CompanyState = pro.Companystate, WhetherDepartment = pro.Whetherdepartment, Bookurl = pro.Bookurl, CompanyLocate = pro.CompanyLocate, Province = pro.Province, City = pro.City, Outshop = pro.Outshop }; return(JsonConvert.SerializeObject(new { type = 100, msg = result })); } else { return(JsonConvert.SerializeObject(new { type = 100, msg = "" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public static string ChannelcompanyOrderlocation(string comid, int pageindex, int pagesize, string key, int channelcompanyid = 0, string channelcompanytype = "0,1,3,4", string openid = "", string n1 = "", string e1 = "") { try { int totalcount = 0; var crmdata = new B2bCrmData(); List <Member_Channel_company> list = new MemberChannelcompanyData().ChannelcompanyOrderlocation(comid, pageindex, pagesize, key, out totalcount, channelcompanyid, channelcompanytype, n1, e1); IEnumerable result = ""; if (list != null) { result = from pro in list //orderby pro.Distance select new { Id = pro.Id, Com_id = pro.Com_id, Companyname = pro.Companyname, Issuetype = pro.Issuetype, Whethercreateqrcode = pro.Whethercreateqrcode, Companyaddress = pro.Companyaddress, Companyphone = pro.Companyphone, CompanyCoordinate = pro.CompanyCoordinate, CompanyLocate = pro.CompanyLocate, Companyimgurl = FileSerivce.GetImgUrl(pro.Companyimg), Companyintro = pro.Companyintro, Companyproject = pro.Companyproject, Distance = crmdata.CalculateTheCoordinates(openid, pro.Id), m = new WxSubscribeSourceData().GetWXSourceByChannelcompanyid(pro.Id) } } ; return(JsonConvert.SerializeObject(new { type = 100, totalcount = totalcount, msg = result })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public static string fuwuPageList(string comid, int pageindex, int pagesize, int user) { var totalcount = 0; try { var prodata = new B2bCrmData(); var list = prodata.fuwuPageList(comid, pageindex, pagesize, user, out totalcount); IEnumerable result = ""; var memcompany = new MemberChannelcompanyData(); if (list != null) { result = from pro in list select new { id = pro.Id, comid = pro.Com_id, phone = pro.Phone, registerdate = pro.Regidate, customername = pro.Name, imprest = pro.Imprest, integral = pro.Integral, idcard = pro.Idcard, email = pro.Email, serverid = pro.Servercard, winxin = pro.Weixin == null || pro.Weixin == "" ? "" : "yes", channel = memcompany.UpCompanyById(pro.Idcard.ToString()), referrer = MemberChannelData.Upstring(pro.Idcard.ToString()).Name.ToString() } } ; return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public static string Adjustchannelcompanystatus(int companyid, int status) { if (companyid == 0) { return(JsonConvert.SerializeObject(new { type = 1, msg = "渠道公司编号传递为0" })); } else { try { int result = new MemberChannelcompanyData().Adjustchannelcompanystatus(companyid, status); //调整门市下员工状态(在职,离职) int employstate = 0; if (status == 1)//调整渠道公司“开通” { employstate = 1; } else //调整渠道公司"停业" { employstate = 0; } int result2 = new B2bCompanyManagerUserData().AdjustChannelCompanyEmploerstate(companyid, employstate); if (result > 0) { return(JsonConvert.SerializeObject(new { type = 100, msg = "操作成功" })); } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "操作有误" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } } }
public static string GetUnitList(int comid, string unittype, string ischosen, int userid) { try { List <Member_Channel_company> list = new List <Member_Channel_company>(); //判断操作账户类型(总公司账户;门市账户) bool IsParentCompanyUser = new B2bCompanyManagerUserData().IsParentCompanyUser(userid); int channelcompanyid = 0; //门店id,用于门市账户添加员工 if (IsParentCompanyUser) //总公司账户 { if (ischosen == "0") //总公司账户,并且没有选择渠道来源:人员所在单位只是显示 总公司名称 { list = null; } else //总公司账户,并且选择了渠道来源:人员所在单位显示 总公司名称+各门店列表/各合作单位列表 { list = new MemberChannelcompanyData().GetUnitList(comid, unittype); } } else //门店账户 { //人员所在单位显示 当前门店 Member_Channel_company model = new MemberChannelcompanyData().GetChannelCompanyByUserId(userid); channelcompanyid = model.Id; list.Add(model); } return(JsonConvert.SerializeObject(new { type = 100, msg = list, channelcompanyid = channelcompanyid })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message, channelcompanyid = 0 })); throw; } }
public static string Logcardact(int actid, int cardid, int comid) { var totalcount = 0; try { var prodata = new B2bCrmData(); var list = prodata.Logcardact(actid, cardid, comid, out totalcount); IEnumerable result = ""; var memcompany = new MemberChannelcompanyData(); if (list != null) { result = from pro in list select new { ID = pro.ID, CardID = MemberCardData.GetCardId(pro.CardID).Cardcode, ACTID = MemberActivityData.GetActById(pro.ACTID).Title, //OrderId = pro.OrderId, ServerName = pro.ServerName, //Sales_admin = pro.Sales_admin, //Num_people = pro.Num_people, Usesubdate = pro.Usesubdate, Per_capita_money = pro.Per_capita_money * pro.Num_people, //Member_return_money = pro.Member_return_money, } } ; return(JsonConvert.SerializeObject(new { type = 100, msg = result, totalcount = totalcount })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
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; } }
internal List <RequestXML> GetWxSendMsgListByComid(int userid, int comid, int pageindex, int pagesize, out int totalcount) { var Table = "WxMemberBasic c right join b2b_crm a " + " right join " + " ( select * from WxRequestXml where id in " + " (select idd from " + " ( select max(a.id) as idd,fromusername from WxRequestXml a " + " where a.comid=" + comid + " and a.contenttype=1 and a.createtimeformat between CONCAT(Convert(varchar(10), dateadd(dd,-1,getdate()),121),' 00:00:00') and CONCAT(Convert(varchar(10),getdate(),121),' 23:59:59') group by fromusername " + " ) as c " + " ) " + " ) as b " + " on a.weixin=b.fromusername on c.openid=a.weixin "; var Column = "a.id as aid,a.name as aname,a.phone as aphone,a.weixin as aweixin,b.*,c.headimgurl,c.province,c.city,c.nickname,c.sex"; var OrderColumn = " b.createtimeformat desc"; var GroupColumn = ""; var PageSize = pagesize; var CurrentPage = pageindex; var Group = ""; var Condition = ""; Member_Channel_company channelcom = new MemberChannelcompanyData().GetChannelCompanyByUserId(userid); if (channelcom == null)//总公司账户 { Condition = ""; } else { if (channelcom.Issuetype == 0)//内部门市 { Condition = "a.idcard in (select cardcode from member_card where issuecard in (select id from member_channel where companyid =" + channelcom.Id + "))"; } else//合作公司 { Condition = "a.weixin in (select openid from WxSubscribeDetail where subscribesourceid in (select id from WxSubscribeSource where channelcompanyid =" + channelcom.Id + "))"; } } var cmd = this.sqlHelper.PrepareStoredSqlCommand("proc_ListPage"); cmd.PagingCommand1(Table, Column, OrderColumn, GroupColumn, PageSize, CurrentPage, Group, Condition); List <RequestXML> list = new List <RequestXML>(); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { RequestXML model = new RequestXML(); model.Id = reader.GetValue <int>("Id"); model.ToUserName = reader.GetValue <string>("ToUserName"); model.FromUserName = reader.GetValue <string>("FromUserName"); model.CreateTime = reader.GetValue <string>("CreateTime"); model.MsgType = reader.GetValue <string>("MsgType"); model.Content = reader.GetValue <string>("Content"); model.Location_X = reader.GetValue <string>("Location_X"); model.Location_Y = reader.GetValue <string>("Location_Y"); model.Scale = reader.GetValue <string>("Scale"); model.Label = reader.GetValue <string>("Label"); model.PicUrl = reader.GetValue <string>("PicUrl"); model.PostStr = reader.GetValue <string>("PostStr"); model.CreateTimeFormat = reader.GetValue <DateTime>("CreateTimeFormat").ToString().ConvertTo <DateTime>(DateTime.Parse("1900-01-01 00:00:00")); model.MediaId = reader.GetValue <string>("MediaId"); model.Format = reader.GetValue <string>("Format"); model.Recognition = reader.GetValue <string>("Recognition"); model.ThumbMediaId = reader.GetValue <string>("ThumbMediaId"); model.Title = reader.GetValue <string>("Title"); model.Description = reader.GetValue <string>("Description"); model.Url = reader.GetValue <string>("Url"); model.MsgId = reader.GetValue <string>("MsgId"); model.ContentType = reader.GetValue <bool>("ContentType"); model.Comid = reader.GetValue <int>("Comid"); model.Crmid = reader.GetValue <int>("aid"); model.Crmname = reader.GetValue <string>("aname"); model.Crmphone = reader.GetValue <string>("aphone"); model.Manageuserid = reader.GetValue <int>("manageuserid").ToString().ConvertTo <int>(0); model.Manageusername = reader.GetValue <string>("manageusername").ConvertTo <string>(""); model.Headimgurl = reader.GetValue <string>("headimgurl").ConvertTo <string>("/images/defaultThumb.png"); model.City = reader.GetValue <string>("city").ConvertTo <string>(""); model.Province = reader.GetValue <string>("province").ConvertTo <string>(""); model.Nickname = reader.GetValue <string>("nickname").ConvertTo <string>(""); model.Sex = reader.GetValue <int>("sex").ToString().ConvertTo <int>(0); list.Add(model); } } //totalcount = list.Count; totalcount = int.Parse(cmd.Parameters[0].Value.ToString()); return(list); }
public static string GetUnitList(int comid, int unittype, int userid = 0, int actid = 0) { try { if (userid != 0) { MemberChannelcompanyData channeldate = new MemberChannelcompanyData(); B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(userid); if (user != null) { if (user.Channelcompanyid == 0) { var list = new MemberChannelcompanyData().GetUnitList(comid, unittype); IEnumerable result = ""; if (list != null) { result = from pro in list select new { Id = pro.Id, Com_id = pro.Com_id, Companyname = pro.Companyname, Issuetype = pro.Issuetype, Selectstate = channeldate.GetchannelUnitListselected(actid, pro.Id) } } ; return(JsonConvert.SerializeObject(new { type = 100, msg = result })); } else { var list = new MemberChannelcompanyData().GetUnitList(comid, unittype, int.Parse(user.Channelcompanyid.ToString())); IEnumerable result = ""; if (list != null) { result = from pro in list select new { Id = pro.Id, Com_id = pro.Com_id, Companyname = pro.Companyname, Issuetype = pro.Issuetype, Selectstate = channeldate.GetchannelUnitListselected(pro.Id, actid) } } ; return(JsonConvert.SerializeObject(new { type = 100, msg = result })); } } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "" })); } } else { var list = new MemberChannelcompanyData().GetUnitList(comid, unittype); return(JsonConvert.SerializeObject(new { type = 100, msg = list })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
public string comlogo = ""; //公司logo地址 protected void Page_Load(object sender, EventArgs e) { openid = Request["openid"]; act = Request["act"]; aid = Request["aid"].ToString(); RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower(); //如果SESSION有值,进行赋值 if (openid == "" && Session["Openid"] != null) { openid = Session["Openid"].ToString(); } //根据域名读取商户ID,如果没有绑定域名直接跳转后台 if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid { //先通过正则表达式获取COMid comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString()); if (comid == 0) { comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid; } } else { B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl); if (companyinfo != null) { comid = companyinfo.Com_id; } } if (comid != 0) { //根据公司id得到公司logo地址和公司名称 comname = B2bCompanyData.GetCompany(comid).Com_name; B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (pro != null) { comlogo = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0)); } } //如果账户登陆状态则读取用户信息 if (Session["AccountId"] != null) { //获取用户卡号 B2bCrmData crmdate = new B2bCrmData(); B2b_crm crmmodle = crmdate.Readuser(Int32.Parse(Session["AccountId"].ToString()), comid); if (crmmodle != null) { cardcode = crmmodle.Idcard; } //获取优惠劵信息 对已领的优惠劵和未领的优惠劵 if (aid != "") { MemberActivityData actdata = new MemberActivityData(); if (act == "A")//已领的优惠劵 { Member_Activity actmodel = actdata.AccountActInfo(Int32.Parse(aid), Int32.Parse(Session["AccountId"].ToString()), comid, out totalcount); if (actmodel != null) { Actend = actmodel.Actend.ToString("yyyy-MM-dd"); Title = actmodel.Title; usestate = actmodel.Usestate; Atitle = actmodel.Atitle; Remark = actmodel.Remark.Replace(((char)10).ToString(), "<br />"); //Useremark = actmodel.Useremark; Usetitle = actmodel.Usetitle.Replace(((char)10).ToString(), "<br />"); } } else {//未领取的 Member_Activity actmodel = actdata.UnAccountActInfo(Int32.Parse(aid), 0, comid, out totalcount); if (actmodel != null) { Actend = actmodel.Actend.ToString("yyyy-MM-dd"); Title = actmodel.Title; Atitle = actmodel.Atitle; Remark = actmodel.Remark.Replace(((char)10).ToString(), "<br />"); //Useremark = actmodel.Useremark.Replace(((char)10).ToString(), "<br />"); Usetitle = actmodel.Usetitle; usestate = 6; } } //活动使用门市 MemberChannelcompanyData chandata = new MemberChannelcompanyData(); var list = chandata.GetUnitListselected(int.Parse(aid)); if (list != null) { for (int i = 0; i < list.Count(); i++) { Useremark += list[i].Companyname + " <br>"; } } } else { Response.Redirect("/M/Default.aspx"); } } else {//非会员看未领取的 if (aid != "") { MemberActivityData actdata = new MemberActivityData(); Member_Activity actmodel = actdata.UnAccountActInfo(Int32.Parse(aid), 0, comid, out totalcount); if (actmodel != null) { Actend = actmodel.Actend.ToString("yyyy-MM-dd"); Title = actmodel.Title; Atitle = actmodel.Atitle; Remark = actmodel.Remark.Replace(((char)10).ToString(), "<br />"); Useremark = actmodel.Useremark.Replace(((char)10).ToString(), "<br />"); Usetitle = actmodel.Usetitle.Length > 14 ? actmodel.Usetitle.Substring(0, 13) + "." : actmodel.Useremark; usestate = 5; } } } }
public static string EditChannelCompany(Member_Channel_company company) { try { int id = new MemberChannelcompanyData().EditChannelCompany(company); if (company.Id == 0)//如果是添加渠道单位操作,则默认添加一个此单位下的渠道人 { Member_Channel channel = new Member_Channel() { Id = 0, Com_id = company.Com_id, Issuetype = company.Issuetype, Companyid = id, Name = "默认渠道", Mobile = "", Cardcode = 0, Chaddress = "", ChObjects = "", RebateOpen = 0, RebateConsume = 0, RebateConsume2 = 0, RebateLevel = 0, Opencardnum = 0, Firstdealnum = 0, Summoney = 0, Whetherdefaultchannel = 1, Runstate = 1 }; int idd = new MemberChannelData().EditChannel(channel); if (id > 0 && idd > 0) { return(JsonConvert.SerializeObject(new { type = 100, msg = id })); } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "编辑渠道时出现错误" })); } } else { //判断渠道公司中是否含有默认渠道,没有的话添加进去 int numm = new MemberChannelData().GetDefaultChannelNum(company.Id); if (numm == 0) { Member_Channel channel = new Member_Channel() { Id = 0, Com_id = company.Com_id, Issuetype = company.Issuetype, Companyid = id, Name = "默认渠道", Mobile = "", Cardcode = 0, Chaddress = "", ChObjects = "", RebateOpen = 0, RebateConsume = 0, RebateConsume2 = 0, RebateLevel = 0, Opencardnum = 0, Firstdealnum = 0, Summoney = 0, Whetherdefaultchannel = 1 }; int idd = new MemberChannelData().EditChannel(channel); if (id > 0 && idd > 0) { return(JsonConvert.SerializeObject(new { type = 100, msg = id })); } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "编辑渠道时出现错误" })); } } else { if (id > 0) { return(JsonConvert.SerializeObject(new { type = 100, msg = id })); } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "编辑渠道时出现错误" })); } } } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); } }
public void DealUserinfo1(string openid, string weixinpass, int comid, int questtype) { if (Request.Cookies["AccountId"] != null) { string accountmd5 = ""; int AccountId = int.Parse(Request.Cookies["AccountId"].Value); if (Request.Cookies["AccountKey"] != null) { accountmd5 = Request.Cookies["AccountKey"].Value; } var data = CrmMemberJsonData.WeixinCookieLogin(AccountId.ToString(), accountmd5, comid, out userinfo); if (data != "OK") { //当cookie错误无法登陆则清除所有COOKIE; HttpCookie aCookie; string cookieName; int limit = Request.Cookies.Count; for (int i = 0; i < limit; i++) { cookieName = Request.Cookies[i].Name; aCookie = new HttpCookie(cookieName); aCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(aCookie); } if (questtype == 1) { VerifyOneOffPass(openid, weixinpass);//重新验证一下是否是正确的一次性密码 } else if (questtype == 2) { openid = GetOpenId(weixinpass, comid);//微信授权验证 } } else { //从cookie中得到微信号 if (Request.Cookies["openid"] != null) { openid = Request.Cookies["openid"].Value; } B2bCrmData dateuser = new B2bCrmData(); dateuser.WeixinConPass(openid, comid);//清空微信密码 if (userinfo != null) { Readuser(userinfo.Idcard, comid);//读取用户信息 } } } else { if (questtype == 1) { VerifyOneOffPass(openid, weixinpass);//重新验证一下是否是正确的一次性密码 } else if (questtype == 2) { { openid = GetOpenId(weixinpass, comid);//微信授权验证 } } } //根据微信号得到会员所在的门市信息 Member_Channel_company menshi = new MemberChannelcompanyData().GetMenShiByJumpId(openid, comid); if (menshi != null) { if (menshi.Whetherdepartment == 0) { //如果不是内部部门,显示门店列表 channelcompanyid = menshi.Id; } } }
public static string SearchPageList(int userid, string comid, int pageindex, int pagesize, string key, string isactivate = "1", string iswxfocus = "0,1", string ishasweixin = "0,1", string ishasphone = "0,1") { var totalcount = 0; try { var list = new List <B2b_crm>(); #region Sys_Group group = new Sys_GroupData().GetGroupByUserId(userid); //判断会员是否要求精确到渠道人 bool crmIsAccurateToPerson = group.CrmIsAccurateToPerson; Member_Channel_company channelcom = new MemberChannelcompanyData().GetChannelCompanyByUserId(userid); if (channelcom == null)//总公司账户 { list = new B2bCrmData().SearchPageList(comid, pageindex, pagesize, key, out totalcount, isactivate, iswxfocus, ishasweixin, ishasphone); } else { string channelcompanytype = "0"; //渠道类型:0内部门店;1合作公司 if (channelcom.Issuetype == 0) //内部门市 { list = new B2bCrmData().SearchPageList1(comid, pageindex, pagesize, key, channelcom.Id, out totalcount, isactivate, iswxfocus, ishasweixin, channelcompanytype, crmIsAccurateToPerson, userid, ishasphone); } else //合作公司 { channelcompanytype = "1"; list = new B2bCrmData().SearchPageList1(comid, pageindex, pagesize, key, channelcom.Id, out totalcount, isactivate, iswxfocus, ishasweixin, channelcompanytype, crmIsAccurateToPerson, userid, ishasphone); } } IEnumerable result = ""; if (list != null) { result = from pro in list select new { id = pro.Id, comid = pro.Com_id, phone = pro.Phone, registerdate = pro.Regidate, customername = pro.Name, imprest = pro.Imprest, integral = pro.Integral, idcard = pro.Idcard, email = pro.Email, serverid = pro.Servercard, isfocuswinxin = pro.Weixin == "" ? "" : pro.Whetherwxfocus == false ? "已取消" : "已关注", weixin = pro.Weixin, channel = new MemberChannelcompanyData().UpCompanyById(pro.Idcard.ToString()), referrer = MemberChannelData.SearchNamestring(pro.Idcard.ToString()), WxHeadimgurl = pro.WxHeadimgurl, WxNickname = pro.WxNickname.Replace("?", ""), WxProvince = pro.WxProvince, WxCity = pro.WxCity, WxSex = pro.WxSex == 0 ? "未知" : pro.WxSex == 1 ? "男" : "女", GroupId = pro.Groupid, GroupName = new B2b_groupData().GetB2bgroupName(pro.Groupid), IsCanReplyWx = IsIn48h(pro.Wxlastinteracttime), whetherwxfocus = pro.Whetherwxfocus } } ; return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result })); #endregion } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }
//给客户发送顾问的信息 public static void Sendweixinchient(string openid, int comid) { WeiXinBasic basic = new WeiXinBasicData().GetWxBasicByComId(comid); string company = ""; string channelname = ""; string name = ""; WxMessageLogData messagelogdata = new WxMessageLogData(); //var messageinfo = messagelogdata.GetWxMessageLogSendTime(comid, openid);//查询2小时内是否给渠道发送过消息 //if (messageinfo == 0) //{ //会员 MemberCardData carddata = new MemberCardData(); var userdata = new B2bCrmData(); var userinfo = userdata.GetB2bCrm(openid, comid); if (userinfo != null) { name = userinfo.Name; } var cardinfo = carddata.GetMemberCardByOpenId(openid); if (cardinfo != null) { //获取渠道 var channeldata = new MemberChannelData(); var channelinfo = channeldata.GetChannelDetail(int.Parse(cardinfo.IssueCard.ToString())); if (channelinfo != null) { channelname = channelinfo.Name; //渠道名称 if (channelinfo.Companyid == 0) //内部渠道 { B2bCompanyData comdata = new B2bCompanyData(); var cominfo = comdata.GetCompanyBasicById(comid); if (cominfo != null) { company = cominfo.Com_name; } } else { //外部合作单位,调取合作单位名称 var channelcompanydata = new MemberChannelcompanyData(); var channelcominfo = channelcompanydata.GetChannelCompany(channelinfo.Companyid.ToString()); if (channelcominfo != null) { company = channelcominfo.Companyname; } } } } if (channelname != "" && channelname != "默认渠道" && channelname != "微信注册" && channelname != "网站注册") { //微信客服 文本消息 string data = SendWxMsg(comid, openid, 1, "", name + "你好,我是您的服务顾问" + company + "的 " + channelname + " ,\n请直接在微信上给我语音或文字留言,我会在手机微信上看到留言并很快回复。您不信? 现在就试试…", "", basic.Weixinno); //微信模板消息 new Weixin_tmplmsgManage().WxTmplMsg_SubscribeActReward(comid, openid, name + "你好,我是您的服务顾问" + company + "的 " + channelname + " , \\n请直接在微信上给我语音或文字留言,我会在手机微信上看到留言并很快回复。您不信? 现在就试试…\\n", "向《我的服务顾问:" + channelname + "》微信咨询", DateTime.Now.ToString(), ""); WxMessageLog messagelog = new WxMessageLog(); messagelog.Comid = comid; messagelog.Weixin = openid; var messageedit = messagelogdata.EditWxMessageLog(messagelog);//插入日志 //顾问录入的 问候语音 int isreplymediasuc = 0;//发送语音消息状态:0失败;1成功 WXAccessToken m_accesstoken = WeiXinManage.GetAccessToken(basic.Comid, basic.AppId, basic.AppSecret); //根据用户微信得到其顾问微信,然后根据微信和标记得到最新的一条保存路径(注:已经上传过语音的即mediaid!="") Wxmedia_updownlog udlog = new Wxmedia_updownlogData().GetWxmedia_updownlog(openid, (int)Clientuptypemark.DownGreetVoice, basic.Comid); if (udlog == null) { isreplymediasuc = 0; } else { string media_id = new WxUploadDownManage().UploadMultimedia(m_accesstoken.ACCESS_TOKEN, "voice", udlog.savepath); if (media_id != "") { Wxmedia_updownlog uplog = new Wxmedia_updownlog { id = 0, mediaid = media_id, mediatype = "voice", savepath = udlog.savepath, created_at = ConvertDateTimeInt(DateTime.Now).ToString(), createtime = DateTime.Now, opertype = "up", operweixin = openid, clientuptypemark = (int)Clientuptypemark.DownGreetVoice,//上传多媒体信息 comid = basic.Comid, relativepath = udlog.relativepath, txtcontent = "", isfinish = 1 }; int uplogresult = new Wxmedia_updownlogData().Edituploadlog(uplog); if (uplogresult == 0) { isreplymediasuc = 0; } else { //resxml = "<xml><ToUserName><![CDATA[" + requestXML.FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + requestXML.ToUserName + "]]></FromUserName><CreateTime>" + ConvertDateTimeInt(DateTime.Now) + "</CreateTime><MsgType><![CDATA[voice]]></MsgType><Voice><MediaId><![CDATA[" + media_id + "]]></MediaId></Voice></xml>"; isreplymediasuc = 1; SendWxMsg(comid, openid, 2, "", "", media_id, basic.Weixinno); } } else { isreplymediasuc = 0; } } ////如果发送语音失败,则发送客服消息 //if (isreplymediasuc == 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) { userid = userinfo.Id.ToString(); //如果是登陆用户则读取用户的实际ID HttpCookie cookie = new HttpCookie("temp_userid"); //实例化HttpCookie类并添加值 cookie.Value = userinfo.Id.ToString(); cookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(cookie); //查询渠道公司,如果有外部合作商户进行跳转 var channelcompany = new MemberChannelcompanyData().GetMenShiByOpenId(userinfo.Weixin, userinfo.Com_id); if (channelcompany != null) { if (channelcompany.Outshop != 0) { Response.Redirect("http://shop" + channelcompany.Outshop + ".etown.cn/h5/order"); } } //当读取用户信息的时候,判断是否有渠道转发信息 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登陆成功,清空微信密码 } }
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 }