/// <summary> /// 确认调职信息 /// </summary> /// <param name="model">调职信息</param> /// <returns></returns> public static bool ConfirmEmplApplyNotifyInfo(EmplApplyNotifyModel model) { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 model.CompanyCD = userInfo.CompanyCD; model.ModifiedUserID = userInfo.UserID; //定义返回变量 bool isSucc = false; //操作日志 LogInfoModel logModel = InitLogInfo(model.NotifyNo); //更新操作 logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; isSucc = EmplApplyNotifyDBHelper.ConfirmEmplApplyNotifyInfo(model); //更新成功时 if (isSucc) { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } //更新不成功 else { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } //登陆日志 LogDBHelper.InsertLog(logModel); return isSucc; }
protected void btnImport_Click(object sender, System.Web.UI.ImageClickEventArgs e) { try { XBase.Model.Office.HumanManager.EmplApplyNotifyModel searchModel = new XBase.Model.Office.HumanManager.EmplApplyNotifyModel();//获取数据 //设置查询条件 //调职单编号 searchModel.NotifyNo = txtNotifyNo.Text.Trim(); //调职单主题 searchModel.Title = txtTitle.Text.Trim(); //对应申请单 searchModel.EmplApplyNo = ddlApply.SelectedValue.Trim(); //员工 searchModel.EmployeeID = hidEmployeeID.Value.Trim(); DataTable dt = XBase.Business.Office.HumanManager.EmplApplyNotifyBus.SearchEmplApplyNotifyInfo(searchModel);//查询数据 for (var i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["BillStatus"].ToString() == "1") { dt.Rows[i]["BillStatus"] = "未确认"; } else { dt.Rows[i]["BillStatus"] = "已确认"; } } //导出标题 string headerTitle = "调职单编号|调职单主题|对应申请单|员工编号|员工姓名|原部门|原岗位|调出时间|调入部门|调入岗位|单据状态"; string[] header = headerTitle.Split('|'); //导出标题所对应的列字段名称 string columnFiled = "NotifyNo|Title|EmplApplyNo|EmployeeNo|EmployeeName|NowDeptName|NowQuarterName|OutDate|NewDeptName|NewQuarterName|BillStatus"; string[] field = columnFiled.Split('|'); XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "调职通知单列表"); } catch { } }
/// <summary> /// 查询调职信息 /// </summary> /// <param name="model">查询条件</param> /// <returns></returns> public static DataTable SearchEmplApplyNotifyInfo(EmplApplyNotifyModel model) { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 model.CompanyCD = userInfo.CompanyCD; //执行查询 return EmplApplyNotifyDBHelper.SearchEmplApplyNotifyInfo(model); }
/// <summary> /// 编辑调职信息 /// </summary> /// <param name="model">调职信息</param> /// <returns></returns> public static bool SaveEmplApplyNotifyInfo(EmplApplyNotifyModel model) { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 model.CompanyCD = userInfo.CompanyCD; model.ModifiedUserID = userInfo.UserID; //定义返回变量 bool isSucc = false; //操作日志 LogInfoModel logModel = InitLogInfo(model.NotifyNo); //更新 if (!string.IsNullOrEmpty(model.ID)) { try { logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //执行更新操作 isSucc = EmplApplyNotifyDBHelper.UpdateEmplApplyNotifyInfo(model); } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //插入 else { try { logModel.Element = ConstUtil.LOG_PROCESS_INSERT; //执行插入操作 isSucc = EmplApplyNotifyDBHelper.InsertEmplApplyNotifyInfo(model); } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //更新成功时 if (isSucc) { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } //更新不成功 else { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } //登陆日志 LogDBHelper.InsertLog(logModel); return isSucc; }
/// <summary> /// 保存时参数设置 /// </summary> /// <param name="comm">命令</param> /// <param name="model">人才代理信息</param> private static void SetSaveParameter(SqlCommand comm, EmplApplyNotifyModel model) { comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD));//企业代码 comm.Parameters.Add(SqlHelper.GetParameterFromString("@NotifyNo", model.NotifyNo));//调职单编号 comm.Parameters.Add(SqlHelper.GetParameterFromString("@Title", model.Title));//调职单主题 comm.Parameters.Add(SqlHelper.GetParameterFromString("@EmplApplyNo", model.EmplApplyNo));//对应调职申请编号 comm.Parameters.Add(SqlHelper.GetParameterFromString("@EmployeeID", model.EmployeeID));//被调职人 comm.Parameters.Add(SqlHelper.GetParameterFromString("@NowDeptID", model.NowDeptID));//原部门(对应部门表ID) comm.Parameters.Add(SqlHelper.GetParameterFromString("@NowQuarterID", model.NowQuarterID));//原岗位(对应岗位表ID) comm.Parameters.Add(SqlHelper.GetParameterFromString("@NowAdminLevel", model.NowAdminLevel));//原岗位职等(分类代码表设置) comm.Parameters.Add(SqlHelper.GetParameterFromString("@NewDeptID", model.NewDeptID));//调至部门ID comm.Parameters.Add(SqlHelper.GetParameterFromString("@NewQuarterID", model.NewQuarterID));//调至岗位ID comm.Parameters.Add(SqlHelper.GetParameterFromString("@NewAdminLevel", model.NewAdminLevel));//调至岗位职等(分类代码表设置) comm.Parameters.Add(SqlHelper.GetParameterFromString("@Reason", model.Reason));//调职事由 comm.Parameters.Add(SqlHelper.GetParameterFromString("@OutDate", model.OutDate));//调出时间 comm.Parameters.Add(SqlHelper.GetParameterFromString("@IntDate", model.IntDate));//调入时间 comm.Parameters.Add(SqlHelper.GetParameterFromString("@Remark", model.Remark));//备注 comm.Parameters.Add(SqlHelper.GetParameterFromString("@Creator", model.Creator));//制单人 comm.Parameters.Add(SqlHelper.GetParameterFromString("@CreateDate", model.CreateDate));//制单日期 comm.Parameters.Add(SqlHelper.GetParameterFromString("@ModifiedUserID", model.ModifiedUserID));//更新用户ID }
/// <summary> /// 更新调职申请信息 /// </summary> /// <param name="model">调职申请信息</param> /// <returns></returns> public static bool UpdateEmplApplyNotifyInfo(EmplApplyNotifyModel model) { #region SQL文拼写 StringBuilder updateSql = new StringBuilder(); updateSql.AppendLine(" UPDATE officedba.EmplApplyNotify "); updateSql.AppendLine(" SET Title = @Title "); updateSql.AppendLine(" ,EmplApplyNo = @EmplApplyNo "); updateSql.AppendLine(" ,EmployeeID = @EmployeeID "); updateSql.AppendLine(" ,NowDeptID = @NowDeptID "); updateSql.AppendLine(" ,NowQuarterID = @NowQuarterID "); updateSql.AppendLine(" ,NowAdminLevel = @NowAdminLevel "); updateSql.AppendLine(" ,NewDeptID = @NewDeptID "); updateSql.AppendLine(" ,NewQuarterID = @NewQuarterID "); updateSql.AppendLine(" ,NewAdminLevel = @NewAdminLevel "); updateSql.AppendLine(" ,Reason = @Reason "); updateSql.AppendLine(" ,OutDate = @OutDate "); updateSql.AppendLine(" ,IntDate = @IntDate "); updateSql.AppendLine(" ,Remark = @Remark "); updateSql.AppendLine(" ,Creator = @Creator "); updateSql.AppendLine(" ,CreateDate = @CreateDate "); updateSql.AppendLine(" ,ModifiedDate = getdate() "); updateSql.AppendLine(" ,ModifiedUserID = @ModifiedUserID "); updateSql.AppendLine(" WHERE "); updateSql.AppendLine(" CompanyCD = @CompanyCD "); updateSql.AppendLine(" AND NotifyNo = @NotifyNo "); #endregion //定义更新基本信息的命令 SqlCommand comm = new SqlCommand(); comm.CommandText = updateSql.ToString(); SetSaveParameter(comm, model);//其他参数 //执行更新 return SqlHelper.ExecuteTransWithCommand(comm); }
/// <summary> /// 确认调职信息 /// </summary> /// <param name="model">调职信息</param> /// <returns></returns> public static bool ConfirmEmplApplyNotifyInfo(EmplApplyNotifyModel model) { #region SQL文拼写 StringBuilder updateSql = new StringBuilder(); updateSql.AppendLine(" UPDATE officedba.EmplApplyNotify "); updateSql.AppendLine(" SET "); updateSql.AppendLine(" BillStatus = @BillStatus "); updateSql.AppendLine(" ,Confirmor = @Confirmor "); updateSql.AppendLine(" ,ConfirmDate = @ConfirmDate "); updateSql.AppendLine(" ,ModifiedDate = getdate() "); updateSql.AppendLine(" ,ModifiedUserID = @ModifiedUserID "); updateSql.AppendLine(" WHERE "); updateSql.AppendLine(" CompanyCD = @CompanyCD "); updateSql.AppendLine(" AND NotifyNo = @NotifyNo "); #endregion //定义更新基本信息的命令 SqlCommand comm = new SqlCommand(); comm.CommandText = updateSql.ToString(); //公司代码 comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD)); //单据状态 comm.Parameters.Add(SqlHelper.GetParameterFromString("@BillStatus", "2")); //编号 comm.Parameters.Add(SqlHelper.GetParameterFromString("@NotifyNo", model.NotifyNo)); //确认人 comm.Parameters.Add(SqlHelper.GetParameterFromString("@Confirmor", model.Confirmor)); //确认日期 comm.Parameters.Add(SqlHelper.GetParameterFromString("@ConfirmDate", model.ConfirmDate)); //最后更新人 comm.Parameters.Add(SqlHelper.GetParameterFromString("@ModifiedUserID", model.ModifiedUserID)); //定义变量 ArrayList lstUpdate = new ArrayList(); //更新调职表 lstUpdate.Add(comm); //更新人员信息 SqlCommand updateEmpl = new SqlCommand(); //设置SQL语句 updateEmpl.CommandText = "UPDATE officedba. EmployeeInfo SET QuarterID = @QuarterID,DeptID = @DeptID,AdminLevelID = @AdminLevelID WHERE ID = @EmplID"; //岗位 updateEmpl.Parameters.Add(SqlHelper.GetParameterFromString("@QuarterID", model.NewQuarterID)); //部门 updateEmpl.Parameters.Add(SqlHelper.GetParameterFromString("@DeptID", model.NewDeptID)); //岗位职等 updateEmpl.Parameters.Add(SqlHelper.GetParameterFromString("@AdminLevelID", model.NewAdminLevel)); //ID updateEmpl.Parameters.Add(SqlHelper.GetParameterFromString("@EmplID", model.EmployeeID)); //添加更新命令 lstUpdate.Add(updateEmpl); //对应申请输入时,更新对应申请的状态 if (!string.IsNullOrEmpty(model.EmplApplyNo)) { //定义变量 SqlCommand updateApply = new SqlCommand(); //设置SQL语句 updateApply.CommandText = "UPDATE officedba.EmplApply SET Status = @Status WHERE EmplApplyNo = @EmplApplyNo AND CompanyCD = @CompanyCD"; //状态标识 updateApply.Parameters.Add(SqlHelper.GetParameterFromString("@Status", "1")); //申请编号 updateApply.Parameters.Add(SqlHelper.GetParameterFromString("@EmplApplyNo", model.EmplApplyNo)); //公司代码 updateApply.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD)); lstUpdate.Add(updateApply); } //执行更新并设置更新结果 return SqlHelper.ExecuteTransWithArrayList(lstUpdate); }
/// <summary> /// 新建调职申请信息 /// </summary> /// <param name="model">调职申请信息</param> /// <returns></returns> public static bool InsertEmplApplyNotifyInfo(EmplApplyNotifyModel model) { #region 登陆SQL文 StringBuilder insertSql = new StringBuilder(); insertSql.AppendLine(" INSERT INTO "); insertSql.AppendLine(" officedba.EmplApplyNotify "); insertSql.AppendLine(" (CompanyCD "); insertSql.AppendLine(" ,NotifyNo "); insertSql.AppendLine(" ,Title "); insertSql.AppendLine(" ,EmplApplyNo "); insertSql.AppendLine(" ,EmployeeID "); insertSql.AppendLine(" ,NowDeptID "); insertSql.AppendLine(" ,NowQuarterID "); insertSql.AppendLine(" ,NowAdminLevel "); insertSql.AppendLine(" ,NewDeptID "); insertSql.AppendLine(" ,NewQuarterID "); insertSql.AppendLine(" ,NewAdminLevel "); insertSql.AppendLine(" ,Reason "); insertSql.AppendLine(" ,OutDate "); insertSql.AppendLine(" ,IntDate "); insertSql.AppendLine(" ,Remark "); insertSql.AppendLine(" ,BillStatus "); insertSql.AppendLine(" ,Creator "); insertSql.AppendLine(" ,CreateDate "); insertSql.AppendLine(" ,ModifiedDate "); insertSql.AppendLine(" ,ModifiedUserID) "); insertSql.AppendLine(" VALUES "); insertSql.AppendLine(" (@CompanyCD "); insertSql.AppendLine(" ,@NotifyNo "); insertSql.AppendLine(" ,@Title "); insertSql.AppendLine(" ,@EmplApplyNo "); insertSql.AppendLine(" ,@EmployeeID "); insertSql.AppendLine(" ,@NowDeptID "); insertSql.AppendLine(" ,@NowQuarterID "); insertSql.AppendLine(" ,@NowAdminLevel "); insertSql.AppendLine(" ,@NewDeptID "); insertSql.AppendLine(" ,@NewQuarterID "); insertSql.AppendLine(" ,@NewAdminLevel "); insertSql.AppendLine(" ,@Reason "); insertSql.AppendLine(" ,@OutDate "); insertSql.AppendLine(" ,@IntDate "); insertSql.AppendLine(" ,@Remark "); insertSql.AppendLine(" ,'1' "); insertSql.AppendLine(" ,@Creator "); insertSql.AppendLine(" ,@CreateDate "); insertSql.AppendLine(" ,getdate() "); insertSql.AppendLine(" ,@ModifiedUserID) "); insertSql.AppendLine(" SET @EmplApplyNotify= @@IDENTITY "); #endregion //定义更新基本信息的命令 SqlCommand comm = new SqlCommand(); //设置存储过程名 comm.CommandText = insertSql.ToString(); //设置保存的参数 SetSaveParameter(comm, model); //添加返回参数 comm.Parameters.Add(SqlHelper.GetOutputParameter("@EmplApplyNotify", SqlDbType.Int)); //执行登陆操作 bool isSucc = SqlHelper.ExecuteTransWithCommand(comm); //设置ID model.ID = comm.Parameters["@EmplApplyNotify"].Value.ToString(); //执行插入并返回插入结果 return isSucc; }
/// <summary> /// 查询调职申请信息 /// </summary> /// <param name="model">查询条件</param> /// <returns></returns> public static DataTable SearchEmplApplyNotifyInfo(EmplApplyNotifyModel model) { #region 查询语句 StringBuilder searchSql = new StringBuilder(); searchSql.AppendLine(" SELECT "); searchSql.AppendLine(" A.ID "); searchSql.AppendLine(" ,ISNULL(A.BillStatus, '') AS BillStatus "); searchSql.AppendLine(" ,A.NotifyNo "); searchSql.AppendLine(" ,A.Title "); searchSql.AppendLine(" ,ISNULL(A.EmplApplyNo, '') AS EmplApplyNo "); searchSql.AppendLine(" ,ISNULL(B.EmployeeNo, '') AS EmployeeNo "); searchSql.AppendLine(" ,ISNULL(B.EmployeeName, '') AS EmployeeName "); searchSql.AppendLine(" ,ISNULL(C.DeptName, '') AS NowDeptName "); searchSql.AppendLine(" ,ISNULL(D.QuarterName, '') AS NowQuarterName "); searchSql.AppendLine(" ,ISNULL(E.DeptName, '') AS NewDeptName "); searchSql.AppendLine(" ,ISNULL(F.QuarterName, '') AS NewQuarterName "); searchSql.AppendLine(" ,ISNULL(CONVERT(VARCHAR(10),A.OutDate,21),'') "); searchSql.AppendLine(" AS OutDate "); searchSql.AppendLine(" ,A.ModifiedDate "); searchSql.AppendLine(" FROM "); searchSql.AppendLine(" officedba.EmplApplyNotify A "); searchSql.AppendLine(" LEFT JOIN officedba.EmployeeInfo B "); searchSql.AppendLine(" ON A.EmployeeID = B.ID "); searchSql.AppendLine(" LEFT JOIN officedba.DeptInfo C "); searchSql.AppendLine(" ON A.NowDeptID = C.ID "); searchSql.AppendLine(" LEFT JOIN officedba.DeptQuarter D "); searchSql.AppendLine(" ON A.NowQuarterID = D.ID "); searchSql.AppendLine(" LEFT JOIN officedba.DeptInfo E "); searchSql.AppendLine(" ON A.NewDeptID = E.ID "); searchSql.AppendLine(" LEFT JOIN officedba.DeptQuarter F "); searchSql.AppendLine(" ON A.NewQuarterID = F.ID "); searchSql.AppendLine(" WHERE "); searchSql.AppendLine(" A.CompanyCD = @CompanyCD "); #endregion //定义查询的命令 SqlCommand comm = new SqlCommand(); //公司代码 comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD)); #region 页面查询条件 //编号 if (!string.IsNullOrEmpty(model.NotifyNo)) { searchSql.AppendLine(" AND A.NotifyNo LIKE '%' + @NotifyNo + '%'"); comm.Parameters.Add(SqlHelper.GetParameterFromString("@NotifyNo", model.NotifyNo)); } //调职单主题 if (!string.IsNullOrEmpty(model.Title)) { searchSql.AppendLine(" AND A.Title LIKE '%' + @Title + '%'"); comm.Parameters.Add(SqlHelper.GetParameterFromString("@Title", model.Title)); } //对应申请单 if (!string.IsNullOrEmpty(model.EmplApplyNo)) { searchSql.AppendLine(" AND A.EmplApplyNo = @EmplApplyNo "); comm.Parameters.Add(SqlHelper.GetParameterFromString("@EmplApplyNo", model.EmplApplyNo)); } //员工 if (!string.IsNullOrEmpty(model.EmployeeID)) { searchSql.AppendLine(" AND A.EmployeeID = @EmployeeID "); comm.Parameters.Add(SqlHelper.GetParameterFromString("@EmployeeID", model.EmployeeID)); } #endregion //指定命令的SQL文 comm.CommandText = searchSql.ToString(); //执行查询 return SqlHelper.ExecuteSearch(comm); }