protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0; try { Ds = Obj_TermsConditionMaster.ChkDuplicate(TxtTitle.Text.Trim(), out StrError); if (Ds.Tables[0].Rows.Count > 0) { obj_Comman.ShowPopUpMsg("Title Name Already Exist..!", this.Page); TxtTitle.Focus(); } else { Entity_TermsConditionMaster.Title = TxtTitle.Text; Entity_TermsConditionMaster.TermsConditions = TxtDescription.Text; Entity_TermsConditionMaster.UserId = Convert.ToInt32(Session["UserId"]); Entity_TermsConditionMaster.LoginDate = DateTime.Now; InsertRow = Obj_TermsConditionMaster.InsertRecord(ref Entity_TermsConditionMaster, out StrError); if (InsertRow > 0) { obj_Comman.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeEmptyForm(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public MainWindow() { InitializeComponent(); TxtTitle.Focus(); _noteServices = new NoteServices(); _notes = new List <Note>(); }
protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false) { TxtTitle.Focus(); this.Form.DefaultButton = BtnAdd.UniqueID; } LblDuplicateTitleError.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false) { TxtTitle.Focus(); this.Form.DefaultButton = BtnUpdate.UniqueID; MyJobPortalModel.Title ObjTitle = new MyJobPortalModel.Title(int.Parse(Request.QueryString["Id"])); TxtTitle.Text = ObjTitle.TitleName; DdlGender.SelectedValue = ObjTitle.ApplicableToGender; DdlStatus.SelectedValue = ObjTitle.Status; } }
private void CtrlNHandler() { if ((TrVwNotesList.SelectedNode as NoteNode)?.IsSaved ?? true) { TxtTitle.Text = RTxtDesc.Text = string.Empty; TxtTitle.Enabled = RTxtDesc.Enabled = true; TxtTitle.Focus(); TreeNode node = new NoteNode(); node.ForeColor = Color.Yellow; node.BackColor = Color.Red; TrVwNotesList.Nodes.Add(node); TrVwNotesList.SelectedNode = node; } }
private void MakeEmptyForm() { ViewState["EditID"] = null; if (!FlagAdd) { BtnSave.Visible = true; } BtnUpdate.Visible = false; BtnDelete.Visible = false; TxtTitle.Text = string.Empty; TxtDescription.Text = string.Empty; // GetSupplierCode(); ReportGrid(StrCondition); TxtTitle.Focus(); }
private bool CheckValues() { if (string.IsNullOrEmpty(CboDocumentType.Text)) { MessageBox.Show("请选择或输入文件类型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboDocumentType.Focus(); return(false); } if (string.IsNullOrEmpty(CboSecretLevel.Text)) { MessageBox.Show("请选择文件密级", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboSecretLevel.Focus(); return(false); } if (string.IsNullOrEmpty(TxtTitle.Text)) { MessageBox.Show("请输入文件标题", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtTitle.Focus(); return(false); } if (string.IsNullOrEmpty(TxtSerialNum.Text) && string.IsNullOrEmpty(TxtISN.Text)) { //文号或机号至少要填写一个 MessageBox.Show("文号或机号至少要填写一个", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (string.IsNullOrEmpty(TxtISN.Text)) { TxtISN.Focus(); } else { TxtSerialNum.Focus(); } return(false); } if (NumQuantity.Value <= 0) { MessageBox.Show("来文份数应为大于0的整数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); NumQuantity.Focus(); return(false); } return(true); }
private void BtnAdd_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TxtTitle.Text) && !string.IsNullOrEmpty(TxtID.Text) && comboBoxCredits.Text != null && comboBoxDepartments.Text != null && comboBoxInstructors.Text != null) { using (var db = new SchoolEntities()) { // converting id text to number Int32.TryParse(TxtID.Text, out Int32 ID); // converting department name to department id var deptID = from o in db.Department where o.Name.Equals(comboBoxDepartments.SelectedItem.ToString()) select o.DepartmentID; Int32.TryParse(deptID.First().ToString(), out Int32 finalDeptID); // converting credits from combobox selection to number Int32.TryParse(comboBoxCredits.SelectedItem.ToString(), out Int32 credits); var course = new Course { CourseID = ID, Title = TxtTitle.Text, Credits = credits, DepartmentID = finalDeptID }; db.Course.Add(course); // course instructor part // missing from model (?) //var courseInstructor = db. db.SaveChanges(); dataGridView1.DataSource = db.Course.ToList(); } TxtID.ResetText(); TxtTitle.ResetText(); comboBoxCredits.SelectedItem = null; comboBoxDepartments.SelectedItem = null; comboBoxInstructors.SelectedItem = null; } }
/*************************************** * * This is where the UTILITY METHODS are. * ***************************************/ /// <summary> /// This clears the form after an entry is added. /// </summary> private void ClearForm() { TxtEmpID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtMiddleName.Clear(); TxtXtraProp1.Clear(); TxtXtraProp2.Clear(); CkbActiveEmployee.Checked = true; CkbBenefits.Checked = true; CkbApproved.Checked = true; LVxCourses.Items.Clear(); TxtCourseID.Clear(); TxtGrade.Clear(); TxtDescription.Clear(); TxtDateApproved.Clear(); TxtCredits.Clear(); TxtMaritalStatus.Clear(); TxtDepartment.Clear(); TxtTitle.Clear(); TxtStartDate.Clear(); }
protected void BtnUpdate_Click(object sender, EventArgs e) { if (this.IsValid == true) { bool AllOk = true; DataTable ObjTitleTable = MyJobPortalModel.Title.GetTitleRecords("TitleName ='" + TxtTitle.Text.Replace("'", "''").Trim() + "' and Id<>" + Request.QueryString["Id"]); if ((int)ObjTitleTable.Rows.Count > 0) { LblDuplicateTitleError.Visible = true; AllOk = false; TxtTitle.Focus(); return; } if (AllOk == true) { MyJobPortalModel.Title ObjTitle = new MyJobPortalModel.Title(int.Parse(Request.QueryString["Id"])); ObjTitle.TitleName = TxtTitle.Text.Replace("'", "''"); ObjTitle.ApplicableToGender = DdlGender.SelectedValue; ObjTitle.Status = DdlStatus.SelectedValue; ObjTitle.Update(); Response.Redirect("TitleList.aspx?Message=Record has been Updated"); } } }
private void Window_ContentRendered(object sender, EventArgs e) { TxtTitle.Focus(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { TxtTitle.Focus(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { TxtTitle.Focus(); }
} // end method UpdateCurrEmp() /// <summary> /// To change eligible fields & compensation types based on the selected emp type /// </summary> /// <param name="sender">The object generating the event</param> /// <param name="e">The event args</param> private void CBxType_SelectionChangeCommitted(object sender, EventArgs e) { //Show dialog prompting user that they are about to change the emp type //Results in a change of benefit & comp values DialogResult result = MessageBox.Show(TYPE_CHANGE_MSG, TYPE_CHANGE_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); //If user does want to change the emp type if (result.Equals(DialogResult.Yes)) { //Clear comp txt boxes TxtComp1.Clear(); TxtComp2.Clear(); TxtComp3.Clear(); TxtDepartment.Clear(); TxtTitle.Clear(); //Determine selected emp type if (CBxType.Text.Equals(LITERAL_HOURLY)) { //Change eligible benefits TxtOvertime.Text = LITERAL_YES; TxtCommission.Text = LITERAL_NO; TxtBenefits.Text = LITERAL_NO; TxtEduBenefits.Text = LITERAL_YES; //Change comp types LblComp1.Text = LITERAL_HRY_RATE; LblComp2.Visible = true; TxtComp2.Visible = true; LblComp2.Text = LITERAL_HOURS_WORKED; LblComp3.Visible = false; TxtComp3.Visible = false; } // end if if (CBxType.Text.Equals(LITERAL_SALARY)) { //Change eligible benefits TxtOvertime.Text = LITERAL_NO; TxtCommission.Text = LITERAL_NO; TxtBenefits.Text = LITERAL_YES; TxtEduBenefits.Text = LITERAL_YES; //Change comp types LblComp1.Text = LITERAL_SAL_RATE; LblComp2.Visible = false; TxtComp2.Visible = false; LblComp3.Visible = false; TxtComp3.Visible = false; } // end if if (CBxType.Text.Equals(LITERAL_SALES)) { //Change eligible benefits TxtOvertime.Text = LITERAL_NO; TxtCommission.Text = LITERAL_YES; TxtBenefits.Text = LITERAL_YES; TxtEduBenefits.Text = LITERAL_YES; //Change comp types LblComp1.Text = LITERAL_SAL_RATE; LblComp2.Text = LITERAL_SRY_RATE; LblComp2.Visible = true; LblComp2.Text = LITERAL_SRY_RATE; TxtComp2.Visible = true; LblComp3.Visible = true; LblComp3.Text = LITERAL_SALES; TxtComp3.Visible = true; } // end if if (CBxType.Text.Equals(LITERAL_CONTRACT)) { //Change eligible benefits TxtOvertime.Text = LITERAL_NO; TxtCommission.Text = LITERAL_NO; TxtBenefits.Text = LITERAL_NO; TxtEduBenefits.Text = LITERAL_NO; //Change comp types LblComp1.Text = LITERAL_CON_RATE; LblComp2.Visible = true; LblComp2.Text = LITERAL_AGENCY; TxtComp2.Visible = true; LblComp3.Visible = false; TxtComp3.Visible = false; } // end if //Show request approval btn based on eduBfts eligibility & prior approval //If the emp now has education benefits (whether value has changed or not) if (TxtEduBenefits.Text.Equals(LITERAL_YES)) { //If the current emp already obtained eduBft approval if (CurrEmp.EducationBenefitsApproved) { BtnEmpBenefits.Visible = true; } // end if else // emp still needs approval { //Show approval request btn BtnRequestApproval.Visible = true; } // end else } // end if } // end if - DialogResult } // end method CBxType_SelectionChangeCommitted()
/*************************************** * * This is where the EMPLOYEE DATA METHODS are. * ***************************************/ /// <summary> /// This will check the shared values for all employee fields /// </summary> /// <param name="creatingEmployee"> This is the employee that needs to be saved.</param> /// <returns></returns> private bool CheckBaseValues(Employee creatingEmployee) { uint tempUint = 0; if (uint.TryParse(TxtEmpID.Text, out tempUint)) { creatingEmployee.EmpID = tempUint; } else { LblStatus.Text = errorMessageUint; TxtEmpID.Focus(); return(false); } if (TxtLastName.Text == "") { LblStatus.Text = "Last name cannot be empty."; TxtLastName.Focus(); return(false); } if (TxtFirstName.Text == "") { LblStatus.Text = "First name cannot be empty."; TxtFirstName.Focus(); return(false); } if (TxtMaritalStatus.Text == "") { LblStatus.Text = "Marital Status cannont be empty."; TxtMaritalStatus.Focus(); return(false); } if (TxtDepartment.Text == "") { LblStatus.Text = "Department cannont be empty."; TxtDepartment.Focus(); return(false); } if (TxtTitle.Text == "") { LblStatus.Text = "Title cannot be emtpy."; TxtTitle.Focus(); return(false); } if (TxtStartDate.Text == "") { LblStatus.Text = "Start Date cannot be empty."; TxtStartDate.Focus(); return(false); } /* * //Middle Name Not required. * if (TxtMiddleName.Text == "") * { * LblStatus.Text = "Middle name cannot be empty."; * TxtMiddleName.Focus(); * return false; * } */ creatingEmployee.EmpType = CbxEmployeeType.Text; creatingEmployee.FirstName = TxtFirstName.Text; creatingEmployee.LastName = TxtLastName.Text; creatingEmployee.MiddleName = TxtMiddleName.Text; creatingEmployee.MaritalStatus = TxtMaritalStatus.Text; creatingEmployee.Department = TxtDepartment.Text; creatingEmployee.Title = TxtTitle.Text; creatingEmployee.StartDate = TxtStartDate.Text; if (CkbBenefits.Checked) { creatingEmployee.Benefits = true; } else { creatingEmployee.Benefits = false; } if (CkbActiveEmployee.Checked) { creatingEmployee.ActiveEmployee = true; } else { creatingEmployee.ActiveEmployee = false; } return(true); }