Exemplo n.º 1
0
        public Revenue()
        {
            data.COUNT = 0;
            InitializeComponent();
            data.COUNT        = 1;
            insertpop.Content = "insertpopup";
            Save.Content      = "Save";
            DataTable dt = re.fill_revenuegrid();

            dgrevenue.ItemsSource = dt.DefaultView;
            //txtrevenuecode.IsEnabled = false;
            //txttaxstructure.IsEnabled = false;
            //txtname.IsEnabled = false;
            //txtmistaxstructure.IsEnabled = false;

            //COMBOBOX2.IsEnabled = false;
            //COMBOBOX3.IsEnabled = false;
            //COMBOBOX4.IsEnabled = false;

            Save.IsEnabled  = true;
            clear.IsEnabled = true;
        }
Exemplo n.º 2
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (error != 0 || txtrevenuecode.Text == "" || txtname.Text == "" || txttaxstructure.Text == "" || txtmistaxstructure.Text == "")
                {
                    //  pop1.IsOpen = true;
                    if (txtrevenuecode.Text == "")
                    {
                        txtrevenuecode.Text = "";
                    }
                    if (txtname.Text == "")
                    {
                        txtname.Text = "";
                    }
                    if (txttaxstructure.Text == "")
                    {
                        txttaxstructure.Text = "";
                    }
                    if (txtmistaxstructure.Text == "")
                    {
                        txtmistaxstructure.Text = "";
                    }
                }
                else
                {
                    revenue rev = new revenue();

                    rev.REVENUE_CODE      = txtrevenuecode.Text;
                    rev.NAME              = txtname.Text;
                    rev.MISCELLANOUS      = COMBOBOX2.Text;
                    rev.PRINT_VOUCHER     = COMBOBOX3.Text;
                    rev.TAX_STRUCTURE     = txttaxstructure.Text;
                    rev.MIS_TAX_STRUCTURE = txtmistaxstructure.Text;
                    rev.STATUS            = COMBOBOX4.Text;
                    // ss rr ii u ii 11/15/2017
                    //rev.USER_NAME = login.u;
                    rev.INSERT_BY   = login.u;
                    rev.INSERT_DATE = DateTime.Today;
                    // add.IsEnabled = true;
                    // Modify.IsEnabled = true;
                    // Save.IsEnabled = false;
                    // clear.IsEnabled = false;
                    string a1 = "Save", b1 = Convert.ToString(Save.Content);
                    if (b1 == a1)
                    {
                        //Save.Content = "Save";
                        //insert.Content = "Inserted Sucessfully";
                        //pop2.IsOpen = true;
                        rev.Insert();
                        DataTable dt = rev.fill_revenuegrid();
                        dgrevenue.ItemsSource = dt.DefaultView;
                        //MessageBox.Show("inserted sucessfully");
                        popup_insert.IsOpen = true;
                    }
                    string a = "Update", b = Convert.ToString(Save.Content);
                    if (b == a)
                    {
                        //insert.Content = "Updated Sucessfully";
                        //pop2.IsOpen = true;
                        rev.UPDATE();
                        DataTable dt = rev.fill_revenuegrid();
                        dgrevenue.ItemsSource = dt.DefaultView;
                        //MessageBox.Show("updated sucessfully");
                        popup_update.IsOpen = true;
                    }
                    clearing();
                    this.NavigationService.Refresh();
                    txtrevenuecode.IsEnabled     = false;
                    txttaxstructure.IsEnabled    = false;
                    txtname.IsEnabled            = false;
                    txtmistaxstructure.IsEnabled = false;
                    COMBOBOX2.IsEnabled          = false;
                    COMBOBOX3.IsEnabled          = false;
                    COMBOBOX4.IsEnabled          = false;
                    Save.Content = "Save";
                    // add.Background = new SolidColorBrush(Color.FromRgb(53, 71, 102));
                    // Modify.Background = new SolidColorBrush(Color.FromRgb(53, 71, 102));
                }
            }
            catch (Exception)
            {
                MessageBox.Show("please Enter correct values");
            }
        }