//
        //---- LOAD DATA
        //
        #region Load Data
        private void loadData()
        {
            userBUS = new UserBUS();
            List <UserDTO> list = userBUS.select();

            if (list == null)
            {
                MessageBox.Show("Fail");
                return;
            }
            dtgvAccount.Columns.Clear();
            dtgvAccount.DataSource = null;

            dtgvAccount.AutoGenerateColumns = false;
            dtgvAccount.AllowUserToAddRows  = false;
            dtgvAccount.DataSource          = list;

            DataGridViewTextBoxColumn ID = new DataGridViewTextBoxColumn();

            ID.Name             = "idm";
            ID.HeaderText       = "Username";
            ID.DataPropertyName = "idm";
            ID.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dtgvAccount.Columns.Add(ID);

            DataGridViewTextBoxColumn PassWord = new DataGridViewTextBoxColumn();

            PassWord.Name             = "pasword";
            PassWord.HeaderText       = "PassWord";
            PassWord.DataPropertyName = "password";
            PassWord.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dtgvAccount.Columns.Add(PassWord);

            DataGridViewTextBoxColumn NAME = new DataGridViewTextBoxColumn();

            NAME.Name             = "name";
            NAME.HeaderText       = "Name:";
            NAME.DataPropertyName = "name";
            NAME.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dtgvAccount.Columns.Add(NAME);

            DataGridViewTextBoxColumn Gender = new DataGridViewTextBoxColumn();

            Gender.Name             = "gender";
            Gender.HeaderText       = "Gender";
            Gender.DataPropertyName = "gender";
            Gender.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dtgvAccount.Columns.Add(Gender);

            DataGridViewTextBoxColumn CMND = new DataGridViewTextBoxColumn();

            CMND.Name             = "cmnd";
            CMND.HeaderText       = "Identify card";
            CMND.DataPropertyName = "cmnd";
            CMND.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dtgvAccount.Columns.Add(CMND);

            DataGridViewTextBoxColumn pHONE = new DataGridViewTextBoxColumn();

            pHONE.Name             = "phone";
            pHONE.HeaderText       = "PHONE";
            pHONE.DataPropertyName = "phone";
            pHONE.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dtgvAccount.Columns.Add(pHONE);

            DataGridViewTextBoxColumn Email = new DataGridViewTextBoxColumn();

            Email.Name             = "email";
            Email.HeaderText       = "Email";
            Email.DataPropertyName = "email";
            Email.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dtgvAccount.Columns.Add(Email);

            CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[dtgvAccount.DataSource];

            myCurrencyManager.Refresh();
        }
        private void HienThi()
        {
            string nguoiduyet = Session["user"].ToString();
            string maphieu    = Session["maphieu"].ToString();


            string      macongty = Session["congty"].ToString();
            pdna        phieu    = pdnaBUS.TimVanBanTheoMa(maphieu, macongty, true);
            Busers2     users    = UserBUS.TimNhanVienTheoMa(nguoiduyet, macongty);
            BDepartment timdonvi = BDepartmentDAO.TimMaDonVi(phieu.pddepid, macongty);

            Session["mabophan"] = timdonvi.ID;
            Session["bophan"]   = timdonvi.DepName;
            abill  loaiphieu      = abillBUS.SearchAbillByID(phieu.Abtype);
            string tenloaiphieuVN = loaiphieu.abname;
            string tenloaiphieuTW = loaiphieu.abnameTW;

            lbLoaiPhieu.Text      = tenloaiphieuVN + " " + tenloaiphieuTW;
            lbldonvidenghi.Text   = timdonvi.DepName;
            lbSoPhieu.Text        = maphieu;
            lblMucDichSuDung.Text = phieu.UseIntent;
            txtSoPhieu.Text       = maphieu.ToString().Trim();
            string dinhdang = phieu.CFMDate0.ToString();
            string thang    = dinhdang.Substring(3, 2);
            string ngay     = dinhdang.Substring(0, 2);
            string nam      = dinhdang.Substring(6, 4);

            lblNgaytao.Text = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";


            List <Abcon> listchitietxetduyet = AbconBUS.QryChiTietXetDuyetTheoIdVanBan(maphieu, true);
            // Abcon captruoc = AbconBUS.LayCapDuyetTruocCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);

            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(maphieu, macongty);

            {
                if (user0 != null)
                {
                    TextBox1.Text        = user0.USERID;
                    ImageLevel0.Width    = 100;
                    ImageLevel0.Height   = 100;
                    ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
                }
                else
                {
                    ImageLevel0.ImageUrl = null;
                }
            }
            //Abcon caphientai = AbconBUS.LayCapDuyetHienTaiCuaNhanVienTheoVanBan(Until.uNhanVien.USERID, maphieu);
            foreach (Abcon abcon in listchitietxetduyet)
            {
                if (abcon == null)
                {
                    ImageLevel1.ImageUrl = null;
                    ImageLevel2.ImageUrl = null;
                    ImageLevel3.ImageUrl = null;
                    ImageLevel4.ImageUrl = null;
                    ImageLevel5.ImageUrl = null;
                    ImageLevel6.ImageUrl = null;

                    return;
                }
                else
                {
                    List <Abcon> lstChiTietXetDuyet1 = AbconBUS.QryChiTietXetDuyetTheoMaVanBanNguoiTrinhDuyet(maphieu, macongty);
                    int          max = (from ct1 in lstChiTietXetDuyet1
                                        select ct1.Abstep).Max();

                    if (abcon.IDCapDuyet == 5 || abcon.IDCapDuyet == 6)
                    {
                        Busers2 nguoiduyet1 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        //ChucVu chuc = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox2.Text        = nguoiduyet1.USERID;
                            ImageLevel1.Width    = 100;
                            ImageLevel1.Height   = 100;
                            ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhoto1.ashx?USERID=" + TextBox2.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox2.Text        = nguoiduyet1.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel1.Width    = 100;
                                ImageLevel1.Height   = 100;
                                ImageLevel1.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel1.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 7)
                    {
                        if (capduyet == null)
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox3.Text   = nguoiduyet2.USERID;
                                Image1.Width    = 100;
                                Image1.Height   = 100;
                                Image1.ImageUrl = "~/ProcessSignature/MyPhoto8.ashx?USERID=" + TextBox3.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    if (khongduyet != null)
                                    {
                                        lblLyDo.Visible = true;
                                        lblLyDo.Text    = khongduyet.lydokhongduyet;
                                    }

                                    TextBox3.Text      = nguoiduyet2.USERID;
                                    txtKhongDuyet.Text = "027276";
                                    Image1.Width       = 100;
                                    Image1.Height      = 100;
                                    Image1.ImageUrl    = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    Image1.ImageUrl = null;
                                }
                            }
                            capduyet = abcon.IDCapDuyet.ToString();
                        }
                        else
                        {
                            Busers2 nguoiduyet2 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                            if (abcon.abrult == true && abcon.Yn == 1)
                            {
                                TextBox4.Text        = nguoiduyet2.USERID;
                                ImageLevel2.Width    = 100;
                                ImageLevel2.Height   = 100;
                                ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhoto2.ashx?USERID=" + TextBox4.Text;
                            }
                            else
                            {
                                if (abcon.Yn == 2)
                                {
                                    Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                    if (khongduyet != null)
                                    {
                                        lblLyDo.Visible = true;
                                        lblLyDo.Text    = khongduyet.lydokhongduyet;
                                    }

                                    txtKhongDuyet.Text   = "027276";
                                    TextBox4.Text        = nguoiduyet2.USERID;
                                    ImageLevel2.Width    = 100;
                                    ImageLevel2.Height   = 100;
                                    ImageLevel2.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                                }
                                else
                                {
                                    ImageLevel2.ImageUrl = null;
                                }
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 9)
                    {
                        Busers2 nguoiduyet3 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet3.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox5.Text        = nguoiduyet3.USERID;
                            ImageLevel3.Width    = 100;
                            ImageLevel3.Height   = 100;
                            ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhoto3.ashx?USERID=" + TextBox5.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox5.Text        = nguoiduyet3.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel3.Width    = 100;
                                ImageLevel3.Height   = 100;
                                ImageLevel3.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel3.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 13)
                    {
                        Busers2 nguoiduyet4 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet4.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox6.Text        = nguoiduyet4.USERID;
                            ImageLevel4.Width    = 100;
                            ImageLevel4.Height   = 100;
                            ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhoto4.ashx?USERID=" + TextBox6.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox6.Text        = nguoiduyet4.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel4.Width    = 100;
                                ImageLevel4.Height   = 100;
                                ImageLevel4.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel4.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 15 || abcon.IDCapDuyet == 14)
                    {
                        Busers2 nguoiduyet5 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet5.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox7.Text        = nguoiduyet5.USERID;
                            ImageLevel5.Width    = 100;
                            ImageLevel5.Height   = 100;
                            ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhoto5.ashx?USERID=" + TextBox7.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                txtKhongDuyet.Text   = "027276";
                                TextBox7.Text        = nguoiduyet5.USERID;
                                ImageLevel5.Width    = 100;
                                ImageLevel5.Height   = 100;
                                ImageLevel5.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel5.ImageUrl = null;
                            }
                        }
                    }
                    if (abcon.IDCapDuyet == 16)
                    {
                        Busers2 nguoiduyet6 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet6.IDChucVu, macongty);
                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox8.Text        = nguoiduyet6.USERID;
                            ImageLevel6.Width    = 100;
                            ImageLevel6.Height   = 100;
                            ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhoto6.ashx?USERID=" + TextBox8.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox8.Text        = nguoiduyet6.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel6.Width    = 100;
                                ImageLevel6.Height   = 100;
                                ImageLevel6.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel6.ImageUrl = null;
                            }
                        }
                    }

                    else if (abcon.IDCapDuyet == 17)
                    {
                        Busers2 nguoiduyet7 = UserBUS.TimNhanVienTheoMa(abcon.Auditor, macongty);
                        ChucVu  chuc        = ChucVuBUS.TimMaChucVu(nguoiduyet7.IDChucVu, macongty);

                        if (abcon.abrult == true && abcon.Yn == 1)
                        {
                            TextBox9.Text        = nguoiduyet7.USERID;
                            ImageLevel7.Width    = 100;
                            ImageLevel7.Height   = 100;
                            ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhoto7.ashx?USERID=" + TextBox9.Text;
                        }
                        else
                        {
                            if (abcon.Yn == 2)
                            {
                                Abcon khongduyet = AbconDAO.LayPhieuKhongDuyetTheoNguoiDuyet(maphieu, abcon.Auditor, macongty);
                                if (khongduyet != null)
                                {
                                    lblLyDo.Visible = true;
                                    lblLyDo.Text    = khongduyet.lydokhongduyet;
                                }

                                TextBox9.Text        = nguoiduyet7.USERID;
                                txtKhongDuyet.Text   = "027276";
                                ImageLevel7.Width    = 100;
                                ImageLevel7.Height   = 100;
                                ImageLevel7.ImageUrl = "~/ProcessSignature/MyPhotoKhongDuyet.ashx?USERID=" + txtKhongDuyet.Text;
                            }
                            else
                            {
                                ImageLevel7.ImageUrl = null;
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
 public static bool DelMusicHU(int id)
 {
     return(UserBUS.DelMusicHU(id));
 }
Пример #4
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            string mabophan = DropDownBoPhan.SelectedValue.ToString();
            string macongty = DropCty.SelectedValue.ToString();
            // string machuquan="CQDV";
            int      idct        = int.Parse(Session["mact"].ToString());
            string   machucvu    = DropDownChucvu.SelectedValue.ToString();
            string   maloaiphieu = Session["maloaiphieu"].ToString();
            string   maloainguoi = DropDownNguoiKy.SelectedValue.ToString();
            DateTime ngaybatdau  = DateTime.Parse(txtNgayBatDau.Text.ToString());

            //string chuquan = idchuquandv.USERID;
            if (cbThongQua.Checked == true)
            {
                string  machuquan   = "CQDV";
                Busers2 idchuquandv = UserDAO.LayNguoiChuQuanDuyetTheoBoPhan(mabophan, machuquan, macongty);
                if (DropDownNguoiKy.SelectedValue.Equals("2"))
                {
                    ChiTietLoaiPhieu chitiet = new ChiTietLoaiPhieu();
                    chitiet.IDChiTiet     = idct;
                    chitiet.GSBH          = macongty;
                    chitiet.IDChucVu      = machucvu;
                    chitiet.NgayBatdau    = ngaybatdau;
                    chitiet.IDNguoiKy     = machucvu;
                    chitiet.DonViThongQua = mabophan;
                    chitiet.IDLoaiNguoiKy = int.Parse(maloainguoi);
                    ChiTietLoaiPhieuBUS.ThemChiTietLoaiPhieu(chitiet);
                }
                else
                {
                    if (DropDownNguoiKy.SelectedValue.Equals("3"))
                    {
                        //Buser laychucvu = UserBUS.LayNguoiDuyetTheoChucVu(machucvu, macongty);
                        ChiTietLoaiPhieu chitiet = new ChiTietLoaiPhieu();
                        chitiet.IDChiTiet     = idct;
                        chitiet.GSBH          = macongty;
                        chitiet.IDChucVu      = machucvu;
                        chitiet.NgayBatdau    = ngaybatdau;
                        chitiet.IDNguoiKy     = machucvu;
                        chitiet.DonViThongQua = mabophan;
                        chitiet.IDLoaiNguoiKy = int.Parse(maloainguoi);
                        ChiTietLoaiPhieuBUS.ThemChiTietLoaiPhieu(chitiet);
                    }
                    else
                    {
                        if (DropDownNguoiKy.SelectedValue.Equals("4"))
                        {
                            Busers2          laynguoiduyet = UserBUS.LayNguoiDuyetTheoMaNguoiDuyet(txtNguoicodinh.Text, macongty);
                            ChiTietLoaiPhieu chitiet       = new ChiTietLoaiPhieu();
                            chitiet.IDChiTiet = idct;
                            chitiet.GSBH      = macongty;
                            chitiet.IDChucVu  = laynguoiduyet.IDChucVu;
                            // chitiet.abtype = maloaiphieu;
                            chitiet.NgayBatdau    = ngaybatdau;
                            chitiet.DonViThongQua = mabophan;
                            chitiet.IDNguoiKy     = txtNguoicodinh.Text;
                            chitiet.IDLoaiNguoiKy = int.Parse(maloainguoi);
                            ChiTietLoaiPhieuBUS.ThemChiTietLoaiPhieu(chitiet);
                        }
                    }
                }
            }
            else
            {
                if (DropDownNguoiKy.SelectedValue.Equals("2"))
                {
                    ChiTietLoaiPhieu chitiet = new ChiTietLoaiPhieu();
                    chitiet.IDChiTiet = idct;
                    chitiet.GSBH      = macongty;
                    chitiet.IDChucVu  = machucvu;

                    chitiet.IDNguoiKy     = machucvu;
                    chitiet.NgayBatdau    = ngaybatdau;
                    chitiet.IDLoaiNguoiKy = int.Parse(maloainguoi);
                    ChiTietLoaiPhieuBUS.ThemChiTietLoaiPhieu(chitiet);
                }
                else
                {
                    if (DropDownNguoiKy.SelectedValue.Equals("3"))
                    {
                        //Buser laychucvu = UserBUS.LayNguoiDuyetTheoChucVu(machucvu, macongty);
                        ChiTietLoaiPhieu chitiet = new ChiTietLoaiPhieu();
                        chitiet.IDChiTiet  = idct;
                        chitiet.GSBH       = macongty;
                        chitiet.IDChucVu   = machucvu;
                        chitiet.NgayBatdau = ngaybatdau;
                        chitiet.IDNguoiKy  = machucvu;

                        chitiet.IDLoaiNguoiKy = int.Parse(maloainguoi);
                        ChiTietLoaiPhieuBUS.ThemChiTietLoaiPhieu(chitiet);
                    }
                    else
                    {
                        if (DropDownNguoiKy.SelectedValue.Equals("4"))
                        {
                            Busers2          laynguoiduyet = UserBUS.LayNguoiDuyetTheoMaNguoiDuyet(txtNguoicodinh.Text, macongty);
                            ChiTietLoaiPhieu chitiet       = new ChiTietLoaiPhieu();
                            chitiet.IDChiTiet = idct;
                            chitiet.GSBH      = macongty;
                            chitiet.IDChucVu  = laynguoiduyet.IDChucVu;
                            // chitiet.abtype = maloaiphieu;
                            chitiet.NgayBatdau    = ngaybatdau;
                            chitiet.IDNguoiKy     = txtNguoicodinh.Text;
                            chitiet.IDLoaiNguoiKy = int.Parse(maloainguoi);
                            ChiTietLoaiPhieuBUS.ThemChiTietLoaiPhieu(chitiet);
                        }
                    }
                }
            }
            HienThiDanhSach();
            DropDownBoPhan.Enabled  = true;
            DropDownNguoiKy.Enabled = true;
            Response.Redirect("Chitietloaiky.aspx");
        }
Пример #5
0
 public static bool DelPartner(int id)
 {
     return(UserBUS.DelPartner(id));
 }
Пример #6
0
 public static IEnumerable <HistoryUser> GetListMusicHUByIDUser(int id, bool music)
 {
     return(UserBUS.GetListMusicHUByIDUser(id, music));
 }
Пример #7
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            dalPDN   dal       = new dalPDN();
            DateTime date      = DateTime.Today;
            string   ngonngu   = Session["languege"].ToString();
            string   ktmaphieu = (string)Session["ktmaphieu"];
            string   themhang  = (string)Session["themhang"];
            string   mahangcu  = (string)Session["mahangcu"];
            string   sizecu    = (string)Session["sizecu"];
            string   bophan    = DropDonVi.SelectedItem.Value.ToString();
            string   congty    = Session["congty"].ToString();
            string   tieude    = txtTieuDe.Text;
            string   noidung   = CKEditorControl1.Text;
            string   bp        = DropDonVi.SelectedItem.Text;
            string   loaiP     = DropLoaiPhieu.SelectedItem.Text;
            string   mucdich   = txtMucDich.Text;

            string user       = Session["user"].ToString();
            string ngaythang  = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyy/MM/dd");
            string ngaythang1 = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("Ngày " + "dd" + "Tháng " + "MM" + "Năm" + "yyyy");
            //string idphieu = Session["maphieu"].ToString();
            string loaiphieu = DropLoaiPhieu.SelectedValue.ToString();

            Busers2 us = UserBUS.TimMaNhanVienTheoBoPhan(user, bophan, congty);

            if (us == null)
            {
                if (ngonngu == "lbl_VN")
                {
                    lbthongbao.Text   = "Người dùng này không thuộc bộ phận " + bp;
                    tablePMH.Visible  = true;
                    btnLuuTam.Enabled = false;
                    btnTiepTu.Enabled = false;
                }
                else if (ngonngu == "lbl_TW")
                {
                    lbthongbao.Text   = "该用户不属于部门 " + bp;
                    tablePMH.Visible  = true;
                    btnLuuTam.Enabled = false;
                    btnTiepTu.Enabled = false;
                }
                else if (ngonngu == "lbl_EN")
                {
                    lbthongbao.Text   = "The user does not belong to the department" + bp;
                    tablePMH.Visible  = true;
                    btnLuuTam.Enabled = false;
                    btnTiepTu.Enabled = false;
                }
            }
            else
            {
                if (ktmaphieu == null)
                {
                    DataTable dt      = dal.DemSoLuongPhieu();
                    string    maphieu = "";
                    string    a       = dt.Rows[0]["pdno"].ToString().Trim();
                    if (dt.Rows.Count != 0 && a != "")
                    {
                        string dem = (int.Parse(a) + 1).ToString();
                        maphieu = dem;
                    }
                    else
                    {
                        maphieu = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMM") + "00" + 1;
                    }
                    pdna phieun = new pdna();
                    {
                        phieun.GSBH       = congty;
                        phieun.pdno       = maphieu;
                        phieun.pddepid    = bophan;
                        phieun.mytitle    = tieude;
                        phieun.pdmemovn   = noidung;
                        phieun.CFMDate0   = DateTime.Today;
                        phieun.USERID     = user;
                        phieun.Abtype     = DropLoaiPhieu.SelectedValue.ToString();
                        phieun.bixoa      = false;
                        phieun.CFMID0     = user;
                        phieun.YN         = 5;
                        phieun.LevelDoing = 0;
                        phieun.USERDATE   = DateTime.Today;
                        phieun.UseIntent  = mucdich;
                        phieun.ABC        = 1;
                    }
                    pdnaBUS.InsertPDNA(phieun);
                    Session["ktmaphieu"] = maphieu;
                    Session["bp"]        = bophan;
                    Session["bophan"]    = bp;
                    Session["loaiP"]     = loaiP;
                    Session["loaiphieu"] = loaiphieu;
                    Session["maphieu"]   = maphieu;

                    Session["noidung"] = noidung;
                    Session["ngaytao"] = ngaythang;
                    Session["tieude"]  = tieude;
                }
                else
                {
                    dal.CapNhatPhieuDeNghi(congty, ktmaphieu, bophan, tieude, noidung, date, user, loaiphieu, user, mucdich, false, 5, date);
                    Session["ktmaphieu"] = ktmaphieu;
                    Session["bp"]        = bophan;
                    Session["bophan"]    = bp;
                    Session["loaiP"]     = loaiP;
                    Session["loaiphieu"] = loaiphieu;
                    Session["maphieu"]   = ktmaphieu;

                    Session["noidung"] = noidung;
                    Session["ngaytao"] = ngaythang;
                    Session["tieude"]  = tieude;
                }
                string tenhang   = txtAutoComplete.Text.Trim();
                string donvitinh = txtdonvitinh.Text.ToUpper();
                string soluong   = txtSoLuong.Text.Trim();
                string ghichu    = txtGhiChu.Text.Trim();
                string Size      = "";



                string mahang = "";
                if (txtSize.Text.Trim() == "")
                {
                    Size = "ZZZZZZ";
                }
                else
                {
                    try
                    {
                        decimal sl = decimal.Parse(txtSize.Text.Trim());
                        Size = sl.ToString();
                    }
                    catch
                    {
                        Size = "ZZZZZZ";
                    }
                }
                if (txtMaHang.Text.Trim() == "")
                {
                    string a = (string)Session["demmahang"];
                    if (a == null && demMH == 1)
                    {
                        mahang = "z" + demMH;
                        demMH++;
                        demmahang            = demMH.ToString();
                        Session["demmahang"] = demmahang;
                    }
                    else
                    {
                        int so = int.Parse(a);
                        mahang = "z" + so;
                        so++;
                        demmahang            = so.ToString();
                        Session["demmahang"] = demmahang;
                    }
                }
                else
                {
                    mahang = txtMaHang.Text;
                }
                string    maphieu1 = Session["maphieu"].ToString();
                DataTable dtTim    = dal.TimMaHangTrongPhieu(congty, mahang, maphieu1);
                if (themhang == null)
                {
                    if (ktmaphieu == null)
                    {
                        if (dtTim.Rows.Count > 0)
                        {
                            dal.SuaHang1(congty, mahang, maphieu1, Size, decimal.Parse(soluong), tenhang, ghichu);
                        }
                        else
                        {
                            dal.ThemHang1(congty, mahang, maphieu1, Size, decimal.Parse(soluong), tenhang, ghichu);
                        }

                        HienThiDanhSachHang();
                    }
                    else
                    {
                        if (dtTim.Rows.Count > 0)
                        {
                            dal.SuaHang1(congty, mahang, ktmaphieu, Size, decimal.Parse(soluong), tenhang, ghichu);
                        }
                        else
                        {
                            dal.ThemHang1(congty, mahang, ktmaphieu, Size, decimal.Parse(soluong), tenhang, ghichu);
                            //dal.ThemCGNOTrongBangCGZLS(congty, CGNO, mahang, user, decimal.Parse(soluong));
                        }


                        HienThiDanhSachHang();
                    }
                }
                else
                {
                    if (ktmaphieu == null)
                    {
                        if (mahangcu != null && mahangcu == mahang)
                        {
                            if (sizecu == Size)
                            {
                                dal.SuaHang1(congty, mahang, ktmaphieu, Size, decimal.Parse(soluong), tenhang, ghichu);
                            }
                            else
                            {
                                dal.XoaHang(congty, mahangcu, ktmaphieu, sizecu);
                                dal.ThemHang1(congty, mahang, ktmaphieu, Size, decimal.Parse(soluong), tenhang, ghichu);
                            }
                        }
                        else
                        {
                            dal.XoaHang(congty, mahangcu, maphieu1, sizecu);
                            // dal.XoaCGNOTrongBangCGZLS(congty, CGNO, mahangcu);
                            if (dtTim.Rows.Count > 0)
                            {
                                dal.SuaHang1(congty, mahang, maphieu1, Size, decimal.Parse(soluong), tenhang, ghichu);
                                //  dal.CapNhatCGNOTrongBangCGZLS(congty, CGNO, mahang, user, decimal.Parse(soluong), date, Yn);
                            }
                            else
                            {
                                dal.ThemHang1(congty, mahang, maphieu1, Size, decimal.Parse(soluong), tenhang, ghichu);
                                // dal.ThemCGNOTrongBangCGZLS(congty, CGNO, mahang, user, decimal.Parse(soluong));
                            }

                            HienThiDanhSachHang();
                        }
                    }
                    else
                    {
                        if (mahangcu != null && mahangcu == mahang)
                        {
                            if (sizecu == Size)
                            {
                                dal.SuaHang1(congty, mahang, ktmaphieu, Size, decimal.Parse(soluong), tenhang, ghichu);
                            }
                            else
                            {
                                dal.XoaHang(congty, mahangcu, ktmaphieu, sizecu);
                                dal.ThemHang1(congty, mahang, ktmaphieu, Size, decimal.Parse(soluong), tenhang, ghichu);
                            }
                        }
                        else
                        {
                            dal.XoaHang(congty, mahangcu, ktmaphieu, sizecu);

                            if (dtTim.Rows.Count > 0)
                            {
                                dal.SuaHang1(congty, mahang, ktmaphieu, Size, decimal.Parse(soluong), tenhang, ghichu);
                            }
                            else
                            {
                                dal.ThemHang1(congty, mahang, ktmaphieu, Size, decimal.Parse(soluong), tenhang, ghichu);
                            }

                            HienThiDanhSachHang();
                        }
                        HienThiDanhSachHang();
                        Session.Remove("themhang");
                        Session.Remove("mahangcu");
                        Session.Remove("sizecu");
                    }
                }


                txtAutoComplete.Text    = "";
                txtMaHang.Text          = "";
                txtSize.Text            = "";
                txtdonvitinh.Text       = "";
                txtAutoComplete.Enabled = true;
                txtdonvitinh.Enabled    = true;

                txtSize.Enabled   = true;
                btnLuuTam.Enabled = true;
                btnTiepTu.Enabled = true;
            }
        }
Пример #8
0
 public static Partner GetPartnerByID(int id)
 {
     return(UserBUS.GetPartnerByID(id));
 }
Пример #9
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string loaiphieu = DropLoaiPhieu.SelectedValue.ToString();

            if (loaiphieu != "PDN2")
            {
                DateTime  date    = DateTime.Today;
                dalPDN    dal     = new dalPDN();
                DataTable dt      = dal.DemSoLuongPhieu();
                string    aa      = dt.Rows[0]["pdno"].ToString().Trim();
                string    maphieu = "";
                if (dt.Rows.Count != 0 && aa != "")
                {
                    string dem = (int.Parse(aa) + 1).ToString();
                    maphieu = dem;
                }
                else
                {
                    maphieu = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMM") + "00" + 1;
                }
                string bophan = DropDonVi.SelectedItem.Value.ToString();

                string tieude     = txtTieuDe.Text;
                string noidung    = CKEditorControl1.Text;
                string bp         = DropDonVi.SelectedItem.Text;
                string loaiP      = DropLoaiPhieu.SelectedItem.Text;
                string congty     = Session["congty"].ToString();
                string user       = Session["user"].ToString();
                string ngaythang  = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyy/MM/dd");
                string ngaythang1 = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("Ngày " + "dd" + "Tháng " + "MM" + "Năm" + "yyyy");
                //string idphieu = Session["maphieu"].ToString();



                Busers2 us = UserBUS.TimMaNhanVienTheoBoPhan(user, bophan, congty);
                if (us == null)
                {
                    lbthongbao.Text = "Người dùng này không nằm trong bộ phận " + bp;
                }
                else
                {
                    pdna phieun = new pdna();
                    {
                        phieun.pdno = maphieu;

                        phieun.GSBH       = congty;
                        phieun.pdno       = maphieu;
                        phieun.Abtype     = loaiphieu;
                        phieun.pddepid    = bophan;
                        phieun.mytitle    = tieude;
                        phieun.pdmemovn   = noidung;
                        phieun.CFMDate0   = DateTime.Today;
                        phieun.CFMID0     = user;
                        phieun.YN         = 5;
                        phieun.USERID     = user;
                        phieun.dagui      = false;
                        phieun.bixoa      = false;
                        phieun.LevelDoing = 0;
                        phieun.ABC        = 1;
                    }
                    pdnaBUS.InsertPDNA(phieun);

                    Session["loaiP"]     = loaiP;
                    Session["loaiphieu"] = loaiphieu;
                    Session["maphieu"]   = maphieu;
                    Session["bp"]        = bophan;
                    Session["bophan"]    = bp;
                    Session["noidung"]   = noidung;
                    Session["ngaytao"]   = ngaythang;
                    Session["tieude"]    = tieude;
                    Response.Redirect("FrmView.aspx");
                }
                SuppliesDAO.SearchAjax(txtdonvitinh.Text);
            }
            else
            {
                Response.Redirect("FrmView.aspx");
            }

            Session.Remove("ktmaphieu");
            Session.Remove("CGNO");
            Session.Remove("ZSBH");
            Session.Remove("themhang");
        }
Пример #10
0
        protected void btnLuuTam_Click(object sender, EventArgs e)
        {
            string ngonngu    = Session["languege"].ToString();
            string loaiphieup = DropLoaiPhieu.SelectedValue.ToString();

            if (loaiphieup != "PDN2")
            {
                DateTime  date    = DateTime.Today;
                dalPDN    dal     = new dalPDN();
                DataTable dt      = dal.DemSoLuongPhieu();
                string    aa      = dt.Rows[0]["pdno"].ToString().Trim();
                string    maphieu = "";
                if (dt.Rows.Count != 0 && aa != "")
                {
                    string dem = (int.Parse(dt.Rows[0]["pdno"].ToString()) + 1).ToString();
                    maphieu = dem;
                }
                else
                {
                    maphieu = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMM") + "00" + 1;
                }
                string bophan     = DropDonVi.SelectedItem.Value.ToString();
                string congty     = Session["congty"].ToString();
                string tieude     = txtTieuDe.Text;
                string noidung    = CKEditorControl1.Text;
                string bp         = DropDonVi.SelectedItem.Text;
                string loaiP      = DropLoaiPhieu.SelectedItem.Text;
                int    level      = 0;
                int    ABC        = 1;
                string user       = Session["user"].ToString();
                string ngaythang  = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyy/MM/dd");
                string ngaythang1 = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("Ngày " + "dd" + "Tháng " + "MM" + "Năm" + "yyyy");
                //string idphieu = Session["maphieu"].ToString();
                string loaiphieu = DropLoaiPhieu.SelectedValue.ToString();
                Session["loaiP"]     = loaiP;
                Session["loaiphieu"] = loaiphieu;
                Session["maphieu"]   = maphieu;
                Session["bp"]        = bophan;
                Session["bophan"]    = bp;
                Session["noidung"]   = noidung;
                Session["ngaytao"]   = ngaythang;
                Session["tieude"]    = tieude;
                Busers2 us = UserBUS.TimMaNhanVienTheoBoPhan(user, bophan, congty);
                if (us == null)
                {
                    if (ngonngu == "lbl_VN")
                    {
                        lbthongbao.Text = "Người dùng này không thuộc bộ phận " + bp;
                    }
                    else if (ngonngu == "lbl_TW")
                    {
                        lbthongbao.Text = "该用户不属于部门 " + bp;
                    }
                    else if (ngonngu == "lbl_EN")
                    {
                        lbthongbao.Text = "The user does not belong to the department" + bp;
                    }
                }
                else
                {
                    if (loaiphieu != "PDN2")
                    {
                        dal.ThemPhieuDeNghi(congty, maphieu, bophan, tieude, noidung, date, user, DropLoaiPhieu.SelectedValue, user, false, 5, date, level, ABC);
                    }
                    Response.Redirect("DanhsachphieumoikhoitaoNV.aspx");
                }
            }
            else
            {
                Response.Redirect("DanhsachphieumoikhoitaoNV.aspx");
                Session.Remove("ktmaphieu");
                Session.Remove("CGNO");
                Session.Remove("ZSBH");
                Session.Remove("themhang");
            }
        }
 public frmLogin()
 {
     InitializeComponent();
     userBUS = new UserBUS();
 }
 public static bool ChangePwd(int idUser, string pwdOld, string pwdNew)
 {
     return(UserBUS.ChangePwd(idUser, pwdOld, pwdNew));
 }
 public static int UpdateInfoUser(User u)
 {
     return(UserBUS.UpdateInfoUser(u));
 }
 public static User UserLogin(string mail)
 {
     return(UserBUS.UserLogin(mail));
 }
Пример #15
0
 public static int CreateUser(User u)
 {
     return(UserBUS.CreateUser(u));
 }
Пример #16
0
 public static bool CreatePartner(Partner p)
 {
     return(UserBUS.CreatePartner(p));
 }
Пример #17
0
        public static User GetUserByID(int id)

        {
            return(UserBUS.GetUserByID(id));
        }
Пример #18
0
 public static IEnumerable <Partner> GetListPartner()
 {
     return(UserBUS.GetListPartner());
 }
Пример #19
0
 public static IEnumerable <User> GetListSinger()
 {
     return(UserBUS.GetListSinger());
 }
Пример #20
0
 public static bool CreateHU(HistoryUser hu)
 {
     return(UserBUS.CreateHU(hu));
 }
Пример #21
0
 public static IEnumerable <User> GetListUser(bool vip)
 {
     return(UserBUS.GetListUser(vip));
 }
Пример #22
0
 public static IEnumerable <HistoryUser> GetListMusicHUByIDMusic(int idUser, int idMusic)
 {
     return(UserBUS.GetListMusicHUByIDMusic(idUser, idMusic));
 }
Пример #23
0
 public static IEnumerable <User> GetListSingerSearch(string value)
 {
     return(UserBUS.GetListSingerSearch(value));
 }
Пример #24
0
 public static bool DelListMusicHU(int idUser, bool music)
 {
     return(UserBUS.DelListMusicHU(idUser, music));
 }
Пример #25
0
 public static bool UpdateUser(User user)
 {
     return(UserBUS.UpdateUser(user));
 }
Пример #26
0
 public FrmLogin()
 {
     InitializeComponent();
     _userBUS           = new UserBUS();
     this.StartPosition = FormStartPosition.CenterScreen;
 }
Пример #27
0
 public static User LoginNormal(string mail, string pwd)
 {
     return(UserBUS.LoginNormal(mail, pwd));
 }
Пример #28
0
 public Login()
 {
     InitializeComponent();
     _userBus = new UserBUS();
 }
Пример #29
0
 public static int ChangePwd(string mail, string pwdNew)
 {
     return(UserBUS.ChangePwd(mail, pwdNew));
 }
Пример #30
0
 public FormDangNhap()
 {
     InitializeComponent();
     _userBUS = new UserBUS();
 }
Пример #31
0
        private void AddTeacher()
        {
            try
            {
                TeacherEntity entity = new TeacherBUS().GetByID(Convert.ToInt32(lblIdTeacher.Text));

                if (entity == null)
                    entity = new TeacherEntity();

                entity.Mobile = txtMobile.Text.Trim();
                entity.Name = txtName.Text.Trim();
                entity.Phone = txtPhone.Text.Trim();
                entity.Sex = cbSex.SelectedIndex < 0 ? "" : cbSex.SelectedIndex == 0 ? "M" : "F";

                var validate = new TeacherBUS().ValideteForm(entity);
                var validateFormLogin = ValidateFormLogin();

                if (string.IsNullOrEmpty(validate) && string.IsNullOrEmpty(validateFormLogin))
                {
                    if (entity.Id > 0)
                    {
                        new TeacherBUS().Update(entity);
                        if(chbUser.Checked)
                        {
                            var entityUser = new UserBUS().GetByIdTeacher(entity.Id);
                            entityUser.AccessType = cbTypeAccess.SelectedValue.ToString();
                            entityUser.Password = txtPassword.Text.Trim();
                            entityUser.UserName = txtUser.Text.Trim();

                            new UserBUS().Update(entityUser);
                        }

                        MessageBox.Show("Registro atualizado com sucesso", "Cadastro de Professor", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        new TeacherBUS().Add(entity);
                        if (chbUser.Checked)
                        {
                            var entityUser = new UserEntity() {
                                AccessType = cbTypeAccess.SelectedIndex == 1 ? "A" : "U",
                                CreateDate = DateTime.Now,
                                IdTeacher = new TeacherBUS().GetAll().Last().Id,
                                Password = txtPassword.Text.Trim(),
                                UserName = txtUser.Text.Trim()
                            };

                            new UserBUS().Add(entityUser);
                        }

                        MessageBox.Show("Registro salvo com sucesso", "Cadastro de Professor", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    ClearFields();
                }
                else
                {
                    MessageBox.Show(validate + "\n" + validateFormLogin, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocorreu um erro ao tentar salvar o registo.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }