public void SaveCL(string txtShipID)
        {
            using (SqlCommand cmd = new SqlCommand("payroll.[dbo].[sp_CL_Insert]", sql.SQLConnReturn()))
            {
                sql.SQLOpen();

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@ID", SqlDbType.VarChar).Value = txtShipID;
                cmd.ExecuteNonQuery();

                sql.SQLClose();
            }
        }
        public void SaveCall(string txtShip, string txtPort, DateTime txtDate)
        {
            using (SqlCommand cmd = new SqlCommand("payroll.[dbo].[sp_Call_Insert]", sql.SQLConnReturn()))
            {
                sql.SQLOpen();

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@ship", SqlDbType.VarChar).Value      = txtShip;
                cmd.Parameters.Add("@date", SqlDbType.Date).Value         = txtDate;
                cmd.Parameters.Add("@FK_PortID", SqlDbType.VarChar).Value = txtPort;
                cmd.ExecuteNonQuery();

                sql.SQLClose();
            }
        }
        public void SaveTour(string txtTourID, string txtPort, string txtTourName, decimal decimalRate)
        {
            Math.Round(decimalRate, 2);

            using (SqlCommand cmd = new SqlCommand("payroll.[dbo].[sp_Tour_Insert]", sql.SQLConnReturn()))
            {
                sql.SQLOpen();

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@tourID", SqlDbType.VarChar).Value   = txtTourID;
                cmd.Parameters.Add("@port", SqlDbType.VarChar).Value     = txtPort;
                cmd.Parameters.Add("@tourName", SqlDbType.VarChar).Value = txtTourName;
                cmd.Parameters.Add("@Rate", SqlDbType.Decimal).Value     = decimalRate;

                cmd.ExecuteNonQuery();

                sql.SQLClose();
            }
        }
Beispiel #4
0
        public void SaveEmployee(string txtFirstName, string txtLastName, string txtEmail, string txtEmpID, string txtEmpType)
        {
            SqlCommand cmd = new SqlCommand("payroll.[dbo].[sp_Employees_Insert]", sql.SQLConnReturn());

            sql.SQLOpen();

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value    = txtFirstName;
            cmd.Parameters.Add("@lastName", SqlDbType.VarChar).Value     = txtLastName;
            cmd.Parameters.Add("@emailAddress", SqlDbType.VarChar).Value = txtEmail;
            cmd.Parameters.Add("@ID", SqlDbType.VarChar).Value           = txtEmpID;
            cmd.Parameters.Add("@type", SqlDbType.VarChar).Value         = txtEmpType;
            cmd.ExecuteNonQuery();

            sql.SQLClose();
        }
        public void SavePayrollLine(string intHeader, string txtCallID, string txtEmployeeID, string txtTourID)
        {
            using (SqlCommand cmd = new SqlCommand("payroll.[dbo].[sp_PayrollLine_Insert]", sql.SQLConnReturn()))
            {
                sql.SQLOpen();

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@HeaderID", SqlDbType.VarChar).Value   = intHeader;
                cmd.Parameters.Add("@callId", SqlDbType.VarChar).Value     = txtCallID;
                cmd.Parameters.Add("@employeeID", SqlDbType.VarChar).Value = txtEmployeeID;
                cmd.Parameters.Add("@tourID", SqlDbType.VarChar).Value     = txtTourID;
                cmd.ExecuteNonQuery();

                sql.SQLClose();
            }
        }
Beispiel #6
0
        public void generatePayrollFile(string ID)
        {
            //string text = System.IO.File.ReadAllText("C:\\Payroll\\FileLoaction.txt");
            //using (StreamWriter writer = new StreamWriter(text + "payroll_" + DateTime.Now.ToString("yyyy-dd-M") + ".txt"))
            using (StreamWriter writer = new StreamWriter("C:\\Users\\phil\\Documents\\payroll_" + DateTime.Now.ToString("yyyy-dd-M") + ".txt"))


            {
                SQLConn sql = new SQLConn();

                sql.SQLOpen();

                SqlCommand cmd = new SqlCommand("payroll.[dbo].[sp_PayrollTotal_Get]", sql.SQLConnReturn());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@id", SqlDbType.VarChar).Value = ID;

                SqlDataReader reader = cmd.ExecuteReader();


                while (reader.Read())
                {
                    writer.WriteLine(reader["employeeID"] + "," + reader["1099"] + "," + reader["w-2"] + "," + reader["salary"]);
                }
            }
        }
Beispiel #7
0
        public void test()
        {
            using (StreamWriter writer = new StreamWriter("C:\\Users\\phil\\Documents\\payroll.txt"))
            {
                writer.WriteLine("test2");

                SQLConn sql = new SQLConn();

                sql.SQLOpen();

                SqlCommand cmd = new SqlCommand("payroll.[dbo].[sp_Employees_Get_All]", sql.SQLConnReturn());

                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    writer.WriteLine(reader["FirstName"]);
                }
            }
        }
        public void SavePayrollHeader(DateTime dateFrom, DateTime dateTo, string description)
        {
            using (SqlCommand cmd = new SqlCommand("payroll.[dbo].[sp_PayrollHeader_Insert]", sql.SQLConnReturn()))
            {
                sql.SQLOpen();

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@date_from", SqlDbType.Date).Value      = dateFrom;
                cmd.Parameters.Add("@date_to", SqlDbType.Date).Value        = dateTo;
                cmd.Parameters.Add("@description", SqlDbType.VarChar).Value = description;
                cmd.ExecuteNonQuery();

                sql.SQLClose();
            }
        }