示例#1
0
        public bool UpdateFlagEmpTerminate(VMSTerminateModel model)
        {
            bool          result = false;
            SqlConnection con    = new SqlConnection(conString);

            try
            {
                SqlCommand com = new SqlCommand("UPDATE [dbo].[emp_terminate] SET [flag_vms_sync] = '" + model.flag_vms_sync + "'  WHERE [person_id] = '" + model.PersonID + "' AND [resign_date] = '" + model.ResignDate + "'", con);
                com.CommandTimeout = 0;
                com.CommandType    = CommandType.Text;

                con.Open();
                if (com.ExecuteNonQuery() > 0)
                {
                    result = true;
                }
            }
            catch (Exception err)
            {
                con.Close();
            }
            finally
            {
                con.Close();
            }

            return(result);
        }
示例#2
0
        public List <VMSTerminateModel> GetEmployeeTerminate()
        {
            List <VMSTerminateModel> TerminateModel = new List <VMSTerminateModel>();
            SqlConnection            con            = new SqlConnection(conString);

            try
            {
                SqlCommand com = new SqlCommand("SELECT * FROM VIEW_vms_emp_terminate", con);
                com.CommandTimeout = 0;
                com.CommandType    = CommandType.Text;


                con.Open();
                SqlDataReader reader = com.ExecuteReader();
                while (reader.Read())
                {
                    VMSTerminateModel model = new VMSTerminateModel();
                    model.PersonID    = reader["person_id"].ToString();
                    model.NIK         = reader["NIK"].ToString();
                    model.Name        = reader["Name"].ToString();
                    model.CompanyName = reader["UnitBusiness"].ToString();
                    model.ResignDate  = reader["resign_date"].ToString();
                    model.reason      = reader["resign_reason"].ToString();

                    TerminateModel.Add(model);
                }
            }
            catch (Exception err)
            {
                con.Close();
            }
            finally
            {
                con.Close();
            }

            return(TerminateModel);
        }