protected void MasterPage_YesClickHandler(object sender, EventArgs e) { if (ViewState["Delete"] != null) { try { RoleManagementEntity entity = new RoleManagementEntity(); entity.OperationId = 3; entity.RoleId = Utility.GetInt(ViewState["RoleId"]); OperationStatusEntity c = new HRRepository(SessionContext).ManageRole(entity); if (c.StatusResult == true) { ShowInfoMessage(c.InfoMessage); FillGrid(); } else { ShowErrorMessage(c.InfoMessage); } } catch (BaseException bex) { ShowErrorMessage(bex.Message); } } }
protected void gvMenuList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { int ParentId = Utility.GetInt(((Label)e.Item.FindControl("lblParentId")).Text); CheckBoxList childList = e.Item.FindControl("chkChildMenuList") as CheckBoxList; if (childList != null) { var list = new HRRepository(SessionContext).GetMenuListByRoleId(Utility.GetInt(ViewState["RoleId"])).Where(x => x.ParentId == ParentId).ToList(); childList.DataSource = list; childList.DataTextField = "MenuName"; childList.DataValueField = "NavigationId"; childList.DataBind(); foreach (ListItem listItem in childList.Items) { foreach (MenuItemEntity p in list) { if (p.IsChecked == true && p.NavigationId == Utility.GetInt(listItem.Value)) { listItem.Selected = true; break; } } } } } }
protected void gridViewList_RowCommand(object sender, GridViewCommandEventArgs e) { string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(';'); if (e.CommandName == "EditRow") { ViewState["RoleId"] = Convert.ToString(arg[0]); int RoleId = Utility.GetInt(ViewState["RoleId"]); ViewState["Update"] = "Update"; RoleManagementEntity entity = new HRRepository(SessionContext).GetRoleById(RoleId); txtRoleName.Text = entity.RoleName.Trim(); var list = new HRRepository(SessionContext).GetMenuListByRoleId(Utility.GetInt(ViewState["RoleId"])).Where(x => x.ParentId == 0 && x.NavigationId != 1).ToList(); gvMenuList.DataSource = list; gvMenuList.DataBind(); DIVList.Visible = false; DIVDetail.Visible = true; } else if (e.CommandName == "DeleteRow") { ViewState["RoleId"] = Convert.ToString(arg[0]); int RoleId = Utility.GetInt(ViewState["RoleId"]); ViewState["Delete"] = "Delete"; ShowYesNoPopup("Are you sure you want to delete this Role and all associated Menu items?"); } }
public UnitOfWork(ERPDatabaseEntities context) { this._context = context; BusinessEntityRepository = new BusinessEntityRepository(context); CultureRepository = new CultureRepository(context); GrantPermissionAdmin = new GrantPermissionAdmin(context); HRRepository = new HRRepository(context); }
private void FillGrid() { var list = new HRRepository(SessionContext).GetEmployeeInformationList(txtUserNameSearch.Text, txtMobileNumberSearch.Text, txtNICNoSearch.Text, Utility.GetInt(ddlRoleSearch.SelectedValue)); gridViewList.LoadData(list); DIVList.Visible = true; DIVDetail.Visible = false; ViewState["Update"] = null; ViewState["UserId"] = null; }
protected void btnSubmit_Click(object sender, EventArgs e) { try { ValidateBusinessData("G1"); RoleManagementEntity entity = new RoleManagementEntity(); if (Convert.ToString(ViewState["Add"]) == "Add") { entity.OperationId = 1; } else if (Convert.ToString(ViewState["Update"]) == "Update") { entity.OperationId = 2; entity.RoleId = Utility.GetInt(ViewState["RoleId"]); } entity.RoleName = txtRoleName.Text.Trim(); OperationStatusEntity c = new HRRepository(SessionContext).ManageRole(entity); if (c.StatusResult == true) { foreach (RepeaterItem Item in gvMenuList.Items) { string NavigationIds = Utility.GetCheckBoxListSelectedValue(((CheckBoxList)Item.FindControl("chkChildMenuList"))); if (!string.IsNullOrWhiteSpace(NavigationIds)) { new HRRepository(SessionContext).UpdateMenuRoleDetail((int)c.ResultId, Utility.GetInt(((Label)Item.FindControl("lblParentId")).Text), NavigationIds, SessionClass.LoginUserEntity.UserId); } } ShowInfoMessage(c.InfoMessage); ClearPageControl(); FillGrid(); } else { ShowErrorMessage(c.InfoMessage); } } catch (ValidationException ex) { ShowErrorMessage(ex.Message); } catch (BaseException be) { ShowErrorMessage(be.DisplayMessage); } }
protected void gridViewList_RowCommand(object sender, GridViewCommandEventArgs e) { string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(';'); if (e.CommandName == "EditRow") { ViewState["UserId"] = Convert.ToString(arg[0]); long UserId = Utility.GetLong(ViewState["UserId"]); ViewState["Update"] = "Update"; LookupUtility.BindCompanyLookup(ddlCompany, SessionContext); LookupUtility.BindUserRoleLookup(ddlRole, SessionContext); LookupUtility.BindDesignationTypeLookup(ddlDesignationType, SessionContext); // LookupUtility.BindLocationLookup(ddlLocation, SessionContext); UserEntity entity = new HRRepository(SessionContext).GetEmployeeInformationById(UserId); //Utility.SetLookupSelectedValue(ddlCompany, Convert.ToString(entity.CompanyId)); //Utility.SetLookupSelectedValue(ddlRole, Convert.ToString(entity.RoleId)); //Utility.SetLookupSelectedValue(ddlDesignationType, Convert.ToString(entity.DesignationTypeId)); //Utility.SetLookupSelectedValue(ddlLocation, Convert.ToString(entity.LocationId)); //txtEmployeeName.Text = entity.UserName; //txtEmployeeCode.Text = entity.EmployeeCode; //txtNICNumber.Text = entity.NICNo; //txtMobileNumber.Text = entity.MobileNumber; //txtEmailId.Text = entity.UserEmailId; //txtParmanentAddress.Text = entity.ParmanentAddress; //txtPresentAddress.Text = entity.PresentAddress; //txtPOCName.Text = entity.POCName; //txtPOCMobileNo.Text = entity.POCMobileNo; //txtPOCEmailId.Text = entity.POCEmailId; //txtPOCParmanentAddress.Text = entity.POCParmanentAddress; ; //txtPOCRemark.Text = entity.POCRemark; //txtCNICNo.Text = entity.CNICNo; //txtPOCPhoneNo.Text = entity.POCPhoneNo; //txtPOCRelation.Text = entity.POCRelation; //txtPOCPresentAddress.Text = entity.POCPresentAddress; ImageUserImage.ImageUrl = entity.PhotoPath; chkIsActive.Checked = entity.IsActive; DIVList.Visible = false; DIVDetail.Visible = true; } }
protected void btnAdd_Click(object sender, EventArgs e) { ClearPageControl(); ViewState["Add"] = "Add"; var list = new HRRepository(SessionContext).GetMenuListByRoleId(Utility.GetInt(ViewState["RoleId"])).Where(x => x.ParentId == 0 && x.NavigationId != 1).ToList(); gvMenuList.DataSource = list; gvMenuList.DataBind(); DIVList.Visible = false; DIVDetail.Visible = true; }
private void FillGrid() { var list = new HRRepository(SessionContext).GetRoleList(); gridViewList.LoadData(list); DIVList.Visible = true; DIVDetail.Visible = false; ViewState["Add"] = null; ViewState["Update"] = null; ViewState["Delete"] = null; ViewState["RoleId"] = null; }
protected void btnSubmit_Click(object sender, EventArgs e) { try { ValidateBusinessData("G1"); ValidateBusinessData("G2"); UserEntity entity = new UserEntity(); entity.UserId = Utility.GetInt(ViewState["UserId"]); entity.LoginId = txtLoginId.Text.Trim(); entity.UserPassword = txtPassword.Text.Trim(); //entity.IsActivateLogin = chkIsActivateLogin.Checked; //entity.CreatedBy = SessionClass.LoginUserEntity.UserId; OperationStatusEntity c = new HRRepository(SessionContext).UpdateUserLoginUpdate(entity); if (c.StatusResult == true) { ShowInfoMessage(c.InfoMessage); ClearPageControl(); FillGrid(); } else { ShowErrorMessage(c.InfoMessage); } } catch (ValidationException ex) { ShowErrorMessage(ex.Message); } catch (BaseException be) { ShowErrorMessage(be.DisplayMessage); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { ValidateBusinessData("G1"); ValidateBusinessData("G2"); if (!String.Equals(txtNewPassword.Text.Trim(), txtConfirmPassword.Text.Trim(), StringComparison.CurrentCulture)) { ShowErrorMessage("Confirm Password does not match."); txtConfirmPassword.Text = string.Empty; txtConfirmPassword.Focus(); return; } string c = new HRRepository(SessionContext).UpdateUserPassword(txtNewPassword.Text.Trim(), SessionClass.LoginUserEntity.UserId); if (c == "success") { ShowInfoMessage("Password changed successfully."); txtNewPassword.Text = string.Empty; txtConfirmPassword.Text = string.Empty; } else { ShowErrorMessage("Error in change password."); } } catch (ValidationException ex) { ShowErrorMessage(ex.Message); } catch (BaseException be) { ShowErrorMessage(be.DisplayMessage); } }
protected void gridViewList_RowCommand(object sender, GridViewCommandEventArgs e) { string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(';'); if (e.CommandName == "EditRow") { ViewState["UserId"] = Convert.ToString(arg[0]); long UserId = Utility.GetLong(ViewState["UserId"]); ViewState["Update"] = "Update"; UserEntity entity = new HRRepository(SessionContext).GetEmployeeInformationById(UserId); lblEmployeeName.Text = entity.UserName; txtLoginId.Text = entity.LoginId; txtPassword.Text = entity.UserPassword; //chkIsActivateLogin.Checked = entity.IsActivateLogin; DIVList.Visible = false; DIVDetail.Visible = true; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { ValidateBusinessData("G1"); ValidateBusinessData("G2"); ValidateBusinessData("G3"); ValidateBusinessData("G4"); ValidateBusinessData("G5"); ValidateBusinessData("G6"); ValidateBusinessData("G7"); ValidateBusinessData("G8"); ValidateBusinessData("G9"); ValidateBusinessData("G10"); ValidateBusinessData("G11"); ValidateBusinessData("G12"); ValidateBusinessData("G13"); ValidateBusinessData("G14"); ValidateBusinessData("G15"); byte[] imgbyte = null; string getFileName = string.Empty; string uploadedFileName = string.Empty; if (txtUserImage.HasFile) { string completePath = string.Empty; string imgType = string.Empty; string[] stringListArr = System.IO.Path.GetFileName(txtUserImage.PostedFile.FileName).Split('.'); imgType = txtUserImage.PostedFile.ContentType; if ((imgType == "image/gif" || imgType == "image/pjpeg" || imgType == "image/jpeg" || imgType == "image/x-png" || stringListArr[1].ToString().Trim().ToLower() == "png")) { int length = txtUserImage.PostedFile.ContentLength; imgbyte = new byte[length]; HttpPostedFile imageFile = txtUserImage.PostedFile; imageFile.InputStream.Read(imgbyte, 0, length); MemoryStream stream = new MemoryStream(imgbyte); int kilobytes = Int32.Parse(Convert.ToString(stream.Length)) / 1024; // Get Size In KB if (kilobytes > 200) { ShowPopup("Please Select a image file less than 200 KB in Size."); return; } else { getFileName = txtUserImage.PostedFile.FileName; if (txtUserImage.PostedFile.ContentLength > 0) { var container = Utility.GetStorageContainer(); string blobFileName = Guid.NewGuid().ToString("N"); string fileExtension = Path.GetExtension(imageFile.FileName); CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobFileName + fileExtension); blockBlob.Properties.ContentType = "image/png"; stream.Seek(0, SeekOrigin.Begin); //input.Position = 0; blockBlob.UploadFromStream(stream); uploadedFileName = blockBlob.StorageUri.PrimaryUri.OriginalString; } } } else { ShowPopup("Please Select a valid picture file."); return; } } UserEntity entity = new UserEntity(); entity.UserId = Utility.GetInt(ViewState["UserId"]); //entity.UserName = txtEmployeeName.Text.Trim(); //entity.EmployeeCode = txtEmployeeCode.Text.Trim(); //entity.NICNo = txtNICNumber.Text.Trim(); //entity.CompanyId = Utility.GetInt(ddlCompany.SelectedValue); //entity.RoleId = Utility.GetInt(ddlRole.SelectedValue); //entity.DesignationTypeId = Utility.GetInt(ddlDesignationType.SelectedValue); //entity.LocationId = Utility.GetLong(ddlLocation.SelectedValue); //entity.MobileNumber = txtMobileNumber.Text.Trim(); //entity.UserEmailId = txtEmailId.Text; //entity.ParmanentAddress = txtParmanentAddress.Text.Trim(); //entity.PresentAddress = txtPresentAddress.Text.Trim(); //entity.POCName = txtPOCName.Text; //entity.POCMobileNo = txtPOCMobileNo.Text; //entity.POCEmailId = txtPOCEmailId.Text; //entity.POCParmanentAddress = txtPOCParmanentAddress.Text; //entity.POCRemark = txtPOCRemark.Text; //entity.CNICNo = txtCNICNo.Text; //entity.POCPhoneNo = txtPOCPhoneNo.Text; //entity.POCRelation = txtPOCRelation.Text; //entity.POCPresentAddress = txtPOCPresentAddress.Text; //entity.PhotoPath = uploadedFileName; //entity.IsActive = chkIsActive.Checked; //entity.CreatedBy = SessionClass.LoginUserEntity.UserId; OperationStatusEntity c = new HRRepository(SessionContext).UpdateEmployeeInformation(entity); if (c.StatusResult == true) { ShowInfoMessage(c.InfoMessage); FillGrid(); } else { ShowErrorMessage(c.InfoMessage); } } catch (ValidationException ex) { ShowErrorMessage(ex.Message); } catch (BaseException be) { ShowErrorMessage(be.DisplayMessage); } }