protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string      manguoidung = Session["user"].ToString();
            GridViewRow row         = GridView1.SelectedRow;
            string      maphieu     = row.Cells[2].Text;

            Session["maphieu"] = maphieu;
            string loaiphieu = row.Cells[1].Text;

            Session["loaiphieu"] = loaiphieu;
            string tieude = row.Cells[3].Text;

            Session["tieude"] = tieude;
            string bophan = row.Cells[7].Text;

            Session["bophan"] = bophan;
            Label  lblMaDV  = (Label)row.FindControl("lblMaDonVi");
            string mabophan = lblMaDV.Text.Trim();

            Session["mabophan"] = mabophan;
            Abcon chitietduyet = AbconBUS.LayChiTietXetDuyetTheoNhanVienDuyet(maphieu, manguoidung);

            if (chitietduyet.abtype == "PDN2")
            {
                Response.Redirect("phieumuahangD.aspx");
            }
            else
            {
                Response.Redirect("frmDetails2D.aspx");
            }
        }
Exemple #2
0
        protected void btnAccep_Click(object sender, EventArgs e)
        {
            try
            {
                string  macongty       = Session["congty"].ToString();
                string  maphieu        = Session["maphieu"].ToString();
                string  ngonngu        = Session["languege"].ToString();
                string  manguoidung    = Session["user"].ToString();
                Busers2 KiemTraMatKhau = UserDAO.KiemTraMatKhauXetDuyetCuaNguoiDuyet(manguoidung, macongty, libraly.Encryption(txtSecure.Text));
                if (KiemTraMatKhau == null)
                {
                    if (ngonngu == "lbl_VN")
                    {
                        lbThongBao.Text = "Mật khẩu là không chính xác";
                    }
                    else if (ngonngu == "lbl_TW")
                    {
                        lbThongBao.Text = "密码不正确";
                    }
                    else if (ngonngu == "lbl_EN")
                    {
                        lbThongBao.Text = "The password is incorrect";
                    }
                }
                else
                {
                    Busers2 user = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);
                    //string abc = libraly.Encryption(txtSecure.Text);
                    if (user != null && libraly.Encryption(txtSecure.Text).Equals(user.Password2))
                    {
                        bool   duyet  = (rdApproval.Checked) ? true : ((rdNotApproval.Checked) ? false : true);
                        string ghichu = txtComment.Text;
                        //Task temp = Task.Factory.StartNew(() => Until.XetDuyet(maphieu, Until.uNhanVien, duyet, ghichu));
                        //{
                        //    if (temp != null)
                        //    {
                        //        lbThongBao.Text = "Approval success";

                        //    }
                        //}

                        //  temp.RunSynchronously();
                        //Task temp = Task.Factory.StartNew(() => Until.XetDuyet(maphieu, Until.uNhanVien, duyet, ghichu));
                        Until.XetDuyet(maphieu, user, duyet, ghichu, macongty);
                        // kiem tra : lay chi tiet theo nguoi duyet neu   nguoi.abresult==true  di qua trang khac nguoc lai khong xet duyet
                        Abcon chitietduyet = AbconBUS.LayChiTietXetDuyetTheoNhanVienDuyet(maphieu, manguoidung);

                        if (chitietduyet == null)
                        {
                            return;
                        }
                        else
                        {
                            if (chitietduyet.abrult == true)
                            {
                                if (ngonngu == "lbl_VN")
                                {
                                    lbThongBao.Text = "Bạn đã xét duyệt thành công";
                                }
                                else if (ngonngu == "lbl_TW")
                                {
                                    lbThongBao.Text = "审核成功";
                                }
                                else if (ngonngu == "lbl_EN")
                                {
                                    lbThongBao.Text = "Approval Success!";
                                }
                                if (chitietduyet.abtype == "PDN2")
                                {
                                    Response.Redirect("phieumuahangD.aspx");
                                }
                                else
                                {
                                    Response.Redirect("frmDetails2D.aspx");
                                }
                            }
                            else
                            {
                                if (chitietduyet.Yn == 2)
                                {
                                    if (ngonngu == "lbl_VN")
                                    {
                                        lbThongBao.Text = "Bạn đã không xét duyệt phiếu này";
                                    }
                                    else if (ngonngu == "lbl_TW")
                                    {
                                        lbThongBao.Text = "本单未审核";
                                    }
                                    else if (ngonngu == "lbl_EN")
                                    {
                                        lbThongBao.Text = "Not Approval ";
                                    }
                                    if (chitietduyet.abtype == "PDN2")
                                    {
                                        Response.Redirect("phieumuahangD.aspx");
                                    }
                                    else
                                    {
                                        Response.Redirect("frmDetails2D.aspx");
                                    }
                                }
                            }
                        }
                    }
                }
                //  Response.Redirect("frmDetails2.aspx");
            }
            catch (Exception ex)
            {
                lbthongbaoLoi.Text = "loi" + ex.Message;
            }
            // Response.Redirect("frmDetails2.aspx");
        }