Beispiel #1
0
        /// <summary>
        /// Phương thức thêm mới nhân viên
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="hoTen"></param>
        /// <param name="email"></param>
        /// <param name="sdt"></param>
        /// <param name="soThe"></param>
        /// <param name="gioiTinh"></param>
        /// <param name="ngaySinh"></param>
        /// <param name="passWord"></param>
        /// <param name="idXaPhuong"></param>
        public static void ThemMoiNhanVien(string userName, string hoTen, string email, string sdt, string soThe, string gioiTinh, string ngaySinh, string passWord, string idXaPhuong)
        {
            DateTime ns   = XuLyNgayThang.XuLyChuoiNgayThang(ngaySinh);
            int      idXP = int.Parse(idXaPhuong);
            bool     gt   = (gioiTinh == "Nam") ? true : false;

            DAL.DAL_QuanLyTaiKhoan.DAL_NhanVien.Nhanvien_Inser(userName, hoTen, email, sdt, soThe, gt, ns, passWord, idXP);
        }
        /// <summary>
        /// Phương thức thêm mới phim
        /// </summary>
        /// <param name="tenPhim"></param>
        /// <param name="anhDaiDien"></param>
        /// <param name="maTheLoai"></param>
        /// <param name="maQuocGia"></param>
        /// <param name="thoiLuong"></param>
        /// <param name="khoiChieu"></param>
        /// <param name="ketThuc"></param>
        /// <param name="daoDien"></param>
        /// <param name="noiDung"></param>
        /// <param name="trailer"></param>
        /// <param name="maDinhDang"></param>
        /// <param name="maNhanVien"></param>
        public static void Themmoiphim(string tenPhim, string anhDaiDien, int maTheLoai, int maQuocGia, string thoiLuong, string khoiChieu, string ketThuc,
                                       string daoDien, string noiDung, string trailer, int maDinhDang, int maNhanVien)
        {
            DateTime kc, kt;

            kc = XuLyNgayThang.XuLyChuoiNgayThang(khoiChieu);
            kt = XuLyNgayThang.XuLyChuoiNgayThang(ketThuc);
            DAL.DAL_QuanLyPhim.DAL_Phim.Phim_Inser(tenPhim, anhDaiDien, maTheLoai, maQuocGia, thoiLuong, kc, kt, daoDien, noiDung, trailer, maDinhDang, maNhanVien);
        }
        /// <summary>
        /// Phương thức thêm mới thành viên
        /// </summary>
        /// <param name="hoTen"></param>
        /// <param name="email"></param>
        /// <param name="sdt"></param>
        /// <param name="soThe"></param>
        /// <param name="gioiTinh"></param>
        /// <param name="ngaySinh"></param>
        /// <param name="passWord"></param>
        /// <param name="idXaPhuong"></param>
        /// <param name="trangThai"></param>
        public static void ThemMoiThanhVien(string hoTen, string email, string sdt, string soThe, string gioiTinh, string ngaySinh, string passWord, string idXaPhuong, string trangThai)
        {
            DateTime ns   = XuLyNgayThang.XuLyChuoiNgayThang(ngaySinh);
            int      idXP = int.Parse(idXaPhuong);
            bool     gt   = (gioiTinh == "Nam") ? true : false;
            bool     tt   = (trangThai == "Đã kích hoạt") ? true : false;

            DAL.DAL_QuanLyTaiKhoan.DAL_ThanhVien.ThanhVien_Inser(hoTen, email, sdt, soThe, gt, ns, MaHoa.MaHoaMD5(passWord), idXP, tt);
        }
Beispiel #4
0
        /// <summary>
        /// Phương thức cập nhật KTG
        /// </summary>
        /// <param name="maKTG"></param>
        /// <param name="ngayChieu"></param>
        /// <param name="gioChieu"></param>
        public static void CapNhatKTG(int maKTG, string ngayChieu, string gioChieu)
        {
            DataTable dt = DAL.DAL_QuanLyLichChieu.DAL_KhungThoiGian.ThongTinKTGTheoMa(maKTG);

            if (dt.Rows.Count > 0)
            {
                DateTime nc = XuLyNgayThang.XuLyChuoiNgayThang(ngayChieu);
                DAL.DAL_QuanLyLichChieu.DAL_KhungThoiGian.KTG_Update(maKTG, nc, gioChieu);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Phương thức cập nhật nhân viên
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="hoTen"></param>
        /// <param name="email"></param>
        /// <param name="sdt"></param>
        /// <param name="soThe"></param>
        /// <param name="gioiTinh"></param>
        /// <param name="ngaySinh"></param>
        /// <param name="passWord"></param>
        /// <param name="idXaPhuong"></param>
        /// <param name="maNhanVien"></param>
        public static void CapNhatNhanVien(string userName, string hoTen, string email, string sdt, string soThe, string gioiTinh, string ngaySinh, string passWord, string idXaPhuong, int maNhanVien)
        {
            DataTable dt = DAL.DAL_QuanLyTaiKhoan.DAL_NhanVien.LayNhanvienTheoMa(maNhanVien);

            if (dt.Rows.Count > 0)
            {
                DateTime ns   = XuLyNgayThang.XuLyChuoiNgayThang(ngaySinh);
                int      idXP = int.Parse(idXaPhuong);
                bool     gt   = (gioiTinh == "Nam" || gioiTinh == "nam") ? true : false;
                DAL.DAL_QuanLyTaiKhoan.DAL_NhanVien.Nhanvien_Update(userName, hoTen, email, sdt, soThe, gt, ns, passWord, idXP, maNhanVien);
            }
        }
        /// <summary>
        /// Phương thức cập nhật phim
        /// </summary>
        /// <param name="maPhim"></param>
        /// <param name="tenPhim"></param>
        /// <param name="anhDaiDien"></param>
        /// <param name="maTheLoai"></param>
        /// <param name="maQuocGia"></param>
        /// <param name="thoiLuong"></param>
        /// <param name="khoiChieu"></param>
        /// <param name="ketThuc"></param>
        /// <param name="daoDien"></param>
        /// <param name="noiDung"></param>
        /// <param name="trailer"></param>
        /// <param name="maDinhDang"></param>
        /// <param name="maNhanVien"></param>
        public static void CapNhatPhim(int maPhim, string tenPhim, string anhDaiDien, int maTheLoai, int maQuocGia, string thoiLuong, string khoiChieu, string ketThuc,
                                       string daoDien, string noiDung, string trailer, int maDinhDang, int maNhanVien)
        {
            DataTable dt = DAL.DAL_QuanLyPhim.DAL_Phim.ThongTinPhimTheoMa(maPhim);

            if (dt.Rows.Count > 0)
            {
                DateTime kc, kt;
                kc = XuLyNgayThang.XuLyChuoiNgayThang(khoiChieu);
                kt = XuLyNgayThang.XuLyChuoiNgayThang(ketThuc);
                DAL.DAL_QuanLyPhim.DAL_Phim.Phim_Update(maPhim, tenPhim, anhDaiDien, maTheLoai, maQuocGia, thoiLuong, kc, kt, daoDien, noiDung, trailer, maDinhDang, maNhanVien);
            }
        }
        /// <summary>
        /// Phương thức cập nhật Thành viên
        /// </summary>
        /// <param name="hoTen"></param>
        /// <param name="email"></param>
        /// <param name="sdt"></param>
        /// <param name="soThe"></param>
        /// <param name="gioiTinh"></param>
        /// <param name="ngaySinh"></param>
        /// <param name="passWord"></param>
        /// <param name="idXaPhuong"></param>
        /// <param name="trangThai"></param>
        /// <param name="maThanhVien"></param>
        public static void CapNhatThanhVien(string hoTen, string email, string sdt, string soThe, string gioiTinh, string ngaySinh, string passWord, string idXaPhuong, string trangThai, int maThanhVien)
        {
            DataTable dt = DAL.DAL_QuanLyTaiKhoan.DAL_ThanhVien.ThongTinThanhVienByMa(maThanhVien);

            if (dt.Rows.Count > 0)
            {
                DateTime ns   = XuLyNgayThang.XuLyChuoiNgayThang(ngaySinh);
                int      idXP = int.Parse(idXaPhuong);
                bool     gt   = (gioiTinh == "Nam") ? true : false;
                bool     tt   = (trangThai == "Đã kích hoạt") ? true : false;
                DAL.DAL_QuanLyTaiKhoan.DAL_ThanhVien.ThanhVien_Update(hoTen, email, sdt, soThe, gt, ns, passWord, idXP, tt, maThanhVien);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Thêm mới KTG
        /// </summary>
        /// <param name="ngayChieu"></param>
        /// <param name="gioChieu"></param>
        public static void ThemMoiKTG(string ngayChieu, string gioChieu)
        {
            DateTime nc = XuLyNgayThang.XuLyChuoiNgayThang(ngayChieu);

            DAL.DAL_QuanLyLichChieu.DAL_KhungThoiGian.KTG_Insert(nc, gioChieu);
        }
        public ActionResult Update_UserMetas(HttpPostedFileBase file)
        {
            try
            {
                DataSet ds = new DataSet();
                if (Request.Files["file"].ContentLength > 0)
                {
                    string fileExtension = System.IO.Path.GetExtension(Request.Files["file"].FileName);

                    if (fileExtension == ".xls" || fileExtension == ".xlsx")
                    {
                        string fileLocation = Server.MapPath("~/Content/") + Request.Files["file"].FileName;
                        if (System.IO.File.Exists(fileLocation))
                        {
                            System.IO.File.Delete(fileLocation);
                        }
                        Request.Files["file"].SaveAs(fileLocation);
                        string excelConnectionString = string.Empty;
                        excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
                        //connection String for xls file format.
                        if (fileExtension == ".xls")
                        {
                            excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
                        }
                        //connection String for xlsx file format.
                        else if (fileExtension == ".xlsx")
                        {
                            excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
                        }
                        //Create Connection to Excel work book and add oledb namespace
                        OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
                        excelConnection.Open();
                        DataTable dt = new DataTable();

                        dt = excelConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                        if (dt == null)
                        {
                            return(null);
                        }

                        String[] excelSheets = new String[dt.Rows.Count];
                        int      t           = 0;
                        //excel data saves in temp file here.
                        foreach (DataRow row in dt.Rows)
                        {
                            excelSheets[t] = row["TABLE_NAME"].ToString();
                            t++;
                        }
                        OleDbConnection excelConnection1 = new OleDbConnection(excelConnectionString);


                        string query = string.Format("Select * from [{0}]", excelSheets[0]);
                        using (OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, excelConnection1))
                        {
                            dataAdapter.Fill(ds);
                        }
                    }
                    if (fileExtension.ToString().ToLower().Equals(".xml"))
                    {
                        string fileLocation = Server.MapPath("~/Content/") + Request.Files["FileUpload"].FileName;
                        if (System.IO.File.Exists(fileLocation))
                        {
                            System.IO.File.Delete(fileLocation);
                        }

                        Request.Files["FileUpload"].SaveAs(fileLocation);
                        XmlTextReader xmlreader = new XmlTextReader(fileLocation);
                        // DataSet ds = new DataSet();
                        ds.ReadXml(xmlreader);
                        xmlreader.Close();
                    }
                    so_dong_thanh_cong = 0;
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        string usname = ds.Tables[0].Rows[i][0].ToString();
                        var    query  = (from u in db.USERS
                                         where u.USERNAME == usname
                                         select u).FirstOrDefault();
                        int id         = query.USER_ID;
                        var query_meta = (from u in db.USER_METAS
                                          where u.USER_ID == id
                                          select u).FirstOrDefault();

                        //query.USERNAME = ds.Tables[0].Rows[i][0].ToString();
                        query_meta.DEPARTMENT_ID = ds.Tables[0].Rows[i][1].ToString();
                        query_meta.SEX           = ds.Tables[0].Rows[i][2].ToString();
                        query_meta.BIRTHDAY      = xuLyNgayThang.XuLyChuoiNgayThang(ds.Tables[0].Rows[i][3].ToString());
                        query_meta.START_TIME    = xuLyNgayThang.XuLyChuoiNgayThang(ds.Tables[0].Rows[i][4].ToString());
                        query_meta.NUMBER_PHONE  = ds.Tables[0].Rows[i][5].ToString();
                        query_meta.SENIORITY     = ds.Tables[0].Rows[i][6].ToString();
                        query_meta.NATIVE_LAND   = ds.Tables[0].Rows[i][7].ToString();
                        query_meta.LITERACY      = ds.Tables[0].Rows[i][8].ToString();

                        //db.USERS.Add(query);

                        db.SaveChanges();
                        so_dong_thanh_cong++;
                    }
                }
            }
            catch (Exception Ex)
            {
                ViewBag.Error = " Đã xảy ra lỗi, Liên hệ ngay với admin. " + Environment.NewLine + " Thông tin chi tiết về lỗi:" + Environment.NewLine + Ex;
            }
            finally
            {
                ViewBag.Message = "Đã import thành công " + so_dong_thanh_cong + " dòng";
            }

            return(View());
        }