public ActionResult Cardhistory(WebLookupCard WebCard)
        {
            try
            {
                //CardHistoryModel PCardHistory = new CardHistoryModel();

                List <WebHistory> TCardHistory       = new List <WebHistory>();
                IHistoryDAO       tHistoryRepository = new HistoryDAO();

                List <CardHistory> cHistory = tHistoryRepository.GetCardHistory(WebCard.CardNumber);
                foreach (CardHistory ch in cHistory)
                {
                    WebHistory HI = new WebHistory();
                    HI.ID            = ch.ID.ToString();
                    HI.When          = ch.When.ToShortDateString();
                    HI.MerchantName  = ch.MerchWhere;
                    HI.TransType     = ch.Transaction;
                    HI.Amount        = ch.Amount.ToString();
                    HI.PointsGranted = ch.PointsGranted.ToString();
                    HI.Reward        = ch.RewardGranted;
                    HI.Text          = ch.Text;
                    TCardHistory.Add(HI);
                }
                TempData["ToDisplay"] = TCardHistory;
                return(RedirectToAction("LookUpHistory"));
            }
            catch (Exception Ex)
            {
                ModelState.AddModelError("", Common.StandardExceptionErrorMessage(Ex));
            }
            return(View());
        }
        protected void btnAddtoOrder_Click(object sender, EventArgs e)
        {
            Account ac = (Account)Session["account"];

            string   txtName = txtFullName.Text;
            string   Email   = txtEmails.Text;
            string   Phone   = txtPhones.Text;
            string   Address = txtEmails.Text;
            DateTime date    = Convert.ToDateTime(txtDates.Text);
            int      id      = Convert.ToInt32(Request.QueryString["productID"]);
            Orders   orders  = new Orders();

            orders.UserName  = ac.UserName;
            orders.Name      = txtName;
            orders.Email     = Email;
            orders.Phone     = Phone;
            orders.Address   = Address;
            orders.Date      = date;
            orders.Total     = result;
            orders.idVatPham = id;

            HistoryDAO historyDAO = new HistoryDAO();

            bool check = historyDAO.Insert(orders);

            if (check)
            {
                Response.Redirect("ShowHistory.aspx");
            }
            else
            {
                this.Label1.Text = "InsertFailer";
            }
        }
Beispiel #3
0
        public ActionResult ViewHistory(HistoryInput historyInput, int?page)
        {
            if (ModelState.IsValid)
            {
                TimeSpan timeSpan = (historyInput.EndDate - historyInput.StartDate);
                if (timeSpan.Days >= 0)
                {
                    HistoryDAO     History_DAO = new HistoryDAO();
                    List <History> HistoryList = History_DAO.ShowHisroty(historyInput.StartDate, historyInput.EndDate).ToList();

                    GridView gridView = new GridView();
                    gridView.DataSource = HistoryList;
                    gridView.DataBind();
                    Session["History"] = gridView;

                    return(View(HistoryList.ToPagedList(page ?? 1, 10)));
                }
                else
                {
                    ModelState.AddModelError("", "Please Select a valid range with correct dates");
                    return(View("ShowHistory"));
                }
            }
            else
            {
                ModelState.AddModelError("", "History is not available");
                return(View("ShowHistory"));
            }
        }
Beispiel #4
0
 public int Login(string username, string password)
 {
     try
     {
         employee = db.GetTable <Employee>();
         HistoryDAO historyDAO = new HistoryDAO();
         var        user       = (from emp in employee
                                  where emp.Username.Equals(username)
                                  select new
         {
             emp.EmployeeID,
             emp.Username,
             emp.Password,
             emp.FirstName,
             emp.LastName,
             emp.Status
         });
         if (user.Count() > 0)
         {
             if (user.FirstOrDefault().Password.Equals(password))
             {
                 if (user.FirstOrDefault().Status.Equals(true))
                 {
                     historyDAO.Insert(user.FirstOrDefault().EmployeeID, 1, "Thành công");
                     LoginDetail.LoginID   = user.FirstOrDefault().EmployeeID;
                     LoginDetail.LoginName = user.FirstOrDefault().FirstName + " " + user.FirstOrDefault().LastName;
                     //Thêm mới lịch sử hoạt động
                     return(1); //Đăng nhập thành công
                 }
                 else
                 {
                     historyDAO.Insert(user.FirstOrDefault().EmployeeID, 1, "Thất bại");
                     //Thêm mới lịch sử hoạt động
                     return(-1); //Tài khoản đã bị khóa
                 }
             }
             else
             {
                 historyDAO.Insert(user.FirstOrDefault().EmployeeID, 1, "Thất bại");
                 //Thêm mới lịch sử hoạt động
                 return(2); //Mật khẩu không chính xác
             }
         }
         else
         {
             return(-2); //Tài khoản không tồn tại
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(0); //Đã xảy ra lỗi trong quá trình đăng nhập
     }
 }
Beispiel #5
0
 public ucXCam()
 {
     InitializeComponent();
     hDAO   = new HistoryDAO();
     camDAO = new CameraDAO();
     fDAO   = new FaceDAO();
     pDAO   = new PeopleDAO();
     #region [Khởi tạo camera]
     _recognizerEngine       = new RecognizerEngine(_trainerDataPath, 1);
     _recognizerEngineunKnow = new RecognizerEngine(_trainerDataPath, 2);
     _cascadeClassifier      = new CascadeClassifier("haarcascade_frontalface_default.xml");
     #endregion
 }
        public ActionResult ShowHistory(int page = 0)
        {
            MerchantHistoryModel ToShow = new MerchantHistoryModel();

            ToShow.MHistory = new List <WebHistory>();
            String ID = GetFromIDCookie();

            if (ID == null)
            {
                return(RedirectToAction("SelectMerchantForEdit"));
            }
            if (ID.Length < 1)
            {
                return(RedirectToAction("SelectMerchantForEdit"));
            }
            int mID    = Convert.ToInt32(ID);
            int hcount = 0;

            ToShow.PageIndex = page;
            try
            {
                IHistoryDAO tHistoryDAO = new HistoryDAO();

                List <CardHistory> cHistory = tHistoryDAO.GetMerchantHistory(mID, page, 15);
                foreach (CardHistory ch in cHistory)
                {
                    WebHistory HI = new WebHistory();
                    HI.ID         = ch.ID.ToString();
                    HI.When       = ch.When.ToShortDateString();
                    HI.CardNumber = ch.CardNumber;
                    HI.TransType  = ch.Transaction;
                    HI.Amount     = ch.Amount.ToString();
                    if (ch.PointsGranted != null)
                    {
                        HI.PointsGranted = ch.PointsGranted.ToString();
                    }
                    ToShow.MHistory.Add(HI);
                    hcount++;
                }
            }
            catch (Exception Ex)
            {
                ModelState.AddModelError("", Common.StandardExceptionErrorMessage(Ex));
            }
            ToShow.HasPreviousPage = (page > 0);
            ToShow.HasNextPage     = (hcount == 15);
            return(View(ToShow));
        }
        public ContentResult DumpHistory()
        {
            StringBuilder Page = new StringBuilder();

            IHistoryDAO   tHistoryRepository = new HistoryDAO();
            List <String> tDump = tHistoryRepository.Dump();

            Page.Append("<p>");
            foreach (String s in tDump)
            {
                Page.Append(s + "<br />");
            }
            Page.Append("</p>");
            //Server.MapPath(".") + "DumpH.txt";
            return(Content(Page.ToString()));
        }
        public ActionResult ReportSummary(DateTime?When, DateTime?StartDate, String Period = "Daily", String Reseller = "", String ChainSelected = "", String MerchantGroup = "", String MerchantSelected = "")
        {
            try
            {
                SummaryReportingData ToShow = new SummaryReportingData();
                using (GiftEntities GiftEntity = new GiftEntities())
                {
                    IHistoryDAO     HistoryRepositoryInstance = new HistoryDAO(GiftEntity);
                    HistoryServices HiInstance = new HistoryServices(GiftEntity);

                    DateTime EndDate;
                    if (When == null)
                    {
                        EndDate = DateTime.Now.Date;
                    }
                    else
                    {
                        EndDate = When.Value;
                    }
                    DateTime ToStart = DateTime.Now.Date;
                    if (StartDate != null)
                    {
                        ToStart = StartDate.Value;
                    }
                    ToShow.ReportData = HiInstance.GetSummaryReport(EndDate, ToStart, Period, Reseller, ChainSelected, MerchantGroup, MerchantSelected);

                    ToShow.When = EndDate;
                    ToShow.When = EndDate;
                }
                return(View(ToShow));
            }
            catch (Exception Ex)
            {
                TempData["Error"] = Common.StandardExceptionErrorMessage(Ex);
                return(RedirectToAction("ViewErrorMessage"));
            }
        }
Beispiel #9
0
 public HistoryServiceImp(HistoryDAO historyDAO)
 {
     this.historyDAO = historyDAO;
 }
 public ucThongKe()
 {
     InitializeComponent();
     hDAO = new HistoryDAO();
 }