예제 #1
0
        public static List <Feature> GetFeatures()
        {
            List <Feature> e  = new List <Feature>();
            DataTable      dt = AccountDAO.GetFeatures();

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            foreach (DataRow dr in dt.Rows)
            {
                Feature f = new Feature();
                f.ID          = dr["FeatureID"].ToString();
                f.Name        = dr["FeatureName"].ToString();
                f.Code        = dr["FeatureCode"].ToString();
                f.DisplayName = f.Name + "_" + f.Code;
                e.Add(f);
            }
            return(e);
        }
예제 #2
0
        public static List <Employee> GetAccountBy(string FName, string LName, string AccountName, string Phone, string Email, Role role)
        {
            List <Employee> lst = new List <Employee>();
            DataTable       dt  = AccountDAO.GetAccountBy(FName, LName, AccountName, Phone, Email, role);

            foreach (DataRow dr in dt.Rows)
            {
                Employee e = new Employee();
                e.AccName     = dr["AccountName"].ToString();
                e.AccPassword = dr["AccountPassword"].ToString();
                e.ID          = dr["EmployeeID"].ToString();
                e.FirstName   = dr["FirstName"].ToString();
                e.LastName    = dr["LastName"].ToString();
                e.Email       = dr["Email"].ToString();
                e.Phone       = dr["Phone"].ToString();
                e.Roles       = RoleList.GetRoleByID(e.ID);
                //e.Features = FeatureList.GetFeaturesByListOfRole(e.Roles);
                if (!lst.Contains(e))
                {
                    lst.Add(e);
                }
            }
            return(lst);
        }
예제 #3
0
        private void DrawSaleChart()
        {
            string[] monthsName = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
            lstTotalByDate.Clear();
            string month = (cbxMonthsSale.SelectedIndex + 1).ToString();

            dgvTopBook.DataSource     = BookDAO.GetTopBookByMonth(month);
            dgvTopEmployee.DataSource = AccountDAO.GetTopEmployeeByMonth(month);

            for (int i = 0; i < DateTime.DaysInMonth(DateTime.Now.Year, Convert.ToInt32(month)); i++)
            {
                string year = "2020";

                string date    = (i + 1).ToString();
                string conDate = year + "-" + month + "-" + date;

                try
                {
                    DateTime dt    = Convert.ToDateTime(conDate);
                    double   value = BillDAO.getTotalByDate(conDate);
                    lstTotalByDate.Add(value);
                } catch (FormatException)
                {
                    lstTotalByDate.Add(0);
                }
            }
            int    basehei = 200;
            double maxVal  = 0;
            double minVal  = 0;

            foreach (double d in lstTotalByDate)
            {
                if (d > maxVal)
                {
                    maxVal = d;
                }
            }
            minVal = maxVal;
            foreach (double d in lstTotalByDate)
            {
                if (d < minVal)
                {
                    minVal = d;
                }
            }
            flpDisplaySale.Controls.Clear();
            for (int i = 0; i < lstTotalByDate.Count; i++)
            {
                int height = CalToCol(basehei, maxVal, lstTotalByDate[i]);

                MyLabel l = new MyLabel();
                l.Height      = height;
                l.BackColor   = Color.Gray;
                l.Months      = i;
                l.MouseHover += L_MouseHover;
                l.MouseLeave += L_MouseLeave;
                MyLabel l2 = new MyLabel();
                l2.Text   = (i + 1).ToString();
                l2.Height = 25;
                FlowLayoutPanel fl1 = new FlowLayoutPanel();
                fl1.Width         = 30;
                fl1.Height        = 300;
                fl1.FlowDirection = FlowDirection.BottomUp;
                fl1.Controls.Add(l2);
                fl1.Controls.Add(l);


                flpDisplaySale.Controls.Add(fl1);
            }
            lblSaleHighest.Text = String.Format("Heightest Of" + monthsName[Convert.ToInt32(month) - 1] + ": {0:n0} VND ", maxVal);
            lblLowest.Text      = String.Format("Lowest Of" + monthsName[Convert.ToInt32(month) - 1] + ": {0:n0} VND ", minVal);
            double aver = 0;

            foreach (double d in lstTotalByDate)
            {
                aver += d;
            }
            lblSaleAver.Text = String.Format("Average : {0:n0} VND / Day", (aver / lstTotalByDate.Count));
        }
예제 #4
0
 public static int UpdateEmployee(string ID, string Accname, string AccPassword, string FirstName, string LastName, string Email, string Phone)
 {
     return(AccountDAO.UpdateEmployee(ID, Accname, AccPassword, FirstName, LastName, Email, Phone));
 }