public static List <Branch> FindAllByBranchNetwork(int branchNetworkId, Connection connection, MySqlTransaction transaction) { using (var dao = new BranchDAO(connection)) { return(dao.FindAllByBranchNetwork(branchNetworkId, transaction)); } }
private void btnSignup_Click(object sender, EventArgs e) { Employee emp; //get matching branch for the user by its address Branch branch = new BranchDAO().getBranch(comboBranchAddress.Text); if (branch == null) { MessageBox.Show("Error on signup", "Signup error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } //sign up user according to its user type switch (comboSignupRole.Text) { case "cashier": emp = new Cashier { first_name = txtSignupFIrstName.Text, last_name = txtSignupLastName.Text, email = txtSignupEmail.Text, role = comboSignupRole.Text, branch = branch, password = hashPassword(txtSignupPassword.Text) }; break; case "admin": emp = new Admin { first_name = txtSignupFIrstName.Text, last_name = txtSignupLastName.Text, email = txtSignupEmail.Text, role = comboSignupRole.Text, branch = branch, password = hashPassword(txtSignupPassword.Text) }; break; default: emp = null; break; } emp = new EmployeeDAO().saveEmployee(emp); if (emp != null) { frmdashboard dashboard = new frmdashboard(emp); dashboard.Show(); this.Close(); } else { MessageBox.Show("Error on signup", "Signup error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }; }
public void Save(Connection connection, MySqlTransaction transaction) { using (var dao = new BranchDAO(connection)) { if (Id == 0) { dao.Insert(this, transaction); } else { dao.Update(this, transaction); } } }
public int createButtons() { List <Branch> branches = new BranchDAO().getAllBranch(); foreach (Branch branch in branches) { string btnName = "Branch " + branch.id.ToString(); Button btn = new Button(); btn.Width = 75; btn.Height = 23; btn.Text = btnName; btn.Name = "btn" + branch.id; btn.Font = new Font("Georgia", 9); btn.Click += new EventHandler(DynamicButton_Click); frmLayoutForButtons.Controls.Add(btn); } return(branches[0].id); }
public BranchService(IMapper mapper, ConfigurationOptions options) { _mapper = mapper; _branchDao = new BranchDAO(options); _branchGroupDao = new BranchGroupDAO(options); }
[HttpGet("{lat}/{lng}")] public ActionResult <List <Branch> > Index(float lat, float lng) { BranchDAO dao = new BranchDAO(_db); return(dao.GetThreeClosetStores(lat, lng)); }