protected void Button1_Click(object sender, EventArgs e)
        {
            string     id                 = Session["id"].ToString();
            string     macongty           = DropCty.SelectedValue.ToString();
            DateTime   tungay             = DateTime.Parse(txtTuNgay.Text.ToString());
            DateTime   denngay            = DateTime.Parse(txtDenNgay.Text.ToString());
            string     ngonngu            = Session["languege"].ToString();
            string     manguoiduyet       = txtNguoiDuyet.Text;
            string     manguoiduocuyquyen = txtNguoiDuocUyQuyen.Text;
            int        khivang            = int.Parse(DropDownVangMat.SelectedValue.ToString());
            ABJobAgent nghiphep           = new ABJobAgent();

            nghiphep.GSBH    = macongty;
            nghiphep.ID      = int.Parse(id);
            nghiphep.TuNgay  = tungay;
            nghiphep.DenNgay = denngay;
            if (txtNguoiDuyet.Text.Trim() == "" && txtNguoiDuocUyQuyen.Text.Trim() == "")
            {
                return;
            }
            else
            {
                Busers2 nguoiuyquyen = UserDAO.TimNhanVienTheoMa(manguoiduyet, macongty);
                Busers2 nguoithaythe = UserDAO.TimNhanVienTheoMa(manguoiduocuyquyen, macongty);
                if (nguoiuyquyen == null && nguoithaythe == null)
                {
                    if (ngonngu == "lbl_VN")
                    {
                        lblThongBao.Text = "Mã người Ủy Quyền hoặc Mã Người Thay Thế không có trong hệ thống";
                    }
                    else if (ngonngu == "lbl_TW")
                    {
                        lblThongBao.Text = "系统没有这个委托人编号或者代理人编号";
                    }
                    else if (ngonngu == "lbl_EN")
                    {
                        lblThongBao.Text = "Mã người Ủy Quyền hoặc Mã Người Thay Thế không có trong hệ thống";
                    }
                }
                else
                {
                    nghiphep.IDNguoiDuyet       = manguoiduyet;
                    nghiphep.IDNguoiDuocUyQuyen = manguoiduocuyquyen;
                    nghiphep.tennguoiuyquyen    = nguoiuyquyen.USERNAME;
                    nghiphep.tennguoithaythe    = nguoithaythe.USERNAME;
                }
            }

            nghiphep.ThongQua = khivang;
            StatusCode thong = KhiVangMatDAO.TimMaThongQua(khivang);

            nghiphep.TenThongQua = thong.NameTaiwan;
            NghiPhepDAO.SuaDuLieu(nghiphep);
            Response.Redirect("frmNghiPhep.aspx");
        }
示例#2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string     macongty           = DropCty.SelectedValue.ToString();
            DateTime   tungay             = DateTime.Parse(txtFromDate.Text.ToString());
            DateTime   denngay            = DateTime.Parse(txtToDate.Text.ToString());
            string     ngonngu            = Session["languege"].ToString();
            string     manguoiduyet       = txtNguoiDuyet.Text;
            string     manguoiduocuyquyen = txtNguoiDuocUyQuyen.Text;
            int        khivang            = int.Parse(DropDownVangMat.SelectedValue.ToString());
            ABJobAgent nghiphep           = new ABJobAgent();

            nghiphep.GSBH    = macongty;
            nghiphep.TuNgay  = tungay;
            nghiphep.DenNgay = denngay;
            if (txtNguoiDuyet.Text.Trim() == "" && txtNguoiDuocUyQuyen.Text.Trim() == "")
            {
                return;
            }
            else
            {
                Busers2 nguoiuyquyen = UserDAO.TimNhanVienTheoMa(manguoiduyet, macongty);
                Busers2 nguoithaythe = UserDAO.TimNhanVienTheoMa(manguoiduocuyquyen, macongty);
                if (nguoiuyquyen == null && nguoithaythe == null)
                {
                    if (ngonngu == "lbl_VN")
                    {
                        lblThongBao.Text = "Mã người Ủy Quyền hoặc Mã Người Thay Thế không có trong hệ thống";
                    }
                    else if (ngonngu == "lbl_TW")
                    {
                        lblThongBao.Text = "系统没有这个委托人编号或者代理人编号";
                    }
                    else if (ngonngu == "lbl_EN")
                    {
                        lblThongBao.Text = "Mã người Ủy Quyền hoặc Mã Người Thay Thế không có trong hệ thống";
                    }
                }
                else
                {
                    nghiphep.IDNguoiDuyet       = manguoiduyet;
                    nghiphep.IDNguoiDuocUyQuyen = manguoiduocuyquyen;
                    nghiphep.tennguoiuyquyen    = nguoiuyquyen.USERNAME;
                    nghiphep.tennguoithaythe    = nguoithaythe.USERNAME;
                }
            }

            nghiphep.ThongQua    = khivang;
            nghiphep.TenThongQua = DropDownVangMat.SelectedItem.Text;
            NghiPhepDAO.ThemDuLieu(nghiphep);
            //List<Abcon> danhsach = AbconDAO.DanhSachPhieuChoDuyetTheoNguoiDuyet(macongty, manguoiduyet);
            DataTable danhsach = dalABcon.DanhSachPhieuTheoNguoiDuyet(macongty, manguoiduyet);

            if (danhsach.Rows.Count > 0)
            {
                foreach (DataRow phieu in danhsach.Rows)
                {
                    string pdno = phieu["pdno"].ToString();
                    int    IDCT = int.Parse(phieu["IDCT"].ToString());
                    dalABcon.CapNhatUyQuyenAbcon(macongty, manguoiduocuyquyen, pdno, IDCT);
                }
            }
            HienThiDanhSach();
        }