Exemplo n.º 1
0
        private void editButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (!inputValidation())
                {
                    return;
                }
                Utility        utl       = new Utility();
                SqlManipulator sql       = new SqlManipulator();
                DaftarTable    newDaftar = new DaftarTable();
                if (login.permission)
                {
                    var itm = (ComboboxItem)placeComboBox.SelectedItem;
                    login.cityID = itm.Value;
                }
                else
                {
                    newDaftar.CityID = login.cityID;
                }
                newDaftar.Id = data.Id;

                //var item = (ComboboxItem)placeComboBox.SelectedItem;
                //newDaftar.CityID = item.Value;
                newDaftar.Refund      = Convert.ToInt64(this.refundTextBox.Text);
                newDaftar.AccountType = this.AccountTypeComboBox.SelectedItem.ToString();
                //  newDaftar.BillDetailCode = Convert.ToInt64(this.billDetailCodetextBox.Text);
                newDaftar.CodeBudget = Convert.ToInt64(this.BudgetCodetextBox.Text);
                //newDaftar.Date = this.dateMaskedTextBox.Text;
                newDaftar.PlaceName = placeComboBox.SelectedItem.ToString();
                // newDaftar.RealDate = utl.changeToRealDate(newDaftar.Date);
                newDaftar.Deposit            = Convert.ToInt64(this.DepositTextBox.Text);
                newDaftar.RealDate           = data.RealDate;
                newDaftar.DepositDetail      = Convert.ToInt64(this.DepositDetailtextBox.Text);
                newDaftar.DepositOwnerDetail = this.DepositOwnerDetailTextBox.Text;
                newDaftar.CityID             = data.CityID;

                if (sql.isRestricted(newDaftar, login.permission))
                {
                    MessageBox.Show("دسترسی شما به این تاریخ توسط مدیر سیستم محدود شده است", "خطا",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }
                ;
                Reporter rpt = new Reporter(sql.update(newDaftar, godmode), (int)errorImages.info);
                rpt.Show();
                form.refreshLastState(lastState, pageNumber, false);
                this.Hide();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ورودی های خود را کنترل نمائید", "خطا",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                MessageBox.Show(ex.Message);
            }
        }