Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Models.LoaiQuanHeEntity loaiquanheEntity = new Models.LoaiQuanHeEntity();
            if (!IsPostBack)
            {
                RadDatePickerNgaySinh.SelectedDate = DateTime.Now.AddYears(-18);
                loaiquanheEntity.Load_AllLoaiQuanHe_ToRadComboBox(cbbQuanHe);
            }

            if (this.Page.RouteData.Values["quanhe"] != null)
            {
                this.UpdateStatus();
                _quanheID = Convert.ToInt32(Page.RouteData.Values["quanhe"]);
                Models.QuanHe quanhe = _quanheEntity.Find(_quanheID);
                _nhanvienID = quanhe.NVID;
                if (!IsPostBack)
                {
                    RadioButtonListBenVo.SelectedValue = quanhe.QHBenVo.ToString();
                    RadTextBoxTen.Text = quanhe.QHTen;
                    RadDatePickerNgaySinh.SelectedDate = Convert.ToDateTime(quanhe.QHNgaySinh);
                    RadTextBoxHoKhau.Text   = quanhe.QHHoKhau;
                    RadTextBoxNoiO.Text     = quanhe.QHNoiO;
                    cbbQuanHe.SelectedValue = quanhe.LQHID.ToString();
                    RadioButtonListGioiTinh.SelectedValue = quanhe.QHGioiTinh.ToString();
                }
            }
            else
            {
                this.CreateStatus();
                _nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]);
            }
        }
Пример #2
0
 public void Delete(int _quanheID)
 {
     Models.EmployeeManagementEntities db = new EmployeeManagementEntities();
     Models.QuanHe quanhe = db.QuanHes.FirstOrDefault(x => x.QHID == _quanheID);
     db.QuanHes.Remove(quanhe);
     db.SaveChanges();
     db.Dispose();
 }
Пример #3
0
 private string ConvertGioiTinh(Models.QuanHe _quanhe)
 {
     if (_quanhe.QHGioiTinh)
     {
         return("Nam");
     }
     else
     {
         return("Nữ");
     }
 }
Пример #4
0
 public void Update(int _quanheID, string _ten, DateTime _ngaysinh, string _noio, int _loaiquanheID, bool _benvo, string _hokhau, bool _gioitinh)
 {
     Models.EmployeeManagementEntities db = new EmployeeManagementEntities();
     Models.QuanHe quanhe = db.QuanHes.FirstOrDefault(x => x.QHID == _quanheID);
     quanhe.QHTen      = _ten;
     quanhe.QHNgaySinh = _ngaysinh;
     quanhe.QHNoiO     = _noio;
     quanhe.LQHID      = _loaiquanheID;
     quanhe.QHBenVo    = _benvo;
     quanhe.QHHoKhau   = _hokhau;
     quanhe.QHGioiTinh = _gioitinh;
     db.SaveChanges();
     db.Dispose();
 }
Пример #5
0
 public void Insert(int _nhanvienID, string _ten, DateTime _ngaysinh, string _noio, int _loaiquanheID, bool _benvo, string _hokhau, bool _gioitinh)
 {
     Models.EmployeeManagementEntities db = new EmployeeManagementEntities();
     Models.QuanHe quanhe = new Models.QuanHe();
     quanhe.NVID       = _nhanvienID;
     quanhe.QHTen      = _ten;
     quanhe.QHNgaySinh = _ngaysinh;
     quanhe.QHNoiO     = _noio;
     quanhe.LQHID      = _loaiquanheID;
     quanhe.QHBenVo    = _benvo;
     quanhe.QHHoKhau   = _hokhau;
     quanhe.QHGioiTinh = _gioitinh;
     db.QuanHes.Add(quanhe);
     db.SaveChanges();
     db.Dispose();
 }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["account"] != null)
            {
                string email = Session["account"].ToString();
                Models.AccountEntity accEntity = new Models.AccountEntity();
                Models.Account       account   = accEntity.FindByEmail(email);

                if (account == null)
                {
                    this.RedirectToIndex();
                }
                else if (account.ACCChucNang > 1)
                {
                    if (!account.ACCUpLyLich)
                    {
                        this.RedirectToIndex();
                    }
                    else if (this.Page.RouteData.Values["quanhecongtac"] != null)
                    {
                        try
                        {
                            int congtacID = Convert.ToInt32(this.Page.RouteData.Values["quanhecongtac"]);
                            Models.QuanHeCongTacEntity congtacEntity = new Models.QuanHeCongTacEntity();
                            Models.QuanHeCongTac       congtac       = congtacEntity.Find(congtacID);
                            if (congtac == null)
                            {
                                this.RedirectToIndex();
                            }
                            else if (congtac.QuanHe.NVID != account.NVID)
                            {
                                this.RedirectToIndex();
                            }
                            else
                            {
                                lblNhanVien.Text = congtac.QuanHe.QHTen;
                            }
                        }
                        catch
                        {
                            this.RedirectToIndex();
                        }
                    }
                    else if (this.Page.RouteData.Values["quanhe"] != null)
                    {
                        try
                        {
                            int quanheID = Convert.ToInt32(this.Page.RouteData.Values["quanhe"]);
                            Models.QuanHeEntity quanheEntity = new Models.QuanHeEntity();
                            Models.QuanHe       quanhe       = quanheEntity.Find(quanheID);
                            if (quanhe == null)
                            {
                                this.RedirectToIndex();
                            }
                            else if (quanhe.NVID != account.NVID)
                            {
                                this.RedirectToIndex();
                            }
                            else
                            {
                                lblNhanVien.Text = quanhe.QHTen;
                            }
                        }
                        catch
                        {
                            this.RedirectToIndex();
                        }
                    }
                    else
                    {
                        this.RedirectToIndex();
                    }
                }
                else if (this.Page.RouteData.Values["quanhecongtac"] != null)
                {
                    try
                    {
                        int congtacID = Convert.ToInt32(this.Page.RouteData.Values["quanhecongtac"]);
                        Models.QuanHeCongTacEntity congtacEntity = new Models.QuanHeCongTacEntity();
                        Models.QuanHeCongTac       congtac       = congtacEntity.Find(congtacID);
                        if (congtac == null)
                        {
                            this.RedirectToIndex();
                        }
                        else
                        {
                            lblNhanVien.Text = congtac.QuanHe.QHTen;
                        }
                    }
                    catch (Exception)
                    {
                        this.RedirectToIndex();
                    }
                }
                else if (this.Page.RouteData.Values["quanhe"] != null)
                {
                    try
                    {
                        int quanheID = Convert.ToInt32(this.Page.RouteData.Values["quanhe"]);
                        Models.QuanHeEntity quanheEntity = new Models.QuanHeEntity();
                        Models.QuanHe       quanhe       = quanheEntity.Find(quanheID);
                        if (quanhe == null)
                        {
                            this.RedirectToIndex();
                        }
                        else
                        {
                            lblNhanVien.Text = quanhe.QHTen;
                        }
                    }
                    catch (Exception) { }
                }
                else
                {
                    this.RedirectToIndex();
                }
            }
            else
            {
                this.RedirectToIndex();
            }
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["account"] != null)
            {
                Models.AccountEntity accEntity = new Models.AccountEntity();
                string         email           = Session["account"].ToString();
                Models.Account account         = accEntity.FindByEmail(email);

                if (account == null)
                {
                    this.RedirectToIndex();
                }
                else if (account.ACCChucNang > 1)
                {
                    if (!account.ACCUpLyLich)
                    {
                        this.RedirectToIndex();
                    }
                    else if (this.Page.RouteData.Values["quanhe"] != null)
                    {
                        try
                        {
                            int quanheID = Convert.ToInt32(this.Page.RouteData.Values["quanhe"]);
                            Models.QuanHeEntity qhEntity = new Models.QuanHeEntity();
                            Models.QuanHe       quanhe   = qhEntity.Find(quanheID);
                            if (quanhe == null)
                            {
                                this.RedirectToIndex();
                            }
                            else if (quanhe.NVID != account.NVID)
                            {
                                this.RedirectToIndex();
                            }
                            else
                            {
                                pnlExtraInformation.Visible = true;
                            }
                        }
                        catch
                        {
                            this.RedirectToIndex();
                        }
                    }
                    else if (this.Page.RouteData.Values["nhanvien"] != null)
                    {
                        try
                        {
                            int nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]);
                            if (nhanvienID != account.NVID)
                            {
                                this.RedirectToIndex();
                            }
                            else
                            {
                                Models.NhanVienEntity nvEntity = new Models.NhanVienEntity();
                                Models.NhanVien       nhanvien = nvEntity.Find_NhanVien(nhanvienID);
                                if (nhanvien == null)
                                {
                                    this.RedirectToIndex();
                                }
                            }
                        }
                        catch
                        {
                            this.RedirectToIndex();
                        }
                    }
                    else
                    {
                        this.RedirectToIndex();
                    }
                }
                else if (this.Page.RouteData.Values["quanhe"] != null)
                {
                    try
                    {
                        int quanheID = Convert.ToInt32(this.Page.RouteData.Values["quanhe"]);
                        Models.QuanHeEntity qhEntity = new Models.QuanHeEntity();
                        Models.QuanHe       quanhe   = qhEntity.Find(quanheID);
                        if (quanhe == null)
                        {
                            this.RedirectToIndex();
                        }
                        else
                        {
                            pnlExtraInformation.Visible = true;
                        }
                    }
                    catch
                    {
                        this.RedirectToIndex();
                    }
                }
                else if (this.Page.RouteData.Values["nhanvien"] != null)
                {
                    try
                    {
                        int nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]);
                        Models.NhanVienEntity nvEntity = new Models.NhanVienEntity();
                        Models.NhanVien       nhanvien = nvEntity.Find_NhanVien(nhanvienID);
                        if (nhanvien == null)
                        {
                            this.RedirectToIndex();
                        }
                    }
                    catch
                    {
                        this.RedirectToIndex();
                    }
                }
                else
                {
                    this.RedirectToIndex();
                }
            }
            else
            {
                this.RedirectToIndex();
            }
        }