Пример #1
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            int branch_id = -1;

            if (this.txt_branch_name.Text == string.Empty)
            {
                MessageBox.Show("Bank branch is a required field", "Accounts info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (this.txt_branch_id.Text != string.Empty)
            {
                branch_id = Convert.ToInt32(this.txt_branch_id.Text);
            }
            Salary_scales.save_update_branch_details("save_update_branch_details", this.txt_branch_name.Text, (this.chk_active.Checked ? true : false), branch_id);
            MessageBox.Show("Success", "Accounts info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            this.get_bank_branches();
        }
Пример #2
0
        protected void get_bank_branches(int bank_id)
        {
            DataTable dt = Salary_scales.get_bank_branches("get_bank_branches", bank_id);

            if (dt.Rows.Count != 0)
            {
                DataRow dtRow = dt.NewRow();
                dtRow["record_guid"]   = string.Empty;
                dtRow["branch_id"]     = -1;
                dtRow["bank_id"]       = -1;
                dtRow["branch_name"]   = string.Empty;
                dtRow["branch_active"] = true;
                dt.Rows.InsertAt(dtRow, 0);
                this.cbo_bank_branch.DisplayMember = "branch_name";
                this.cbo_bank_branch.ValueMember   = "branch_id";
                this.cbo_bank_branch.DataSource    = dt;
            }
        }
        protected void select_guard_bank_details_mapping_search()
        {
            DataTable dt = Salary_scales.select_guard_bank_details_mapping_search("select_guard_bank_details_mapping_search", this.cbo_branch_search.Text, this.txt_guard_number_search.Text);

            if (dt.Rows.Count != 0)
            {
                this.gdv_guards.DataSource = dt;
                this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
                this.gdv_guards.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                this.gdv_guards.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
                this.gdv_guards.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
                this.gdv_guards.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
                this.gdv_guards.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
                this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
            }
        }
        protected void get_guard_bank_mapping()
        {
            DataTable dt = Salary_scales.return_bank_lists("select_guard_bank_details_mapping");

            if (dt.Rows.Count != 0)
            {
                this.gdv_guards.DataSource = dt;
                this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
                this.gdv_guards.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                this.gdv_guards.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
                this.gdv_guards.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
                this.gdv_guards.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
                this.gdv_guards.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
                this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
            }
        }
        //function below does assign salary scale to selected guards
        protected void Save_or_update_guard_salary_scale()
        {
            for (int i = 0; i < gdv_guard_salaries.Rows.Count; i++)
            {
                if ((Convert.ToBoolean(gdv_guard_salaries.Rows[i].Cells[0].Value)) == true)
                {
                    int    guard_auto_id     = Convert.ToInt32(gdv_guard_salaries.Rows[i].Cells[1].Value.ToString()); //guard auto id
                    string guard_number      = gdv_guard_salaries.Rows[i].Cells[3].Value.ToString();                  //guard number
                    int    previous_scale_id = Convert.ToInt32(gdv_guard_salaries.Rows[i].Cells[7].Value.ToString());
                    int    scale_id          = Convert.ToInt32(txt_auto_id.Text);

                    //call function to assign scale from app code
                    Salary_scales.Salary_scale_manual_assigment_query("salary_scale_manual_assigment_query", guard_auto_id, guard_number, scale_id, SystemConst._username, previous_scale_id);
                }
            }
            //display success message after all tasks executed succesfully
            MessageBox.Show("All selected guards salary scales succesfully updated", "save scales", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #6
0
        protected void get_bank_branches()
        {
            DataTable dt = Salary_scales.get_bank_branches("get_bank_branches", Salary_scales.bank_id);

            this.gdv_branches.DataSource = dt;
            this.gdv_branches.Columns["record_guid"].Visible            = false;
            this.gdv_branches.Columns["branch_id"].Visible              = false;
            this.gdv_branches.Columns["bank_id"].Visible                = false;
            this.gdv_branches.DefaultCellStyle.SelectionBackColor       = Color.White;
            this.gdv_branches.DefaultCellStyle.SelectionForeColor       = Color.Black;
            this.gdv_branches.RowsDefaultCellStyle.BackColor            = Color.LightGray;
            this.gdv_branches.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
            this.gdv_branches.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
            this.gdv_branches.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
            this.gdv_branches.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
            this.gdv_branches.DefaultCellStyle.SelectionBackColor       = Color.White;
            this.gdv_branches.DefaultCellStyle.SelectionForeColor       = Color.Black;
            this.txt_bank_id.Text = Salary_scales.bank_id.ToString();
        }
        //return list of salary scales
        protected void get_list_of_salary_scales_for_guards()
        {
            DataTable dt = Salary_scales.return_salary_scales("return_salary_scales");

            if (dt.Rows.Count > 0)
            {
                gdv_salary_scales.DataSource = dt;

                gdv_salary_scales.Columns[0].Visible = false;
                gdv_salary_scales.Columns[1].Visible = false;
                gdv_salary_scales.Columns[2].Visible = false;
                gdv_salary_scales.Columns["basic_amount"].HeaderText     = "Basic Amount";
                gdv_salary_scales.Columns["salary_amount"].HeaderText    = "Salary Amount";
                gdv_salary_scales.Columns["scale_name"].HeaderText       = "Scale Name";
                gdv_salary_scales.Columns["transport_amount"].HeaderText = "Transport Amount";
                gdv_salary_scales.Columns["housing_amount"].HeaderText   = "Housing Amount";

                gdv_salary_scales.Columns["scale_name"].Width = 220;
                gdv_salary_scales.Columns["salary_amount"].DefaultCellStyle.ForeColor = Color.Blue;

                gdv_salary_scales.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                gdv_salary_scales.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;

                // Set the row and column header styles.
                gdv_salary_scales.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                gdv_salary_scales.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
                gdv_salary_scales.RowHeadersDefaultCellStyle.BackColor    = Color.Black;

                // Set the selection background color for all the cells.
                gdv_salary_scales.DefaultCellStyle.SelectionBackColor = Color.Cyan;
                gdv_salary_scales.DefaultCellStyle.SelectionForeColor = Color.Black;

                foreach (DataGridViewColumn c in gdv_salary_scales.Columns)
                {
                    c.DefaultCellStyle.Font = new Font("Arial", 12.5F, GraphicsUnit.Pixel);
                }

                //set the background color of the header row
                gdv_salary_scales.ColumnHeadersDefaultCellStyle.BackColor = Color.CadetBlue;
                gdv_salary_scales.EnableHeadersVisualStyles = false;
            }
        }
        protected void Return_guard_salary_mappings()
        {
            DataTable dt = Salary_scales.return_guard_salary_mappings("return_guard_salary_mappings");

            if (dt.Rows.Count > 0)
            {
                gdv_guard_salaries.DataSource = dt;

                gdv_guard_salaries.Columns[0].HeaderText = "Guard Name";
                gdv_guard_salaries.Columns[1].HeaderText = "Branch";
                gdv_guard_salaries.Columns[2].HeaderText = "Duration Served(Years):0 Means Less than a year";
                gdv_guard_salaries.Columns[3].HeaderText = "Posible Salary Scale";

                gdv_guard_salaries.DefaultCellStyle.SelectionBackColor = Color.White;
                gdv_guard_salaries.DefaultCellStyle.SelectionForeColor = Color.Black;

                gdv_guard_salaries.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                gdv_guard_salaries.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;

                // Set the row and column header styles.
                gdv_guard_salaries.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                gdv_guard_salaries.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
                gdv_guard_salaries.RowHeadersDefaultCellStyle.BackColor    = Color.Black;

                // Set the selection background color for all the cells.
                gdv_guard_salaries.DefaultCellStyle.SelectionBackColor = Color.White;
                gdv_guard_salaries.DefaultCellStyle.SelectionForeColor = Color.Black;

                foreach (DataGridViewColumn c in gdv_guard_salaries.Columns)
                {
                    c.DefaultCellStyle.Font = new Font("Arial", 12.5F, GraphicsUnit.Pixel);
                }

                //set the background color of the header row
                gdv_guard_salaries.ColumnHeadersDefaultCellStyle.BackColor = Color.CadetBlue;
                gdv_guard_salaries.EnableHeadersVisualStyles = false;
            }
        }
        protected void auto_assign_salary_scale_to_guard()
        {
            DataTable dt = Salary_scales.return_number_of_years_served_for_each_gaurd("return_number_of_years_served_for_each_gaurd");

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dtRow         = dt.Rows[i];
                    int     guard_auto_id = Convert.ToInt32(dtRow["auto_id"].ToString());
                    string  guard_number  = (string)dtRow["guard_number"];
                    int     Duration      = Convert.ToInt32(dtRow["Duration"].ToString());
                    try
                    {
                        Salary_scales.auto_assign_salary_scale_to_guard("auto_assign_salary_scale_to_guard", Duration, guard_auto_id, guard_number);
                    }
                    catch (Exception exception)
                    {
                        throw exception;
                    }
                }
                MessageBox.Show("All Guards salary scales successfully updated", "Update salary scales", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
        //return scale mapping
        protected void Return_guard_salary_mappings()
        {
            DataTable dt = Salary_scales.return_guard_salary_mappings("return_manual_guard_salary_scale_mappings");

            if (dt.Rows.Count > 0)
            {
                gdv_guard_salaries.DataSource = dt;

                gdv_guard_salaries.Columns["full_name"].HeaderText     = "Guard Name";
                gdv_guard_salaries.Columns["branch"].HeaderText        = "Branch";
                gdv_guard_salaries.Columns["Duration"].HeaderText      = "Duration Served(Years)";
                gdv_guard_salaries.Columns["salary_amount"].HeaderText = "Salary Amt";

                gdv_guard_salaries.Columns["auto_id"].Visible       = false;
                gdv_guard_salaries.Columns["guard_number"].Visible  = false;
                gdv_guard_salaries.Columns["scale_auto_id"].Visible = false;

                //set read only properties for these columns
                gdv_guard_salaries.Columns["full_name"].ReadOnly     = true;
                gdv_guard_salaries.Columns["branch"].ReadOnly        = true;
                gdv_guard_salaries.Columns["Duration"].ReadOnly      = true;
                gdv_guard_salaries.Columns["salary_amount"].ReadOnly = true;

                gdv_guard_salaries.Columns["full_name"].Width = 200;
                gdv_guard_salaries.Columns["salary_amount"].DefaultCellStyle.ForeColor = Color.Blue;

                //insert the checkbox column at index 0 of the grid
                DataGridViewCheckBoxColumn chk_select_guard = new DataGridViewCheckBoxColumn();
                chk_select_guard.Name       = "column_select";
                chk_select_guard.HeaderText = "Select Guard";
                chk_select_guard.FalseValue = 0;
                chk_select_guard.TrueValue  = 1;
                gdv_guard_salaries.Columns.Insert(0, chk_select_guard);

                //set checkbox column to allow edits.
                gdv_guard_salaries.Columns["column_select"].ReadOnly = false;
                gdv_guard_salaries.Columns["column_select"].Width    = 50;

                gdv_guard_salaries.DefaultCellStyle.SelectionBackColor = Color.White;
                gdv_guard_salaries.DefaultCellStyle.SelectionForeColor = Color.Black;

                gdv_guard_salaries.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                gdv_guard_salaries.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;

                // Set the row and column header styles.
                gdv_guard_salaries.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                gdv_guard_salaries.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
                gdv_guard_salaries.RowHeadersDefaultCellStyle.BackColor    = Color.Black;

                // Set the selection background color for all the cells.
                gdv_guard_salaries.DefaultCellStyle.SelectionBackColor = Color.Cyan;
                gdv_guard_salaries.DefaultCellStyle.SelectionForeColor = Color.Black;

                foreach (DataGridViewColumn c in gdv_guard_salaries.Columns)
                {
                    c.DefaultCellStyle.Font = new Font("Arial", 12.5F, GraphicsUnit.Pixel);
                }

                //set the background color of the header row
                gdv_guard_salaries.ColumnHeadersDefaultCellStyle.BackColor = Color.CadetBlue;
                gdv_guard_salaries.EnableHeadersVisualStyles = false;
            }
        }