示例#1
0
        /// <summary>
        /// 确认离职信息
        /// </summary>
        /// <param name="model">离职信息</param>
        /// <returns></returns>
        public static bool ConfirmMoveNotifyInfo(MoveNotifyModel 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 = MoveNotifyDBHelper.ConfirmMoveNotifyInfo(model);

            //更新成功时
            if (isSucc)
            {
                //设置操作成功标识
                logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            //更新不成功
            else
            {
                //设置操作成功标识 
                logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
            }

            //登陆日志
            LogDBHelper.InsertLog(logModel);

            return isSucc;
        }
示例#2
0
    protected void btnImport_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        try
        {
            XBase.Model.Office.HumanManager.MoveNotifyModel searchModel = new XBase.Model.Office.HumanManager.MoveNotifyModel();//获取数据

            //设置查询条件
            //离职单编号
            searchModel.NotifyNo = txtNotifyNo.Text.Trim();
            //离职单主题
            searchModel.Title = txtTitle.Text.Trim();
            //对应申请单
            searchModel.MoveApplyNo = ddlApply.SelectedValue.Trim();
            //员工
            searchModel.EmployeeID = hidEmployeeID.Value.Trim();
            //离职时间
            searchModel.OutDate   = txtOutDate.Text;
            searchModel.OutToDate = txtOutToDate.Text;

            DataTable dt = XBase.Business.Office.HumanManager.MoveNotifyBus.SearchMoveNotifyInfo(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|MoveApplyNo|EmployeeNo|EmployeeName|DeptName|OutDate|BillStatus";
            string[] field       = columnFiled.Split('|');

            XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "离职通知单列表");
        }
        catch { }
    }
    protected void btnImport_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        try
        {
            XBase.Model.Office.HumanManager.MoveNotifyModel searchModel = new XBase.Model.Office.HumanManager.MoveNotifyModel();//获取数据

            //设置查询条件
            //离职单编号
            searchModel.NotifyNo = txtNotifyNo.Text.Trim();
            //离职单主题
            searchModel.Title = txtTitle.Text.Trim();
            //对应申请单
            searchModel.MoveApplyNo = ddlApply.SelectedValue.Trim();
            //员工
            searchModel.EmployeeID = hidEmployeeID.Value.Trim();
            //离职时间
            searchModel.OutDate = txtOutDate.Text;
            searchModel.OutToDate = txtOutToDate.Text;

            DataTable dt = XBase.Business.Office.HumanManager.MoveNotifyBus.SearchMoveNotifyInfo(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|MoveApplyNo|EmployeeNo|EmployeeName|DeptName|OutDate|BillStatus";
            string[] field = columnFiled.Split('|');

            XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "离职通知单列表");
        }
        catch { }
    }
示例#4
0
        /// <summary>
        /// 编辑离职申请信息
        /// </summary>
        /// <param name="model">离职申请信息</param>
        /// <returns></returns>
        public static bool SaveMoveNotifyInfo(MoveNotifyModel 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 = MoveNotifyDBHelper.UpdateMoveNotifyInfo(model);
                }
                catch (Exception ex)
                {
                    //输出系统日志
                    WriteSystemLog(userInfo, ex);
                }
            }
            //插入
            else
            {
                try
                {
                    logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
                    //执行插入操作
                    isSucc = MoveNotifyDBHelper.InsertMoveNotifyInfo(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;
        }
示例#5
0
 /// <summary>
 /// 查询离职信息
 /// </summary>
 /// <param name="model">查询条件</param>
 /// <returns></returns>
 public static DataTable SearchMoveNotifyInfo(MoveNotifyModel model)
 {
     //获取登陆用户信息
     UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
     //设置公司代码
     model.CompanyCD = userInfo.CompanyCD;
     return MoveNotifyDBHelper.SearchMoveNotifyInfo(model);
 }
 /// <summary>
 /// 保存时参数设置
 /// </summary>
 /// <param name="comm">命令</param>
 /// <param name="model">人才代理信息</param>
 private static void SetSaveParameter(SqlCommand comm, MoveNotifyModel 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("@MoveApplyNo", model.MoveApplyNo));//离职申请编号
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@EmployeeID", model.EmployeeID));//离职人
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@Reason", model.Reason));//离职事由
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@OutDate", model.OutDate));//离职时间
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@JobNote", model.JobNote));//离职交接说明
     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 UpdateMoveNotifyInfo(MoveNotifyModel model)
        {

            #region SQL文拼写
            StringBuilder updateSql = new StringBuilder();
            updateSql.AppendLine(" UPDATE officedba.MoveNotify        ");
            updateSql.AppendLine(" SET  Title = @Title                ");
            updateSql.AppendLine(" 	,MoveApplyNo = @MoveApplyNo       ");
            updateSql.AppendLine(" 	,EmployeeID = @EmployeeID         ");
            updateSql.AppendLine(" 	,Reason = @Reason                 ");
            updateSql.AppendLine(" 	,OutDate = @OutDate               ");
            updateSql.AppendLine(" 	,JobNote = @JobNote               ");
            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 InsertMoveNotifyInfo(MoveNotifyModel model)
        {
            #region 登陆SQL文
            StringBuilder insertSql = new StringBuilder();
            insertSql.AppendLine(" INSERT INTO          ");
            insertSql.AppendLine(" officedba.MoveNotify ");
            insertSql.AppendLine(" 	(CompanyCD          ");
            insertSql.AppendLine(" 	,NotifyNo           ");
            insertSql.AppendLine(" 	,Title              ");
            insertSql.AppendLine(" 	,MoveApplyNo        ");
            insertSql.AppendLine(" 	,EmployeeID         ");
            insertSql.AppendLine(" 	,Reason             ");
            insertSql.AppendLine(" 	,OutDate            ");
            insertSql.AppendLine(" 	,JobNote            ");
            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(" 	,@MoveApplyNo       ");
            insertSql.AppendLine(" 	,@EmployeeID        ");
            insertSql.AppendLine(" 	,@Reason            ");
            insertSql.AppendLine(" 	,@OutDate           ");
            insertSql.AppendLine(" 	,@JobNote           ");
            insertSql.AppendLine(" 	,@Remark            ");
            insertSql.AppendLine(" 	,'1'                ");
            insertSql.AppendLine(" 	,@Creator           ");
            insertSql.AppendLine(" 	,@CreateDate        ");
            insertSql.AppendLine(" 	,getdate()          ");
            insertSql.AppendLine(" 	,@ModifiedUserID)   ");
            insertSql.AppendLine("   SET @MoveNotifyID= @@IDENTITY  ");
            #endregion

            //定义更新基本信息的命令
            SqlCommand comm = new SqlCommand();
            //设置存储过程名
            comm.CommandText = insertSql.ToString();
            //设置保存的参数
            SetSaveParameter(comm, model);

            //添加返回参数
            comm.Parameters.Add(SqlHelper.GetOutputParameter("@MoveNotifyID", SqlDbType.Int));

            //执行登陆操作
            bool isSucc = SqlHelper.ExecuteTransWithCommand(comm);
            //设置ID
            model.ID = comm.Parameters["@MoveNotifyID"].Value.ToString();

            //执行插入并返回插入结果
            return isSucc;
        }
        /// <summary>
        /// 确认离职信息
        /// </summary>
        /// <param name="model">离职信息</param>
        /// <returns></returns>
        public static bool ConfirmMoveNotifyInfo(MoveNotifyModel model)
        {
            #region SQL文拼写
            StringBuilder updateSql = new StringBuilder();
            updateSql.AppendLine(" UPDATE officedba.MoveNotify        ");
            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 Flag = @Flag WHERE ID = @EmplID";
            //标识参数
            updateEmpl.Parameters.Add(SqlHelper.GetParameterFromString("@Flag", ConstUtil.JOB_FLAG_LEAVE));
            //ID
            updateEmpl.Parameters.Add(SqlHelper.GetParameterFromString("@EmplID", model.EmployeeID));
            //添加更新命令
            lstUpdate.Add(updateEmpl);
            //对应申请输入时,更新对应申请的状态
            if (!string.IsNullOrEmpty(model.MoveApplyNo))
            {
                //定义变量
                SqlCommand updateApply = new SqlCommand();
                //设置SQL语句
                updateApply.CommandText = "UPDATE officedba.MoveApply SET Status = @Status WHERE MoveApplyNo = @MoveApplyNo AND CompanyCD = @CompanyCD";
                //状态标识
                updateApply.Parameters.Add(SqlHelper.GetParameterFromString("@Status", "1"));
                //申请编号
                updateApply.Parameters.Add(SqlHelper.GetParameterFromString("@MoveApplyNo", model.MoveApplyNo));
                //公司代码
                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 DataTable SearchMoveNotifyInfo(MoveNotifyModel model)
        {

            #region 查询语句
            StringBuilder searchSql = new StringBuilder();
            searchSql.AppendLine(" SELECT                                         ");
            searchSql.AppendLine(" 	 A.ID                                         ");
            searchSql.AppendLine(" 	,A.NotifyNo                                   ");
            searchSql.AppendLine(" 	,ISNULL(A.BillStatus, '') AS BillStatus       ");
            searchSql.AppendLine(" 	,A.Title                                      ");
            searchSql.AppendLine(" 	,ISNULL(A.MoveApplyNo,'') AS MoveApplyNo      ");
            searchSql.AppendLine(" 	,ISNULL(B.EmployeeNo, '') AS EmployeeNo       ");
            searchSql.AppendLine(" 	,ISNULL(B.EmployeeName, '') AS EmployeeName   ");
            searchSql.AppendLine(" 	,ISNULL(C.DeptName, '') AS DeptName           ");
            searchSql.AppendLine(" 	,ISNULL(CONVERT(VARCHAR(10),A.OutDate,21),'') ");
            searchSql.AppendLine(" 		AS OutDate                                ");
            searchSql.AppendLine(" 	,A.ModifiedDate                               ");
            searchSql.AppendLine(" FROM                                           ");
            searchSql.AppendLine(" 	officedba.MoveNotify 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 B.DeptID = C.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.MoveApplyNo))
            {
                searchSql.AppendLine("	AND A.MoveApplyNo = @MoveApplyNo ");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@MoveApplyNo", model.MoveApplyNo));
            }
            //员工
            if (!string.IsNullOrEmpty(model.EmployeeID))
            {
                searchSql.AppendLine("	AND A.EmployeeID = @EmployeeID ");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@EmployeeID", model.EmployeeID));
            }
            //离职日期
            if (!string.IsNullOrEmpty(model.OutDate))
            {
                searchSql.AppendLine("	AND A.OutDate >= @OutDate ");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@OutDate", model.OutDate));
            }
            if (!string.IsNullOrEmpty(model.OutToDate))
            {
                searchSql.AppendLine("	AND A.OutDate <= @OutToDate ");
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@OutToDate", model.OutToDate));
            }
            #endregion

            //指定命令的SQL文
            comm.CommandText = searchSql.ToString();
            //执行查询
            return SqlHelper.ExecuteSearch(comm);
        }