/// <summary> /// 获取对象DataTable /// </summary> /// <param name="tOaAtt">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByTable(TOaAttVo tOaAtt, int iIndex, int iCount) { string strSQL = " select * from T_OA_ATT {0} "; strSQL = String.Format(strSQL, BuildWhereStatement(tOaAtt)); return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount))); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tOaAtt">用户对象</param> /// <returns>是否成功</returns> public bool Edit(TOaAttVo tOaAtt) { string strSQL = SqlHelper.BuildUpdateExpress(tOaAtt, TOaAttVo.T_OA_ATT_TABLE); strSQL += string.Format(" where ID='{0}' ", tOaAtt.ID); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tOaAtt_UpdateSet">UpdateSet用户对象</param> /// <param name="tOaAtt_UpdateWhere">UpdateWhere用户对象</param> /// <returns>是否成功</returns> public bool Edit(TOaAttVo tOaAtt_UpdateSet, TOaAttVo tOaAtt_UpdateWhere) { string strSQL = SqlHelper.BuildUpdateExpress(tOaAtt_UpdateSet, TOaAttVo.T_OA_ATT_TABLE); strSQL += this.BuildWhereStatement(tOaAtt_UpdateWhere); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
public static string getNoticeInfo() { string serverPath = "..\\Channels\\OA\\Notice\\Image"; DataTable dt = new TOaNoticeLogic().getTopTenData(); dt.Columns.Add("Path", System.Type.GetType("System.String")); foreach (DataRow row in dt.Rows) { if (row["CONTENT"].ToString().Length > 140) { row["CONTENT"] = row["CONTENT"].ToString().Substring(0, 140) + "..."; } TOaAttVo TOaAttVo = new TOaAttVo(); TOaAttVo.BUSINESS_ID = row["ID"].ToString(); TOaAttVo.BUSINESS_TYPE = "OA_NOTICE"; TOaAttVo TOaAttVoTemp = new TOaAttLogic().Details(TOaAttVo); string strExtent = TOaAttVoTemp.ATTACH_TYPE; string path = serverPath + "\\" + row["ID"].ToString() + strExtent; if (strExtent != "") { row["Path"] = path; } else { row["Path"] = "..\\Channels\\OA\\Notice\\default.gif"; } } string strJson = DataTableToJson(dt); return(strJson); }
/// <summary> /// 对象删除 /// </summary> /// <param name="Id">ID</param> /// <returns>是否成功</returns> public bool Delete(TOaAttVo tOaAtt) { string strSQL = "delete from T_OA_ATT "; strSQL += this.BuildWhereStatement(tOaAtt); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 获取附件ID /// </summary> /// <param name="strBusinessID">业务ID</param> /// <param name="strAttType">业务类型</param> /// <returns></returns> protected string GetAttID(string strBusinessID, string strAttType) { TOaAttVo objAtt = new TOaAttVo(); objAtt.BUSINESS_ID = strBusinessID; objAtt.BUSINESS_TYPE = strAttType; return(new TOaAttLogic().Details(objAtt).ID); }
/// <summary> /// 查询站务管理---人事档案信息的考核历史记录,可以多个附件 /// </summary> /// <param name="tOaAtt"></param> /// <returns></returns> public DataTable SelectUnionEmployeTable(TOaAttVo tOaAtt) { string strSQL = String.Format(" SELECT A.ID AS ATTID, A.BUSINESS_ID,A.BUSINESS_TYPE,A.ATTACH_NAME,A.ATTACH_TYPE,A.UPLOAD_PATH,A.UPLOAD_DATE,A.UPLOAD_PERSON,A.DESCRIPTION " + " FROM dbo.T_OA_ATT A" + " LEFT JOIN dbo.T_OA_EMPLOYE_EXAMINEHISTORY B ON B.ID=A.BUSINESS_ID" + " WHERE B.EMPLOYEID='{0}' AND A.BUSINESS_TYPE='{1}'", tOaAtt.REMARKS, tOaAtt.BUSINESS_TYPE); return(SqlHelper.ExecuteDataTable(strSQL)); }
protected void showDetail() { TOaAttVo TOaAttVo = new TOaAttVo(); TOaAttVo.BUSINESS_ID = this.Request["id"].ToString(); TOaAttVo.BUSINESS_TYPE = this.Request["filetype"].ToString(); TOaAttVo TOaAttVoTemp = new TOaAttLogic().Details(TOaAttVo); this.ATTACH_NAME.Text = TOaAttVoTemp.ATTACH_NAME; this.DESCRIPTION.Text = TOaAttVoTemp.DESCRIPTION; }
/// <summary> /// 创建原因:删除指定子任务附件 /// 创建人:胡方扬 /// 创建原因:2013-07-03 /// </summary> /// <param name="strSubTaskID"></param> /// <returns></returns> public string DelFile(string strSubTaskID) { string result = ""; TOaAttVo objToa = new TOaAttVo(); objToa.BUSINESS_ID = strSubTaskID; objToa.BUSINESS_TYPE = "SubTask"; if (new TOaAttLogic().Delete(objToa)) { result = "True"; } return(result); }
/// <summary> /// 创建原因:查找当前子任务是否已经复制了点位图 /// 创建人:胡方扬 /// 创建日期:2013-07-03 /// </summary> /// <param name="strSubTaskID"></param> /// <returns></returns> public bool GetSubTaskAtt(string strSubTaskID) { bool blFlag = false; TOaAttVo objTOaAttVo = new TOaAttVo(); objTOaAttVo.BUSINESS_ID = strSubTaskID; objTOaAttVo.BUSINESS_TYPE = "SubTask"; DataTable dt = new TOaAttLogic().SelectByTable(objTOaAttVo); if (dt.Rows.Count > 0) { blFlag = true; } return(blFlag); }
protected void btnFileClear_Click(object sender, EventArgs e) { //获取主文件路径 string mastPath = System.Configuration.ConfigurationManager.AppSettings["AttPath"].ToString(); TOaAttVo TOaAttVo = new TOaAttVo(); TOaAttVo.BUSINESS_TYPE = this.Request["filetype"].ToString(); TOaAttVo.BUSINESS_ID = this.Request["id"].ToString(); //获取路径信息 DataTable objTable = new TOaAttLogic().SelectByTable(TOaAttVo); if (objTable.Rows.Count > 0) { try { //获取该记录的ID string strId = objTable.Rows[0]["ID"].ToString(); //获取原来文件的路径 string strOldFilePath = objTable.Rows[0]["UPLOAD_PATH"].ToString(); //如果存在的话,删除原来的文件 if (File.Exists(mastPath + "\\" + strOldFilePath)) { File.Delete(mastPath + "\\" + strOldFilePath); } //删除数据库信息 if (new TOaAttLogic().Delete(TOaAttVo)) { this.status.Value = "2"; LigerDialogAlert("附件清除成功", "success"); } else { this.status.Value = "0"; LigerDialogAlert("附件清除失败", "error"); } } catch (Exception ex) { LigerDialogAlert(ex.Message, "error"); } } else { LigerDialogAlert("不存在附件信息", "error"); } }
/// <summary> /// 创建原因:复制噪声点位图到噪声子任务中 /// 创建人:胡方扬 /// 创建原因:2013-07-03 /// </summary> /// <param name="dt"></param> public void CopyPointMap(DataTable dt) { string strFilePath = ConfigurationManager.AppSettings["AttPath"].ToString(); if (!String.IsNullOrEmpty(strFilePath)) { if (dt.Rows.Count > 0) { string strSourceFilePath = strFilePath + "\\" + dt.Rows[0]["UPLOAD_PATH"].ToString(); if (File.Exists(strSourceFilePath)) { //新文件夹路径 string strfolderPath = "SubTask" + "\\" + DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(strFilePath + "\\" + strfolderPath)) { //创建目录 Directory.CreateDirectory(strFilePath + "\\" + strfolderPath); } string strSerialNumber = GetSerialNumber("attFileId"); string strFullName = dt.Rows[0]["ATTACH_TYPE"].ToString(); //新命名的文件名称 string strNewFileName = DateTime.Now.ToString("yyyyMMddHHmm") + "-" + strSerialNumber + strFullName; //将新的信息写入数据库 TOaAttVo objTOaAttVo = new TOaAttVo(); objTOaAttVo.ID = strSerialNumber; objTOaAttVo.DESCRIPTION = dt.Rows[0]["DESCRIPTION"].ToString(); objTOaAttVo.BUSINESS_ID = this.SUBTASK_ID.Value.ToString(); objTOaAttVo.BUSINESS_TYPE = "SubTask"; objTOaAttVo.UPLOAD_PATH = strfolderPath + "\\" + strNewFileName; objTOaAttVo.UPLOAD_DATE = DateTime.Now.ToString("yyyy-MM-dd"); objTOaAttVo.UPLOAD_PERSON = LogInfo.UserInfo.REAL_NAME; objTOaAttVo.ATTACH_NAME = dt.Rows[0]["ATTACH_NAME"].ToString(); objTOaAttVo.ATTACH_TYPE = dt.Rows[0]["ATTACH_TYPE"].ToString(); //新文件路径 string strDestFilePath = strFilePath + "\\" + objTOaAttVo.UPLOAD_PATH; //COPY文件到新文件 File.Copy(strSourceFilePath, strDestFilePath, true); new TOaAttLogic().Create(objTOaAttVo); } } } }
/// <summary> /// 加载数据 /// </summary> /// <returns></returns> public string frmLoadData() { TOaAttVo TOaAttVo = new TOaAttVo(); TOaAttVo.BUSINESS_ID = this.Request["id"].ToString(); TOaAttVo.BUSINESS_TYPE = "OA_NOTICE"; TOaAttVo TOaAttVoTemp = new TOaAttLogic().Details(TOaAttVo); string strUrl = TOaAttVoTemp.UPLOAD_PATH; string mastPath = System.Configuration.ConfigurationManager.AppSettings["AttPath"].ToString(); string filePath = mastPath + '\\' + strUrl; TOaNoticeVo TOaNoticeVo = new TOaNoticeVo(); TOaNoticeVo.ID = Request["id"].ToString(); TOaNoticeVo TOaNoticeVoTemp = new TOaNoticeLogic().Details(TOaNoticeVo); return(ToJson(TOaNoticeVoTemp)); }
/// <summary> /// 将显示序号前10条任务存储在临时目录 /// </summary> /// <returns></returns> private void loadPicToTemp() { DataTable dt = new TOaNoticeLogic().getTopTenData(); //清空Image临时文件夹下所有的临时文件 string serverPath = HttpRuntime.AppDomainAppPath + "Channels\\OA\\Notice\\Image"; DirectoryInfo di = new DirectoryInfo(serverPath); if (di.Exists) { FileInfo[] files = di.GetFiles(); foreach (FileInfo fi in files) { try { fi.Delete(); } catch (Exception ex) { } } } //将文件库中的文件复制到临时文件目录下 //获取主文件路径 string mastPath = System.Configuration.ConfigurationManager.AppSettings["AttPath"].ToString(); foreach (DataRow row in dt.Rows) { string id = row["ID"].ToString(); TOaAttVo TOaAttVo = new TOaAttVo(); TOaAttVo.BUSINESS_ID = id; TOaAttVo.BUSINESS_TYPE = "OA_NOTICE"; TOaAttVo TOaAttVoTemp = new TOaAttLogic().Details(TOaAttVo); string strExtent = TOaAttVoTemp.ATTACH_TYPE; string Path = TOaAttVoTemp.UPLOAD_PATH; string sumPath = mastPath + '\\' + Path; try { File.Copy(sumPath, serverPath + "\\" + id + strExtent, true); } catch (Exception ex) { } } }
protected void showDetail() { TOaAttVo TOaAttVo = new TOaAttVo(); //======Begin 添加按照附加ID进行加载下载附件信息 胡方扬 2013-01-09======== if (!String.IsNullOrEmpty(this.Request["strAttID"])) { TOaAttVo.ID = this.Request["strAttID"].Trim(); } else { TOaAttVo.BUSINESS_ID = this.Request["id"].ToString(); TOaAttVo.BUSINESS_TYPE = this.Request["filetype"].ToString(); } //======End 添加按照附加ID进行加载下载附件信息 胡方扬 2013-01-09======== TOaAttVo TOaAttVoTemp = new TOaAttLogic().Details(TOaAttVo); this.btnFileName.Text = TOaAttVoTemp.ATTACH_NAME + TOaAttVoTemp.ATTACH_TYPE; this.lblUploadDate.Text = TOaAttVoTemp.UPLOAD_DATE; this.lblUploadPerson.Text = TOaAttVoTemp.UPLOAD_PERSON; this.lblDescription.Text = TOaAttVoTemp.DESCRIPTION; this.hidden.Value = TOaAttVoTemp.UPLOAD_PATH; }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tOaAtt">用户对象</param> /// <returns>是否成功</returns> public bool Edit(TOaAttVo tOaAtt) { return(access.Edit(tOaAtt)); }
/// <summary> /// 对象明细 /// </summary> /// <param name="tOaAtt">对象条件</param> /// <returns>对象</returns> public TOaAttVo Details(TOaAttVo tOaAtt) { string strSQL = String.Format("select * from T_OA_ATT " + this.BuildWhereStatement(tOaAtt)); return(SqlHelper.ExecuteObject(new TOaAttVo(), strSQL)); }
/// <summary> /// 获取对象List /// </summary> /// <param name="tOaAtt">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public List <TOaAttVo> SelectByObject(TOaAttVo tOaAtt, int iIndex, int iCount) { string strSQL = String.Format("select * from T_OA_ATT " + this.BuildWhereStatement(tOaAtt)); return(SqlHelper.ExecuteObjectList(tOaAtt, BuildPagerExpress(strSQL, iIndex, iCount))); }
/// <summary> /// 根据对象获取全部数据,用Table承载 /// 数据量较小时使用【不推荐】 /// </summary> /// <param name="tOaAtt"></param> /// <returns></returns> public DataTable SelectByTable(TOaAttVo tOaAtt) { string strSQL = "select * from T_OA_ATT " + this.BuildWhereStatement(tOaAtt); return(SqlHelper.ExecuteDataTable(strSQL)); }
/// <summary> /// 根据对象特征获取单一对象 /// </summary> /// <param name="tOaAtt">对象</param> /// <returns></returns> public TOaAttVo SelectByObject(TOaAttVo tOaAtt) { return(access.SelectByObject(tOaAtt)); }
/// <summary> /// 根据对象获取全部数据,用Table承载 /// 数据量较小时使用【不推荐】 /// </summary> /// <param name="tOaAtt"></param> /// <returns></returns> public DataTable SelectByTable(TOaAttVo tOaAtt) { return(access.SelectByTable(tOaAtt)); }
/// <summary> /// 获取对象DataTable /// </summary> /// <param name="tOaAtt">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByTable(TOaAttVo tOaAtt, int iIndex, int iCount) { return(access.SelectByTable(tOaAtt, iIndex, iCount)); }
/// <summary> /// 获取对象List /// </summary> /// <param name="tOaAtt">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public List <TOaAttVo> SelectByObject(TOaAttVo tOaAtt, int iIndex, int iCount) { return(access.SelectByObject(tOaAtt, iIndex, iCount)); }
/// <summary> /// 对象明细 /// </summary> /// <param name="tOaAtt">对象条件</param> /// <returns>对象</returns> public TOaAttVo Details(TOaAttVo tOaAtt) { return(access.Details(tOaAtt)); }
/// <summary> /// 获得查询结果总行数,用于分页 /// </summary> /// <param name="tOaAtt">对象</param> /// <returns>返回行数</returns> public int GetSelectResultCount(TOaAttVo tOaAtt) { return(access.GetSelectResultCount(tOaAtt)); }
public TOaAttLogic(TOaAttVo _tOaAtt) { tOaAtt = _tOaAtt; access = new TOaAttAccess(); }
/// <summary> /// 查询站务管理---人事档案信息的考核历史记录,可以多个附件 /// </summary> /// <param name="tOaAtt"></param> /// <returns></returns> public DataTable SelectUnionEmployeTable(TOaAttVo tOaAtt) { return(access.SelectUnionEmployeTable(tOaAtt)); }
/// <summary> /// 对象删除 /// </summary> /// <param name="Id">ID</param> /// <returns>是否成功</returns> public bool Delete(TOaAttVo tOaAtt) { return(access.Delete(tOaAtt)); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tOaAtt_UpdateSet">UpdateSet用户对象</param> /// <param name="tOaAtt_UpdateWhere">UpdateWhere用户对象</param> /// <returns>是否成功</returns> public bool Edit(TOaAttVo tOaAtt_UpdateSet, TOaAttVo tOaAtt_UpdateWhere) { return(access.Edit(tOaAtt_UpdateSet, tOaAtt_UpdateWhere)); }
/// <summary> /// 对象添加 /// </summary> /// <param name="sysRole">对象</param> /// <returns>是否成功</returns> public bool Create(TOaAttVo tOaAtt) { return(access.Create(tOaAtt)); }