예제 #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
        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();
            }
        }
예제 #3
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();
            }
        }