コード例 #1
0
 public static List <Branch> FindAllByBranchNetwork(int branchNetworkId, Connection connection, MySqlTransaction transaction)
 {
     using (var dao = new BranchDAO(connection))
     {
         return(dao.FindAllByBranchNetwork(branchNetworkId, transaction));
     }
 }
コード例 #2
0
        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);
            };
        }
コード例 #3
0
 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);
         }
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: BranchService.cs プロジェクト: dingzeng/Tripod
 public BranchService(IMapper mapper, ConfigurationOptions options)
 {
     _mapper         = mapper;
     _branchDao      = new BranchDAO(options);
     _branchGroupDao = new BranchGroupDAO(options);
 }
コード例 #6
0
        [HttpGet("{lat}/{lng}")] public ActionResult <List <Branch> > Index(float lat, float lng)
        {
            BranchDAO dao = new BranchDAO(_db);

            return(dao.GetThreeClosetStores(lat, lng));
        }