/// <summary> /// 输出系统日志 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="ex">异常信息</param> private static void WriteSystemLog(UserInfoUtil userInfo, int ModuleType, Exception ex) { /* * 出现异常时,输出系统日志到文本文件 * 考虑出现异常情况比较少,尽管一个方法可能多次异常, * 但还是考虑将异常日志的变量定义放在catch里面 */ //定义变量 LogInfo logSys = new LogInfo(); //设置日志类型 需要指定为系统日志 logSys.Type = LogInfo.LogType.SYSTEM; //指定系统日志类型 出错信息 logSys.SystemKind = LogInfo.SystemLogKind.SYSTEM_ERROR; //指定登陆用户信息 logSys.UserInfo = userInfo; //设定模块ID if (ModuleType == 0) { logSys.ModuleID = ConstUtil.MODULE_ID_INCOMEBILL_ADD; } else { logSys.ModuleID = ConstUtil.MODULE_ID_INCOMEBILL_LIST; } //描述 logSys.Description = ex.ToString(); //输出日志 LogUtil.WriteLog(logSys); }
protected void Page_Load(object sender, EventArgs e) { userInfo = SessionUtil.Session["UserInfo"] as UserInfoUtil; // 小数位数 _selPoint = int.Parse(userInfo.SelPoint); if (!IsPostBack) { FlowApply1.BillTypeFlag = ConstUtil.BILL_TYPECODE_STORAGE_QUALITY; FlowApply1.BillTypeCode = ConstUtil.BILL_TYPECODE_STORAGE_NOPASS; checkNo.CodingType = ConstUtil.CODING_RULE_StorageQuality_NO; checkNo.ItemTypeID = ConstUtil.CODING_RULE_StorageNOPass_NO; #region 初始化 int EmployeeId = userInfo.EmployeeID; string Company = userInfo.CompanyCD; string UserID = userInfo.UserID; txtCloseDate.Text = Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("yyyy-MM-dd"); txtCloser.Value = userInfo.EmployeeName; txtCloserReal.Value = userInfo.EmployeeName; txtCloser.Value = EmployeeId.ToString(); txtConfirmor.Value = userInfo.EmployeeName; txtConfirmDate.Text = Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("yyyy-MM-dd"); tbCreater.Text = userInfo.EmployeeName; txtCreateDate.Text = Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("yyyy-MM-dd"); txtModifiedUserID.Text = UserID; txtModifiedDate.Text = Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("yyyy-MM-dd"); tbProcessDate.Text = Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("yyyy-MM-dd"); hiddenModifiedUserID.Value = UserID; #endregion } }
/// <summary> /// 获得任务状态 /// </summary> /// <param name="userInfo">当前用户信息</param> /// <param name="userList">查询人员列表</param> /// <param name="dtS">开始时间</param> /// <param name="dtE">结束时间</param> /// <returns></returns> public static DataTable GetTask(UserInfoUtil userInfo, string userList, Nullable<DateTime> dtS, Nullable<DateTime> dtE) { string sql = @"SELECT tab1.UserID, tab1.MainDate, tab1.ReportStatus, tab1.TaskType,COUNT(*) AS Num FROM ( SELECT t.Principal AS UserID ,SUBSTRING(CONVERT(VARCHAR ,t.CompleteDate ,120) ,0 ,11) AS MainDate ,CASE t.[Status] WHEN 1 THEN '待下达' WHEN 2 THEN '未完成' WHEN 3 THEN '已完成' WHEN 4 THEN '已撤销' WHEN 5 THEN '已考评' ELSE '状态错误' END AS ReportStatus ,t.TaskType FROM officedba.Task t WHERE t.CompanyCD=@CompanyCD AND t.Principal IN ({0}) AND DATEDIFF(DAY, @DateStart, t.CompleteDate) >= 0 AND DATEDIFF(DAY, t.CreateDate, @DateEnd) >= 0 ) AS tab1 GROUP BY tab1.MainDate,tab1.ReportStatus,tab1.UserID,tab1.TaskType"; SqlParameter[] parms = { new SqlParameter("@CompanyCD",userInfo.CompanyCD), new SqlParameter("@DateStart",dtS.Value), new SqlParameter("@DateEnd",dtE.Value) }; return SqlHelper.ExecuteSql(String.Format(sql, userList), parms); }
/// <summary> /// 获得日志状态 /// </summary> /// <param name="userInfo">当前用户信息</param> /// <param name="userList">查询人员列表</param> /// <param name="dtS">开始时间</param> /// <param name="dtE">结束时间</param> /// <returns></returns> public static DataTable GetPersonalNote(UserInfoUtil userInfo, string userList, Nullable<DateTime> dtS, Nullable<DateTime> dtE) { string sql = @"SELECT pn.Creator AS UserID, SUBSTRING(CONVERT(VARCHAR, pn.NoteDate, 120), 0, 11) AS MainDate , CASE pn.[Status] WHEN 0 THEN '草稿' WHEN 1 THEN '已提交' WHEN 2 THEN '已点评' ELSE '状态错误' END AS ReportStatus ,pn.[Status] FROM officedba.PersonalNote pn WHERE pn.CompanyCD=@CompanyCD AND pn.Creator IN ({0}) AND DATEDIFF(DAY, @DateStart, pn.NoteDate) >= 0 AND DATEDIFF(DAY, pn.NoteDate, @DateEnd) >= 0 GROUP BY pn.Creator,pn.NoteDate,pn.[Status]"; SqlParameter[] parms = { new SqlParameter("@CompanyCD",userInfo.CompanyCD), new SqlParameter("@DateStart",dtS.Value), new SqlParameter("@DateEnd",dtE.Value) }; return SqlHelper.ExecuteSql(String.Format(sql, userList), parms); }
protected void Page_Load(object sender, EventArgs e) { userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; if (!Page.IsPostBack) { this.txt_begintime.Text = DateTime.Now.ToString("yyyy-MM-01"); this.txt_endtime.Text = DateTime.Now.ToString("yyyy-MM-dd"); string flag = this.summaryType.Value; switch (flag) { case "1": lbl_title.Text = "部门/分店名称"; break; case "2": lbl_title.Text = "业务员姓名"; break; case "3": lbl_title.Text = "产品名称"; break; } rpt_result1.DataSource = UserProjectInfoBus.GetSummaryData(this.txt_begintime.Text, this.txt_endtime.Text, userInfo, typeorder.Value, int.Parse(this.summaryType.Value),userInfo.SelPoint); rpt_result1.DataBind(); } }
private static int ruleCode; //企业员工编号规则码 protected void Page_Load(object sender, EventArgs e) { userinfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; if (!Page.IsPostBack) { initState(); } }
protected void Page_Load(object sender, EventArgs e) { userInfo = SessionUtil.Session["UserInfo"] as UserInfoUtil; // 小数位数 _selPoint = int.Parse(userInfo.SelPoint); if (!Page.IsPostBack) { BinddrpStorageName();//绑定仓库名称 } }
//protected bool Check_page_security_validate_code(string fromUrl) //{ // string _page_security_validate_code = GetParam("_page_security_validate_code"); // bool isok = CRCer.CheckString(_page_security_validate_code); // if(!isok) // { // return false; // } // string _fromUrl = _page_security_validate_code.Substring(0,_page_security_validate_code.Length - 6); // return (_fromUrl == fromUrl); //} public void ProcessRequest(HttpContext context) { _context = context; _request = context.Request; _response = context.Response; _context.Response.ContentType = "text/plain"; UserInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; if (UserInfo == null) { OutputResult(false,"Session过期,请重新登陆"); return; } if (_request.UrlReferrer == null) { OutputResult(false, "未授权的访问."); return; } if (_request.UrlReferrer.Host != _request.Url.Host) { OutputResult(false, "未授权的访问."); return; } //string fromUrl = _request.UrlReferrer.PathAndQuery; //if (fromUrl.IndexOf("))/") != -1) //{ // fromUrl = fromUrl.Substring( fromUrl.IndexOf("))/")+3); //} //if (!Check_page_security_validate_code(fromUrl)) //{ // OutputResult(false, "未授权的访问."); // return; //} _action = GetParam("action");//获取当前的ACTION if (_action == string.Empty) { Output("未指定action"); } else { ActionHandler(_action); } }
protected void Page_Load(object sender, EventArgs e) { txtContent.Attributes.Add("onkeyup", "freshLength(this)"); ImageButton1.Attributes.Add("onclick", "return checkInput()"); UserInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //XBase.Model.SystemManager.CompanyOpenServModel entity = XBase.Business.SystemManager.CompanyOpenServBus.GetCompanyOpenServInfo(UserInfo.CompanyCD); DataSet ds = new XBase.Business.KnowledgeCenter.MyKeyWord().GetCompanyOpenServ(UserInfo.CompanyCD); smCnt.Text = ds.Tables[0].Rows[0]["ManMsgNum"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { userInfo = SessionUtil.Session["UserInfo"] as UserInfoUtil; // 小数位数 _selPoint = int.Parse(userInfo.SelPoint); if (!Page.IsPostBack) { DataRow dt = SubStorageDBHelper.GetSubDeptFromDeptID(((UserInfoUtil)SessionUtil.Session["UserInfo"]).DeptID.ToString()); if (dt != null) { HidDeptID.Value = dt["ID"].ToString(); } } }
/// <summary> /// 输出系统日志 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="ex">异常信息</param> private static void WriteSystemLog(UserInfoUtil userInfo, Exception ex) { /* * 出现异常时,输出系统日志到文本文件 * 考虑出现异常情况比较少,尽管一个方法可能多次异常, * 但还是考虑将异常日志的变量定义放在catch里面 */ //定义变量 LogInfo logSys = new LogInfo(); //设置日志类型 需要指定为系统日志 logSys.Type = LogInfo.LogType.SYSTEM; //指定系统日志类型 出错信息 logSys.SystemKind = LogInfo.SystemLogKind.SYSTEM_ERROR; //指定登陆用户信息 logSys.UserInfo = userInfo; //设定模块ID logSys.ModuleID = ConstUtil.MODULE_ID_ACCOUNTSUBJECTS_SETTING; //描述 logSys.Description = ex.ToString(); //输出日志 LogUtil.WriteLog(logSys); }
/// <summary> /// 导入数据 /// </summary> /// <param name="dt">数据集</param> /// <param name="userInfo">人员信息</param> /// <returns></returns> public static bool ImportData(DataTable dt, UserInfoUtil userInfo) { ArrayList list = new ArrayList(); foreach (DataRow dr in dt.Rows) { list.Add(GetImportInsert(dr, userInfo)); } return SqlHelper.ExecuteTransWithArrayList(list); }
protected void Page_PreLoad(object sender, EventArgs e) { //获得用户页面控制权限 UserInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //XBase.Common.CRCer.GetValidateCode(this.Page); //获得工程路径 String currentDomainPath = System.AppDomain.CurrentDomain.BaseDirectory; //Session时间过期 if (UserInfo == null) { Response.Redirect("~/Pages/SystemErrorPage/TimeOutPage.aspx"); return; } //获得ModuleID string moduleID = (string)Request.QueryString["ModuleID"]; //ModuleID为空时,默认为不对页面进行权限控制 if (string.IsNullOrEmpty(moduleID)) { moduleID = (string)Session["curpage_ModuleID"]; if (string.IsNullOrEmpty(moduleID)) return; } else { Session["curpage_ModuleID"] = moduleID; } //ModuleID类型判断,如果不为数字,则输出Error if (!ValidateUtil.IsInt(moduleID)) { // ModuleID不为数字时,为错误ID,页面跳转去没有权限的页面 //Response.Redirect("~/Pages/SystemErrorPage/NoAuthorityPage.aspx"); return; } //获得页面控制权限 string[] AuthInfo = SafeUtil.GetPageAuthority(moduleID, UserInfo); //有权限操作页面 if (AuthInfo != null && AuthInfo.Length > 0) { //可操作的控件显示 for (int i = 0; i < AuthInfo.Length; i++) { try { //设置可见 this.FindControl(AuthInfo[i].Trim()).Visible = true; } catch //页面没有此控件时 { //TODO continue; } } } //没有权限操作页面,页面跳转 else { // Response.Redirect("~/Pages/SystemErrorPage/NoAuthorityPage.aspx"); } }
public static int InsertReport(ReportTableModel report, XBase.Common.UserInfoUtil userinfo, string ID, string useridlist) { return(TableReportDBHelper.InsertReport(report, userinfo, ID, useridlist)); }
/// <summary> /// 获得日程状态 /// </summary> /// <param name="userInfo">当前用户信息</param> /// <param name="userList">查询人员列表</param> /// <param name="dtS">开始时间</param> /// <param name="dtE">结束时间</param> /// <returns></returns> public static DataTable GetArrange(UserInfoUtil userInfo, string userList, Nullable<DateTime> dtS, Nullable<DateTime> dtE) { string sql = @"SELECT pda.Creator ,pda.StartDate ,pda.EndDate ,ISNULL(pda.[Status],0) AS Status ,CASE ISNULL(pda.[Status],0) WHEN 0 THEN '草稿' WHEN 1 THEN '已提交' WHEN 2 THEN '已点评' ELSE '状态错误' END AS ReportStatus FROM officedba.PersonalDateArrange pda WHERE pda.CompanyCD=@CompanyCD AND pda.Creator IN ({0}) AND DATEDIFF(DAY, @DateStart, pda.EndDate) >= 0 AND DATEDIFF(DAY, pda.StartDate, @DateEnd) >= 0"; SqlParameter[] parms = { new SqlParameter("@CompanyCD",userInfo.CompanyCD), new SqlParameter("@DateStart",dtS.Value), new SqlParameter("@DateEnd",dtE.Value) }; return SqlHelper.ExecuteSql(String.Format(sql, userList), parms); }
protected void btn_input_Click(object sender, EventArgs e) { try { userinfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; StorageInfoBus.GetExcelToStorageInfo(userinfo.CompanyCD, userinfo.UserID, userinfo.IsBatch ? "1" : "0", userinfo.EmployeeID); this.lbl_jg.Text = "Excel数据导入成功"; if (Session["newfile"] != null) { ProductInfoBus.DeleteFile(userinfo.CompanyCD, Session["newfile"].ToString()); } ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), ds.Tables[0].Rows.Count, 1, "成功导入" + ds.Tables[0].Rows.Count.ToString() + "条数据"); this.tab_end.Visible = true; btn_input.Enabled = false; } catch (Exception ex) { btn_input.Enabled = true; this.tab_end.Visible = true; this.lbl_jg.Text = ex.Message; ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_jg.Text); } }
/// <summary> /// 根据日期获得汇报任务列表 /// </summary> /// <param name="reportDate">时间</param> /// <param name="isNew">是否是新增</param> /// <param name="userInfo">用户信息</param> /// <returns></returns> public static DataTable GetAllReport(DateTime reportDate, bool isNew, UserInfoUtil userInfo) { string strSql = @"SELECT t.id AS ID,t.Title AS Title,t.[Content] AS [Content],0 AS ReportType FROM officedba.Task t WHERE t.CompanyCD=@CompanyCD AND (t.Principal=@userID OR CHARINDEX(','+@userName+',',','+ISNULL(t.Joins,'')+',')>0 ) AND DATEDIFF(DAY,t.CreateDate,@Time)>=0 AND DATEDIFF(DAY,@Time,t.CompleteDate)>=0 {0} UNION ALL SELECT pda.id AS ID,pda.ArrangeTItle AS Title,pda.[Content] AS [Content],1 AS ReportType FROM officedba.PersonalDateArrange pda WHERE pda.CompanyCD=@CompanyCD AND (pda.Creator=@userID OR CHARINDEX(','+cast(@userID AS VARCHAR)+',',','+ISNULL(pda.CanViewUser,'')+',')>0 ) AND DATEDIFF(DAY,pda.StartDate,@Time)>=0 AND DATEDIFF(DAY,@Time, pda.EndDate)>=0 {1} "; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Time", SqlDbType.DateTime), new SqlParameter("@CompanyCD", SqlDbType.VarChar), new SqlParameter("@userID", SqlDbType.Int), new SqlParameter("@userName", SqlDbType.VarChar) }; parameters[0].Value = reportDate; parameters[1].Value = userInfo.CompanyCD; parameters[2].Value = userInfo.EmployeeID; parameters[3].Value = userInfo.UserName; strSql = String.Format(strSql, isNew ? "AND t.Status=2" : "", isNew ? "AND pda.Status<>'2'" : ""); return SqlHelper.ExecuteSql(strSql, parameters); }
/// <summary> /// 获得目标状态 /// </summary> /// <param name="userInfo">当前用户信息</param> /// <param name="userList">查询人员列表</param> /// <param name="dtS">开始时间</param> /// <param name="dtE">结束时间</param> /// <returns></returns> public static DataTable GetAim(UserInfoUtil userInfo, string userList, Nullable<DateTime> dtS, Nullable<DateTime> dtE) { return XBase.Data.OperatingModel.AimManager.PersonalAnalysisDBHelper.GetAim(userInfo, userList, dtS, dtE); }
public static DataSet GetSummaryData(string begintime, string endtime, XBase.Common.UserInfoUtil userinfo, string orderby, int summarytype, string point) { return(UserProjectInfoDBHelper.GetSummaryData(begintime, endtime, userinfo, orderby, summarytype, point)); }
public static DataTable GetDataDetailByID(string id, XBase.Common.UserInfoUtil userinfo) { return(UserProjectInfoDBHelper.GetDataDetailByID(id, userinfo)); }
public static DataTable DataList(int pageindex, int pagecount, string OrderBy, XBase.Common.UserInfoUtil userinfo, ref int totalCount) { return(UserProjectInfoDBHelper.DataList(pageindex, pagecount, OrderBy, userinfo, ref totalCount)); }
public static void BindProject(System.Web.UI.WebControls.DropDownList ddl, XBase.Common.UserInfoUtil userinfo) { ProjectConstructionDBHelper.BindProject(ddl, userinfo); }
public static DataTable GetProessList(int pageindex, int pagecount, string projectid, string summaryname, string OrderBy, XBase.Common.UserInfoUtil userinfo, ref int totalCount) { return(ProjectConstructionDBHelper.GetProessList(pageindex, pagecount, projectid, summaryname, OrderBy, userinfo, ref totalCount)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { switch (System.Configuration.ConfigurationManager.AppSettings["VerNameGuid"].ToString()) { case XBase.Common.ConstUtil.Ver_ERP_Guid://生产版 ModelName = "执行模式|办公模式|运营模式|决策模式|知识中心|智能表单"; Zxl100Path = string.Empty; break; default://未匹配到 break; } } hidSessionID.Value = Session.SessionID; UserInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //AuthorityInfo 默认是NULL,用这个属性来判断是否已经加载 if (UserInfo.AuthorityInfo == null) { menuInfo = XBase.Business.Common.SafeUtil.InitMenuData(UserInfo.UserID, UserInfo.CompanyCD); UserInfo.MenuInfo = menuInfo; UserInfo.AuthorityInfo = XBase.Business.Common.SafeUtil.InitPageAuthority(UserInfo.UserID, UserInfo.CompanyCD); SessionUtil.Session["UserInfo"] = UserInfo; } else { menuInfo = UserInfo.MenuInfo; //添加自定义表单 DataTable customdt; try { customdt = XBase.Business.DefManager.CustomModuleBus.GetDataTableList(); } catch { customdt = null; } if (customdt != null && customdt.Rows.Count > 0) { for (int i = 0; i < customdt.Rows.Count; i++) { DataRow dr = menuInfo.NewRow(); dr[0] = customdt.Rows[i]["ModuleID"].ToString(); dr[1] = customdt.Rows[i]["ModuleName"].ToString(); dr[2] = customdt.Rows[i]["ModuleType"].ToString(); dr[3] = customdt.Rows[i]["ParentID"].ToString(); dr[4] = customdt.Rows[i]["PropertyType"].ToString(); dr[5] = customdt.Rows[i]["PropertyValue"].ToString(); dr[6] = ""; dr[7] = ""; menuInfo.Rows.Add(dr); } } DataView view = menuInfo.DefaultView; DataTable tagetTable= view.ToTable(true, "ModuleID", "ModuleName","ParentID","ModuleType","PropertyType","PropertyValue","ImgPath","DefaultPage"); menuInfo = tagetTable; } string moduleId = string.Empty; if (Request.QueryString["ModuleID"] != null) { moduleId = Request.QueryString["ModuleID"].ToString().Trim(); } //moduleId = "6"; //从菜单信息中获取Top信息 DataRow[] rows = menuInfo.Select("ParentID is null"); DataRow curR = null; if (rows.Length < 1) { XBase.Common.XgLoger.Log("用户:"+UserInfo.UserID+"-顶部菜单信息未取到"); return; } string jscode = "var defaultPage=\"\""; if (moduleId == string.Empty) { moduleId = rows[0]["ModuleID"].ToString(); curR = rows[0]; } else { bool has = false; foreach (DataRow row in rows) { if (row["ModuleID"].ToString().Trim() == moduleId) { has = true; curR = row; jscode = "var defaultPage=\"" + curR["defaultPage"].ToString() + "\""; } } if (!has) { XBase.Common.XgLoger.Log("用户:"+UserInfo.UserID+"-当前ModuleID 不在授权列表中"); return; } } ClientScript.RegisterClientScriptBlock(this.GetType(), "fdf", jscode, true); if (!this.IsPostBack) { if (moduleId != string.Empty) { BindMenuData(moduleId); } } }
protected void setup6_Click(object sender, EventArgs e) { userinfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; string suberrorstr = string.Empty; errorstr = string.Empty; int j = 0;//定义错误列表序号 int total = 0;//总错误记录 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //判断仓库是否存在 bool flag = ProductInfoBus.ChargeStorage(ds.Tables[0].Rows[i]["主放仓库"].ToString().Trim(), userinfo.CompanyCD); if (!flag) { suberrorstr += (++j).ToString() + ": " + "第" + (i + 2).ToString() + "行中的仓库不存在,导入操作失败!<br>"; } } if (j > 0) { total += j; errorstr = "<strong>数据存在校验错误列表(主放仓库)</strong><br>"; errorstr += suberrorstr; suberrorstr = string.Empty; } j = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string unitstr = ds.Tables[0].Rows[i]["单位"].ToString().Trim(); if (unitstr.Length > 0) { bool flag = ProductInfoBus.ChargeCodeUnit(ds.Tables[0].Rows[i]["单位"].ToString().Trim(), userinfo.CompanyCD); if (!flag) { suberrorstr += (++j).ToString() + ": " + "第" + (i + 2).ToString() + "行中的物品单位不存在,导入操作失败!<br>"; } } } if (j > 0) { total += j; errorstr += "<strong>数据存在校验错误列表(物品单位)</strong><br>"; errorstr += suberrorstr; suberrorstr = string.Empty; } j = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string unitstr = ds.Tables[0].Rows[i]["物品分类"].ToString().Trim(); if (unitstr.Length > 0) { bool flag = ProductInfoBus.ChargeCodeType(ds.Tables[0].Rows[i]["物品分类"].ToString().Trim(), userinfo.CompanyCD); if (!flag) { suberrorstr += (++j).ToString() + ": " + "第" + (i + 2).ToString() + "行中的物品分类不存在,导入操作失败!<br>"; } } } if (j > 0) { total += j; errorstr += "<strong>数据存在校验错误列表(物品分类)</strong><br>"; errorstr += suberrorstr; suberrorstr = string.Empty; } j = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string unitstr = ds.Tables[0].Rows[i]["条码"].ToString().Trim(); if (unitstr.Length > 0) { bool flag = ProductInfoBus.ChargeBarCode(ds.Tables[0].Rows[i]["条码"].ToString().Trim(), userinfo.CompanyCD); if (flag) { suberrorstr += (++j).ToString() + ": " + "第" + (i + 2).ToString() + "行中的条码已经存在,导入操作失败!<br>"; } } } if (j > 0) { total += j; errorstr += "<strong>数据存在校验错误列表(物品分类)</strong><br>"; errorstr += suberrorstr; suberrorstr = string.Empty; } //验证颜色是否存在 j = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string unitstr = ds.Tables[0].Rows[i]["颜色"].ToString().Trim(); if (unitstr.Length > 0) { bool flag = ProductInfoBus.ValidateProductColor(ds.Tables[0].Rows[i]["颜色"].ToString().Trim(), userinfo.CompanyCD); if (!flag) { suberrorstr += (++j).ToString() + ": " + "第" + (i + 2).ToString() + "行中的颜色在系统中不存在,导入操作失败!<br>"; } } } if (j > 0) { total += j; errorstr += "<strong>数据存在校验错误列表(物品颜色)</strong><br>"; errorstr += suberrorstr; suberrorstr = string.Empty; } if ((total += j) > 0) { this.tr_result.Visible = true; if (Session["newfile"] != null) { ProductInfoBus.DeleteFile(userinfo.CompanyCD, Session["newfile"].ToString()); } ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, errorstr); } else { this.tr_result.Visible = false; this.setup5.Enabled = false; this.setup6.Enabled = false; lbl_end.Visible = true; this.btn_input.Enabled = true; } }
/// <summary> /// 导入数据命令 /// </summary> /// <param name="dr">数据集</param> /// <param name="userInfo">人员信息</param> /// <returns></returns> private static SqlCommand GetImportInsert(DataRow dr, UserInfoUtil userInfo) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = @"INSERT INTO officedba.SubProductSendPrice(CompanyCD, ProductID, DeptID, SendPrice,SendPriceTax, SendTax, Discount, Creator, CreateDate, ModifiedDate,ModifiedUserID) SELECT @CompanyCD ,(SELECT TOP(1) pi1.ID FROM officedba.ProductInfo pi1 WHERE pi1.CompanyCD=@CompanyCD AND pi1.ProdNo=@ProdNo) ,ISNULL((SELECT TOP(1) di.ID FROM officedba.DeptInfo di WHERE di.CompanyCD=@CompanyCD AND di.DeptName=@DeptName),0) ,@SendPrice,@SendPrice*(1+@SendTax),@SendTax,@Discount,@Creator,GETDATE(),GETDATE(),@ModifiedUserID"; SqlParameter[] paras = { new SqlParameter("@CompanyCD",SqlDbType.VarChar), new SqlParameter("@ProdNo",SqlDbType.VarChar), new SqlParameter("@DeptName",SqlDbType.VarChar), new SqlParameter("@SendPrice",SqlDbType.Decimal), new SqlParameter("@SendTax",SqlDbType.Decimal), new SqlParameter("@Discount",SqlDbType.Decimal), new SqlParameter("@Creator",SqlDbType.Int), new SqlParameter("@ModifiedUserID",SqlDbType.VarChar) }; int i = 0; paras[i++].Value = userInfo.CompanyCD; paras[i++].Value = dr["物品编号"]; paras[i++].Value = dr["分店名称"]; paras[i++].Value = dr["去税单价"]; paras[i++].Value = dr["税率"]; paras[i++].Value = dr["折扣(%)"]; paras[i++].Value = userInfo.EmployeeID; paras[i++].Value = userInfo.UserID; cmd.Parameters.AddRange(paras); return cmd; }
/// <summary> /// 获取产品销售记录列表(分页) /// </summary> /// <param name="userinfo">用户session信息</param> /// <param name="CustID">检索条件:客户</param> /// <param name="ProductID">检索条件:物品</param> /// <param name="DateBegin">检索条件:开始时间</param> /// <param name="DateEnd">检索条件:结束时间</param> /// <param name="pageIndex"></param> /// <param name="pageCount"></param> /// <param name="OrderBy"></param> /// <param name="totalCount"></param> /// <returns></returns> public static DataTable GetSellAnnalList(XBase.Common.UserInfoUtil userinfo, string CustID, string ProductID, string DateBegin, string DateEnd, int pageIndex, int pageCount, string OrderBy, ref int totalCount) { return(ServiceDBHelper.GetSellAnnalList(userinfo, CustID, ProductID, DateBegin, DateEnd, pageIndex, pageCount, OrderBy, ref totalCount)); }
/// <summary> /// 批量导入数据 /// </summary> /// <param name="dt">数据集</param> /// <param name="userInfo">登录信息</param> /// <returns></returns> public static bool ImportData(DataTable dt, UserInfoUtil userInfo) { ArrayList list = new ArrayList(); string temp = ""; decimal count = 0m; Dictionary<string, Product> dicProduct = new Dictionary<string, Product>(); Dictionary<string, int> dicDept = new Dictionary<string, int>(); foreach (DataRow dr in dt.Rows) { #region 添加门店库存流水帐 SubStorageAccountModel aModel = new SubStorageAccountModel(); aModel.BillNo = ""; aModel.BillType = 8; aModel.CompanyCD = userInfo.CompanyCD; aModel.Creator = userInfo.EmployeeID; aModel.HappenDate = DateTime.Now; aModel.Price = 0; temp = dr["物品编号"].ToString().Trim(); if (!dicProduct.ContainsKey(temp)) {// 物品编号 foreach (DataRow item in GetProductIDWithProdNo(userInfo.CompanyCD, temp).Rows) { Product p = new Product(); p.id = int.Parse(item["ID"].ToString()); p.isBatchNo = item["IsBatchNo"].ToString() == "1"; dicProduct.Add(temp, p); } } aModel.BatchNo = dicProduct[temp].isBatchNo ? dr["批次"].ToString() : ""; aModel.ProductID = dicProduct[temp].id; temp = dr["分店名称"].ToString().Trim(); if (!dicDept.ContainsKey(temp)) {// 分店名称 foreach (DataRow item in GetDeptIDWithDeptName(userInfo.CompanyCD, temp).Rows) { dicDept.Add(temp, int.Parse(item["ID"].ToString())); } } aModel.DeptID = dicDept[temp]; if (decimal.TryParse(dr["现有存量"].ToString(), out count)) { aModel.HappenCount = count; } list.Add(XBase.Data.Office.SubStoreManager.SubStorageAccountDBHelper.GetCountAndInsertCommand(aModel)); #endregion // 更新分店存量表 list.Add(StorageProductQueryDBHelper.UpdateProductCount(userInfo.CompanyCD , aModel.ProductID.ToString(), aModel.DeptID.ToString(), aModel.BatchNo, count)); } return SqlHelper.ExecuteTransWithArrayList(list); }
/// <summary> /// 获得人员岗位权限 /// </summary> /// <param name="userInfo">当前用户信息</param> /// <param name="userList">查询人员列表</param> /// <returns></returns> public static DataTable GetQuarter(UserInfoUtil userInfo, string userList) { return XBase.Data.OperatingModel.AimManager.PersonalAnalysisDBHelper.GetQuarter(userInfo, userList); }
protected void btn_input_Click(object sender, EventArgs e) { try { userinfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; EmployeeInfoBus.GetExcelToEmployeeInfo(userinfo.CompanyCD); this.lbl_jg.Text = "Excel数据导入成功"; ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), ds.Tables[0].Rows.Count, 1, "成功导入" + ds.Tables[0].Rows.Count.ToString() + "条数据"); /* * 更新有特殊符号的员工编号"##@@$$@@##" */ DataSet nullds = EmployeeInfoBus.GetNullEmployeeList(userinfo.CompanyCD); for (int i = 0; i < nullds.Tables[0].Rows.Count; i++) { //获取规则码 string employeeNo = XBase.Business.Common.ItemCodingRuleBus.GetCodeValue(ruleCode.ToString(), "EmployeeInfo", "EmployeeNo"); EmployeeInfoBus.UpdateEmployeeInfo(userinfo.CompanyCD, employeeNo, nullds.Tables[0].Rows[i]["ID"].ToString()); } /* * 更新结束 */ if (Session["newfile"] != null) { ProductInfoBus.DeleteFile(userinfo.CompanyCD, Session["newfile"].ToString()); } this.tab_end.Visible = true; btn_input.Enabled = false; } catch (Exception ex) { btn_input.Enabled = true; this.tab_end.Visible = true; this.lbl_jg.Text = ex.Message; ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_jg.Text); } }
public string errorstr = string.Empty; //错误串 protected void Page_Load(object sender, EventArgs e) { userinfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; }
/// <summary> /// 获得采购订单编号 /// </summary> /// <param name="pageIndex">当前页</param> /// <param name="pageCount">每页记录数</param> /// <param name="orderBy">排序方法</param> /// <param name="TotalCount">总记录数</param> /// <param name="userInfo">用户信息实体类</param> /// <returns></returns> public static DataTable SelectPurchaseOrder(int pageIndex, int pageCount, string orderBy, ref int TotalCount , UserInfoUtil userInfo) { SqlCommand comm = new SqlCommand(); comm.CommandText = @"SELECT DISTINCT po.ID ,po.OrderNo ,po.Title FROM officedba.PurchaseOrder po INNER JOIN officedba.PurchaseOrderDetail pod ON po.CompanyCD = pod.CompanyCD AND po.OrderNo = pod.OrderNo AND pod.ProductCount>pod.ArrivedCount WHERE po.CompanyCD=@CompanyCD AND po.BillStatus<>'1'"; comm.Parameters.Add(new SqlParameter("@CompanyCD", userInfo.CompanyCD)); return SqlHelper.PagerWithCommand(comm, pageIndex, pageCount, orderBy, ref TotalCount); }
protected void btn_excel_Click(object sender, EventArgs e) { if (this.upExcelFile.PostedFile.FileName.Length > 0) { this.initState(); } else { this.lbl_upresult.Text = "请选择要上传的Excel文件!"; return; } userinfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; ////如果该公司或分店已经存在月结数据,不能再使用导入功能 //if (!StorageInitailBus.ISADD(userinfo.CompanyCD)) //{ // lbl_upresult.Text = "存在月结数据,不允许导入,操作失败"; // ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_upresult.Text); // return; //} string filename = upExcelFile.PostedFile.FileName; string subfile = filename.Substring(filename.LastIndexOf(".") + 1); if (subfile.ToUpper() != "XLS" && subfile.ToUpper() != "XLSX") { this.lbl_upresult.Text = "导入文件格式错误,必须为XLS,XLSX格式!"; ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_upresult.Text); } else { try { //获取企业上传文件路径 string upfilepath = ProductInfoBus.GetCompanyUpFilePath(userinfo.CompanyCD);//得到格式如:"D:\zhou" //获取企业并构造企业上传文件名称 Session["newfile"] = DateTime.Now.ToString("yyyyMMddhhmmss") + filename.Substring(filename.LastIndexOf("\\") + 1); //Session["newfile"] = "Book1.xlsx"; upExcelFile.PostedFile.SaveAs(upfilepath + @"\" + Session["newfile"].ToString()); this.lbl_upresult.Text = "Excel文件上传成功!"; this.setup1.Enabled = true; //将excel中的数据读取到ds中 try { ds = StorageInfoBus.ReadEexcel(upfilepath + @"\" + Session["newfile"].ToString(), userinfo.CompanyCD); if (ds.Tables[0].Rows.Count < 1) { initState(); this.lbl_upresult.Text = "您导入的Excel表没有数据!"; } } catch (Exception ex) { initState(); this.lbl_upresult.Text = "数据读取失败!错误原因:" + ex.Message; ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_upresult.Text); } } catch (Exception ex) { this.setup1.Enabled = false; this.lbl_upresult.Text = "数据读取失败,原因:" + ex.Message; ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_upresult.Text); } } }
/// <summary> /// 根据日期获得汇报任务列表 /// </summary> /// <param name="reportDate">时间</param> /// <param name="isNew">是否是新增</param> /// <param name="userInfo">用户信息</param> /// <returns></returns> public static DataTable GetAllReport(DateTime reportDate, bool isNew, UserInfoUtil userInfo) { return PersonalNoteDBHelper.GetAllReport(reportDate, isNew, userInfo); }
public static DataTable GetProessList(string projectid,string summaryid, UserInfoUtil userinfo) { return ProjectConstructionDBHelper.GetProessList(projectid,summaryid, userinfo); }
/// <summary> /// 导入数据 /// </summary> /// <param name="dt">数据集</param> /// <param name="userInfo">人员信息</param> /// <returns></returns> public static bool ImportData(DataTable dt, UserInfoUtil userInfo) { return SubProductSellPriceDBHelper.ImportData(dt, userInfo); }
public static DataTable GetReportList(XBase.Common.UserInfoUtil userinfo, string menuname, int pageindex, int pagecount, string OrderBy, ref int totalCount) { return(TableReportDBHelper.GetReportList(userinfo, menuname, pageindex, pagecount, OrderBy, ref totalCount)); }
/// <summary> /// 获取金额精度位数 /// 调用方法:1、确保页面继承BasePage,页面加载时调用GetPoint()方法,返回系统设置的金额小数位数赋值给全局变量或隐藏域 HiddenPoint.Value = GetPoint(); /// 2、页面控件输入时调用:onchange='Number_round(this,$("#HiddenPoint").val())' /// 3、计算金额页面赋值时这样用:$("#Money")val(parseFloat(item.Money).toFixed($("#HiddenPoint").val())); /// </summary> /// <returns></returns> //protected string GetPoint() //{ // DataTable dt = XBase.Business.Office.SystemManager.ParameterSettingBus.GetPoint(UserInfo.CompanyCD, "5"); // if (dt != null) // { // if (dt.Rows.Count > 0) return dt.Rows[0]["SelPoint"].ToString(); // else // return "2";//默认 // } // else // return "2";//默认 //} #region 输出单据打印页面,根据打印模板设置项动态显示 /// <summary> /// 根据打印模板设置项动态显示 /// </summary> /// <param name="billTitle">打印页面正标题</param> /// <param name="strBaseFields">设置的主表字段值,用竖线分割的字符串。 例:MRPNo|DeptName</param> /// <param name="strDetailFields">设置的明细表字段值,用竖线分割的字符串。 例:ProdNo|ProductName|GrossCount</param> /// <param name="aBase">取主表返回的DataTable里的字段,以及对应页面显示出来的标题,用二维数组形式。例:在dbBaseTable里取出来的MRPNo对应的是单据编号一栏,取出来的DeptName对应的是部门一栏</param> /// <param name="aDetail">取明细表返回的DataTable里的字段,以及对应页面显示出来的标题,用二维数组形式。例:在dtDetailTable里取出来的ProdNo对应的是物品编号一栏,取出来的ProductName是物品名称一栏</param> /// <param name="dbBaseTable">取主表返回的DataTable</param> /// <param name="dbDetailTable">取主表返回的DataTable</param> /// <param name="isBaseInfo">是否是主表信息(用来区分是主表还是明细,从而输出不同的html标签)</param> /// <returns></returns> protected string WritePrintPageTable(string billTitle, string strBaseFields, string strDetailFields, string[,] aBase, string[,] aDetail, DataTable dbBaseTable, DataTable dbDetailTable, bool isBaseInfo) { //获得用户页面控制权限 UserInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; selPoint = int.Parse(UserInfo.SelPoint); string notContains = ""; if (isBaseInfo) { string[] arrBaseKey = strBaseFields.Split('|'); for (int m = 0; m < arrBaseKey.Length; m++) { if (!dbBaseTable.Columns.Contains(arrBaseKey[m].ToString())) { notContains = notContains + arrBaseKey[m].ToString() + ","; } } } else { string[] arrDetailKey = strDetailFields.Split('|'); for (int n = 0; n < arrDetailKey.Length; n++) { if (!dbDetailTable.Columns.Contains(arrDetailKey[n].ToString())) { notContains = notContains + arrDetailKey[n].ToString() + ","; } } } if (!string.IsNullOrEmpty(notContains)) { return notContains; } if (isBaseInfo) { StringBuilder sbBase = new StringBuilder(); string[] arrBaseKey = strBaseFields.Split('|'); if (arrBaseKey.Length > 0) { sbBase.AppendLine("<tr><td colspan=\"10\" align=\"center\"><font size=\"5\"><b>" + billTitle + "</b></font></td></tr><tr height=\"20\"><td colspan=\"10\" style=\"color: #cccccc\"></td></tr><tr height=\"20\">"); for (int m = 0; m < arrBaseKey.Length; m++) { for (int x = 0; x < aBase.Length / 2; x++) { if (aBase[x, 1].ToString().Equals(arrBaseKey[m].ToString())) { if (!aBase[x, 0].ToString().EndsWith("}")) { sbBase.AppendLine("<td align=\"left\" width=\"15%\">" + aBase[x, 0].ToString() + ":</td><td colspan=\"4\" align=\"left\" width=\"35%\">" + FormatValue(dbBaseTable, 0, arrBaseKey[m].ToString()) + "</td>"); } } } if (m % 2 == 1) { if (m == (arrBaseKey.Length - 1)) { sbBase.AppendLine("</tr>"); } else { sbBase.AppendLine("</tr><tr height=\"20\">"); } } } if (arrBaseKey.Length % 2 == 1) { sbBase.AppendLine("<td align=\"left\" width=\"15%\"></td><td colspan=\"4\" align=\"left\" width=\"35%\"></td></tr>"); } } return sbBase.ToString(); } else { StringBuilder sbDetailTitle = new StringBuilder(); StringBuilder sbDetailData = new StringBuilder(); string[] arrDetailKey = strDetailFields.Split('|'); if (arrDetailKey.Length > 0) { sbDetailData.AppendLine("<tr>"); for (int i = 0; i < dbDetailTable.Rows.Count; i++) { if (i == 0) { sbDetailTitle.AppendLine("<tr>"); } for (int n = 0; n < arrDetailKey.Length; n++) { if (!dbDetailTable.Columns.Contains(arrDetailKey[n].ToString())) { notContains = notContains + arrDetailKey[n].ToString() + ","; } for (int y = 0; y < aDetail.Length / 2; y++) { if (aDetail[y, 1].ToString().Equals(arrDetailKey[n].ToString())) { if (n == 0) { if (i == 0) { sbDetailTitle.AppendLine("<td class=\"tdFirstTitleMyLove\">" + aDetail[y, 0].ToString() + "</td>"); } sbDetailData.AppendLine("<td class=\"trDetailFirst\">" + FormatValue(dbDetailTable, i, arrDetailKey[n].ToString()) + " </td>"); } else { if (i == 0) { sbDetailTitle.AppendLine("<td align=\"left\" class=\"tdContent\">" + aDetail[y, 0].ToString() + "</td>"); } sbDetailData.AppendLine("<td class=\"trDetail\">" + FormatValue(dbDetailTable, i, arrDetailKey[n].ToString()) + " </td>"); } } } } if (i == 0) { sbDetailTitle.AppendLine("</tr>"); } sbDetailData.AppendLine("</tr>"); } return sbDetailTitle.ToString() + sbDetailData.ToString(); } } return ""; }