private void button1_Click(object sender, EventArgs e) { ushort iSerialNo; if (!ushort.TryParse(txtSerialNo.Text, out iSerialNo)) { MessageBox.Show(this, "Serial No must be numeric!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (string.IsNullOrEmpty(cbxProduct.Text)) { MessageBox.Show(this, "Please select the Product Code", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } HRPlus.ProductKey key = new HRPlus.ProductKey(); key.SerialNo = iSerialNo; key.ProductType = (HRPlus.ProductKey.ProductLicenseType)Enum.Parse(typeof(HRPlus.ProductKey.ProductLicenseType), cbxProduct.Text); key.NumOfCompanies = Convert.ToUInt16(numCompany.Value); key.NumOfUsers = Convert.ToUInt16(numUser.Value); key.IsAttendance = chkModuleAttendance.Checked; key.IsESS = chkModuleESS.Checked; key.IsLeaveManagement = chkModuleLeave.Checked; key.IsPayroll = chkModulePayroll.Checked; key.IsTaxation = chkModuleTaxation.Checked; key.IsCostCenter = chkModuleCostCenter.Checked; key.IsTraining = chkModuleTraining.Checked; txtProductKey.Text = key.GetProductKey(); return; }
private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cbxProduct.Text)) { MessageBox.Show(this, "Please select the Product Code", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } HRPlus.ProductKey key = new HRPlus.ProductKey(); //key.ProductType = (HRPlus.ProductKey.ProductLicenseType)Enum.Parse(typeof(HRPlus.ProductKey.ProductLicenseType), cbxProduct.Text); key.LoadProductKey(txtProductKey.Text); cbxProduct.Text = key.ProductType.ToString(); txtSerialNo.Text = key.SerialNo.ToString(); numCompany.Value = key.NumOfCompanies; numUser.Value = key.NumOfUsers; chkModuleAttendance.Checked = key.IsAttendance; chkModuleESS.Checked = key.IsESS; chkModuleLeave.Checked = key.IsLeaveManagement; chkModulePayroll.Checked = key.IsPayroll; chkModuleTaxation.Checked = key.IsTaxation; chkModuleCostCenter.Checked = key.IsCostCenter; chkModuleTraining.Checked = key.IsTraining; return; }