示例#1
0
        /********************************* General Form Events *****************************/
        public void ClientOptions(bool isShown)
        {
            if (isShown)
            {
                linkableClientBox.Visible = true;
                DataTable clients = MClient.GetList();

                DataTable dt = new DataTable();
                dt = clients.Clone();
                dt.Rows.Add(new String[] { null, "<Select Client>" });
                foreach (DataRow r in clients.Rows)
                {
                    dt.ImportRow(r);
                }

                linkableClientBox.DataSource    = dt;
                linkableClientBox.DisplayMember = dt.Columns[1].ToString();
                linkableClientBox.ValueMember   = dt.Columns[0].ToString();
                new_Client_Button.Visible       = true;
            }
            else
            {
                linkableClientBox.Visible = false;
                new_Client_Button.Visible = false;
            }
        }
示例#2
0
        public void Client_Contract_Button_Click(object sender, EventArgs e)
        {
            String id = _client.GetContract();

            if ((id == null) || id == "")
            {
                NewContract();
                _contractForm = new AddEditContractForm(this, false, userID, _contract.FindID());
                _contractForm.ClientLinked(_clientForm.GetName());
                _contract.SetClient(_client.FindID());
                _contractForm.ShowDialog();

                if (MClientContract.GetDT(_contract.FindID(), "Client_Contract", "client_contract_id").Rows.Count > 0)
                {
                    MClient.SetContract(_client.FindID(), _contract.FindID());
                    _client.changeContract(_contract.FindID());
                    // _clientForm.SetContractButton(MClientContract.GetName(_contract.FindID()));
                }
            }
            else
            {
                OldContract(id);
                _contractForm = new AddEditContractForm(this, false, userID, id);
                _contractForm.ClientLinked(_clientForm.GetName());
                _contractForm.SetFields(_contract.Get(), userID);
                Populate_AddrGridView(id);
                _contractForm.Activate();
                _contractForm.ShowDialog();
            }
        }
示例#3
0
        /********************************* Sets *****************************/

        public void SetFields(String[] values, int userID)
        {
            if (isEdit)
            {
                nameComboBox.Text = values[1];
            }

            this.contractNameBox.Text  = values[1];
            this.StartDatePicker.Value = Convert.ToDateTime(values[2]);
            this.EndDatePicker.Value   = Convert.ToDateTime(values[3]);
            this.TermsBox.Text         = values[4];
            SetClientLabel(MClient.GetName(values[5]));
        }
示例#4
0
        public AddEditClientForm(MaintainClientController parent, bool edit, int id)
        {
            InitializeComponent();
            my_controller = parent;
            isEdit        = edit;
            userid        = id;
            noChanges     = true;

            #region Form Event Handlers

            /* this.Back_Button.Click += new System.EventHandler(my_controller.Client_Cancel_Button_Click);
             * this.Back_Button.MouseEnter += new EventHandler(button1_MouseEnter);
             * this.Back_Button.MouseLeave += new EventHandler(button1_MouseLeave);
             * this.Back_Button.Location = new Point(65, 38);
             * this.Back_Button.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.Back2));
             * Back_Button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
             * Back_Button.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
             */
            // this.contract_Button.Click += new EventHandler(my_controller.Client_Contract_Button_Click);
            this.Ok_Button.Click += new System.EventHandler(my_controller.Client_Ok_Button_Click);
            // this.Cancel_Button.Click += new System.EventHandler(my_controller.Client_Cancel_Button_Click);
            this.delete_Button.Click               += new EventHandler(my_controller.Client_Delete_Button_Click);
            this.CountryBox.SelectedValueChanged   += new System.EventHandler(my_controller.Country_Changed);
            this.ProvStateBox.SelectedValueChanged += new EventHandler(my_controller.Province_Changed);
            this.CityBox.SelectedValueChanged      += new EventHandler(my_controller.City_Changed);

            this.nameTxtBox.TextChanged         += new EventHandler(my_controller.Client_Text_Changed);
            this.typeTextBox.TextChanged        += new EventHandler(my_controller.Client_Text_Changed);
            this.addrTextBox.TextChanged        += new EventHandler(my_controller.Client_Text_Changed);
            this.postalCodeTextBox.TextChanged  += new EventHandler(my_controller.Client_Text_Changed);
            this.PoBoxTextBox.TextChanged       += new EventHandler(my_controller.Client_Text_Changed);
            this.EmailTextBox.TextChanged       += new EventHandler(my_controller.Client_Text_Changed);
            this.mainPhoneTxtBox.TextChanged    += new EventHandler(my_controller.Client_Text_Changed);
            this.SecondPhoneTextBox.TextChanged += new EventHandler(my_controller.Client_Text_Changed);
            this.FaxTextBox.TextChanged         += new EventHandler(my_controller.Client_Text_Changed);
            this.PrimContactTextBox.TextChanged += new EventHandler(my_controller.Client_Text_Changed);
            #endregion

            if (isEdit)
            {
                #region Create and set a combo selection box
                DataTable clients = MClient.GetList();
                nameComboBox          = new ComboBox();
                nameComboBox.Location = new Point(300, 31);
                nameComboBox.Font     = new Font(nameComboBox.Font.FontFamily, 10);
                nameComboBox.Size     = new Size(195, 28);

                DataTable dt = new DataTable();
                dt = clients.Clone();
                dt.Rows.Add(new String[] { null, "<Select Client>" });
                foreach (DataRow r in clients.Rows)
                {
                    dt.ImportRow(r);
                }

                nameComboBox.DataSource    = dt;
                nameComboBox.DisplayMember = dt.Columns[1].ToString();
                nameComboBox.ValueMember   = dt.Columns[0].ToString();

                nameComboBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
                nameComboBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
                for (int i = 0; i < clients.Rows.Count; i++)
                {
                    nameComboBox.AutoCompleteCustomSource.Add(clients.Rows[i][1].ToString());
                }

                nameComboBox.TextChanged          += new EventHandler(my_controller.Client_Text_Changed);
                nameComboBox.SelectedValueChanged += new EventHandler(my_controller.Edit_Client_Populate);
                this.Controls.Add(nameComboBox);

                Label nameSelection = new Label();
                nameSelection.Text     = "Select Client:";
                nameSelection.Font     = new Font(nameComboBox.Font.FontFamily, 10);
                nameSelection.Location = new Point(490, 166);
                this.Controls.Add(nameSelection);
                #endregion
            }

            here : try { SetCountryBox(MCountry.GetList(), "0"); }
            catch (Exception)
            {
                if (MessageBox.Show("Error connecting to Database\nDo you want to retry?", "Connection Problems", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    goto here;
                }
            }

            //User label
            user   = new Users();
            userid = id;
            setup(userid.ToString(), "FAFOS Client Form");
        }
示例#5
0
        }//Make it Cascade

        public void Contract_Ok_Button_Click(object sender, EventArgs e)
        {
            bool okToSubmit = true;

            if (_contractForm.noChanges)
            {
                _contractForm.Close();
            }
            else
            {
                if (_contract.getClientID() == "")
                {
                    MessageBox.Show("A contract requires a Client to be created");
                    okToSubmit = false;
                }

                String[] values = _contractForm.GetInputs();
                String[,] srvAddrs = _contractForm.GetViewInputs();


                for (int i = 0; i < values.Length; i++)
                {
                    if (values[i] == "Fail")
                    {
                        okToSubmit = false;
                    }
                }


                if (okToSubmit)
                {
                    if (MessageBox.Show("Are you sure you want to submit these changes?", "Confirm Submission", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        _contract.Set(values);// if we are good, submit changes to dataBase
                        NewSrvAddr();
                        String[] row;
                        int      test = 1;
                        for (int i = 0; i < (srvAddrs.Length / 10); i++)
                        {
                            row = new String[10];
                            for (int j = 0; j < 10; j++)
                            {
                                row[j] = srvAddrs[i, j];
                            }

                            test = _srvAddr.Set1(row);
                        }
                        OldClient(_contract.getClientID());
                        MClient.SetContract(_contract.getClientID(), _contract.FindID());
                        okDone = true;
                        if (test == 1)
                        {
                            _contractForm.Close();
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            } _mainForm.Notifications();
        }
示例#6
0
 private static void OldClient(String id)
 {
     _client = null; _client = new MClient(id);
 }
示例#7
0
/************************* Instantiating Models *************************************************/
        private static void NewClient()
        {
            _client = null; _client = new MClient();
        }
 private static void OldClient(String id)
 {
     _client = null; _client = new MClient(id);
 }
 /************************* Instantiating Models *************************************************/
 private static void NewClient()
 {
     _client = null; _client = new MClient();
 }