public void display_product_information() { txtItemName.Text = item_name; txtDescription.Text = description; txtBrand.Text = brand; txtModel.Text = model; txtSerialNumber.Text = serial_number; txtPropertyNumber.Text = property_number; dtpDateAcquired.Value = acquired_at; dtpDateAcquired.MaxDate = DateTime.Today; if (inventory_type == "Hardware") { chkCapacity.Enabled = true; if (capacity_id == 0) { chkCapacity.Checked = false; } else { chkCapacity.Checked = true; txtCapacity.Text = capacity.ToString(); cbCapacity.SelectedIndex = cbCapacity.FindStringExact(capacity_size); txtCapacity.Enabled = true; cbCapacity.Enabled = true; } rdbCondemned.Visible = true; rdbWorking.Text = "Working"; rdbDefective.Text = "Defective"; rdbWorking.Enabled = true; rdbDefective.Enabled = true; foreach (Control control in panel1.Controls) { if (control.GetType() == typeof(Guna.UI2.WinForms.Guna2RadioButton)) { Guna.UI2.WinForms.Guna2RadioButton rdb = control as Guna.UI2.WinForms.Guna2RadioButton; rdb.Checked = (rdb.Text == status) ? true : false; } } lblDateExpiry.Visible = false; dtpDateExpiry.Visible = false; } else if (inventory_type == "Software") { chkCapacity.Enabled = false; chkCapacity.Checked = false; cbCapacity.Enabled = false; txtCapacity.Enabled = false; rdbCondemned.Visible = false; rdbWorking.Text = "Subscribed"; rdbDefective.Text = "Expired"; rdbWorking.Enabled = false; rdbDefective.Enabled = false; foreach (Control control in panel1.Controls) { if (control.GetType() == typeof(Guna.UI2.WinForms.Guna2RadioButton)) { Guna.UI2.WinForms.Guna2RadioButton rdb = control as Guna.UI2.WinForms.Guna2RadioButton; rdb.Checked = (rdb.Text == status) ? true : false; } } lblDateExpiry.Visible = true; dtpDateExpiry.Visible = true; dtpDateExpiry.Value = expire_at; } }
private void rdoWuxiaWorldSite_CheckedChanged(object sender, EventArgs e) { txtSearch.ResetText(); Guna.UI2.WinForms.Guna2RadioButton rdo = (Guna.UI2.WinForms.Guna2RadioButton)sender; ChangeSource(Convert.ToInt32(rdo.Tag.ToString())); }
private void update_product_information() { if (string.IsNullOrEmpty(txtItemName.Text)) { MessageBox.Show("Please indicate the item name.", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Error); txtItemName.Text = ""; txtItemName.Focus(); } else { if (string.IsNullOrEmpty(txtDescription.Text)) { MessageBox.Show("Please indicate the description of the item.", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDescription.Text = ""; txtDescription.Focus(); } else { if (string.IsNullOrEmpty(txtBrand.Text)) { MessageBox.Show("Please indicate the brand of the item.", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Error); txtBrand.Text = ""; txtBrand.Focus(); } else { if (string.IsNullOrEmpty(txtModel.Text)) { MessageBox.Show("Please indicate the model of the item.", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Error); txtModel.Text = ""; txtModel.Focus(); } else { if (string.IsNullOrEmpty(txtSerialNumber.Text)) { MessageBox.Show("Please indicate the serial number of the item.", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSerialNumber.Text = ""; txtSerialNumber.Focus(); } else { if (chkCapacity.Checked) { if (string.IsNullOrEmpty(cbCapacity.Text)) { MessageBox.Show("Please indicate the capacity of the item.", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSerialNumber.Text = ""; txtSerialNumber.Focus(); } else { if (cbCapacity.Text == "--Select--" || cbCapacity.SelectedIndex == 0 || cbCapacity.SelectedIndex == -1) { MessageBox.Show("Please indicate the capacity size of the item.", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Error); cbCapacity.SelectedIndex = 0; cbCapacity.Focus(); } } } if (string.IsNullOrEmpty(txtPropertyNumber.Text)) { MessageBox.Show("Please indicate the propery number of the item.", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPropertyNumber.Text = ""; txtPropertyNumber.Focus(); } else { inv_prod_info = new classes.Inventory_ProductInformation(); inv_prod_info.inventory_id = inventory_id; inv_prod_info.inventory_type = inventory_type; inv_prod_info.item_name = txtItemName.Text; inv_prod_info.description = txtDescription.Text; inv_prod_info.brand = txtBrand.Text; inv_prod_info.model = txtModel.Text; inv_prod_info.serial_number = txtSerialNumber.Text; inv_prod_info.hasCapacity = (chkCapacity.Checked) ? true : false; inv_prod_info.capacity_id = capacity_id; inv_prod_info.capacity = Convert.ToInt32(txtCapacity.Text); inv_prod_info.capacity_size = capacity_size; inv_prod_info.property_number = txtPropertyNumber.Text; foreach (Control control in panel1.Controls) { if (control.GetType() == typeof(Guna.UI2.WinForms.Guna2RadioButton)) { Guna.UI2.WinForms.Guna2RadioButton rdb = control as Guna.UI2.WinForms.Guna2RadioButton; if (rdb.Checked) { inv_prod_info.status = rdb.Text; } } } inv_prod_info.acquired_at = dtpDateAcquired.Value; inv_prod_info.expire_at = dtpDateExpiry.Value; if (inv_prod_info.update_product_information()) { MessageBox.Show("Item has been updated!", "Update Product Information", MessageBoxButtons.OK, MessageBoxIcon.Question); frmViewItem.instance.display_selected_inventory(inventory_id); this.Close(); } else { return; } } } } } } } }
private void btnNext_Click(object sender, EventArgs e) { if (txtPropertyNumber.Text == "Property Number" || string.IsNullOrEmpty(txtPropertyNumber.Text)) { MessageBox.Show("Please indicate the propery number of the item.", "Add Item", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPropertyNumber.Text = ""; txtPropertyNumber.Focus(); } else { if (cbDepartment.Text == "--Select department--" || cbDepartment.SelectedIndex == 0 || cbDepartment.SelectedIndex == -1) { MessageBox.Show("Please select the department where this item is located.", "Add Item", MessageBoxButtons.OK, MessageBoxIcon.Error); cbDepartment.Text = ""; cbDepartment.Focus(); } else { ucPreview.instance.inventory_type = inventory_type; ucPreview.instance.category_id = category_id; ucPreview.instance.category_name = category_name; ucPreview.instance.supplier_id = supplier_id; ucPreview.instance.supplier_name = supplier_name; ucPreview.instance.item_name = item_name; ucPreview.instance.description = description; ucPreview.instance.brand = brand; ucPreview.instance.model = model; ucPreview.instance.serial_number = serial_number; ucPreview.instance.hasCapacity = hasCapacity; ucPreview.instance.capacity = capacity; ucPreview.instance.capacity_size = capacity_size; ucPreview.instance.quantity = quantity; ucPreview.instance.unit_of_measurement = unit_of_measurement; ucPreview.instance.property_number = txtPropertyNumber.Text; ucPreview.instance.department_id = Convert.ToInt32(cbDepartment.SelectedValue); ucPreview.instance.department_name = cbDepartment.Text; foreach (Control control in gbStatus.Controls) { if (control.GetType() == typeof(Guna.UI2.WinForms.Guna2RadioButton)) { Guna.UI2.WinForms.Guna2RadioButton rdb = control as Guna.UI2.WinForms.Guna2RadioButton; if (rdb.Checked) { ucPreview.instance.status = rdb.Text; } } } ucPreview.instance.date_acquired = dtpDateAcquired.Value; ucPreview.instance.date_expired = dtpDateExpiry.Value; ucPreview.instance.display_preview(); ((Form)this.TopLevelControl).Controls["panelContainer"].Controls["ucOtherProductInformation1"].Visible = false; ((Form)this.TopLevelControl).Controls["panelContainer"].Controls["ucPreview1"].Visible = true; } } }