private void Delete() { if (strMenuOption == "User...") { int Row = fUser.gvwUser.FocusedRowHandle; if (Row >= 0) { int intUserID = Convert.ToInt32(fUser.gvwUser.GetRowCellValue(fUser.gvwUser.FocusedRowHandle, fUser.gcolUserID).ToString()); int intContactID = Convert.ToInt32(fUser.gvwUser.GetRowCellValue(fUser.gvwUser.FocusedRowHandle, fUser.gcolContactID).ToString()); if (Message.MsgDelete()) { User objUser = new User(); objUser.UserID = intUserID; objUser.ContactID = intContactID; if (!objUser.DeleteData()) { Message.MsgWarning("User cannot be deleted"); fUser.grdUser.Focus(); return; } fUser.LoadUser(); fUser.grdUser.Focus(); fUser.gvwUser.FocusedRowHandle = Row - 1; if (fUser.gvwUser.RowCount > 0) { if (fUser.gvwUser.FocusedRowHandle < 0) { fUser.gvwUser.FocusedRowHandle = 0; } } } } } else if ((strMenuOption == "Contact...") || (strMenuOption == "Instructor...") || (strMenuOption == "Client...")) { string strtemp = ""; int Row = fContact.gvwContact.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fContact.gvwContact.GetRowCellValue(fContact.gvwContact.FocusedRowHandle, fContact.gcolContactID).ToString()); strtemp = strMenuOption; strtemp = strtemp.Replace("...", ""); if (Message.MsgDelete()) { Contact objContact = new Contact(); objContact.ContactID = intID; //objContact.DeleteData(); if (!objContact.DeleteData()) { Message.MsgWarning(strtemp + " cannot be deleted"); fContact.grdContact.Focus(); return; } fContact.LoadContact(strtemp); fContact.grdContact.Focus(); fContact.gvwContact.FocusedRowHandle = Row - 1; if (fContact.gvwContact.RowCount > 0) { if (fContact.gvwContact.FocusedRowHandle < 0) { fContact.gvwContact.FocusedRowHandle = 0; } } } } } else if (strMenuOption == "Department...") { int Row = fDept.gvwDept.FocusedRowHandle; if (Row >= 0) { int intDeptID = Convert.ToInt32(fDept.gvwDept.GetRowCellValue(fDept.gvwDept.FocusedRowHandle, fDept.gColDeptID).ToString()); int intContactID = Convert.ToInt32(fDept.gvwDept.GetRowCellValue(fDept.gvwDept.FocusedRowHandle, fDept.gColContactID).ToString()); if (Message.MsgDelete()) { Department objDept = new Department(); objDept.DeptID = intDeptID; objDept.ContactID = intContactID; //objDept.DeleteData(); if (!objDept.DeleteData()) { Message.MsgWarning("Department cannot be deleted"); fDept.grdDept.Focus(); return; } fDept.LoadDepartment(); fDept.grdDept.Focus(); fDept.gvwDept.FocusedRowHandle = Row - 1; if (fDept.gvwDept.RowCount > 0) { if (fDept.gvwDept.FocusedRowHandle < 0) { fDept.gvwDept.FocusedRowHandle = 0; } } } } } else if (strMenuOption == "Program...") { int Row = fProgram.gvwProgram.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fProgram.gvwProgram.GetRowCellValue(fProgram.gvwProgram.FocusedRowHandle, fProgram.gcolProgID).ToString()); if (Message.MsgDelete()) { Program objProg = new Program(); objProg.ProgramID = intID; //objProg.DeleteData(); if (!objProg.DeleteData()) { Message.MsgWarning("Program cannot be deleted"); fProgram.grdProgram.Focus(); return; } fProgram.LoadProgram(); fProgram.grdProgram.Focus(); fProgram.gvwProgram.FocusedRowHandle = Row - 1; if (fProgram.gvwProgram.RowCount > 0) { if (fProgram.gvwProgram.FocusedRowHandle < 0) { fProgram.gvwProgram.FocusedRowHandle = 0; } } } } } else if (strMenuOption == "Class...") { int Row = fCourse.gvwCourse.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fCourse.gvwCourse.GetRowCellValue(fCourse.gvwCourse.FocusedRowHandle, fCourse.gcolCourseId).ToString()); if (Message.MsgDelete()) { Course objCourse = new Course(); objCourse.CourseId = intID; //objCourse.DeleteData(); if (!objCourse.DeleteData()) { Message.MsgWarning("Class cannot be deleted"); fCourse.grdCourse.Focus(); return; } fCourse.LoadCourse(); fCourse.grdCourse.Focus(); fCourse.gvwCourse.FocusedRowHandle = Row - 1; if (fCourse.gvwCourse.RowCount > 0) { if (fCourse.gvwCourse.FocusedRowHandle < 0) { fCourse.gvwCourse.FocusedRowHandle = 0; } } } } } else if (strMenuOption == "Event...") { int Row = fEvt.gvwEvent.FocusedRowHandle; bool IsRecur = false; if (Row >= 0) { int intID = Convert.ToInt32(fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.gcolEventID).ToString()); int intCalID = Convert.ToInt32(fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.colCalendarEventID).ToString()); int CourseId = Convert.ToInt32(fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.gcolCourseId).ToString()); if (fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.gcolIsRecur).ToString() != "") IsRecur = true; if (IsRecur) { frmDeleteEvents frmDelEvt = new frmDeleteEvents(intID, intCalID); if (frmDelEvt.ShowDialog() == DialogResult.OK) { fEvt.LoadEvent(); fEvt.grdEvent.Focus(); fEvt.gvwEvent.FocusedRowHandle = Row - 1; if (fEvt.gvwEvent.RowCount > 0) { if (fEvt.gvwEvent.FocusedRowHandle < 0) fEvt.gvwEvent.FocusedRowHandle = 0; } } frmDelEvt.Close(); frmDelEvt.Dispose(); frmDelEvt = null; } else { if (Message.MsgDelete()) { string strMess = ""; Events evt = new Events(); evt.EventID = intID; strMess = evt.CheckClassEvent(); if (strMess == "") strMess = evt.CheckProgramEvent(); if (strMess != "") { Message.MsgWarning("This Event is linked with" + strMess + ".\n\nEvent cannot be deleted."); return; } //evt.DeleteData(true); if (evt.EventType=="Extra Class") evt.DeleteSingleCalendarEvent(); else evt.DeleteTestEvent("Course", CourseId); fEvt.LoadEvent(); fEvt.grdEvent.Focus(); fEvt.gvwEvent.FocusedRowHandle = Row - 1; if (fEvt.gvwEvent.RowCount > 0) if (fEvt.gvwEvent.FocusedRowHandle < 0) fEvt.gvwEvent.FocusedRowHandle = 0; } } } } else if (strMenuOption == "Calendar...") { if (fCalendar.schedulerControl1.SelectedAppointments.Count > 0) { Appointment apt = fCalendar.schedulerControl1.SelectedAppointments[0]; bool IsRecur = false; controller = new AppointmentFormController(fCalendar.schedulerControl1, apt); int intCalID = Convert.ToInt32(controller.LabelId.ToString()); int intEventID = Common.GetID("select EventID from CalendarEvent where CalendarEventID=" + intCalID.ToString()); string strRecurrenceText = Common.GetString("select RecurrenceText from Event where EventID=" + intEventID.ToString()); if (strRecurrenceText != "") IsRecur = true; if (IsRecur) { frmDeleteEvents frmDelEvt = new frmDeleteEvents(intEventID, intCalID); if (frmDelEvt.ShowDialog() == DialogResult.OK) { fCalendar.LoadCalendar(); } frmDelEvt.Close(); frmDelEvt.Dispose(); frmDelEvt = null; } else { if (Message.MsgDelete()) { string strMess = ""; Events evt = new Events(); evt.EventID = intEventID; strMess = evt.CheckClassEvent(); if (strMess == "") strMess = evt.CheckProgramEvent(); if (strMess != "") { Message.MsgWarning("This Event is linked with" + strMess + ".\n\nEvent cannot be deleted."); return; } evt.DeleteData(true); fCalendar.LoadCalendar(); } } } } }
private void btnSave_Click(object sender, EventArgs e) { //User Table if (txtUserName.Text == "") { tbcUser.SelectedIndex = 0; Message.MsgInformation("Enter User Name"); txtUserName.Focus(); return; } if (txtPwd.Text == "") { tbcUser.SelectedIndex = 0; Message.MsgInformation("Enter Password"); txtPwd.Focus(); return; } if (cmbType.Text == "") { tbcUser.SelectedIndex = 0; Message.MsgInformation("Enter Level"); cmbType.Focus(); return; } User objUser = null; objUser = new User(); if ((_mode == "Add") || (_mode=="AddClone") || (_mode == "")) { objUser.Name = txtUserName.Text.Trim(); if (objUser.UserExists()) { Message.MsgInformation("Duplicate User Name not allowed"); tbcUser.SelectedIndex = 0; txtUserName.Focus(); return; } } else { if (txtUserName.Tag.ToString() != txtUserName.Text.Trim()) { objUser.Name = txtUserName.Text.Trim(); if (objUser.UserExists()) { Message.MsgInformation("Duplicate User Name not allowed"); tbcUser.SelectedIndex = 0; txtUserName.Focus(); return; } } } //Contacts Table if (txtFName.Text == "") { tbcUser.SelectedIndex = 1; Message.MsgInformation("Enter First Name"); txtFName.Focus(); return; } if (txtLName.Text == "") { tbcUser.SelectedIndex = 1; Message.MsgInformation("Enter Last Name"); txtLName.Focus(); return; } bool boolSuccess; Contact objContact = null; objContact = new Contact(); objContact.ContactID = 0; objContact.ContactType = 0; //for User objContact.LastName = txtLName.Text; objContact.LastNamePhonetic = txtLNamePhonetic.Text; objContact.LastNameRomaji = txtLNameRomaji.Text; objContact.FirstName = txtFName.Text; objContact.FirstNamePhonetic = txtFNamePhonetic.Text; objContact.FirstNameRomaji = txtFNameRomaji.Text; objContact.CompanyName = txtCompName.Text; objContact.CompanyNamePhonetic = txtCompPhonetic.Text; objContact.CompanyNameRomaji = txtCompRomaji.Text; objContact.TitleForName = cmbTitle.Text; objContact.TitleForJob = txtTitleJob.Text; objContact.Street1 = txtStreet1.Text; objContact.Street2 = txtStreet2.Text; objContact.Street3 = txtStreet3.Text; objContact.City = txtCity.Text; objContact.State = txtState.Text; objContact.PostalCode = txtPost.Text; objContact.Country = txtCountry.Text; //objContact.ContactType=cmbType.SelectedIndex; objContact.BlockCode = cmbBlock.Text; objContact.Email1 = txtEmail1.Text; objContact.Email2 = txtEmail2.Text; objContact.Phone1 = txtPhone1.Text; objContact.Phone2 = txtPhone2.Text; objContact.PhoneMobile1 = txtMobile1.Text; objContact.PhoneMobile2 = txtMobile2.Text; objContact.PhoneBusiness1 = txtPhone3.Text; objContact.PhoneBusiness2 = txtPhone4.Text; objContact.PhoneFax1 = txtFax1.Text; objContact.PhoneFax2 = txtFax2.Text; objContact.PhoneOther = txtPhoneOther.Text; objContact.Url = txtUrl.Text; objContact.TimeStatus = cmbEmpStatus.Text; if (dtDOB.Checked) objContact.DateBirth = dtDOB.Value; else objContact.DateBirth = Convert.ToDateTime(null); if (dtJoined.Checked) objContact.DateJoined = dtJoined.Value; else objContact.DateJoined = Convert.ToDateTime(null); if (dtEnded.Checked) objContact.DateEnded = dtEnded.Value; else objContact.DateEnded = Convert.ToDateTime(null); //objContact.TimeStatus=.Text; objContact.Nationality = txtNationality.Text; objContact.Married = cmbMarried.SelectedIndex; objContact.NumberDependents = Convert.ToInt16(txtNoDependent.Text); objContact.VisaStatus = txtVisaStatus.Text; if (dtVisaTo.Checked) objContact.VisaFromDate = dtVisaFrom.Value; else objContact.VisaFromDate = Convert.ToDateTime(null); if (dtVisaTo.Checked) objContact.VisaUntilDate = dtVisaTo.Value; else objContact.VisaUntilDate = Convert.ToDateTime(null); objContact.ClosestStation1 = txtClosestSt1.Text; objContact.ClosestLine1 = txtClosestLine1.Text; objContact.MinutesToStation1 = Convert.ToInt16(txtMintSt1.Text); objContact.ClosestStation2 = txtClosestSt2.Text; objContact.ClosestLine2 = txtClosestLine2.Text; objContact.MinutesToStation2 = Convert.ToInt16(txtMintSt2.Text); objContact.ContactStatus = cmbStatus.SelectedIndex; objContact.AccountRepLastName = ""; objContact.AccountRepLastNamePhonetic = ""; objContact.AccountRepLastNameRomaji = ""; objContact.AccountRepFirstName = ""; objContact.AccountRepFirstNamePhonetic = ""; objContact.AccountRepFirstNameRomaji = ""; objContact.ContactID = _contactid; /*if(objContact.Exists(txtFName.Text, txtLName.Text, 0)) { Scheduler.BusinessLayer.Message.MsgInformation("Duplicate Contact Name not allowed"); txtLName.Focus(); return; }*/ if ((_mode == "Add") || (_mode=="AddClone") || (_mode == "")) boolSuccess = objContact.InsertData(); else { objContact.ContactID = _contactid; boolSuccess = objContact.UpdateData(); } if (!boolSuccess) { if (_mode == "Add") Message.ShowException("Adding Contact record.", objContact.Message); else if (_mode=="AddClone") Message.ShowException("Cloning Contact record.", objContact.Message); else Message.ShowException("Updating Contact record.", objContact.Message); return; } //get the ContactID to insert it into User Table _contactid = objContact.ContactID; //User objUser.UserID = 0; objUser.ContactID = _contactid; objUser.Name = txtUserName.Text.Trim(); objUser.Pwd = txtPwd.Text.Trim(); //pass the encrypted password objUser.Pwd = SimpleHash.Encrypt(txtPwd.Text); objUser.TypeID = cmbType.SelectedIndex; objUser.StatusID = cmbStatus.SelectedIndex; if ((_mode == "Add") || (_mode == "AddClone") || (_mode == "")) { if (objUser.Exists()) { Message.MsgInformation("Duplicate User Name not allowed"); txtUserName.Focus(); return; } boolSuccess = objUser.InsertData(); } else { objUser.UserID = _userid; objUser.PasswordChanged = false; if (txtPwd.Text != txtPwd.Tag.ToString()) objUser.PasswordChanged = true; boolSuccess = objUser.UpdateData(); } if (!boolSuccess) { if (_mode == "Add" || _mode == "AddClone") Message.ShowException("Error occured while inserting user record.", objUser.Message); else Message.ShowException("Error occured while updating user record.", objUser.Message); return; } DialogResult = DialogResult.OK; Close(); }
public void LoadData() { if (_mode == "Edit" || _mode=="AddClone") { if (_mode == "AddClone") { btnDelete.Enabled = false; Text = "Adding User Clone..."; } else { btnDelete.Enabled = true; Text = "Editing User..."; } User objUser = new User(); objUser.UserID = _userid; objUser.LoadData(); if (_mode == "Edit") { txtUserName.Text = objUser.Name; txtUserName.Tag = objUser.Name; txtPwd.Text = objUser.Pwd; txtPwd.Tag = objUser.Pwd; } else { txtUserName.Text = "Copy of " + objUser.Name; } cmbType.SelectedIndex = objUser.TypeID; //cmbStatus.SelectedIndex = objUser.StatusID; //Getting Contact details from Contact Table Contact objContact = new Contact(); objContact.ContactID = _contactid; objContact.LoadData("User"); foreach (DataRow dr in objContact.dtblContacts.Rows) { //cmbType.SelectedIndex = Convert.ToInt16(dr["ContactType"].ToString()); txtLName.Text = dr["LastName"].ToString(); txtLNamePhonetic.Text = dr["LastNamePhonetic"].ToString(); txtLNameRomaji.Text = dr["LastNameRomaji"].ToString(); txtFName.Text = dr["FirstName"].ToString(); txtFNamePhonetic.Text = dr["FirstNamePhonetic"].ToString(); txtFNameRomaji.Text = dr["FirstNameRomaji"].ToString(); txtCompName.Text = dr["CompanyName"].ToString(); txtCompPhonetic.Text = dr["CompanyNamePhonetic"].ToString(); txtCompRomaji.Text = dr["CompanyNameRomaji"].ToString(); cmbTitle.Text = dr["TitleForname"].ToString(); txtTitleJob.Text = dr["TitleForJob"].ToString(); if (dr["BlockCode"].ToString().Trim() != "") cmbBlock.Text = dr["BlockCode"].ToString(); txtStreet1.Text = dr["Street1"].ToString(); txtStreet2.Text = dr["Street2"].ToString(); txtStreet3.Text = dr["Street3"].ToString(); txtCity.Text = dr["City"].ToString(); txtState.Text = dr["State"].ToString(); txtPost.Text = dr["PostalCode"].ToString(); txtCountry.Text = dr["Country"].ToString(); txtEmail1.Text = dr["Email1"].ToString(); txtEmail2.Text = dr["EMail2"].ToString(); txtPhone1.Text = dr["Phone1"].ToString(); txtPhone2.Text = dr["Phone2"].ToString(); txtMobile1.Text = dr["PhoneMobile1"].ToString(); txtMobile2.Text = dr["PhoneMobile2"].ToString(); txtPhone3.Text = dr["PhoneBusiness1"].ToString(); txtPhone4.Text = dr["PhoneBusiness2"].ToString(); txtFax1.Text = dr["PhoneFax1"].ToString(); txtFax2.Text = dr["PhoneFax2"].ToString(); txtPhoneOther.Text = dr["PhoneOther"].ToString(); txtUrl.Text = dr["url"].ToString(); if (dr["DateBirth"] != DBNull.Value) dtDOB.Value = Convert.ToDateTime(dr["DateBirth"].ToString()); else dtDOB.Checked = false; if (dr["DateJoined"] != DBNull.Value) dtJoined.Value = Convert.ToDateTime(dr["DateJoined"].ToString()); else dtJoined.Checked = false; if (dr["DateEnded"] != DBNull.Value) dtEnded.Value = Convert.ToDateTime(dr["DateEnded"].ToString()); else dtEnded.Checked = false; txtNationality.Text = dr["Nationality"].ToString(); cmbMarried.SelectedIndex = Convert.ToInt16(dr["Married"].ToString()); txtNoDependent.Text = dr["NumberDependents"].ToString(); txtVisaStatus.Text = dr["VisaStatus"].ToString(); if (dr["VisaFromDate"] != DBNull.Value) dtVisaFrom.Value = Convert.ToDateTime(dr["VisaFromDate"].ToString()); else dtVisaFrom.Checked = false; if (dr["VisaUntilDate"] != DBNull.Value) dtVisaTo.Value = Convert.ToDateTime(dr["VisaUntilDate"].ToString()); else dtVisaTo.Checked = false; txtMintSt1.Text = dr["MinutesToStation1"].ToString(); txtClosestSt1.Text = dr["ClosestStation1"].ToString(); txtClosestLine1.Text = dr["Closestline1"].ToString(); txtMintSt2.Text = dr["MinutesToStation2"].ToString(); txtClosestSt2.Text = dr["ClosestStation2"].ToString(); txtClosestLine2.Text = dr["Closestline2"].ToString(); cmbEmpStatus.Text = dr["TimeStatus"].ToString(); cmbStatus.Text = dr["Status"].ToString(); } } else { btnDelete.Enabled = false; Text = "Adding User..."; cmbType.SelectedIndex = 0; cmbStatus.SelectedIndex = 0; txtUserName.Text = String.Empty; txtUserName.Tag = String.Empty; txtPwd.Text = String.Empty; txtPwd.Tag = String.Empty; txtLName.Text = String.Empty; txtLNamePhonetic.Text = String.Empty; txtLNameRomaji.Text = String.Empty; txtFName.Text = String.Empty; txtFNamePhonetic.Text = String.Empty; txtFNameRomaji.Text = String.Empty; txtCompName.Text = String.Empty; txtCompPhonetic.Text = String.Empty; txtCompRomaji.Text = String.Empty; cmbTitle.Text = String.Empty; txtTitleJob.Text = String.Empty; cmbBlock.Text = String.Empty; txtStreet1.Text = String.Empty; txtStreet2.Text = String.Empty; txtStreet3.Text = String.Empty; txtCity.Text = String.Empty; txtState.Text = String.Empty; txtPost.Text = String.Empty; txtCountry.Text = String.Empty; txtEmail1.Text = String.Empty; txtEmail2.Text = String.Empty; txtPhone1.Text = String.Empty; txtPhone2.Text = String.Empty; txtMobile1.Text = String.Empty; txtMobile2.Text = String.Empty; txtPhone3.Text = String.Empty; txtPhone4.Text = String.Empty; txtFax1.Text = String.Empty; txtFax2.Text = String.Empty; txtPhoneOther.Text = String.Empty; txtUrl.Text = String.Empty; dtDOB.Checked = false; dtJoined.Checked = false; dtEnded.Checked = false; txtNationality.Text = String.Empty; cmbMarried.SelectedIndex = 0; txtNoDependent.Text = String.Empty; txtVisaStatus.Text = String.Empty; dtVisaFrom.Checked = false; dtVisaTo.Checked = false; txtMintSt1.Text = String.Empty; txtClosestSt1.Text = String.Empty; txtClosestLine1.Text = String.Empty; txtMintSt2.Text = String.Empty; txtClosestSt2.Text = String.Empty; txtClosestLine2.Text = String.Empty; cmbEmpStatus.Text = String.Empty; cmbStatus.Text = String.Empty; } }
private void btnDelete_Click(object sender, EventArgs e) { if (Message.MsgDelete()) { User objUser = new User(); objUser.UserID = _userid; objUser.ContactID = _contactid; if (!objUser.DeleteData()) { Message.MsgWarning("User cannot be deleted"); return; } else { deleted = true; btnDelete.Enabled = false; Text = "Adding User..."; _mode = "Add"; _contactid = 0; foreach (Control c in tbpContact.Controls) { if (c.GetType().ToString() == "System.Windows.Forms.TextBox") { if (c.Tag == null) c.Text = ""; else if (c.Tag.ToString() == "N") c.Text = "0"; } if (c.GetType().ToString() == "System.Windows.Forms.LinkLabel") c.Text = "None"; if (c.GetType().ToString() == "System.Windows.Forms.ComboBox") c.Text = ""; if (c.GetType().ToString() == "System.Windows.Forms.DateTimePicker") { DateTimePicker dp = c as DateTimePicker; dp.Value = DateTime.Now; } } foreach (Control c in tbpLogin.Controls) { if (c.GetType().ToString() == "System.Windows.Forms.TextBox") { if (c.Tag == null) c.Text = ""; else if (c.Tag.ToString() == "N") c.Text = "0"; } if (c.GetType().ToString() == "System.Windows.Forms.ComboBox") c.Text = ""; } foreach (Control c in tbpPersonal.Controls) { if (c.GetType().ToString() == "System.Windows.Forms.TextBox") { if (c.Tag == null) c.Text = ""; else if (c.Tag.ToString() == "N") c.Text = "0"; } if (c.GetType().ToString() == "System.Windows.Forms.ComboBox") c.Text = ""; if (c.GetType().ToString() == "System.Windows.Forms.DateTimePicker") { DateTimePicker dp = c as DateTimePicker; dp.Value = DateTime.Now; } } DialogResult = DialogResult.OK; Close(); } } }
private void btnLogin_Click(object sender, System.EventArgs e) { if((txtUser.Text.ToUpper()=="ADMIN") && (txtPwd.Text.ToUpper()=="SUPPORT")) { Common.LogonID=0; Common.LogonType=1; Common.LogonDate=DateTime.Now; this.DialogResult = DialogResult.OK; return; } intTry++; User objUser=new User(); objUser.Name=txtUser.Text; objUser.Pwd = txtPwd.Text; //pass the encrypted password //objUser.Pwd = MD5Hashing.Encrypt(txtPwd.Text); if(objUser.Exists()) { Common.LogonID = objUser.UserID; Common.LogonUser = txtUser.Text.Trim(); Common.LogonDate = DateTime.Now; Common.LogonType = objUser.TypeID; if(objUser.StatusID==1) { Scheduler.BusinessLayer.Message.MsgInformation("User is Inactive, cannot open..."); txtUser.Focus(); } else { this.DialogResult = DialogResult.OK; } } else { if(intTry<3) { Scheduler.BusinessLayer.Message.MsgInformation("Invalid User or Password"); txtUser.Focus(); } else { Scheduler.BusinessLayer.Message.MsgInformation("Exiting Application"); this.DialogResult = DialogResult.Cancel; } } }