Esempio n. 1
0
        private void NewEditExit_EditClick(object sender, EventArgs e)
        {
            try
            {
                switch (NewEditExit.BtnEditText)
                {
                case "&Edit":
                    this.EnableDisableControls(false);
                    this.VisibleControls(true);
                    this.BindComboBox(true);
                    this.InitializeControls();
                    break;

                case "&Delete":
                    if (this.cboBusCode.SelectedValue != null)
                    {
                        if (Globalizer.ShowMessage(MessageType.Question, "Are you sure want to delete?") == DialogResult.Yes)
                        {
                            BusController busController = new BusController();

                            busController.DeleteByBusID(this.cboBusCode.SelectedValue.ToString());

                            string log = "Form-Bus;Item-BusCode:" + this.cboBusCode.Text + ";action-Delete";
                            userAction.Log(log);

                            this.BindComboBox(true);
                            Globalizer.ShowMessage(MessageType.Information, "Deleted Successfully");
                            this.ResetControl();
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }