/// <summary> /// 显示账单明细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPayDetail_Click(object sender, EventArgs e) { try { string sqlWhere = " OrderId='" + txtOldOrder.Text.Trim() + "' "; PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>; List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>; List <string> strList = new PbProject.Logic.Pay.Bill().CreateOrderAndTicketPayDetailNew(mOrderList[0], PassengerList); //计算订单金额生成订单 if (strList != null && strList.Count > 0) { foreach (string item in strList) { txtReturnValue.Text += item + "\r\r\n"; } txtReturnValue.Text += "PayMoney = " + mOrderList[0].PayMoney + "\r\r\n"; txtReturnValue.Text += "OrderMoney = " + mOrderList[0].OrderMoney + "\r\r\n"; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.Ticks.ToString(), "alert('生成数据失败');", true); } } catch (Exception ex) { } }
/// <summary> /// 计算订单金额 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPayMoney_Click(object sender, EventArgs e) { try { string sqlWhere = " OrderId='" + txtOldOrder.Text.Trim() + "' "; PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>; List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>; // PbProject.Logic.Pay.Data d = new PbProject.Logic.Pay.Data(); //string PayMoney = d.CreateOrderPayMoney(mOrderList[0], PassengerList).ToString(); //string OrderMoney = d.CreateOrderOrderMoney(mOrderList[0], PassengerList).ToString(); PbProject.Logic.Pay.Bill bill = new PbProject.Logic.Pay.Bill(); bill.CreateOrderAndTicketPayDetailNew(mOrderList[0], PassengerList); decimal PayMoney = mOrderList[0].PayMoney; decimal OrderMoney = mOrderList[0].OrderMoney; txtReturnValue.Text += "PayMoney=" + PayMoney + ",OrderMoney=" + OrderMoney; } catch (Exception ex) { } }
/// <summary> /// 绑定数据 /// </summary> private void PageDataBind() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", Con, ViewState["orderBy"].ToString() }) as List <Tb_Ticket_Order>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; repList.DataSource = list; repList.DataBind(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "", "showdialog('页面出错,请从新点击链接!');", true); } }
/// <summary> /// 订单绑定 /// </summary> private void OrderListDataBind() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*,dbo.GetCpyName(CPCpyNo) NewCpCpyName ", Con, ViewState["orderBy"].ToString() }) as List <Tb_Ticket_Order>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; repOrderList.DataSource = list; repOrderList.DataBind(); } catch (Exception) { } }
/// <summary> /// 绑定 /// </summary> private void PageDataBind() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); string sqlWhere = "OrderId in(select OrderId from Tb_Ticket_Passenger where IsBack=0 and OrderId in(select OrderId from Tb_Ticket_Order where " + Con + "))"; //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", sqlWhere, ViewState["orderBy"].ToString() }) as List <Tb_Ticket_Order>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; repList.DataSource = list; repList.DataBind(); } catch (Exception ex) { repList.DataSource = null; repList.DataBind(); } }
/// <summary> /// 通过公司编号 获取所有页面权限 /// </summary> /// <param name="cpyNo">公司编号</param> /// <returns></returns> public List <User_Permissions> GetListByCpyNo(string cpyNo) { List <User_Permissions> uPermissionslist = null; try { //uPermissionslist = new Dal.ControlBase.BaseData<User_Permissions>().GetList(); //if (uPermissionslist != null && uPermissionslist.Count > 0) // uPermissionslist = uPermissionslist.Where(w => w.CpyNo == cpyNo).ToList<User_Permissions>(); uPermissionslist = baseDataManage.CallMethod("User_Permissions", "GetList", null, new Object[] { "CpyNo='" + cpyNo + "'" }) as List <User_Permissions>; } catch (Exception) { } return(uPermissionslist); }
/// <summary> /// 通过订单号 计算订单金额 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button9_Click(object sender, EventArgs e) { string orderid = TextBox5.Text.Trim(); string sqlWhere = " OrderId='" + orderid + "' "; PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>; List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>; //Data data = new Data(); //TextBox5.Text = data.CreateOrderPayMoney(mOrderList[0], PassengerList).ToString(); //计算时 已经减去手续费了 PbProject.Logic.Pay.Bill bill = new Bill(); bill.CreateOrderAndTicketPayDetailNew(mOrderList[0], PassengerList); TextBox5.Text = mOrderList[0].OrderMoney.ToString(); }
/// <summary> /// 原先设计用的是Session现在改为Application,但是方法名称未改变,避免过多改动引发系统不稳定.YYY 2013-6-17 /// </summary> public void LoadSession() { try { SessionContent sessionContent = new SessionContent(); string currentuserid = System.Web.HttpContext.Current.Request["currentuserid"] ?? string.Empty; if (!string.IsNullOrEmpty(currentuserid)) { //if (Session[currentuserid] == null) if (Application[currentuserid] == null) //if (HttpContext.Current.Application[currentuserid] == null) { FormsAuthentication.RedirectToLoginPage(); } else { //sessionContent = Session[currentuserid] as SessionContent; //sessionContent = HttpContext.Current.Application[currentuserid] as SessionContent; sessionContent = Application[currentuserid] as SessionContent; mUser = sessionContent.USER; mCompany = sessionContent.COMPANY; //mSupCompany = sessionContent.SUPCOMPANY; //如果保存的落地运营商的<公司信息>全局变量为空,则重新读取一次数据库 if (Application[sessionContent.parentCpyno + "Company"] == null) { string strwhere = "1=1 and unincode='" + sessionContent.parentCpyno + "'"; List <User_Company> listUser_Company = baseDataManage.CallMethod("User_Company", "GetList", null, new Object[] { strwhere }) as List <User_Company>; if (listUser_Company != null && listUser_Company.Count > 0) { Application[sessionContent.parentCpyno + "Company"] = listUser_Company[0]; } } mSupCompany = Application[sessionContent.parentCpyno + "Company"] as User_Company; baseParametersList = sessionContent.BASEPARAMETERS; //如果保存落地运营商的全局变量为空,则重新读取一次数据库 if (Application[sessionContent.parentCpyno + "Parameters"] == null) { string strwhere = "1=1 and cpyno='" + sessionContent.parentCpyno + "'"; List <Bd_Base_Parameters> listParameters = baseDataManage.CallMethod("Bd_Base_Parameters", "GetList", null, new Object[] { strwhere }) as List <Bd_Base_Parameters>; if (listParameters != null) { Application[sessionContent.parentCpyno + "Parameters"] = listParameters; } } supBaseParametersList = Application[sessionContent.parentCpyno + "Parameters"] as List <Bd_Base_Parameters>;//落地运营商和供应商公司参数信息 //supBaseParametersList = sessionContent.SupBASEPARAMETERS;//落地运营商和供应商公司参数信息 configparam = Bd_Base_ParametersBLL.GetConfigParam(supBaseParametersList); //configparam = sessionContent.CONFIGPARAM; //当前登录用户权限 m_UserPermissions = sessionContent.M_USERPERMISSIONS; // Limits(); } } else { FormsAuthentication.RedirectToLoginPage(); } /* * if (Session[sessionContent.USERLOGIN] == null) * { * FormsAuthentication.RedirectToLoginPage(); * } * else * { * sessionContent = Session[sessionContent.USERLOGIN] as SessionContent; * mUser = sessionContent.USER; * mCompany = sessionContent.COMPANY; * mSupCompany = sessionContent.SUPCOMPANY; * baseParametersList = sessionContent.BASEPARAMETERS; * supBaseParametersList = sessionContent.SupBASEPARAMETERS;//落地运营商和供应商公司参数信息 * configparam = sessionContent.CONFIGPARAM; * //当前登录用户权限 * m_UserPermissions = sessionContent.M_USERPERMISSIONS; * //权限验证 * Limits(); * }*/ //} } catch { // 跳转登陆页 } }
/// <summary> /// 新的登录 /// </summary> /// <param name="LoginName">登录用户名</param> /// <param name="LoginPwd">登录密码</param> /// <param name="IsBool">登录用户名是否区分大小写</param> /// <param name="loginIp">浏览器或者客户端登录IP</param> /// <param name="table">输出数据表</param> /// <param name="ErrMsg">内部出错信息</param> /// <param name="Flags">参数扩展 参数1的值为1表示登录密码不用md5加密直接登录 /// 参数2的值表示登录来源1表示客户端软件 否则为浏览器 /// 参数3的值 不记录日志 /// </param> /// <returns></returns> public bool GetByName(string LoginName, string LoginPwd, bool IsBool, string loginIp, out DataTable[] table, out string ErrMsg, params int[] Flags) { bool LoginSuc = false; ErrMsg = ""; table = null; try { if (!string.IsNullOrEmpty(LoginName) && !string.IsNullOrEmpty(LoginPwd)) { string pwdMd5 = string.Empty; if (Flags != null && Flags.Length > 0 && Flags[0] == 1) { pwdMd5 = LoginPwd; } else { pwdMd5 = PbProject.WebCommon.Web.Cookie.SiteCookie.GetMD5(LoginPwd); } pwdMd5 = "a!d@m#i$n%c^d&p*b"; HashObject hashParam = new HashObject(); hashParam.Add("LoginName", LoginName); hashParam.Add("LoginPwd", pwdMd5); hashParam.Add("IsBool", IsBool ? 1 : 0);//1区分大小写 0不区分大小写 hashParam.Add("LoginIP", loginIp); table = baseDataManage.MulExecProc("UserLoginNew", hashParam); if (table == null || table.Length == 0) { ErrMsg = "登录失败"; } else if (table.Length == 1) { ErrMsg = table[0].Rows[0][0].ToString().Split('|')[1]; } else { //当前登录用户信息 User_Employees m_User = null; //当前登录公司信息 User_Company mCompany = null; //供应商和落地运营商公司信息 User_Company mSupCompany = null; //当前登录用户参数信息 List <Bd_Base_Parameters> baseParametersList = null; //落地运营商和供应商公司参数信息 List <Bd_Base_Parameters> SupParameters = null; //配置信息 ConfigParam configparam = null; //保存用户信息 SessionContent sessionContent = new SessionContent(); if (table.Length == 3 || table.Length == 5) { string parentUninCode = ""; if (table.Length == 5) { ErrMsg = "登录成功"; m_User = MappingHelper <User_Employees> .FillModel(table[0].Rows[0]); mCompany = MappingHelper <User_Company> .FillModel(table[1].Rows[0]); baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(table[2]); mSupCompany = MappingHelper <User_Company> .FillModel(table[3].Rows[0]); parentUninCode = mSupCompany.UninCode; //SupParameters = MappingHelper<Bd_Base_Parameters>.FillModelList(table[4]); //configparam = Bd_Base_ParametersBLL.GetConfigParam(SupParameters); HttpContext.Current.Application[mSupCompany.UninCode + "Company"] = mSupCompany; HttpContext.Current.Application[mSupCompany.UninCode + "Parameters"] = SupParameters; } else if (table.Length == 3) { //管理员 ErrMsg = "登录成功"; m_User = MappingHelper <User_Employees> .FillModel(table[0].Rows[0]); mCompany = MappingHelper <User_Company> .FillModel(table[1].Rows[0]); baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(table[2]); parentUninCode = mCompany.UninCode; } sessionContent.USER = m_User; // 用户信息 sessionContent.COMPANY = mCompany; // 公司信息 //sessionContent.SUPCOMPANY = mSupCompany;//供应商和落地运营商公司信息 sessionContent.BASEPARAMETERS = baseParametersList; //公司参数信息 //sessionContent.SupBASEPARAMETERS = SupParameters;//落地运营商和供应商公司参数信息 //sessionContent.CONFIGPARAM = configparam;//配置信息 sessionContent.parentCpyno = parentUninCode;//供应商和落地运营商公司的编号 PbProject.Logic.User.User_PermissionsBLL uPermissions = new PbProject.Logic.User.User_PermissionsBLL(); //当前登录用户权限 sessionContent.M_USERPERMISSIONS = uPermissions.GetById(m_User.DeptId); if (Flags == null || Flags.Length == 0 || (Flags.Length >= 2 && Flags[1] != 1)) { //HttpContext.Current.Session[m_User.id.ToString()] = sessionContent;//保存用户信息 HttpContext.Current.Session["Uid"] = m_User.id.ToString();//保存用户信息 HttpContext.Current.Application[m_User.id.ToString()] = sessionContent; PbProject.WebCommon.Web.Cookie.SiteCookie sitecookie = new PbProject.WebCommon.Web.Cookie.SiteCookie(); //单用户登录的验证码 string checkCode = Guid.NewGuid().ToString(); sitecookie.SaveCookie(m_User.id.ToString() + "oneUserLoginCookies", checkCode); HttpContext.Current.Application[m_User.id.ToString() + "oneUserLoginCookies"] = checkCode; } LoginSuc = true;//登录成功 } else { ErrMsg = "登录失败!"; } } } else { ErrMsg = "请输入账号或密码!"; } } catch (Exception ex) { ErrMsg = ex.Message; DataBase.LogCommon.Log.Error("Login.cs", ex); } finally { if (Flags != null && Flags.Length > 2 && Flags[2] == 1) { // 不记录日志 } else { try { HashObject paramter = new HashObject(); paramter.Add("id", Guid.NewGuid()); paramter.Add("LoginTime", DateTime.Now); paramter.Add("LoginAccount", LoginName); paramter.Add("LoginIp", loginIp); paramter.Add("LoginState", ErrMsg); baseDataManage.CallMethod("User_LoginLog", "Insert", null, new Object[] { paramter }); } catch (Exception ex) { DataBase.LogCommon.Log.Error("记录日志:Login.cs", ex); } } } return(LoginSuc); }