//[HttpPost]
        //public ActionResult AddImage()
        //{
        //    st
        //}


        public ActionResult UpdateVe(string id)
        {
            var ve    = DataAccess.db.VEs.SingleOrDefault(x => x.MAVE == id);
            var veNew = new VE();

            veNew = ve;
            if (ve != null)
            {
                if (ve.TINHTRANGVE.MATINHTRANGVE == "tinhtrang01")
                {
                    veNew.MATINHTRANGVE = "tinhtrang02";
                    DataAccess.db.VEs.AddOrUpdate(veNew);
                    DataAccess.db.SaveChanges();
                    return(RedirectToAction("QuanLyVe", "Admin"));
                }
                else
                {
                    return(RedirectToAction("QuanLyVe", "Admin"));
                }
            }
            else
            {
                return(RedirectToAction("QuanLyVe", "Admin"));
            }
        }
        public ActionResult ThemVe(FormCollection f)
        {
            try
            {
                string id = "ve000" + (DataAccess.db.VEs.Count() + 2).ToString();
                var    ve = new VE()
                {
                    MAVE            = id,
                    MATHONGTINCHIEU = f["MaThongTinChieu"],
                    MATV            = f["MaThanhVien"],
                    MATINHTRANGVE   = f["MaTinhTrangVe"],
                    MAVOUCHER       = f["MaVoucher"],
                    DONGIA          = (int?)int.Parse(f["DonGia"]),
                };
                DataAccess.db.VEs.Add(ve);
                DataAccess.db.SaveChanges();

                return(RedirectToAction("QuanLyVe", "Admin"));
            }
            catch (Exception e)
            {
                //throw
                return(RedirectToAction("QuanLyVe", "Admin"));
            }
        }
Exemplo n.º 3
0
        public VirtualFolder GetSubFolderByPathRecursive(string FilePathRelative, bool IncludeDeleted = false)
        {
            foreach (VirtualElement VE in SubElements.Where(x => x.ElementType == VirtualElementType.Folder))
            {
                if (IncludeDeleted)
                {
                    if (VE.PathRelative.Equals(FilePathRelative, StringComparison.OrdinalIgnoreCase))
                    {
                        return((VirtualFolder)VE);
                    }
                }
                else
                {
                    if (VE.PathRelative.Equals(FilePathRelative, StringComparison.OrdinalIgnoreCase) && !VE.IsDeleted)
                    {
                        return((VirtualFolder)VE);
                    }
                }
            }

            foreach (VirtualElement VE in SubElements.Where(x => x.ElementType == VirtualElementType.Folder))
            {
                VirtualFolder VF = VE.GetSubFolderByPathRecursive(FilePathRelative, IncludeDeleted);
                if (VF != null)
                {
                    return(VF);
                }
            }

            return(null);
        }
Exemplo n.º 4
0
        public VirtualFolder GetSubFolderByIDRecursive(Guid FolderId, bool IncludeDeleted = false)
        {
            foreach (VirtualElement VE in SubElements.Where(x => x.ElementType == VirtualElementType.Folder))
            {
                if (IncludeDeleted)
                {
                    if (VE.ElementId.Equals(FolderId))
                    {
                        return((VirtualFolder)VE);
                    }
                }
                else
                {
                    if (VE.ElementId.Equals(FolderId) && !VE.IsDeleted)
                    {
                        return((VirtualFolder)VE);
                    }
                }
            }

            foreach (VirtualElement VE in SubElements.Where(x => x.ElementType == VirtualElementType.Folder))
            {
                VirtualFolder VF = VE.GetSubFolderByIDRecursive(FolderId, IncludeDeleted);
                if (VF != null)
                {
                    return(VF);
                }
            }

            return(null);
        }
Exemplo n.º 5
0
        public ActionResult Edit([Bind(Include = "GiaMua,MaChuyen,TramLen,TramXuong,GioDi,MaXe")] VE vE, string strGhe, string MaKH, string maVe)
        {
            if (ModelState.IsValid)
            {
                if (strGhe != "" && MaKH != "")
                {
                    if (maVe != "")
                    {
                        VE vE_Delete = service.LoadVeWWithMaVe(int.Parse(maVe));
                        vE_Delete.isDeleted = 1;
                        service.Delete(vE_Delete);
                    }

                    string[] dsGhe   = strGhe.Split(',');
                    DateTime current = DateTime.Now;
                    for (int i = 0; i < dsGhe.Length; i++)
                    {
                        vE.MaKH      = int.Parse(MaKH);
                        vE.MaGhe     = int.Parse(dsGhe[i]);
                        vE.isDeleted = 0;
                        vE.NgayMua   = current;
                        service.Add(vE);
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(vE));
        }
Exemplo n.º 6
0
        public ActionResult DeleteConfirmed(int id)
        {
            VE vE = db.VEs.Find(id);

            db.VEs.Remove(vE);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
 public void CancelAllActionsRecursive(Int32?CallerTaskId)
 {
     ActionInvalidateAll(CallerTaskId);
     foreach (VirtualElement VE in this.SubElements)
     {
         VE.CancelAllActionsRecursive(CallerTaskId);
     }
 }
Exemplo n.º 8
0
 private void VE_MouseDown(object sender, MouseEventArgs e)
 {
     VE.Refresh();
     start       = e.Location;
     pre         = start;
     selected    = false;
     paintting   = true;
     Check_Mouse = true;
 }
Exemplo n.º 9
0
 public ActionResult Edit([Bind(Include = "MaVe,NgayMua,GiaMua,MaGhe,MaXe,MaChuyen,MaKH,TramLen,TramXuong,GioDi,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] VE vE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vE));
 }
Exemplo n.º 10
0
 /// <summary>
 /// Recalcule le chemin jusqu'à la racine pour tous les éléments enfants de cet élément (ne s'applique qu'aux répertoires)
 /// </summary>
 public void RecomputePathToRootForAllSubElements()
 {
     foreach (VirtualElement VE in this.GetSubElementsFilesAndFolders())
     {
         VE.PathToRoot = this.PathRelative + Path.DirectorySeparatorChar;
         if (VE.ElementType == VirtualElementType.Folder)
         {
             VE.RecomputePathToRootForAllSubElements();
         }
     }
 }
Exemplo n.º 11
0
        // GET: VEs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VE vE = db.VEs.Find(id);

            if (vE == null)
            {
                return(HttpNotFound());
            }
            return(View(vE));
        }
Exemplo n.º 12
0
        private void Form1_Load(object sender, EventArgs e)
        {
            VE[] list =
            {
                new VE("init",        VE.TailOr("a", "b",  "c"), InitState, () => { SetLog("!"); }),
                new VE("a",           "b",           () => { SetLog("a->b"); }),
                new VE("b",           "a",           () => { SetLog("b->a"); }),
                new VE("a",           "a",           () => { SetLog("a->a"); }),
                new VE("b",           "b",           () => { SetLog("b->b"); }),
                new VE(VE.HeadOr("a", "b"),          "c",  () => { SetLog("a|b->c"); }),
                new VE("c",           VE.TailOr("a", "b"), () => { SetLog("c->a|b"); })
            };

            m_stateVector = new StateVector("init", list);
        }
Exemplo n.º 13
0
        public ActionResult DeleteMany()
        {
            string temp = Request.Form["deletecheckbox"];

            if (temp == null)
            {
                return(RedirectToAction("Index"));
            }
            string[] listDelete = temp.Split(',');
            for (int i = 0; i < listDelete.Length; i++)
            {
                VE vE = service.LoadVeWWithMaVe(int.Parse(listDelete[i]));
                vE.isDeleted = 1;
                service.Delete(vE);
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 14
0
        public void Delete(VE v)
        {
            var user = HttpContext.Current.Session[GlobalConstant.USER];

            if (user != null)
            {
                NHANVIEN currentUser = (NHANVIEN)user;
                v.lastupdateUser = currentUser.MaNV;
            }
            DateTime current = DateTime.Now;

            v.lastupdateDate = current;
            using (QLXeKhachEntities context = new QLXeKhachEntities())
            {
                context.Entry(v).State = EntityState.Modified;
                context.SaveChanges();
            }
        }
Exemplo n.º 15
0
 public int Add(VE v)
 {
     using (QLXeKhachEntities context = new QLXeKhachEntities())
     {
         var user = HttpContext.Current.Session[GlobalConstant.USER];
         if (user != null)
         {
             NHANVIEN currentUser = (NHANVIEN)user;
             v.createUser     = currentUser.MaNV;
             v.lastupdateUser = currentUser.MaNV;
         }
         DateTime current = DateTime.Now;
         v.createDate     = current;
         v.lastupdateDate = current;
         context.VEs.Add(v);
         context.SaveChanges();
         return(1);
     }
 }
Exemplo n.º 16
0
        private void SubElementsDeleteAllRecursive(List <VirtualElementDeleted> RemovedElements, Int32?CallerTaskId)
        {
            lock (SubElementLock)
            {
                foreach (VirtualElement VE in this.SubElements.ToList())
                {
                    VE.ActionInvalidateAll(CallerTaskId);
                    VE.SubElementsDeleteAllRecursive(RemovedElements, CallerTaskId);

                    if (RemovedElements != null)
                    {
                        RemovedElements.Add(new VirtualElementDeleted()
                        {
                            ElementId = VE.ElementId, ElementType = VE.ElementType
                        });
                    }
                    this.SubElements.Remove(VE);
                }
            }
        }
Exemplo n.º 17
0
        public void Refresh_OK_ab_FuncList()
        {
            // 状態Aから状態Bへの変化条件が登録済みのため動作する
            int lambdaCheck = 0;

            VEFD func = () => { lambdaCheck = 1; };//<Refresh_OK_ab>g__func|0

            VE[] list =
            {
                new VE("a", "b",
                       VE.Func(() => { lambdaCheck = 1; }), /* <Refresh_OK_ab>b__1 */
                       func,                                /* <Refresh_OK_ab_FuncList>b__0 */
                       NameCheckFunc,                       /* NameCheckFunc */
                       () => { lambdaCheck = 1; } /* <Refresh_OK_ab_FuncList>b__2 */)
            };
            ins = new TW_StateVector("Refresh_OK_ab_FuncList", "a", list);
            ins.EnableRefreshTrace = true;
            ins.Refresh("b");
            Assert.AreEqual(1, lambdaCheck);
        }
Exemplo n.º 18
0
        public void Refresh_OK_ab_bb()
        {
            // 状態A or Bから状態Bへの変化条件が登録済みのため動作する
            int lambdaCheck = 0;

            VEFD func = () => { lambdaCheck++; };

            VE[] list =
            {
                new VE(
                    VE.HeadOr("a", "b"),
                    "b",
                    VE.Func(func))
            };
            ins = new TW_StateVector("Refresh_OK_ab_bb", "a", list);
            ins.EnableRefreshTrace = true;
            ins.Refresh("b");
            Assert.AreEqual(1, lambdaCheck);
            ins.Refresh("b");
            Assert.AreEqual(2, lambdaCheck);
        }
Exemplo n.º 19
0
        public void Refresh_OK_ab_ac()
        {
            // 状態Aから状態B or Cへの変化条件が登録済みのため動作する
            int lambdaCheck = 0;

            VEFD func = () => { lambdaCheck++; };

            VE[] list =
            {
                new VE(
                    "a",
                    VE.TailOr("b","c"),
                    func)
            };
            ins = new TW_StateVector("Refresh_OK_ab_ac", "a", list);
            ins.EnableRefreshTrace = true;
            ins.Refresh("b");
            Assert.AreEqual(1, lambdaCheck);
            ins.StateNow = "a";
            ins.Refresh("c");
            Assert.AreEqual(2, lambdaCheck);
        }
        public ActionResult SuccessResult()
        {
            if (Session["Taikhoan"] != null)
            {
                var kh = (THANHVIEN)Session["Taikhoan"];
                if (Session["MaVoucher"].ToString() == "")
                {
                    var ve = new VE()
                    {
                        MAVE            = "ve000" + (DataAccess.db.VEs.Count() + 2).ToString(),
                        DONGIA          = Int32.Parse(Session["ThanhTien"].ToString()),
                        MATHONGTINCHIEU = Session["MaThongTinChieu"].ToString(),
                        MATV            = kh.MATV,
                        MATINHTRANGVE   = "tinhtrang01"
                    };
                    Session["MaVe"] = ve.MAVE;
                    DataAccess.db.VEs.Add(ve);
                    string sIn = Session["Ghe"].ToString();

                    Regex lineSplitter = new Regex(@"[\s*\*]*\|[\s*\*]*");
                    var   columns      = lineSplitter.Split(sIn).Where(s => s != String.Empty);
                    foreach (var s1 in sIn.Split(' '))
                    {
                        if (s1.Length >= 2)
                        {
                            var ghe = DataAccess.GetGheByKey(Session["MaThongTinChieu"].ToString(), s1);
                            ghe.MAVE   = ve.MAVE;
                            ghe.IsUsed = 1;
                            DataAccess.db.GHEs.AddOrUpdate(ghe);

                            DataAccess.db.SaveChanges();
                        }
                    }
                }
                else
                {
                    var ve = new VE()
                    {
                        MAVE            = "ve000" + (DataAccess.db.VEs.Count() + 2).ToString(),
                        MAVOUCHER       = Session["MaVoucher"].ToString(),
                        DONGIA          = Int32.Parse(Session["ThanhTien"].ToString()),
                        MATHONGTINCHIEU = Session["MaThongTinChieu"].ToString(),
                        MATV            = kh.MATV,
                        MATINHTRANGVE   = "tinhtrang01"
                    };
                    Session["MaVe"] = ve.MAVE;
                    DataAccess.db.VEs.Add(ve);
                    string sIn = Session["Ghe"].ToString();

                    Regex lineSplitter = new Regex(@"[\s*\*]*\|[\s*\*]*");
                    var   columns      = lineSplitter.Split(sIn).Where(s => s != String.Empty);
                    foreach (var s1 in sIn.Split(' '))
                    {
                        if (s1.Length >= 2)
                        {
                            var ghe = DataAccess.GetGheByKey(Session["MaThongTinChieu"].ToString(), s1);
                            ghe.MAVE   = ve.MAVE;
                            ghe.IsUsed = 1;
                            DataAccess.db.GHEs.AddOrUpdate(ghe);
                            DataAccess.db.SaveChanges();
                        }
                    }
                }

                string content = System.IO.File.ReadAllText(Server.MapPath("~/Mail-Booking.html"));

                content = content.Replace("{{mave}}", Session["MaVe"].ToString());
                content = content.Replace("{{tenphim}}", Session["TenPhim"].ToString());
                content = content.Replace("{{tenrap}}", Session["TenRap"].ToString());
                content = content.Replace("{{phong}}", Session["PhongChieu"].ToString());
                content = content.Replace("{{ghe}}", Session["Ghe"].ToString());
                content = content.Replace("{{ngaychieu}}", Session["NgayChieu"].ToString().Substring(0, 9));
                content = content.Replace("{{suatchieu}}", Session["GioChieu"].ToString());

                new MailHelper().SendMail(kh.EMAIL, "Thông tin đặt vé ", content);

                Session["MaVe"]            = null;
                Session["TenPhim"]         = null;
                Session["MaThongTinChieu"] = null;
                Session["TenRap"]          = null;
                Session["NgayChieu"]       = null;
                Session["GioChieu"]        = null;
                Session["PhongChieu"]      = null;
                Session["MaVoucher"]       = null;
                return(View());
            }
            else
            {
                return(RedirectToAction("DangNhap", "NguoiDung"));
            }
        }
Exemplo n.º 21
0
        public ActionResult Create([Bind(Include = "TenKH,SDT,CMND,DiaChi,Email")] KHACHHANG KH, [Bind(Include = "GiaMua,MaChuyen,TramLen,TramXuong,GioDi,MaXe")] VE vE, string strGhe, string MaKH)
        {
            if (ModelState.IsValid)
            {
                if (strGhe != "")
                {
                    string[] dsGhe   = strGhe.Split(',');
                    int      maKHNew = -1;
                    if (MaKH == "")
                    {
                        KH.isDeleted = 0;
                        maKHNew      = khService.Add(KH);
                    }
                    else
                    {
                        maKHNew = int.Parse(MaKH);
                    }
                    DateTime current = DateTime.Now;
                    for (int i = 0; i < dsGhe.Length; i++)
                    {
                        vE.MaKH      = maKHNew;
                        vE.MaGhe     = int.Parse(dsGhe[i]);
                        vE.isDeleted = 0;
                        vE.NgayMua   = current;
                        service.Add(vE);
                    }
                }
                return(RedirectToAction("Index"));
            }

            return(View(vE));
        }
Exemplo n.º 22
0
        //Vẽ tự do
        private void VE_MouseMove(object sender, MouseEventArgs e)
        {
            end = e.Location;
            Bitmap bmp;

            if (VE.Image == null)
            {
                bmp = new Bitmap(VE.Width, VE.Height);
            }
            else
            {
                bmp = (Bitmap)VE.Image.Clone();
            }
            if (paintting)
            {
                if (specialkey == 0)
                {
                    switch (control)
                    {
                    case 1:
                        VE.Refresh();
                        break;

                    case 2:
                        VE.Refresh();
                        break;

                    case 3:
                        VE.Image = bmp;
                        VE.Refresh();
                        break;

                    case 4:
                        VE.Refresh();
                        break;

                    case 5:
                        VE.Refresh();
                        break;

                    case 6:
                        VE.Refresh();
                        break;

                    case 10:     // Freedom draw
                        LineDraw(bmp, pre, end, color);
                        pre = end;
                        backup.Add(VE.Image);
                        VE.Image = bmp;
                        break;

                    case 11:     // selection
                        VE.Refresh();
                        break;
                    }
                }
                else
                {
                    switch (control)
                    {
                    case 1:
                        LineDraw(bmp, start, end, color);
                        VE.Image = bmp;
                        break;

                    case 2:
                        CircleMidpointDraw(bmp, start, end, color);
                        VE.Image = bmp;
                        break;

                    case 3:
                        VeTamGiacVuong(bmp, start, end, color);
                        VE.Image = bmp;
                        break;

                    case 4:
                        VeElip(bmp, start, end, color);
                        VE.Image = bmp;
                        break;

                    case 5:
                        VeHinhChuNhat(bmp, start, end, color);
                        VE.Image = bmp;
                        break;

                    case 6:
                        VE.Refresh();
                        break;

                    case 10:     // Freedom draw
                        LineDraw(bmp, pre, end, color);
                        pre = end;
                        backup.Add(VE.Image);
                        VE.Image = bmp;
                        break;

                    case 11:     // selection
                        VE.Refresh();
                        break;
                    }
                }
            }
        }