protected void Button1_Click(object sender, EventArgs e) { VPBLL.Vendor.VenderHelper vhelp = new VPBLL.Vendor.VenderHelper(); List<VPBLL.Vendor.ABiVendor> vendorList = vhelp.getABiVendor(this.vendorName.Value, this.taxNumber.Value); if (vendorList != null && vendorList.Count > 0) { VPBLL.Vendor.ABiVendor vendor = vendorList[0]; VPBLL.Users.UsersHelper uhelp = new VPBLL.Users.UsersHelper(); List<VPBLL.Users.ABiAdminUsers>userList=uhelp.getUsers(vendor.VendorCode); if (userList != null && userList.Count > 0) { VPBLL.Users.ABiAdminUsers user = VPBLL.Users.ABiAdminUsers.FromABiVendor(vendor); VPBLL.Users.ABiAdminUsers user1 = userList[0]; user.ABi_Admin_Users_ID = user1.ABi_Admin_Users_ID; user.Password = user.Password.Substring(user.Password.Length - 6, 6); user.PwdLastChanged = user.PwdLastChanged.AddDays(-91); uhelp.updateUsersPassWord(user, true); ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('密码初始化成功,请尽快修改密码');</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('该供应商未开设帐号');</script>"); } } else { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('无相关信息');</script>"); } }
private void Bind() { if (Request.QueryString["vendorCode"] != null && string.IsNullOrEmpty(Request.QueryString["vendorCode"].ToString()) == false) { VPBLL.Vendor.VenderHelper vhelp = new VPBLL.Vendor.VenderHelper(); List<VPBLL.Vendor.ABiVendor> vendorList = vhelp.getABiVendorByCode(Request.QueryString["vendorCode"].ToString()); if(vendorList!=null&&vendorList.Count>0) { VPBLL.Vendor.ABiVendor vendor=vendorList[0]; VPBLL.Users.ABiAdminUsers users=VPBLL.Users.ABiAdminUsers.FromABiVendor(vendor); VPBLL.Users.UsersHelper uhelp=new VPBLL.Users.UsersHelper(); if (String.IsNullOrEmpty(users.Password) || users.Password.Length <= 6) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('纳税人识别号为空或不正确');back();</script>"); return; } //users.Password = users.Password.Substring(users.Password.Length - 6, 6); uhelp.addUsers(users);//添加帐户 vendor.Active = "1"; vhelp.updateVendorActive(vendor);//标识该vendor已经激活 List<VPBLL.Users.ABiAdminUsers> uList = uhelp.getUsers(users.Username); if (uList != null && uList.Count > 0) { users = uList[0]; VPBLL.Roles.ABiAdminUsersRoles roles = new VPBLL.Roles.ABiAdminUsersRoles(); roles.ABi_Admin_Users_ID = users.ABi_Admin_Users_ID; roles.ABi_Admin_Roles_ID = 4; VPBLL.Roles.AdminUsersRolesHelper rhelp = new VPBLL.Roles.AdminUsersRolesHelper(); rhelp.addUsersRoles(roles); ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('帐号添加成功');back();</script>"); } else ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('用户添加失败');back();</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('未知的编号');back();</script>"); } } else { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('非正常请求');back();</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { VPBLL.IV.IVHelper IVhelp = new VPBLL.IV.IVHelper(); VPBLL.Users.UsersHelper Userhelp = new VPBLL.Users.UsersHelper(); Remarks = new List<VPBLL.IV.ABiRemark>(); Remarks.Add(new VPBLL.IV.ABiRemark() { Username = Userhelp.getUsersByID(UserID).First().Username, InvoiceID = this.InvoiceID, Remark = txtMgrRemark.Text, RemarkPerson = txtARRemarkPerson.Text, RoleName = Userhelp.GetUserRole(UserID).RoleName, DateCreated = DateTime.Now, RoleID = this.RoleID }); IVhelp.setInvoiceRemark(Remarks[Remarks.Count-1]); }
protected void Button1_Click(object sender, EventArgs e) { string NewPassword = this.newPassWord.Value; if (NewPassword.Length < 8) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('新密码必须大于8位')</script>"); return; } else if (this.newPassWord.Value != this.newPassWord2.Value) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('二次密码输入不相同')</script>"); return; } VPBLL.Users.UsersHelper uhelper = new VPBLL.Users.UsersHelper(); List<VPBLL.Users.ABiAdminUsers> uList = uhelper.getUsersByID(this.UserID); if (uList != null && uList.Count > 0) { VPBLL.Users.ABiAdminUsers users=uList[0]; if (users.Password != uhelper.getMd5Hash(this.oldPassWord.Value)) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>setResult('原密码错误');</script>"); return; } users.Password = this.newPassWord.Value; users.PwdLastChanged = DateTime.Now; uhelper.updateUsersPassWord(users, false); if (Response.Cookies["NeedResetPwd"] != null) Response.Cookies["NeedResetPwd"].Value = "false"; ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('密码修改成功');closeForm();</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('用户已实效')</script>"); return; } }
protected void LinkButton1_Click(object sender, EventArgs e) { try { string userID = Request.Cookies["UserID"].Value; VPBLL.Users.UsersHelper helper = new VPBLL.Users.UsersHelper(); List<VPBLL.Users.ABiAdminUsers> userList = helper.getUsersByID(Convert.ToInt32(userID)); VPBLL.Users.ABiAdminUsers user = userList[0]; user.LoginStatus = "0"; helper.updateUsersLastLogin(user); HttpCookie hc = Request.Cookies["UserID"]; hc.Expires = DateTime.Now.AddDays(-1); Response.AppendCookie(hc); hc = Request.Cookies["RoleID"]; hc.Expires = DateTime.Now.AddDays(-1); Response.AppendCookie(hc); hc = Request.Cookies["Name"]; hc.Expires = DateTime.Now.AddDays(-1); Response.AppendCookie(hc); hc = Request.Cookies["LastLogin"]; hc.Expires = DateTime.Now.AddDays(-1); Response.AppendCookie(hc); //hc = Request.Cookies["NeedResetPwd"]; //hc.Expires = DateTime.Now.AddDays(-1); //Response.AppendCookie(hc); } catch { } ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>window.location.href = 'login.aspx';</script>"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.GetRequest(); this.BindSel(); if (string.IsNullOrEmpty(_ID) == false) { VPBLL.Users.UsersHelper helper = new VPBLL.Users.UsersHelper(); List<VPBLL.Users.ABiAdminUsers> list = helper.getUsersByID(Convert.ToInt32(_ID)); if (list != null && list.Count > 0) { VPBLL.Users.ABiAdminUsers user = list[0]; this.userID.Value = user.ABi_Admin_Users_ID.ToString(); this.userName.Value = user.Username; this.name.Value = user.Name; this.phone.Value = user.Phone; this.email.Value = user.Email; this.status.SelectedIndex = user.Status ? 1 : 0; VPBLL.Roles.AdminUsersRolesHelper rhelper = new VPBLL.Roles.AdminUsersRolesHelper(); List<VPBLL.Roles.ABiAdminUsersRoles> roleList = rhelper.getUsersRolesByUserID(user.ABi_Admin_Users_ID); if (roleList != null && roleList.Count > 0) { VPBLL.Roles.ABiAdminUsersRoles role = roleList[0]; this.role.SelectedIndex = role.ABi_Admin_Roles_ID - 1; } else { this.role.Items.Add(""); this.role.SelectedIndex = role.Items.Count - 1; } } } } }
protected void Button1_Click(object sender, EventArgs e) { try { VPBLL.Users.UsersHelper uhelper = new VPBLL.Users.UsersHelper(); VPBLL.Roles.AdminUsersRolesHelper rhelper = new VPBLL.Roles.AdminUsersRolesHelper(); VPBLL.Users.ABiAdminUsers user = new VPBLL.Users.ABiAdminUsers(); user.Name = this.name.Value; user.Password = this.passWord.Value; user.Username = this.userName.Value; user.Status = this.status.Value == "1" ? true : false; user.Phone = this.phone.Value; user.Email = this.email.Value; if (string.IsNullOrEmpty(this.userID.Value)) { if (string.IsNullOrEmpty(user.Password) || string.IsNullOrEmpty(user.Username)) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('用户名密码必填')</script>"); return; } List<VPBLL.Users.ABiAdminUsers>checklist= uhelper.getUsers(user.Username); if (checklist != null && checklist.Count > 0) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('该用户名已存在')</script>"); return; } if (string.IsNullOrEmpty(role.Value)) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('请选择用户角色')</script>"); return; } user.DateCreated = DateTime.Now; user.DateModified = DateTime.Now; user.LastLogin = DateTime.Now; user.PwdLastChanged = DateTime.Now; int nRet = uhelper.addUsers(user); user = uhelper.getUsers(user.Username)[0]; VPBLL.Roles.ABiAdminUsersRoles roles = new VPBLL.Roles.ABiAdminUsersRoles(); roles.ABi_Admin_Roles_ID = Convert.ToInt32(this.role.Value); roles.ABi_Admin_Users_ID = user.ABi_Admin_Users_ID; rhelper.addUsersRoles(roles); ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('帐户添加成功');back();</script>"); } else { if (string.IsNullOrEmpty(role.Value)) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('请选择用户角色')</script>"); return; } List<VPBLL.Roles.ABiAdminUsersRoles> rList = rhelper.getUsersRoles(Convert.ToInt32(this.userID.Value)); VPBLL.Roles.ABiAdminUsersRoles roles = new VPBLL.Roles.ABiAdminUsersRoles(); if (rList != null && rList.Count > 0) { roles = rList[0]; rhelper.deleteUsersRoles(roles.ABi_Admin_Users_Roles_ID); } roles.ABi_Admin_Roles_ID = this.role.SelectedIndex + 1; roles.ABi_Admin_Users_ID = Convert.ToInt32(this.userID.Value); rhelper.addUsersRoles(roles); user.ABi_Admin_Users_ID = Convert.ToInt32(this.userID.Value); user.DateModified = DateTime.Now; uhelper.updateUsers(user); ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('帐户修改成功');back();</script>"); } } catch (Exception ex) { Utility.LogHelper logger = new Utility.LogHelper("InsertUser"); logger.LogError(this, ex); } }
public String ToTraceString() { StringBuilder sb = new StringBuilder(); String username = ""; var users = new VPBLL.Users.UsersHelper().getUsersByID(UserID); if (users != null && users.Count > 0) { username = users.First().Username; } sb.AppendFormat("<td><B>操作用户:</B>{0}</td>", username); sb.AppendFormat("<td><B>操作类型:</B>{0}</td>", Trace.TraceHelper.TraceTypeString(TraceType)); IABiTrace model = TraceHelper.ReadTrace(TraceType, Data); VPDAL.ABInvVPEntities dbContext = new VPDAL.ABInvVPEntities(); if ((TraceType & (int)Trace.eTraceType.eInvoiceBase) > 0) { int invoiceId = int.Parse(AssetIDs[0]); var ivObjs = from iv in dbContext.ABi_Invoice join v in dbContext.ABi_Vendor on iv.ABi_Vendor_ID equals v.ABi_Vendor_ID where iv.ABi_Invoice_ID == invoiceId select new {iv.InvoiceNumber, v.VendorCode}; if (ivObjs != null && ivObjs.Count() > 0) { var iv = ivObjs.First(); sb.AppendFormat("<td><B>发票号</B>({0}),<B>供应商代码</B>({1})</td>", iv.InvoiceNumber, iv.VendorCode); } } else if ((TraceType & (int)Trace.eTraceType.ePOBase) > 0) { int poId = int.Parse(AssetIDs[0]); var poObjs = from po in dbContext.ABi_PO where po.ABi_PO_ID == poId select po; if (poObjs != null && poObjs.Count() > 0) { var po = poObjs.First(); sb.AppendFormat("<td><B>凭据:</B>订单号({0}),订单行号({1})</td>", po.PONumber, po.POItemNumber); } } else if ((TraceType & (int)Trace.eTraceType.eGRBase) > 0) { sb.AppendFormat("<td>"); foreach (var strGRId in AssetIDs) { int grId = int.Parse(strGRId); var grObjs = from gr in dbContext.ABi_GR join pg in dbContext.ABi_PO_GR on gr.ABi_GR_ID equals pg.ABi_GR_ID join po in dbContext.ABi_PO on pg.ABi_PO_ID equals po.ABi_PO_ID where gr.ABi_GR_ID == grId select new { gr.RefGRNumber, gr.RefGRItemNumber, po.PONumber, po.POItemNumber, gr.GRNumber, gr.GRItemNumber }; if (grObjs != null && grObjs.Count() > 0) { var gr = grObjs.First(); sb.AppendFormat("<B>收货单号</B>({0}),<B>收货行号</B>({1}),<B>订单号</B>({2}),<B>订单行号</B>({3})<br />", gr.GRNumber, gr.GRItemNumber, gr.PONumber, gr.POItemNumber); } } sb.AppendFormat("</td>"); } return sb.ToString(); }
public void ProcessRequest(HttpContext context) { try { int userId = -1; int roleId = -1; String strUId = context.Request.QueryString["apiuid"]; String strRId = context.Request.QueryString["apirid"]; if (!String.IsNullOrEmpty(strUId) && !String.IsNullOrEmpty(strRId)) { userId = int.Parse(strUId); roleId = int.Parse(strRId); } else { VPBLL.BasePage bp = new VPBLL.BasePage(); bp.CheckUser(HttpContext.Current.Request.Cookies["LastLogin"], context); userId = bp.UserID; roleId = bp.RoleID; } String act = context.Request.QueryString["act"]; bool bExport = ("1" == context.Request.QueryString["be"]); VPBLL.DataTable.FormatedList fl = new VPBLL.DataTable.FormatedList(); switch (act) { case "1"://GRReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.GR.ABiGR>(context.Request); var helper = new VPBLL.GR.GRHelper(); var list = helper.GetGR(new VPBLL.GR.GRHelper.QueryCondition() { GRNumber = context.Request.QueryString["gn"], MoveType = context.Request.QueryString["mt"], VendorCode = context.Request.QueryString["vc"], PONumber = context.Request.QueryString["pn"], DateStart = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToDateTime(context.Request.QueryString["ed"]), UserID = userId, IsExport = bExport, RoleID = roleId }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "2": //GRIVReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.GR.ABiGRIV>(context.Request); var helper = new VPBLL.GR.GRHelper(); var list = helper.GetGRIV(new VPBLL.GR.GRHelper.QueryCondition() { IVNumber = context.Request.QueryString["iv"], VendorCode = context.Request.QueryString["vc"], DateStart = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToDateTime(context.Request.QueryString["ed"]), PONumber = context.Request.QueryString["pn"], UserID = userId, IsExport = bExport }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "3": //POReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.PO.ABiPO>(context.Request); var helper = new VPBLL.PO.POHelper(); var list = helper.getPO(new VPBLL.PO.POHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], CompanyName = context.Request.QueryString["cn"], VendorCode = context.Request.QueryString["vc"], MeterialNumber = context.Request.QueryString["mn"], PONumber = context.Request.QueryString["pn"], DateBegin = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToDateTime(context.Request.QueryString["ed"]), UserID = userId, IsExport = bExport, RoleID = roleId }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "4": //POIVReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.PO.ABiPOIV>(context.Request); var helper = new VPBLL.PO.POHelper(); var list = helper.getPOIV(new VPBLL.PO.POHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], CompanyName = context.Request.QueryString["cn"], VendorCode = context.Request.QueryString["vc"], MeterialNumber = context.Request.QueryString["mn"], PONumber = context.Request.QueryString["pn"], DateBegin = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToDateTime(context.Request.QueryString["ed"]), UserID = userId, IsExport = bExport }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "5": //POStatusReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.PO.ABiPOStatus>(context.Request); var helper = new VPBLL.PO.POHelper(); var list = helper.getPOStatus(new VPBLL.PO.POHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], CompanyName = context.Request.QueryString["cn"], VendorCode = context.Request.QueryString["vc"], MeterialNumber = context.Request.QueryString["mn"], PONumber = context.Request.QueryString["pn"], DateBegin = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToDateTime(context.Request.QueryString["ed"]), UserID = userId, IsExport = bExport }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "6": //IVReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIV>(context.Request); var helper = new VPBLL.IV.IVHelper(); var list = helper.getIV(new VPBLL.IV.IVHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], VendcorName = context.Request.QueryString["vn"], VendorCode = context.Request.QueryString["vc"], InvoiceNumber = context.Request.QueryString["in"], IsTolerance = context.Request.QueryString["it"], DateBegin = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToDateTime(context.Request.QueryString["ed"]), PaymentStatus = context.Request.QueryString["ps"], UserID = userId, IsExport = bExport, RoleID = roleId }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "7": //IVCompletedReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIVCompleted>(context.Request); var helper = new VPBLL.IV.IVHelper(); var list = helper.getIVCompleted(new VPBLL.IV.IVHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], VendcorName = context.Request.QueryString["vn"], VendorCode = context.Request.QueryString["vc"], InvoiceNumber = context.Request.QueryString["in"], IsTolerance = context.Request.QueryString["it"], DateBegin = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToDateTime(context.Request.QueryString["ed"]), UserID = userId, IsExport = bExport }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "8": //IVPendingReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIVPending>(context.Request); var helper = new VPBLL.IV.IVHelper(); var list = helper.getIVPending(new VPBLL.IV.IVHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], VendcorName = context.Request.QueryString["vn"], VendorCode = context.Request.QueryString["vc"], InvoiceNumber = context.Request.QueryString["in"], IsTolerance = context.Request.QueryString["it"], DateBegin = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToDateTime(context.Request.QueryString["ed"]), Buys = context.Request.QueryString["b"], UserID = userId, IsExport = bExport }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "9": //GR_NewIV.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.GR.ABiNewIV>(context.Request); var helper = new VPBLL.GR.GRHelper(); var list = helper.getNewIV(new VPBLL.GR.GRHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], GRNumber = context.Request.QueryString["gn"], PONumber = context.Request.QueryString["pn"], DateStart = ToDateTime(context.Request.QueryString["ds"]), DateEnd = ToDateTime(context.Request.QueryString["de"]), PODateStart = ToDateTime(context.Request.QueryString["pds"]), PODateEnd = ToDateTime(context.Request.QueryString["pde"]), VendorCode = context.Request.QueryString["vc"], UserID = userId, IsExport = bExport, RoleID = roleId }); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "10": //IVRemark.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIVRemark>(context.Request); var helper = new VPBLL.IV.IVHelper(); int invoiceId; if (int.TryParse(context.Request.QueryString["id"], out invoiceId)) { var list = helper.getIVRemarkGR(invoiceId, userId); fl = parser.Parse(list.AsQueryable(), bExport); } } break; case "11": //IVDetail.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIVDetail>(context.Request); var helper = new VPBLL.IV.IVHelper(); int invoiceId; if (int.TryParse(context.Request.QueryString["id"], out invoiceId)) { var list = helper.getInvoiceDetail(invoiceId, userId); fl = parser.Parse(list.AsQueryable(), bExport); } } break; case "21"://VendorCompanyReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Vendor.ABiVendorCompany>(context.Request); var helper = new VPBLL.Vendor.VenderHelper(); string seachCode = context.Request.QueryString["vc"]; if (roleId == 4) { VPBLL.Users.UsersHelper uhelper = new VPBLL.Users.UsersHelper(); List<VPBLL.Users.ABiAdminUsers> uList = uhelper.getUsersByID(userId); if (uList != null && uList.Count > 0) { seachCode = uList[0].Username; } } var list = helper.getABiVendorCompany(new VPBLL.Vendor.VenderHelper.QueryCondition() { VendorCode = seachCode, VendorName = context.Request.QueryString["vn"], TaxNumber = context.Request.QueryString["tn"], CompanyCode = context.Request.QueryString["cc"], DateBegin = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToMaxDateTime(context.Request.QueryString["ed"]), //DateBegin = Convert.ToDateTime("2001-01-01 00:00:00"), //DateEnd = Convert.ToDateTime("2020-01-01 00:00:00"), UserID=userId, RoleID=roleId }); list.AsQueryable(); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "22"://CompanyReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Company.ABiCompany>(context.Request); var helper = new VPBLL.Company.CompanyHelper(); var list = helper.getABiCompany(new VPBLL.Company.CompanyHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], CompanyName = context.Request.QueryString["cn"], }); list.AsQueryable(); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "23"://PlantReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Plant.ABiPlant>(context.Request); var helper = new VPBLL.Plant.PlantHelper(); var list = helper.getABiPlant(new VPBLL.Plant.PlantHelper.QueryCondition() { PlantCode = context.Request.QueryString["pc"] }); list.AsQueryable(); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "24"://VendorActiveReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Vendor.ABiVendorReport>(context.Request); var helper = new VPBLL.Vendor.VenderHelper(); var list = helper.getABiVendorActive(new VPBLL.Vendor.VenderHelper.QueryCondition() { VendorCode = context.Request.QueryString["vc"], VendorName = context.Request.QueryString["vn"], TaxNumber = context.Request.QueryString["tn"], DateBegin = ToDateTime(context.Request.QueryString["sd"]), DateEnd = ToMaxDateTime(context.Request.QueryString["ed"]) //DateBegin = Convert.ToDateTime("2001-01-01 00:00:00"), //DateEnd = Convert.ToDateTime("2020-01-01 00:00:00") }); list.AsQueryable(); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "25"://UsersReport.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Users.ABiUsersRoles>(context.Request); var helper = new VPBLL.Users.UsersHelper(); string UserName = context.Request.QueryString["un"]; var list = helper.getABiUsersRoles(new VPBLL.Users.UsersHelper.QueryCondition() { UserName = context.Request.QueryString["un"], Name = context.Request.QueryString["nm"], Status = context.Request.QueryString["st"], ABi_Admin_Roles_ID = context.Request.QueryString["ro"] }); list.AsQueryable(); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "26"://UsersCompany.aspx { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Users.UsersCompany>(context.Request); var helper = new VPBLL.Company.CompanyHelper(); var list = helper.getUsersCompany(new VPBLL.Company.CompanyHelper.QueryCondition() { CompanyCode = context.Request.QueryString["cc"], CompanyName = context.Request.QueryString["cn"], ABi_Admin_Users_ID = context.Request.QueryString["Admin_Users_ID"], Type = context.Request.QueryString["type"] }); list.AsQueryable(); fl = parser.Parse(list.AsQueryable(), bExport); } break; case "30": { var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Vendor.ABiVendor>(context.Request); var helper = new VPBLL.Vendor.VenderHelper(); String cc = context.Request.QueryString["cc"]; String ia = context.Request.QueryString["ia"]; String hi = context.Request.QueryString["hi"]; var list = helper.getVenders(ia, cc, hi); list.AsQueryable(); fl = parser.Parse(list.AsQueryable(), bExport); } break; } if (fl != null) { if (!bExport) { context.Response.ContentType = "application/json"; context.Response.Write(fl.ToJSON()); } else { context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); context.Response.ContentType = "application/ms-excel"; context.Response.Charset = "GB2312"; context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("export" + ".xls", System.Text.Encoding.GetEncoding("GB2312")).ToString()); context.Response.Write(fl.ToCVS()); } } } catch (Exception ex) { logger.LogError("", ex); } }
protected void ImageButton1_Click(object sender, EventArgs e) { string userName = this.userName.Value; string passWord = this.userPwd.Value; VPBLL.Users.UsersHelper helper = new VPBLL.Users.UsersHelper(); #if DEBUG List<VPBLL.Users.ABiAdminUsers> list = helper.getUsers(userName); #else List<VPBLL.Users.ABiAdminUsers> list = helper.getUsers(userName, passWord); #endif if (list != null && list.Count > 0 && list[0].Status) { VPBLL.Users.ABiAdminUsers user = list[0]; if (user.LoginStatus == "1" && user.LastLogin >= DateTime.Now.AddMinutes(-15)&&user.IPAddress!=Request.UserHostAddress) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('该帐号处于登陆状态')</script>"); } else { VPBLL.Roles.AdminUsersRolesHelper roleHelper = new VPBLL.Roles.AdminUsersRolesHelper(); List<VPBLL.Roles.ABiAdminUsersRoles> roleList = roleHelper.getUsersRolesByUserID(user.ABi_Admin_Users_ID); if (roleList != null && roleList.Count > 0) { user.LoginStatus = "1"; user.LastLogin = DateTime.Now; user.IPAddress = Request.UserHostAddress; helper.updateUsersLastLogin(user); //保存userID到cookie HttpCookie newcookie = new HttpCookie("UserID"); newcookie.Value = user.ABi_Admin_Users_ID.ToString(); newcookie.Expires = DateTime.Now.AddHours(1); Response.Cookies.Add(newcookie); //Session["UserID"] = user.ABi_Admin_Users_ID; //保存userName到cookie newcookie = new HttpCookie("Name"); newcookie.Value = Server.UrlEncode(user.Name); newcookie.Expires = DateTime.Now.AddHours(1); Response.Cookies.Add(newcookie); //Session["Name"] = Server.UrlEncode(user.Name); //保存LastLogin到cookie user.LastLogin = DateTime.Now; newcookie = new HttpCookie("LastLogin"); newcookie.Value = user.LastLogin.ToString(); newcookie.Expires = DateTime.Now.AddHours(1); Response.Cookies.Add(newcookie); helper.updateUsersLastLogin(user); //Session["LastLogin"] = user.LastLogin.ToString(); //保存角色编号 VPBLL.Roles.ABiAdminUsersRoles role = roleList[0]; newcookie = new HttpCookie("RoleID"); newcookie.Value = role.ABi_Admin_Roles_ID.ToString(); newcookie.Expires = DateTime.Now.AddHours(1); Response.Cookies.Add(newcookie); //Session["RoleID"] = role.ABi_Admin_Roles_ID; newcookie = new HttpCookie("NeedResetPwd"); newcookie.Value = user.NeedResetPwd.ToString(); newcookie.Expires = DateTime.Now.AddHours(1); Response.Cookies.Add(newcookie); //Session["NeedResetPwd"] = user.NeedResetPwd; String warningMsg = ""; String act = "0"; if (role.ABi_Admin_Roles_ID == 4) {//Vendor int nPendGRCount = new VPBLL.GR.GRHelper().getGRNewIVCount(user.ABi_Admin_Users_ID); if (nPendGRCount > 0) { //warningMsg = String.Format("您有{0}收货待开发票,为确保付款及时性,发票请于付款到期日至少45自然日前送达BSC(付款到期日=发票开票日与PO收货日孰晚+账期)"); warningMsg = String.Format("您有{0}收货待开发票,为确保付款及时性,发票请于付款到期日至少45自然日前送达BSC(付款到期日=发票开票日与PO收货日孰晚+账期)", nPendGRCount); act = "4"; } } else if (role.ABi_Admin_Roles_ID == 1) { int inactiveVendorCount = new VPBLL.Vendor.VenderHelper().getInactiveVendorCount(); if (inactiveVendorCount > 0) { warningMsg = String.Format("您有{0}供应商待激活", inactiveVendorCount); act = "1"; } } ScriptManager.RegisterStartupScript(Page, GetType(), "", String.Format("ValidateIEversion('Index.aspx', '{0}', {1},'{2}');", warningMsg, role.ABi_Admin_Roles_ID,act), true); } else { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('该帐户未授权')</script>"); } } } else { if (list != null && list.Count > 0 && !list[0].Status) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('用户未激活,请与管理员联系')</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('您必须指定一个有效的用户名和密码')</script>"); } } }
protected void InitControls() { VPBLL.Users.UsersHelper Userhelp = new VPBLL.Users.UsersHelper(); txtARRemarkPerson.Text = Userhelp.getUsersByID(UserID).First().Username; }
private string BindHtml() { //父级别目录 System.Text.StringBuilder result = new System.Text.StringBuilder(); //子级别目录 System.Text.StringBuilder sresult = new System.Text.StringBuilder(); result.Append(" <div class='navigation'><ul>"); VPBLL.Users.UsersHelper uhelper = new VPBLL.Users.UsersHelper(); List<VPBLL.Users.ABiAdminUsers> uList = uhelper.getUsersByID(this.UserID); if (uList == null || uList.Count == 0) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", String.Format("<script>alert('登陆过期:{0}');</script>", this.UserID)); return ""; } VPBLL.Users.ABiAdminUsers users = uList[0]; if (users.PwdLastChanged.AddDays(90) < DateTime.Now) { ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('密码已过期,请修改密码');changePassWord();</script>"); } List<ABiPurview> parList = helper.getPurviewByRoleID(this.RoleID, 0); int index = 0; foreach (ABiPurview abi in parList) { if (act == "0")//如果是正常登陆 { if (index == 0) { result.AppendFormat(" <li><a class='current' href='{0}' target='mainFrame'><span>{1}</span></a></li>", abi.PurviewUrl, abi.PurviewName); FristPage = abi.PurviewUrl; } else result.AppendFormat(" <li><a href='{0}' target='mainFrame'><span>{1}</span></a></li>", abi.PurviewUrl, abi.PurviewName); List<ABiPurview> List = helper.getPurviewByRoleID(this.RoleID, abi.ABi_Purview_ID); int tryCount = 0; while ((List == null || List.Count == 0) && tryCount < 3) { //logger.LogError(String.Format("getPurviewByRoleID({0}, {1}) = 0", RoleID, abi.ABi_Purview_ID)); System.Threading.Thread.Sleep(50); List = helper.getPurviewByRoleID(this.RoleID, abi.ABi_Purview_ID); tryCount++; } sresult.Append("<div class='subNav'><b>操作:</b>"); foreach (ABiPurview obj in List) { if (index == 0) sresult.AppendFormat(" <a class='current' href='{0}' target='mainFrame' >{1}</a>", obj.PurviewUrl, obj.PurviewName); else sresult.AppendFormat(" <a target='mainFrame' href='{0}' >{1}</a>", obj.PurviewUrl, obj.PurviewName); index++; } } else if (act == "1") { if (abi.PurviewName == "供应商信息") { result.AppendFormat(" <li><a class='current' href='{0}' target='mainFrame'><span>{1}</span></a></li>", abi.PurviewUrl, abi.PurviewName); FristPage = abi.PurviewUrl; } else result.AppendFormat(" <li><a href='{0}' target='mainFrame'><span>{1}</span></a></li>", abi.PurviewUrl, abi.PurviewName); List<ABiPurview> List = helper.getPurviewByRoleID(this.RoleID, abi.ABi_Purview_ID); int tryCount = 0; while ((List == null || List.Count == 0) && tryCount < 3) { //logger.LogError(String.Format("getPurviewByRoleID({0}, {1}) = 0", RoleID, abi.ABi_Purview_ID)); System.Threading.Thread.Sleep(50); List = helper.getPurviewByRoleID(this.RoleID, abi.ABi_Purview_ID); tryCount++; } sresult.Append("<div class='subNav'><b>操作:</b>"); foreach (ABiPurview obj in List) { if (obj.PurviewName == "激活供应商") sresult.AppendFormat(" <a class='current' href='{0}' target='mainFrame' >{1}</a>", obj.PurviewUrl, obj.PurviewName); else sresult.AppendFormat(" <a target='mainFrame' href='{0}' >{1}</a>", obj.PurviewUrl, obj.PurviewName); index++; } } else if (act == "4") { if (abi.PurviewName == "收货信息") { result.AppendFormat(" <li><a class='current' href='{0}' target='mainFrame'><span>{1}</span></a></li>", abi.PurviewUrl, abi.PurviewName); FristPage = abi.PurviewUrl; } else result.AppendFormat(" <li><a href='{0}' target='mainFrame'><span>{1}</span></a></li>", abi.PurviewUrl, abi.PurviewName); List<ABiPurview> List = helper.getPurviewByRoleID(this.RoleID, abi.ABi_Purview_ID); int tryCount = 0; while ((List == null || List.Count == 0) && tryCount < 3) { //logger.LogError(String.Format("getPurviewByRoleID({0}, {1}) = 0", RoleID, abi.ABi_Purview_ID)); System.Threading.Thread.Sleep(50); List = helper.getPurviewByRoleID(this.RoleID, abi.ABi_Purview_ID); tryCount++; } sresult.Append("<div class='subNav'><b>操作:</b>"); foreach (ABiPurview obj in List) { if (obj.PurviewName == "开票") sresult.AppendFormat(" <a class='current' href='{0}' target='mainFrame' >{1}</a>", obj.PurviewUrl, obj.PurviewName); else sresult.AppendFormat(" <a target='mainFrame' href='{0}' >{1}</a>", obj.PurviewUrl, obj.PurviewName); index++; } } sresult.Append("</div>"); index++; } result.Append("</ul></div>"); return result.ToString()+sresult.ToString(); }
public void ProcessRequest(HttpContext context) { String act = ""; String resultMsg = ""; try { act = context.Request.Params["act"]; if (HttpContext.Current.Request.Cookies["UserID"] == null) { resultMsg = new VPBLL.ResponseInfo(VPBLL.eResponseCode.User_Need_ReLogin, "登陆已失效,请重新登陆").ToMessage(); } else { int userId = Convert.ToInt32(HttpContext.Current.Request.Cookies["UserID"].Value); switch (act) { case "1": //GR_NewIV.aspx String refGRNumList = context.Request.Params["rgn"]; String refGRItemList = context.Request.Params["rgin"]; String invoiceNumber = context.Request.Params["ivn"]; String strInvoiceDate = context.Request.Params["ivd"]; String strTaxAmount = context.Request.Params["ivt"]; String strTotalAmount = context.Request.Params["iva"]; String strVendorRemark = context.Request.Params["vr"]; String poNumList = context.Request.Params["pn"]; String poINList = context.Request.Params["pin"]; DateTime invoiceDate = new DateTime(); double taxAmount; double totalAmount; if (String.IsNullOrEmpty(invoiceNumber) || !(!String.IsNullOrEmpty(strInvoiceDate) && DateTime.TryParse(strInvoiceDate, out invoiceDate)) || !(!String.IsNullOrEmpty(strTaxAmount) && double.TryParse(strTaxAmount, out taxAmount)) || !(!String.IsNullOrEmpty(strTotalAmount) && double.TryParse(strTotalAmount, out totalAmount))) { resultMsg = new VPBLL.ResponseInfo(VPBLL.eResponseCode.New_Invoice_Error_IVInformation_Wrong, "发票输入信息不正确").ToMessage(); break; } if (String.IsNullOrEmpty(refGRItemList) || String.IsNullOrEmpty(refGRItemList) || String.IsNullOrEmpty(poNumList) || String.IsNullOrEmpty(poINList) || refGRItemList.Split(',').Length != refGRItemList.Split(',').Length) { resultMsg = new VPBLL.ResponseInfo(VPBLL.eResponseCode.New_Invoice_Error_GRInformation_Wrong, "收货信息错误").ToMessage(); break; } var result = new VPBLL.GR.GRHelper().createNewIV(userId, refGRNumList, refGRItemList, poNumList, poINList, invoiceNumber, invoiceDate, taxAmount, totalAmount, strVendorRemark); resultMsg = result.ToMessage(); logger.LogInfo(String.Format("NewIV(userId:{0}, refGRNumbers:'{1}', refGRItemNumber'{2}', invoiceNumber:{3}, invoiceDate:{4}) = {5}", userId, refGRNumList, refGRItemList, invoiceNumber, invoiceDate, resultMsg)); if (result.ResponseCode == 1) { try { String subject = "开发票超容差,请备注"; String vendorCode = new VPBLL.Users.UsersHelper().getUsersByID(userId).First().Username; String vendorName = new VPBLL.Vendor.VenderHelper().getABiVendorByCode(vendorCode).First().VendorName; String content = new VPBLL.GR.GRHelper().GetEmailContent(int.Parse(result.ResponseMessage), 3, userId, invoiceNumber, vendorCode, vendorName); List<KeyValuePair<String, String>> buyers = new VPBLL.Vendor.VenderHelper().getBuyerOfCompany(result.ResponseMessage, 3); if (buyers.Count > 0) { var mh = new VPBLL.MailHelper(); mh.EmainSend((from o in buyers select o.Value).ToArray(), content, subject); } } catch (Exception ex) { logger.LogError(String.Format("开票超容差发送email失败"), ex); } } break; case "2": { VPBLL.BasePage bp = new VPBLL.BasePage(); if (bp.RoleID != 5) { resultMsg = new VPBLL.ResponseInfo(VPBLL.eResponseCode.User_NoPermission, "用户无权限").ToMessage(); } else { String ivId = context.Request.Params["ivd"]; String payAmount = context.Request.Params["pa"]; String payDate = context.Request.Params["dp"]; String mdIV = context.Request.Params["in"]; resultMsg = new VPBLL.IV.IVHelper().updateInvoice(int.Parse(ivId), mdIV, DateTime.Parse(payDate), double.Parse(payAmount)).ToMessage(); logger.LogInfo(String.Format("updateInvoice(invoiceId'{0}', PayDate'{1}', PayAmount'{2}'). UserID:{3}", ivId, payDate, payAmount, bp.UserID)); } } break; case "3": { VPBLL.BasePage bp = new VPBLL.BasePage(); if (bp.RoleID != 5) { resultMsg = new VPBLL.ResponseInfo(VPBLL.eResponseCode.User_NoPermission, "用户无权限").ToMessage(); } else { string grNumber = context.Request.Params["gn"]; string grItemNumber = context.Request.Params["gin"]; int nRow = new VPBLL.GR.GRHelper().deleteGR(grNumber, grItemNumber); resultMsg = String.Format("{0}&{1}", nRow > 0 ? 0 : -300, nRow.ToString()); logger.LogInfo(String.Format("deleteGR(userID={0}, grNumber={1}, grItemNumber={2}) = {3}", bp.UserID, grNumber, grItemNumber, nRow)); } } break; case "4": { VPBLL.BasePage bp = new VPBLL.BasePage(); if (bp.RoleID != 5) { resultMsg = new VPBLL.ResponseInfo(VPBLL.eResponseCode.User_NoPermission, "用户无权限").ToMessage(); } else { string grNumber = context.Request.Params["pn"]; string grItemNumber = context.Request.Params["pin"]; int nRow = new VPBLL.PO.POHelper().deletePO(grNumber, grItemNumber); resultMsg = String.Format("{0}&{1}", nRow > 0 ? 0 : -300, nRow.ToString()); logger.LogInfo(String.Format("deleteGR(userID={0}, poNumber={1}, poItemNumber={2}) = {3}", bp.UserID, grNumber, grItemNumber, nRow)); } } break; case "5": { VPBLL.BasePage bp = new VPBLL.BasePage(); if (bp.RoleID != 5) { resultMsg = new VPBLL.ResponseInfo(VPBLL.eResponseCode.User_NoPermission, "用户无权限").ToMessage(); } else { string strgrinfo = context.Request.Params["gn"]; string strpoinfo = context.Request.Params["po"]; string gn = strgrinfo.Split(',')[0]; string gin = strgrinfo.Split(',')[1]; string pn = strpoinfo.Split(',')[0]; string pin = strpoinfo.Split(',')[1]; int nDelRow = new VPBLL.GR.GRHelper().deleteGRNew(gn, gin, pn, pin, userId); resultMsg = String.Format("{0}&{1}", nDelRow > 0 ? 0 : -300, nDelRow.ToString()); logger.LogInfo(String.Format("deleteGRNew(userID={0}, gn={1}, po={2}) = {3}", bp.UserID, strgrinfo, strpoinfo, nDelRow)); } } break; } } } catch (Exception ex) { logger.LogError(this, ex); resultMsg = new VPBLL.ResponseInfo(VPBLL.eResponseCode.SystemError, ex.Message).ToMessage();//"-550&未知错误"; } context.Response.ContentType = "text/plain"; context.Response.Write(resultMsg); }