开发工具:
文件大小: 28mb
下载次数: 0
上传时间: 2015-10-16
详细说明: 一个不错的治具管理系统 namespace MainDepartment { public class MainDepartmentDAL { private string Module_Desc = "Department Maintenance"; SecAuditTrail.SecAuditTrailDAL SecAuditTrailDAL = new SecAuditTrail.SecAuditTrailDAL(); SQLAPI.SQLAPI SQLAPI = new SQLAPI.SQLAPI(); #region Search public DataTable Search(object obj) { string s = ""; try { if (obj is MainDepartment && obj !=null) { MainDepartment obj2 = (MainDepartment)obj; s = " SELECT a.DepId,a.DepCd,a.DepDesc,a.Status,a.CreatedBy,a.CreatedDate,a.UpdatedDate,a.UpdatedBy,b.SiteCd +'-'+ b.SiteDesc as Site" + " FROM CR_Department a with (nolock)" + //" inner join CR_Site b with (nolock) on a.CreatedSite = b.SiteId" + " where a.DepDesc like '" + SqlObject.Encode(obj2.DepDesc) + "%'" + " and a.DepCd like '" + SqlObject.Encode(obj2.DepCd) + "%'" + " and a.Status like '" + SqlObject.Encode(obj2.Status) + "%'" + // " and a.CreatedSite in (" + obj2.CreatedSite + ")" + " order by a.DepCd "; return SQLAPI.ExecuteNonQueryReturnDataTable(SQLAPI.ENCRYPT_CONN_STRING(), s, null, CommandType.Text); } else { throw new Exception("MainDepartment Object not found!"); } } catch (Exception ex) { throw new Exception("MainDepartmentDAL.Search : " + ex.Message); } return SQLAPI.ExecuteNonQueryReturnDataTable(SQLAPI.ENCRYPT_CONN_STRING(), s, null, CommandType.Text); } #endregion #region add public void add(Object obj) { string s = ""; try { if (obj is MainDepartment && obj !=null) { MainDepartment obj2 = (MainDepartment)obj; s = "INSERT INTO CR_Department " + "(DepCd,DepDesc,Status,CreatedBy,CreatedDate,CreatedSite) " + "VALUES(" + "'" + SqlObject.Encode(obj2.DepCd) + "'," + "'" + SqlObject.Encode(obj2.DepDesc) + "'," + "'A'," + "'" + SqlObject.Encode(obj2.CreatedBy) + "'," + " Convert(datetime,getdate(),12) , " + "'" + obj2.CreatedSite + "'" + ")"; SQLAPI.ExecuteNonQuery(SQLAPI.ENCRYPT_CONN_STRING(), s,null, CommandType.Text); SecAuditTrailDAL.add(Module_Desc, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name.ToString(), obj2.CreatedBy.ToString()); } else { throw new Exception("MainDepartment Object not found!"); } } catch (Exception ex) { throw new Exception("MainDepartmentDAL.add : " + ex.Message); } } #endregion #region delete public void delete(Object obj) { string s = ""; try { if (obj is MainDepartment && obj !=null) { MainDepartment obj2 = (MainDepartment)obj; s = "Delete from CR_Department where DepId = '" + obj2.DepId + "'"; SQLAPI.ExecuteNonQuery(SQLAPI.ENCRYPT_CONN_STRING(), s, null, CommandType.Text); SecAuditTrailDAL.add(Module_Desc, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name.ToString(), obj2.UpdatedBy.ToString()); } else { throw new Exception("MainDepartment Object not found!"); } } catch (Exception ex) { throw new Exception("MainDepartmentDAL.delete : " + ex.Message); } } #endregion #region update public void update(Object obj) { string s = ""; try { if (obj is MainDepartment && obj !=null) { MainDepartment obj2 = (MainDepartment)obj; s = "UPDATE CR_Department SET " + " DepCd = '" + SqlObject.Encode(obj2.DepCd) + "', " + " DepDesc = '" + SqlObject.Encode(obj2.DepDesc) + "', " + " Status = '" + SqlObject.Encode(obj2.Status) + "', " + " UpdatedBy = '" + SqlObject.Encode(obj2.UpdatedBy) + "', " + " UpdatedDate = Convert(datetime,getdate(),12) " + " where DepId = '" + obj2.DepId + "'"; SQLAPI.ExecuteNonQuery(SQLAPI.ENCRYPT_CONN_STRING(), s, null, CommandType.Text); SecAuditTrailDAL.add(Module_Desc, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name.ToString(), Convert.ToString(obj2.UpdatedBy)); } else { throw new Exception("MainDepartment Object not found!"); } } catch (Exception ex) { throw new Exception("MainDepartmentDAL.update : " + ex.Message); } } #endregion #region CheckDuplicate public string CheckDuplicate(object obj) { string s = ""; try { if (obj is MainDepartment && obj !=null) { MainDepartment obj2 = (MainDepartment)obj; s = " select (case when count(*)='0' then 'No' else 'Yes' end) FROM CR_Department with (nolock)" + " where DepCd = '" + SqlObject.Encode(obj2.DepCd) + "' and CreatedSite = '" + obj2.CreatedSite + "'"; return SQLAPI.ExecuteScalar(SQLAPI.ENCRYPT_CONN_STRING(), s, null, CommandType.Text); } else { throw new Exception("MainDepartment Object not found!"); } } catch (Exception ex) { throw new Exception("MainDepartmentDAL.CheckDuplicate : " + ex.Message); } } #endregion #region updateStatus public void updateStatus(Object obj) { string s = ""; try { if (obj is MainDepartment && obj !=null) { MainDepartment obj2 = (MainDepartment)obj; s = "UPDATE CR_Department SET " + " Status ='" + SqlObject.Encode(obj2.Status) + "', " + " UpdatedBy = '" + SqlObject.Encode(obj2.UpdatedBy) + "', " + " UpdatedDate = Convert(datetime,getdate(),12) " + " where DepId = '" + obj2.DepId + "'"; SQLAPI.ExecuteNonQuery(SQLAPI.ENCRYPT_CONN_STRING(), s, null, CommandType.Text); SecAuditTrailDAL.add(Module_Desc, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name.ToString(), obj2.UpdatedBy.ToString()); } else { throw new Exception("MainDepartment Object not found!"); } } catch (Exception ex) { throw new Exception("MainDepartmentDAL.updateStatus : " + ex.Message); } } #endregion #region DDL public DataTable DDL(object obj) { string s = ""; try { if (obj is MainDepartment && obj !=null) { MainDepartment obj2 = (MainDepartment)obj; s = " SELECT DepId,DepCd+'-'+DepDesc as CdDesc " + " FROM CR_Department with (nolock)" + " where Status='A'" + " and CreatedSite in (" + obj2.CreatedSite + ") order by DepCd asc "; return SQLAPI.ExecuteNonQueryReturnDataTable(SQLAPI.ENCRYPT_CONN_STRING(), s, null, CommandType.Text); } else { throw new Exception("MainDepartment Object not found!"); } } catch (Exception ex) { throw new Exception("MainDepartmentDAL.DDL : " + ex.Message); } } #endregion } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.