internal HRM_Office GetOfficeCodeByOfficeId(int officeId) { int ofId = Convert.ToInt32(officeId); HRM_Office office = _context.HRM_Office.First(x => x.OfficeID == ofId); return(office); }
internal HRM_Office GetOfficeById(string officeId, string OCODE) { int ofId = Convert.ToInt32(officeId); HRM_Office office = _context.HRM_Office.First(x => x.OfficeID == ofId); return(office); }
private void SetOfficeCodeByofficeID(int officeId) { HRM_Office objOffice = new HRM_Office(); objOffice = objOfficeBLL.GetOfficeCodeByOfficeId(officeId); if (objOffice != null) { txtoffice.Text = objOffice.OfficeCode.Trim(); } }
protected void imgbtnEdit_Clik(object sender, EventArgs e) { HRM_Office objOffice = new HRM_Office(); ImageButton imgbtn = (ImageButton)sender; GridViewRow row = (GridViewRow)imgbtn.NamingContainer; try { string officeId = ""; Label lblOfficeId = (Label)gridViewOffice.Rows[row.RowIndex].FindControl("lblOfficeId"); if (lblOfficeId != null) { string OCODE = ((SessionUser)Session["SessionUser"]).OCode; officeId = lblOfficeId.Text; objOffice = objOfficeBLL.GetOfficeById(officeId, OCODE); if (objOffice != null) { hidOfficeId.Value = objOffice.OfficeID.ToString(); drpRegion.SelectedValue = objOffice.RegionId.ToString(); hidOfficeName.Value = txtbxOfficeName.Text = objOffice.OfficeName.ToString(); txtbxAddress.Text = objOffice.OfficeAddress.ToString(); int regionId = Convert.ToInt32(drpRegion.SelectedValue); SetRegionCode(regionId); string officeCode = objOffice.OfficeCode.ToString(); bool contains = officeCode.Contains("-"); if (contains) { string[] occode = officeCode.Split('-'); if (occode.Length > 0) { txtbxOfficeCode.Text = occode[1]; } } else { txtbxOfficeCode.Text = officeCode; } if (btnSave.Text == "Submit") { btnSave.Text = "Update"; } } } } catch (Exception ex) { throw; } }
// internal int UpdateOffice(HRM_Office objOffice, int officeId) { HRM_Office objoffice = _context.HRM_Office.First(x => x.OfficeID == officeId); objoffice.RegionId = objOffice.RegionId; objoffice.OfficeName = objOffice.OfficeName; objoffice.OfficeCode = objOffice.OfficeCode; objoffice.OfficeAddress = objOffice.OfficeAddress; objoffice.OCODE = objOffice.OCODE; objoffice.EDIT_USER = objOffice.EDIT_USER; objoffice.EDIT_DATE = objOffice.EDIT_DATE; _context.SaveChanges(); return(1); }
protected void drpdwnOffice_SelecttedIndexChanged(object sender, EventArgs e) { try { int officeId = Convert.ToInt32(drpdwnOffice.SelectedValue); HRM_Office objOffice = new HRM_Office(); objOffice = objOfficeBLL.GetOfficeCodeByOfficeId(officeId); if (objOffice != null) { lblOfficeCode.Text = objOffice.OfficeCode + "-"; } } catch { } }
private void SetOfficeCodeByofficeID(int officeId) { try { HRM_Office objOffice = new HRM_Office(); objOffice = objOfficeBLL.GetOfficeCodeByOfficeId(officeId); if (objOffice != null) { txtoffice.Text = objOffice.OfficeCode.Trim(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
protected void drpdwnOffice_SelecttedIndexChanged(object sender, EventArgs e) { try { int officeId = Convert.ToInt32(drpdwnOffice.SelectedValue); HRM_Office objOffice = new HRM_Office(); objOffice = objDept_BLL.GetOfficeCodeByOfficeId(officeId); if (objOffice != null) { lblOfficeCode.Text = objOffice.OfficeCode + "-"; } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (drpRegion.SelectedItem.ToString() == "--Select--") { // lblMessage.Text = ""; // lblMessage.ForeColor = System.Drawing.Color.Red; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Region!')", true); } else if (txtbxOfficeName.Text == "") { // lblMessage.Text = ""; // lblMessage.ForeColor = System.Drawing.Color.Red; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Office Name!')", true); } else if (txtbxOfficeCode.Text == "") { // lblMessage.Text = ""; // lblMessage.ForeColor = System.Drawing.Color.Red; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Office Code!')", true); } //else if (txtbxOfficeCode.Text.Length < 3) //{ // // lblMessage.Text = ""; // // lblMessage.ForeColor = System.Drawing.Color.Red; // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Office Code Minimum Length 3!')", true); //} else if (txtbxAddress.Text == "") { // lblMessage.Text = ""; // lblMessage.ForeColor = System.Drawing.Color.Red; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Office Address!')", true); } else { HRM_Office objOffice = new HRM_Office(); objOffice.RegionId = Convert.ToInt32(drpRegion.SelectedValue.ToString()); objOffice.OfficeName = txtbxOfficeName.Text; string FullCode = txtRegionCode.Text.ToString() + "-" + txtbxOfficeCode.Text.ToString(); objOffice.OfficeCode = FullCode; objOffice.OfficeAddress = txtbxAddress.Text; objOffice.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; objOffice.EDIT_DATE = DateTime.Now; objOffice.OCODE = ((SessionUser)Session["SessionUser"]).OCode; if (btnSave.Text == "Submit") { int result = objOfficeBLL.SaveOffice(objOffice); if (result == 1) { // lblMessage.Text = "Data Save successfully!"; // lblMessage.ForeColor = System.Drawing.Color.Green; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Save successfully')", true); } } else { int officeId = Convert.ToInt32(hidOfficeId.Value); int result = objOfficeBLL.UpdateOffice(objOffice, officeId); if (result == 1) { // lblMessage.Text = "Data Update successfully!"; // lblMessage.ForeColor = System.Drawing.Color.Green; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully')", true); } //else //{ // int officeId = Convert.ToInt32(hidOfficeId.Value); // int result = objOfficeBLL.UpdateOffice(objOffice, officeId); // if (result == 1) // { // // lblMessage.Text = "Data Update successfully!"; // // lblMessage.ForeColor = System.Drawing.Color.Green; // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully')", true); // } //} } GetOfficeListForGridview(); ClearAllControl(); } } catch (Exception) { throw; } }
internal int SaveOffice(HRM_Office objOffice) { _context.HRM_Office.AddObject(objOffice); _context.SaveChanges(); return(1); }
internal int UpdateOffice(HRM_Office objOffice, int officeId) { return(objOfficeDal.UpdateOffice(objOffice, officeId)); }
internal int SaveOffice(HRM_Office objOffice) { return(objOfficeDal.SaveOffice(objOffice)); }