예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (InputTextbox.SelectedText.Length > 0)
            {
                InputTextbox.Text = InputTextbox.Text.Replace(InputTextbox.SelectedText, InputTextbox.SelectedText);
            }

            if (textBox1.Text.Length > 0)
            {
                InputTextbox.SelectionBackColor = Color.Empty;
                int index = 0;
                while (index < InputTextbox.Text.LastIndexOf(textBox1.Text))
                {
                    if (checkBox1.Checked)
                    {
                        InputTextbox.Find(textBox1.Text, index, InputTextbox.TextLength, RichTextBoxFinds.None);
                    }
                    else
                    {
                        InputTextbox.Find(textBox1.Text, index, InputTextbox.TextLength, RichTextBoxFinds.MatchCase);
                    }

                    InputTextbox.SelectionBackColor = Color.Yellow;
                    index = InputTextbox.Text.IndexOf(textBox1.Text, index) + 1;
                }
            }
        }
예제 #2
0
        /*******************************************************************************************************/
        #region METHODS

        protected override void setupFields()
        {
            Settings.setGeneralSettings(this);

            //NOTES: must use inputColumns sequentially from the first one to the next. Otherwise calculation of the form width will be off

            //Field ID
            col_grid_id.DataPropertyName = PettyCashRecordsCategory.COL_DB_Id;

            //Field Default
            col_grid_default.Visible = true;

            //Field Active
            col_grid_active.Visible = true;

            //Field Name - textbox
            _inputTxtName = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Name", PettyCashRecordsCategory.COL_DB_Name, false);
            _inputTxtName.setMaxLength(50);                                        //set max length
            col_grid_name.DataPropertyName = PettyCashRecordsCategory.COL_DB_Name; //set field's data property name in gridview

            //Field Notes - textbox
            _inputTxtNotes = (InputTextbox)setupInputControl(new InputTextbox(), 2, "Notes", PettyCashRecordsCategory.COL_DB_Notes, 100, true, true, null);
            _inputTxtNotes.setToMultiline(4);
            _inputTxtNotes.setMaxLength(100); //set max length

            //set default control to focus
            DefaultInputToFocus = _inputTxtName;
        }
        /*******************************************************************************************************/
        #region METHODS

        protected override void setupFields()
        {
            Settings.setGeneralSettings(this);

            //NOTES: must use inputColumns sequentially from the first one to the next. Otherwise calculation of the form width will be off

            //Field ID
            col_grid_id.DataPropertyName = FabricColor.COL_DB_ID;

            //Field Default
            col_grid_default.Visible = true;

            //Field Active
            col_grid_active.Visible = true;

            //Field Name - textbox
            _inputTxtName = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Name", FabricColor.COL_DB_NAME, false);
            _inputTxtName.setMaxLength(20);                           //set max length
            col_grid_name.DataPropertyName = FabricColor.COL_DB_NAME; //set field's data property name in gridview

            //Field Allow2ndColor
            _colChkAllow2ndColor                  = col_grid_checkbox1;
            _colChkAllow2ndColor.Visible          = true;
            _colChkAllow2ndColor.DataPropertyName = "allow_2nd_color";
            _colChkAllow2ndColor.HeaderText       = "2nd color";
            _colChkAllow2ndColor.Width            = 50;


            //set default control to focus
            DefaultInputToFocus = _inputTxtName;
        }
예제 #4
0
        /*******************************************************************************************************/
        #region METHODS

        protected override void setupFields()
        {
            Settings.setGeneralSettings(this);

            //NOTES: must use inputColumns sequentially from the first one to the next. Otherwise calculation of the form width will be off

            //Field ID
            col_grid_id.DataPropertyName = City.COL_DB_ID;

            //Field Default
            col_grid_default.Visible = false;

            //Field Active
            col_grid_active.Visible = true;

            //Field Name - textbox
            _inputTxtName = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Name", City.COL_DB_NAME, false);
            _inputTxtName.setMaxLength(50);                    //set max length
            col_grid_name.DataPropertyName = City.COL_DB_NAME; //set field's data property name in gridview

            //Field State - dropdownlist
            _inputDDLStates = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "State", City.COL_STATENAME, -1, true, false, null);
            _inputDDLStates.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateStates_LinkClicked); //add event handler for update link
            State.populateDropDownList(_inputDDLStates.Dropdownlist, false, true);                                       //populate

            //set default control to focus
            DefaultInputToFocus = _inputTxtName;
        }
예제 #5
0
        private void InputTextbox_TextChanged(object sender, TextChangedEventArgs e)
        {
            try
            {
                try
                {
                    MainDataGrid.Columns.RemoveAt(1);
                    MainDataGrid.Columns.RemoveAt(0);
                    MainDataGrid.Items.Clear();
                }
                catch (Exception)
                {
                }

                double   a      = System.Convert.ToDouble(InputTextbox.Text);
                string[] labels = new string[] { "Значение X", "Значение Y" };

                foreach (string label in labels)
                {
                    DataGridTextColumn column = new DataGridTextColumn();
                    column.Header  = label;
                    column.Binding = new Binding(label.Replace(' ', '_'));

                    MainDataGrid.Columns.Add(column);
                }

                for (int i = -20; i < 21; i++)
                {
                    if ((i >= -20) && (i <= 20))
                    {
                        string[] values = new string[] { System.Convert.ToString(i), Convert.ToString(Checker(i, a)) };

                        dynamic row = new ExpandoObject();

                        for (int ii = 0; ii < labels.Length; ii++)
                        {
                            ((IDictionary <String, Object>)row)[labels[ii].Replace(' ', '_')] = values[ii];
                        }

                        MainDataGrid.Items.Add(row);
                    }
                }
            }
            catch (OverflowException)
            {
                MessageBox.Show("Введено слишком большое число");
                InputTextbox.Focus();
            }
            catch (FormatException)
            {
                MessageBox.Show("Введено некорректное значение");
                InputTextbox.Focus();
            }
            catch (OutOfMemoryException)
            {
                MessageBox.Show("Не хватает памяти для обработки введенного числа!");
                InputTextbox.Focus();
            }
        }
예제 #6
0
        public IDInputWindow(IDInputWindowViewModel.Type type)
        {
            InitializeComponent();
            vm          = new IDInputWindowViewModel(type, this);
            DataContext = vm;

            InputTextbox.Focus();
        }
 public EditSearchTermWdw(string searchTerm, string wdwTitle, string msg)
 {
     InitializeComponent();
     InputTextbox.Focus();
     InputTextbox.Text = searchTerm ?? string.Empty;
     this.Title        = wdwTitle;
     this.TextboxDescriptionLabel.Content = msg;
     this.InputTextbox.SelectAll();
 }
예제 #8
0
 //Handles message sending from server
 public void BtnSend_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(InputTextbox.Text))
     {
         MessageBox.Show(Properties.strings.enterMessage, Properties.strings.error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         WriteToAllClients("|| " + Properties.strings.server + "@" + serverIep.Address + " >> " + InputTextbox.Text);
         InputTextbox.Clear();
     }
 }
예제 #9
0
        private void InputButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog inputFileDialog = new OpenFileDialog();

            inputFileDialog.Filter      = "Image files (*.webp)|*.webp|All files (*.*)|*.*";
            inputFileDialog.Multiselect = true;
            inputFileDialog.Title       = "Select file(s)";

            if (inputFileDialog.ShowDialog() == DialogResult.OK)
            {
                InputTextbox.Clear(); //Clear previous selection / files.
                foreach (string filePath in inputFileDialog.FileNames)
                {
                    InputTextbox.Text   += filePath + ";";
                    convertTextbox.Text += filePath.Replace(".webp", $".{outputType.SelectedItem.ToString()};");
                    //MessageBox.Show(filePath);
                }
            }
        }
예제 #10
0
        /*******************************************************************************************************/
        #region METHODS

        protected override void setupFields()
        {
            Settings.setGeneralSettings(this);

            disableFieldActive();

            //NOTES: must use inputColumns sequentially from the first one to the next. Otherwise calculation of the form width will be off

            //Field ID
            col_grid_id.DataPropertyName = Transport.COL_DB_ID;

            //Field Default
            col_grid_default.Visible = false;

            //Field Name - textbox
            _inputTxtName = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Name", Transport.COL_DB_NAME, false);
            _inputTxtName.setMaxLength(50);                         //set max length
            col_grid_name.DataPropertyName = Transport.COL_DB_NAME; //set field's data property name in gridview

            //Field Phone1 - textbox
            _inputTxtPhone1 = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Phone 1", Transport.COL_DB_PHONE1, 0, true, false, null);
            _inputTxtPhone1.setMaxLength(20); //set max length

            //Field Phone2 - textbox
            _inputTxtPhone2 = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Phone 2", Transport.COL_DB_PHONE2, 0, true, false, null);
            _inputTxtPhone2.setMaxLength(20); //set max length

            //Field Address - textbox
            _inputTxtAddress = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Address", Transport.COL_DB_ADDRESS, 100, true, false, null);
            _inputTxtAddress.setToMultiline(4);
            _inputTxtAddress.setMaxLength(100); //set max length

            //Field Notes - textbox
            _inputTxtNotes = (InputTextbox)setupInputControl(new InputTextbox(), 2, "Notes", Transport.COL_DB_NOTES, 100, true, true, null);
            _inputTxtNotes.setToMultiline(4);
            _inputTxtNotes.setMaxLength(100); //set max length

            //set default control to focus
            DefaultInputToFocus = _inputTxtName;
        }
예제 #11
0
        /*******************************************************************************************************/
        #region METHODS

        protected override void setupFields()
        {
            Settings.setGeneralSettings(this);

            //disableFieldActive();
            DoNotClearInputAfterSubmission = true;

            //NOTES: must use inputColumns sequentially from the first one to the next. Otherwise calculation of the form width will be off

            //Field ID
            col_grid_id.DataPropertyName = GordenItem.COL_DB_ID;

            //Field Default
            col_grid_default.Visible = false;

            //Field Name - textbox
            _inputTxtName = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Name", GordenItem.COL_DB_NAME, false);
            _inputTxtName.setMaxLength(50);                          //set max length
            col_grid_name.DataPropertyName = GordenItem.COL_DB_NAME; //set field's data property name in gridview

            //Field Categories - dropdownlist
            _inputDDLCategories = (InputEnumDropdownlist)setupInputControl(new InputEnumDropdownlist(), 0, "Category", GordenItem.COL_CATEGORYNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            Tools.populateDropDownList(_inputDDLCategories.Dropdownlist, typeof(GordenItemCategories));

            //Field Vendor - dropdownlist
            _inputDDLVendors = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Vendor", GordenItem.COL_VENDORNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLVendors.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateVendors_LinkClicked); //add event handler for update link
            Vendor.populateDropDownList(_inputDDLVendors.Dropdownlist, false, false);                                      //populate

            //Field Product Width - dropdownlist
            _inputDDLProductWidths = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Lebar cm", GordenItem.COL_PRODUCTWIDTHNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLProductWidths.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateProductWidths_LinkClicked); //add event handler for update link
            ProductWidth.populateDropDownList(_inputDDLProductWidths.Dropdownlist, false, false);                                      //populate

            //Field Retail Length Units - dropdownlist
            _inputDDLRetailLengthUnits = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 1, "Retail Unit", GordenItem.COL_RETAILLENGTHUNITNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLRetailLengthUnits.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateLengthUnits_LinkClicked); //add event handler for update link
            LengthUnit.populateDropDownList(_inputDDLRetailLengthUnits.Dropdownlist, false, false);                                      //populate

            //Field Buy Retail Price - textbox
            _inputTxtBuyRetailPricePerUnit = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Buy Retail", GordenItem.COL_DB_BUYRETAILPRICEPERUNIT, (int)MasterDataColumnWidth.Fit, true, false, "N2");
            _inputTxtBuyRetailPricePerUnit.setMaxLength(10); //set max length

            //Field Sell Retail Price - textbox
            _inputTxtSellRetailPricePerUnit = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Sell Retail", GordenItem.COL_DB_SELLRETAILPRICEPERUNIT, (int)MasterDataColumnWidth.Fit, true, false, "N2");
            _inputTxtSellRetailPricePerUnit.setMaxLength(10); //set max length

            //Field Bulk Length Units - dropdownlist
            _inputDDLBulkLengthUnits = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 1, "Roll Unit", GordenItem.COL_BULKLENGTHUNITNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLBulkLengthUnits.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateLengthUnits_LinkClicked); //add event handler for update link
            LengthUnit.populateDropDownList(_inputDDLBulkLengthUnits.Dropdownlist, false, false);                                      //populate

            //Field Buy Bulk Price - textbox
            _inputTxtBuyBulkPricePerUnit = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Buy Roll", GordenItem.COL_DB_BUYBULKPRICEPERUNIT, (int)MasterDataColumnWidth.Fit, true, false, "N2");
            _inputTxtBuyBulkPricePerUnit.setMaxLength(10); //set max length

            //Field Sell Bulk Price - textbox
            _inputTxtSellBulkPricePerUnit = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Sell Roll", GordenItem.COL_DB_SELLBULKPRICEPERUNIT, (int)MasterDataColumnWidth.Fit, true, false, "N2");
            _inputTxtSellBulkPricePerUnit.setMaxLength(10); //set max length

            //Field Notes - textbox
            _inputTxtNotes = (InputTextbox)setupInputControl(new InputTextbox(), 2, "Notes", GordenItem.COL_DB_NOTES, 100, true, true, null);
            _inputTxtNotes.setToMultiline(4);
            _inputTxtNotes.setMaxLength(100); //set max length

            //set default control to focus
            DefaultInputToFocus = _inputTxtName;

            if (GlobalData.UserAccount.role != Roles.Super)
            {
                _inputTxtBuyRetailPricePerUnit.Visible = false;
                gridview.Columns[GordenItem.COL_DB_BUYRETAILPRICEPERUNIT].Visible = false;
                _inputTxtBuyBulkPricePerUnit.Visible = false;
                gridview.Columns[GordenItem.COL_DB_BUYBULKPRICEPERUNIT].Visible = false;
                _inputTxtSellRetailPricePerUnit.Visible = false;
                gridview.Columns[GordenItem.COL_DB_SELLRETAILPRICEPERUNIT].Visible = false;
            }
        }
예제 #12
0
        /*******************************************************************************************************/
        #region METHODS

        protected override void setupFields()
        {
            Settings.setGeneralSettings(this);

            DoNotClearInputAfterSubmission = true;

            col_grid_name.Visible = false;
            disableFieldActive();

            btnAction1.Enabled = true;
            btnAction1.Text    = "DELETE";
            btnAction1.Width   = 100;

            btnAction2.Enabled = true;
            btnAction2.Text    = "CLEAR QTY";
            btnAction2.Width   = 100;

            btnAction3.Enabled = true;
            btnAction3.Text    = "CREATE PO";
            btnAction3.Width   = 100;

            btnAction4.Enabled = true;
            btnAction4.Text    = "HIDE COLUMNS";
            btnAction4.Width   = 120;

            btnAction5.Enabled = true;
            btnAction5.Text    = "-";
            btnAction5.Width   = 30;

            btnAction6.Enabled = true;
            btnAction6.Text    = "+";
            btnAction6.Width   = 30;

            //NOTES: must use inputColumns sequentially from the first one to the next. Otherwise calculation of the form width will be off

            //Field ID
            col_grid_id.DataPropertyName = InventoryStockLevel.COL_DB_ID;

            //Field Default
            col_grid_default.Visible = false;


            //Filter Vendor - dropdownlist
            _inputDDLVendors = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Vendor", InventoryStockLevel.COL_VENDORNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            Vendor.populateDropDownList(_inputDDLVendors.Dropdownlist, false, true);                                                  //populate
            _inputDDLVendors.UpdateLink.LinkClicked            += new LinkLabelLinkClickedEventHandler(lnkUpdateVendors_LinkClicked); //add event handler for update link
            _inputDDLVendors.Dropdownlist.SelectedIndexChanged += new System.EventHandler(this.cbVendors_SelectedIndexChanged);
            _inputDDLVendors.Dropdownlist.TextChanged          += new System.EventHandler(this.cbVendors_TextChanged);

            //Field Name/Store - dropdownlist
            _inputDDLProducts = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Product", InventoryStockLevel.COL_PRODUCTSTORENAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLProducts.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateProducts_LinkClicked); //add event handler for update link
            _inputDDLProducts.Enabled = false;

            //Field Grades - dropdownlist
            _inputDDLGrades = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Grade", InventoryStockLevel.COL_GRADE_NAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLGrades.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateGrades_LinkClicked); //add event handler for update link
            Grade.populateDropDownList(_inputDDLGrades.Dropdownlist, false, true);                                       //populate

            //Field Product Widths - dropdownlist
            _inputDDLProductWidths = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Lebar", InventoryStockLevel.COL_PRODUCT_WIDTH_NAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLGrades.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateProductWidths_LinkClicked); //add event handler for update link
            ProductWidth.populateDropDownList(_inputDDLProductWidths.Dropdownlist, false, true);                                //populate

            //Field Color - dropdownlist
            _inputDDLColors = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 1, "Color", InventoryStockLevel.COL_COLOR_NAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLColors.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateColors_LinkClicked); //add event handler for update link
            FabricColor.populateDropDownList(_inputDDLColors.Dropdownlist, false, true);                                 //populate

            //Field Length Units - dropdownlist
            _inputDDLLengthUnits = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 1, "Unit", InventoryStockLevel.COL_LENGTH_UNIT_NAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLLengthUnits.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateLengthUnits_LinkClicked); //add event handler for update link
            LengthUnit.populateDropDownList(_inputDDLLengthUnits.Dropdownlist, false, true);                                       //populate

            //Field Lot Qty - textbox
            _inputTxtOrderLotQty = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Lot Qty", InventoryStockLevel.COL_DB_ORDERLOTQTY, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputTxtOrderLotQty.setMaxLength(5); //set max length

            //Field Qty - textbox
            _inputTxtQty = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Min Qty", InventoryStockLevel.COL_DB_QTY, 40, true, false, null);
            _inputTxtQty.setMaxLength(5); //set max length

            //add columns
            col_grid_remainingQty                 = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_remainingQty", "Stock", InventoryStockLevel.COL_REMAININGSTOCKQTY, 40, true, null);        //add field to gridview
            col_grid_bookedQty                    = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_bookedQty", "Booked", InventoryStockLevel.COL_BOOKEDQTY, 50, true, null);                  //add field to gridview
            col_grid_orderQty                     = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_orderQty", "Pending", InventoryStockLevel.COL_PENDINGDELIVERYQTY, 50, true, null);         //add field to gridview
            col_grid_newQty                       = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_newQty", "Order", InventoryStockLevel.COL_NEWORDER_QTY, 40, false, null);                  //add field to gridview
            col_grid_lastOrderInventoryID         = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_referencedInventoryID", "", InventoryStockLevel.COL_LASTORDERINVENTORYID, 40, true, null); //add field to gridview
            col_grid_lastOrderInventoryID.Visible = false;
            col_grid_lastOrderTimestamp           = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_lastOrderTimestamp", "", InventoryStockLevel.COL_LASTORDERTIMESTAMP, 40, true, null);      //add field to gridview
            col_grid_lastOrderTimestamp.Visible   = false;

            //Field PO Notes - textbox
            _inputTxtPONotes = (InputTextbox)setupInputControl(new InputTextbox(), 2, "PO Notes", InventoryStockLevel.COL_DB_PONOTES, (int)MasterDataColumnWidth.Fit, false, true, null);
            _inputTxtPONotes.setToMultiline(4);
            _inputTxtPONotes.setMaxLength(50); //set max length

            //Field Notes - textbox
            _inputTxtNotes = (InputTextbox)setupInputControl(new InputTextbox(), 2, "Notes", InventoryStockLevel.COL_DB_NOTES, 100, false, true, null);
            _inputTxtNotes.setToMultiline(4);
            _inputTxtNotes.setMaxLength(100); //set max length
            gridview.Columns[InventoryStockLevel.COL_DB_NOTES].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            //set default control to focus
            DefaultInputToFocus = _inputDDLVendors;

            clearInputFields(); //clear dropdownlists

            if (GlobalData.UserAccount.role != Roles.Super)
            {
                btnAction1.Enabled = false;
                btnAction3.Enabled = false;
                gridview.Columns[InventoryStockLevel.COL_DB_PONOTES].Visible = false;
            }
        }
예제 #13
0
 public MainWindow()
 {
     InitializeComponent();
     InputTextbox.Focus();
 }
예제 #14
0
        /*******************************************************************************************************/
        #region METHODS

        protected override void setupFields()
        {
            Settings.setGeneralSettings(this);

            col_grid_name.Visible = false;
            disableFieldActive();
            //DoNotClearInputAfterSubmission = true;

            //NOTES: must use inputColumns sequentially from the first one to the next. Otherwise calculation of the form width will be off

            //Field ID
            col_grid_id.DataPropertyName = Sample.COL_DB_ID;

            //Field Default
            col_grid_default.Visible = false;

            //Field Sample No - textbox
            _inputTxtSampleNo         = (InputTextbox)setupInputControl(new InputTextbox(), 0, "No", Sample.COL_DB_SAMPLENO, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputTxtSampleNo.Enabled = false;

            //Field Storage Name - textbox
            _inputTxtStorageName = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Loc", Sample.COL_DB_STORAGENAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputTxtStorageName.setMaxLength(30); //set max length

            //Field Description - textbox
            _inputTxtDescription = (InputTextbox)setupInputControl(new InputTextbox(), 0, "Description", Sample.COL_DB_DESCRIPTION, (int)MasterDataColumnWidth.Fill, true, false, null);
            _inputTxtDescription.setToMultiline(4);
            Tools.setGridviewColumnWordwrap(gridview.Columns["Description"]);

            //Field Discontinue Date - textbox
            _inputDtpDiscontinueDate           = (InputDateTimePicker)setupInputControl(new InputDateTimePicker(true), 1, "Discontinue Date", Sample.COL_DB_DISCONTINUEDATE, (int)MasterDataColumnWidth.Fit, true, true, null);
            _inputDtpDiscontinueDate.SetFormat = "ddd, dd/MM/yy";

            //Field Price Date - textbox
            _inputDtpPriceDate           = (InputDateTimePicker)setupInputControl(new InputDateTimePicker(true), 1, "Price Date", Sample.COL_DB_PRICEDATE, (int)MasterDataColumnWidth.Fit, true, true, null);
            _inputDtpPriceDate.SetFormat = "ddd, dd/MM/yy";

            //Field Price Per Unit - textbox
            _inputTxtPricePerUnit = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Buy Price/Unit", Sample.COL_DB_PRICEPERUNIT, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputTxtPricePerUnit.setMaxLength(10); //set max length

            //Field Length Units - dropdownlist
            _inputDDLLengthUnits = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 1, "Unit", Sample.COL_LENGTHUNITNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLLengthUnits.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateLengthUnits_LinkClicked); //add event handler for update link
            LengthUnit.populateDropDownList(_inputDDLLengthUnits.Dropdownlist, false, true);                                       //populate

            //Field Sell Price Per Unit - textbox
            _inputTxtSellPricePerUnit = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Sell Price/Unit", Sample.COL_DB_SELLPRICEPERUNIT, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputTxtSellPricePerUnit.setMaxLength(10); //set max length

            //Field Vendor Name - textbox
            _inputTxtVendorName = (InputTextbox)setupInputControl(new InputTextbox(), 2, "Vendor Name", Sample.COL_DB_VENDORNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputTxtVendorName.setMaxLength(30); //set max length
            gridview.Columns[2].Visible = false;

            //Field Vendor Info - textbox
            _inputTxtVendorInfo = (InputTextbox)setupInputControl(new InputTextbox(), 2, "Vendor Info", Sample.COL_DB_VENDORINFO, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputTxtVendorInfo.setToMultiline(4);

            //Field Notes - textbox
            _inputTxtNotes = (InputTextbox)setupInputControl(new InputTextbox(), 2, "Notes", Sample.COL_DB_NOTES, 100, false, true, null);
            _inputTxtNotes.setToMultiline(4);
            _inputTxtNotes.setMaxLength(300); //set max length
            Tools.setGridviewColumnWordwrap(gridview.Columns["Notes"]);

            //set default control to focus
            DefaultInputToFocus = _inputTxtStorageName;

            clearInputFields(); //clear dropdownlists

            if (GlobalData.UserAccount.role != Roles.Super)
            {
                _inputDtpPriceDate.Visible    = false;
                _inputTxtPricePerUnit.Visible = false;
                _inputTxtNotes.Visible        = false;
                _inputTxtVendorInfo.Visible   = false;
                gridview.Columns[Sample.COL_DB_PRICEDATE].Visible    = false;
                gridview.Columns[Sample.COL_DB_PRICEPERUNIT].Visible = false;
                gridview.Columns[Sample.COL_DB_NOTES].Visible        = false;
                gridview.Columns[Sample.COL_DB_VENDORINFO].Visible   = false;
            }
        }