Exemplo n.º 1
0
        private void UncheckApproval(DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            string empID    = gvRecap.Rows[e.RowIndex].Cells[0].Value.ToString();
            string fieldVal = "1";
            bool   val      = (bool)gvRecap.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;

            if (val)
            {
                fieldVal = "0";
            }
            string appField = "SupApprove";

            switch (gvRecap.Columns[e.ColumnIndex].Name)
            {
            case "OMApproved":
                appField = "OMApprove";
                break;

            case "HOApproved":
                appField = "HOApprove";
                break;
            }
            string sql = "UPDATE Timesheet SET " + appField + "= " + fieldVal;

            sql += " WHERE EmployeeID = " + empID;
            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                dg.RunCommand(sql);
            }
            FillTotalsView();
        }
Exemplo n.º 2
0
        private void LoadEmployeeGrid()
        {
            string sql = "SELECT EmployeeID,Lastname,Firstname,Branch,TSApprover,TSSubmitter,isActive FROM Employee ";

            sql += "WHERE QBFile='" + GetCompany() + "' ";
            if (GetBranch() != "AA")
            {
                sql += "AND Branch = '" + GetBranch() + "' ";
            }
            switch (cbShow.SelectedIndex)
            {
            case 0:
                sql += "AND isActive = 1";
                break;

            case 1:
                sql += "AND isActive = 0";
                break;
            }
            DataSet ds = null;

            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                ds = dg.GetDataSet(sql);
            }
//            List<Employee> empList = new ReaderToModel<Employee>().CreateList(sql, CommonProcs.WCompanyConnStr);
            gvEmpList.DataSource = ds.Tables[0].DefaultView;
        }
Exemplo n.º 3
0
        private bool CheckApproved(TimesheetTotals tot, string type)
        {
            int    empID = tot.EmployeeID;
            string sql   = "SELECT * FROM Timesheet WHERE EmployeeID = " + empID;

            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                switch (type)
                {
                case "SUP":
                    sql += " AND SupApprove = 0";
                    break;

                case "OM":
                    sql += " AND OMApprove = 0";
                    break;

                case "HO":
                    sql += " AND HOApprove = 0";
                    break;
                }
                if (dg.HasData(sql))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Exemplo n.º 4
0
        private void ApproveBySuper(DataGridViewCellEventArgs e)
        {
            string empId = gvRecap.Rows[e.RowIndex].Cells[0].Value.ToString();

            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                string sql = "UPDATE Timesheet SET SupApprove = 1 WHERE EmployeeID = " + empId;
                dg.RunCommand(sql);
            }
        }
Exemplo n.º 5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Login login = new Login();

            login.firstName = "New Login";
            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                new ModelToSQL <Login>().WriteInsertSQL("Login", login, "userID", CommonProcs.WCompanyConnStr);
            }
            LoadLoginGrid();
        }
Exemplo n.º 6
0
        public static void MakeMeetingPDF()
        {
            dg = new clsDataGetter("Data Source = 184.168.194.75; Initial Catalog = aaphones2; Persist Security Info = True; User ID = billwilson12; Password = keepitsimple62");
            SqlDataReader dr = dg.GetDataReader("EXEC sp_GetMeetingsPrint");

            MakePDFForm(@"D:\My Documents\Projects\dist23mvc\Dist23MVC\Dist23MVC\upload\district_23_template.pdf", @"D:\My Documents\Projects\dist23mvc\Dist23MVC\Dist23MVC\upload\district_23101.pdf", dr);
            dg.KillReader(dr);
            dr = dg.GetDataReader("EXEC sp_GetMeetingsPrint");
            FillPDFForm(@"D:\My Documents\Projects\dist23mvc\Dist23MVC\Dist23MVC\upload\district_23101.pdf", @"D:\My Documents\Projects\dist23mvc\Dist23MVC\Dist23MVC\upload\district_23curr.pdf", dr);
            dg.KillReader(dr);
        }
Exemplo n.º 7
0
        private void LoadAccessLevels()
        {
            string sql = "SELECT * FROM AccessLevels";

            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                System.Data.SqlClient.SqlDataReader dr = dg.GetDataReader(sql);
                while (dr.Read())
                {
                    string alStr = dr["accessLevelID"].ToString() + " - " + dr["accDesc"].ToString();
                    lbAccessLevels.Items.Add(alStr);
                }
            }
        }
Exemplo n.º 8
0
        private void LoadEmployeeGridFromSearch(string searchStr)
        {
            string sql = "SELECT EmployeeID,Lastname,Firstname,Branch,TSApprover,TSSubmitter,isActive FROM Employee ";

            sql += "WHERE FirstName LIKE '%" + searchStr + "%' ";
            sql += "OR LastName LIKE '%" + searchStr + "%' ";
            DataSet ds = null;

            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                ds = dg.GetDataSet(sql);
            }
            gvEmpList.DataSource = ds.Tables[0].DefaultView;
        }
Exemplo n.º 9
0
        private void ApproveAll(string btnName, string val)
        {
            string appField = "SupApprove";

            if (btnName == "OM")
            {
                appField = "OMApprove";
            }
            string sql = "UPDATE Timesheet SET " + appField + "= " + val;

            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                dg.RunCommand(sql);
            }
        }
Exemplo n.º 10
0
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (gvTimesheet.SelectedRows.Count < 1)
            {
                MessageBox.Show("Please select the entry before trying to delete");
                return;
            }
            string TimelineID = gvTimesheet.SelectedRows[0].Cells[0].Value.ToString();

            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                string sql = "DELETE FROM Timesheet  WHERE TimesheetID=" + TimelineID;
                dg.RunCommand(sql);
            }
            FillGridView(true);
        }
Exemplo n.º 11
0
        private bool CheckCompleteForRecap()
        {
            DateTime weekEnding = this.dtpWeekEnding.Value;
            string   sql        = "SELECT * FROM Timesheet ";

            sql += " WHERE WeekEnding = '" + weekEnding.ToShortDateString() + "' ";
            sql += "AND Complete = 0";
            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                if (dg.HasData(sql))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 12
0
        private string BuildEventFileName(string ext, int id = -1)
        {
            int nextKey = 0;

            if (id < 0)
            {
                clsDataGetter dg = new clsDataGetter(db.Database.Connection.ConnectionString);
                nextKey  = dg.GetScalarInteger("SELECT MAX(pKey) FROM Events WHERE DistKey=" + GlobalVariables.DistNumber);
                nextKey += 1;
            }
            else
            {
                nextKey = id;
            }
            return("event_" + GlobalVariables.DistNumber + "_" + nextKey.ToString() + ext);
        }
Exemplo n.º 13
0
        private void btnClose_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;

            if (btn.Text == "Close")
            {
                Close();
            }
            else
            {
                using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
                {
                    dg.RunCommand("DELETE FROM Employee WHERE EmployeeID = " + lblEmpID.Text);
                }
                Close();
            }
        }
Exemplo n.º 14
0
        private int GetOTPayrollItem(string RegHoursID)
        {
            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                string branchStr = GetCurrentBranch();

                string nameSQL = "SELECT name FROM PayrollItem ";
                nameSQL += "WHERE payItemID=" + RegHoursID;
                string   itemName  = dg.GetScalarString(nameSQL);
                string[] nameParts = itemName.Split('-');
                itemName = nameParts[0] + "-" + nameParts[1];

                string IDSql = "SELECT payItemID FROM PayrollItem ";
                IDSql += "WHERE Name LIKE '%" + itemName + "-OT' ";
                IDSql += "AND WageType = 'HourlyOvertime' ";
                IDSql += "AND QBFile='" + GetCurrentCompany() + "'";
                return(dg.GetScalarInteger(IDSql));
            }
        }
Exemplo n.º 15
0
        private static string LookupEmail(string type, bool isDistrict)
        {
            Dist23Data    db  = new Dist23Data();
            clsDataGetter dg  = new clsDataGetter(db.Database.Connection.ConnectionString);
            string        sql = "SELECT email FROM contacts c ";

            sql += "INNER JOIN ContactPosition cp ON cp.contactID = c.pKey ";
            sql += "INNER JOIN positions p ON p.pKey = cp.PositionID ";
            sql += "INNER JOIN groups g ON g.pKey = cp.GroupID ";
            sql += "WHERE positionName = '" + type + "' ";
            sql += "AND g.DistKey = " + GlobalVariables.DistKey;
            if (isDistrict)
            {
                sql += " AND g.isDistrict = 1";
            }
            string email = dg.GetScalarString(sql);

            return(email);
        }
Exemplo n.º 16
0
        private void gvTimesheet_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (gvTimesheet.Columns[e.ColumnIndex].Name != "OTHours" && gvTimesheet.Columns[e.ColumnIndex].Name != "RegHours")
            {
                return;
            }
            string colName  = gvTimesheet.Columns[e.ColumnIndex].Name;
            string newValue = gvTimesheet.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();

            if (newValue == string.Empty)
            {
                newValue = "0.0";
            }
            string timeSheetID = gvTimesheet.Rows[e.RowIndex].Cells[0].Value.ToString();

            using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr))
            {
                string sql = "UPDATE Timesheet SET " + colName + " = " + newValue + " WHERE TimesheetID=" + timeSheetID;
                dg.RunCommand(sql);
            }
            FillGridView(true);
        }