private void BindTree() { IList <Branch> branchLists = BranchManager.GetAllBranch(); //循环添加机构 foreach (Branch branch in branchLists) { TreeNode branchNode = new TreeNode(branch.BranchName, "", "~/images/menuclose.gif"); IList <Depart> departLists = DepartInfoManager.GetDeparByBranchId(branch.BranchId); //循环添加部门 foreach (Depart depart in departLists) { TreeNode departNode = new TreeNode(depart.DepartName, "", "~/images/CloseTree.gif"); IList <User> userLists = UserManager.GetUseryDepartId(depart.DepartId); //循环添加用户 foreach (User user in userLists) { TreeNode userNode = new TreeNode(user.UserName, user.UserId, "~/images/person.gif"); departNode.ChildNodes.Add(userNode); } branchNode.ChildNodes.Add(departNode); } this.tvUser.Nodes.Add(branchNode); } }
// // GET: /Branch/ public ActionResult Index() { Branch srchBranch = new Branch() { BranchName = "", AddressLine1 = "", IsActive = true }; List <Branch> branList = BranchManager.GetAllBranch(srchBranch, "nirshan"); List <BranchModel> branchList = Utility.ConvetrToList <BranchModel, Branch>(branList); return(View(branchList)); }
private void BindBranches() { try { txtBranch.DataSource = _branchManager.GetAllBranch(); txtBranch.DataBind(); } catch (Exception ex) { txtError.Text = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message; } }
public CascadingDropDownNameValue[] GetBranchs(string knownCategoryValues, string category) { IList <Branch> branchs = BranchManager.GetAllBranch(); List <CascadingDropDownNameValue> branchList = new List <CascadingDropDownNameValue>(); foreach (Branch bc in branchs) { branchList.Add(new CascadingDropDownNameValue(bc.BranchName, bc.BranchId.ToString())); } return(branchList.ToArray()); }
public ActionResult Create() { TransferModel transfer = new TransferModel(); List <Branch> fromBranchList = BranchManager.GetAllBranch(new Branch { BranchName = "", AddressLine1 = "", IsActive = true }, "dini"); ViewBag.FromBranchList = fromBranchList; Branch[] tmpArray = new Branch[] { }; fromBranchList.CopyTo(tmpArray); List <Branch> toBranchList = tmpArray.ToList(); ViewBag.ToBranchList = toBranchList; return(View(transfer)); }
public ActionResult Index(FormCollection collection) { try { string branchName = collection.GetValue("BranchName").AttemptedValue; string addressLine1 = collection.GetValue("AddressLine1").AttemptedValue; bool bIsActive = Request.Form.GetValues("active") != null && Request.Form.GetValues("active")[0] != null ? true : false; Branch srcBran = new Branch() { BranchName = branchName, AddressLine1 = addressLine1, IsActive = bIsActive }; List <Branch> branch = new List <Branch>(); List <BranchModel> branchModels = new List <BranchModel>(); branch = BranchManager.GetAllBranch(srcBran, "nirshan"); return(View(Utility.ConvetrToList <BranchModel, Branch>(branch))); } catch { return(View()); } }
protected void Page_Load(object sender, EventArgs e) { var role = (string)Session["role"]; if (Session["username"] == null || role != "Admin") { Response.Redirect("Login.aspx"); } if (string.IsNullOrEmpty(Request.QueryString["Id"])) { Response.Redirect("EmployeeEntry.aspx?Id=" + 0); } if (!IsPostBack) { ListItem listItem = new ListItem("---------Select One---------", "-1"); roleDropDownBox.DataSource = _roleManager.GetAllRoles().ToList(); roleDropDownBox.DataBind(); sectionDropDownBox.DataSource = _sectionManager.GetAllSections(); sectionDropDownBox.DataBind(); designationDropDownBox.DataSource = _designationManager.GetAllDesignations(); designationDropDownBox.DataBind(); branchDropDownBox.DataSource = _branchManager.GetAllBranch(); branchDropDownBox.DataBind(); roleDropDownBox.Items.Insert(0, listItem); sectionDropDownBox.Items.Insert(0, listItem); designationDropDownBox.Items.Insert(0, listItem); branchDropDownBox.Items.Insert(0, listItem); int id = int.Parse(Request.QueryString["Id"].ToString()); if (id > 0) { passwordTextBox.Visible = false; confirmPasswordTextBox.Visible = false; emailTextBox.Visible = false; passwordLabel.Visible = false; confirmPasswordLabel.Visible = false; emailLabel.Visible = false; Employee employee = _employeeUserManager.GetEmployeeById(id); employeeIdHiddenField.Value = employee.Id.ToString(); fullNameTextBox.Text = employee.FullName; firstNameTextBox.Text = employee.FirstName; lastNameTextBox.Text = employee.LastName; roleDropDownBox.DataSource = _roleManager.GetAllRoles().ToList(); roleDropDownBox.DataBind(); roleDropDownBox.Items.FindByValue(employee.RoleId.ToString()).Selected = true; mobileTextBox.Text = employee.MobileNo; sectionDropDownBox.Items.FindByValue(employee.SectionId.ToString()).Selected = true; designationDropDownBox.Items.FindByValue(employee.DesignationId.ToString()).Selected = true; salaryTextBox.Text = employee.BasicSalary.ToString(); if (employee.Gander == "Male") { maleRadioButton.Checked = true; } else { femaleRadioButton.Checked = true; } dateOfBirthTextBox.Text = employee.DateOfBirth.ToString(); joinDateTextBox.Text = employee.JoinDate.ToString(); branchDropDownBox.Items.FindByValue(employee.BranchId.ToString()).Selected = true; addressTextBox.Text = employee.Address; } } }
/// <summary> /// 绑定部门显示信息 /// </summary> private void BindBranchInfo() { this.gvBranchList.DataSource = BranchManager.GetAllBranch(); this.gvBranchList.DataBind(); }