Example #1
0
        private void ManagerForm_Load(object sender, EventArgs e)
        {
            ExtensionMethods.DoubleBuffered(this.usersDataGridView, true);
            selectedRow = 0;
            SqlManipulator sql = new SqlManipulator();

            try
            {
                makeTableUsers(sql.getDataLogin());
                //usersDataGridView.Columns[0].Visible = false;
                var cities = sql.queryCities();
                cityComboBox.DataSource = cities;

                // this.cityTableTableAdapter.Fill(this.daftarDataSet1.CityTable);
                makeTable(sql.getDataCity());
                makeTableUsers(sql.getDataLogin());
                makeValidationTable(sql.getValidationData());
                startendDate                = sql.findMaxminMonthDay(0);
                this.versionTextBox.Text    = global.currentVersion.ToString();
                this.versionTextBox.Enabled = false;
                DGV_SetStyle(this.cityDataGridView);


                changeCityDGVname();

                changeColumnName();
                selectedRow = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #2
0
        private void deleteRestrictionButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("آیا از حذف مطمئن هستید؟", "هشدار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dialogResult == DialogResult.Yes)
            {
                try {
                    selectedRow = validationDataGridView.CurrentCell.RowIndex;

                    SqlManipulator  sql                = new SqlManipulator();
                    DataGridViewRow newDataRow         = validationDataGridView.Rows[selectedRow];
                    validationTable deletedRestriction = new validationTable();


                    deletedRestriction.City        = (long)newDataRow.Cells[2].Value;
                    deletedRestriction.startDate   = (long)newDataRow.Cells[3].Value;
                    deletedRestriction.enDate      = (long)newDataRow.Cells[4].Value;
                    deletedRestriction.id          = (long)newDataRow.Cells[0].Value;
                    deletedRestriction.description = (String)newDataRow.Cells[1].Value;
                    sql.removeRestriction(deletedRestriction);
                    var data = sql.getValidationData();
                    makeValidationTable(data);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Example #3
0
        private void tabControl1_Selected(object sender, TabControlEventArgs e)
        {
            if (e.TabPage == tabPage1)
            {
                selectedRow = 0;

                SqlManipulator sql = new SqlManipulator();
                try
                {
                    makeTableUsers(sql.getDataLogin());

                    /// usersDataGridView.Columns[0].Visible = false;
                    var cities = sql.queryCities();
                    cityComboBox.DataSource = cities;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            if (e.TabPage == tabPage2)

            {
                selectedRow = 0;
                SqlManipulator sql = new SqlManipulator();
                makeTable(sql.getDataCity());
            }
            if (e.TabPage == tabPage4)
            {
                try {
                    SqlManipulator sql = new SqlManipulator();
                    makeValidationTable(sql.getValidationData());
                    var cities = sql.queryCities();
                    validCityComboBox.DataSource = cities;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Example #4
0
        private void addRestriction()
        {
            try
            {
                validationTable valid = new validationTable();

                DateTime endTime = endDateTimePickerX1.SelectedDateInDateTime;

                StartEndMonthClass date = new StartEndMonthClass();

                date.endDate = Convert.ToInt64(endTime.ToFa("yyyyMMdd"));

                valid.startDate = startendDate.min;
                valid.enDate    = date.endDate;
                valid.City      = Convert.ToInt64(validCityComboBox.SelectedValue);
                SqlManipulator sql = new SqlManipulator();

                //if (this.lockAllCitiesCheckBox.Checked == true)
                //{
                //    var cities = sql.getDataCity();
                //    foreach(var city in cities)
                //    {

                //    }
                //}
                var           cityName  = sql.getCityName(valid.City);
                FarsiDateUtil startDate = new FarsiDateUtil(startendDate.min.ToString());
                FarsiDateUtil endDate   = new FarsiDateUtil(date.endDate.ToString());
                valid.description = "قفل" + " " + cityName + "  " + endDate.MonthName + endDate.Year;
                Reporter rpt = new Reporter(sql.addValidation(valid), (int)errorImages.info);
                rpt.Show();
                makeValidationTable(sql.getValidationData());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }