protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row        = GridView1.SelectedRow;
            Label       lblMaPhieu = (Label)row.FindControl("lblpdno");
            string      macongty   = Session["congty"].ToString();
            string      UserID     = Session["UserID"].ToString();
            pdna        timphieu   = pnaDAO.TimKiemVanBanTheoMaNguoiTaoCongTy(lblMaPhieu.Text.Trim(), UserID, macongty, false);

            if (timphieu != null)
            {
                Session["maphieu"]   = timphieu.pdno;
                Session["loaiphieu"] = timphieu.Abtype;
                if (timphieu.Abtype == "PDN2")
                {
                    if (timphieu.YN == 3)
                    {
                        Response.Redirect("frmSuaphieumuahang.aspx");
                    }
                    else if (timphieu.YN == 5)
                    {
                        Response.Redirect("FrmViewCB.aspx");
                    }
                    else if (timphieu.YN == 6)
                    {
                        Response.Redirect("frmChitietphieumuahangdich.aspx");
                    }
                    else if (timphieu.YN == 1)
                    {
                        Response.Redirect("phieumuahang.aspx");
                    }
                    else if (timphieu.YN == 2)
                    {
                        Response.Redirect("phieumuahang.aspx");
                    }
                }
                else
                {
                    if (timphieu.YN == 3)
                    {
                        Response.Redirect("chitietphieuchuadich.aspx");
                    }
                    else if (timphieu.YN == 5)
                    {
                        Response.Redirect("FrmViewCB.aspx");
                    }
                    else if (timphieu.YN == 6)
                    {
                        Response.Redirect("chitietphieudadich.aspx");
                    }
                    else if (timphieu.YN == 1)
                    {
                        Response.Redirect("frmDetails2.aspx");
                    }
                    else if (timphieu.YN == 2)
                    {
                        Response.Redirect("frmDetails2.aspx");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row        = GridView1.SelectedRow;
            Label       lblMaPhieu = (Label)row.FindControl("lblSoPhieu");
            string      UserID     = Session["user"].ToString();
            string      macongty   = Session["congty"].ToString();

            Session["maphieu"] = lblMaPhieu.Text.Trim();
            Label  lblisPause = (Label)row.FindControl("lblisPause");
            string ispause    = lblisPause.Text.Trim().ToLower();
            pdna   timmaphieu = pnaDAO.TimVanBanTheoMa(lblMaPhieu.Text.Trim(), macongty, false);

            if (timmaphieu != null)
            {
                if (timmaphieu.Abtype == "PDN2")
                {
                    if (timmaphieu.trangthaidich == false)
                    {
                        Response.Redirect("frmSuaphieumuahangND.aspx");
                    }
                }
                else
                {
                    Response.Redirect("chitietphieuchuadichND.aspx");
                }
            }
        }
Ejemplo n.º 3
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string      macongty    = Session["congty"].ToString();
            string      manguoidung = Session["user"].ToString();
            GridViewRow row         = GridView1.SelectedRow;
            string      maphieu     = row.Cells[4].Text;

            Session["maphieu"] = maphieu;
            string loaiphieu    = row.Cells[2].Text;
            string tenloaiphieu = row.Cells[3].Text;

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

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

            Session["bophan"] = bophan;
            //  Response.Redirect("frmDetails2.aspx");
            pdna chitietduyet = pnaDAO.LayPhieuTheoNguoiGui(maphieu, manguoidung, macongty);

            if (chitietduyet.Abtype == "PDN2")
            {
                Response.Redirect("phieumuahang.aspx");
            }
            else
            {
                Response.Redirect("frmDetails2.aspx");
            }
        }
Ejemplo n.º 4
0
        private void HienThiChiTiet()
        {
            string macongty   = Session["congty"].ToString();
            string nguoiduyet = Session["user"].ToString();
            string maphieu    = Session["maphieu"].ToString();
            //string bophan = Session["bophan"].ToString();
            //string tenloaiphieu = Session["loaiphieu"].ToString();
            pdna        list = pdnaBUS.LayNoiDungVanBanTheoIDPhieuIDNhanVien(maphieu, nguoiduyet, macongty);
            BDepartment bp   = BDepartmentDAO.TimMaDonVi(list.pddepid, macongty);

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

            lblTieuDe.Text      = list.mytitle + list.pdnsubject;
            lbLoaiPhieu.Text    = tenloaiphieuVN + " " + tenloaiphieuTW;
            lbldonvidenghi.Text = bp.DepName;
            lbSoPhieu.Text      = maphieu;

            string dinhdang = list.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 + "";
        }
Ejemplo n.º 5
0
        private void HienThiChiTiet()
        {
            string macongty   = Session["congty"].ToString();
            string nguoiduyet = Session["UserID"].ToString();
            string maphieu    = Session["maphieu"].ToString();

            pdna        list      = pdnaBUS.LayNoiDungVanBanTheoIDPhieuIDNhanVien(maphieu, nguoiduyet, macongty);
            abill       loaiphieu = abillBUS.SearchAbillByID(list.Abtype);
            BDepartment bp        = BDepartmentDAO.TimMaDonVi(list.pddepid, macongty);
            aABC        douutien  = ABCDAO.TimDoUuTien(int.Parse(list.ABC.ToString()));

            if (douutien != null)
            {
                lblDoUutien.Text = douutien.NameABC + "-" + douutien.NameABCTW;
            }
            Session["mabophan"] = bp.ID;
            Session["bophan"]   = bp.DepName;
            string tenloaiphieuVN = loaiphieu.abname;
            string tenloaiphieuTW = loaiphieu.abnameTW;

            Session["loaiphieu"] = tenloaiphieuVN + " " + tenloaiphieuTW;
            lbLoaiPhieu.Text     = tenloaiphieuVN + " " + tenloaiphieuTW;
            lbBoPhan.Text        = bp.DepName;
            lbSoPhieu.Text       = maphieu;
            lbNoiDung.Text       = list.pdmemovn;
            lblTieuDe.Text       = list.mytitle + "-" + list.pdnsubject;
            lbNoidungdich.Text   = list.NoiDungDich;
            string dinhdang = list.CFMDate0.ToString();
            string thang    = dinhdang.Substring(3, 2);
            string ngay     = dinhdang.Substring(0, 2);
            string nam      = dinhdang.Substring(6, 4);

            lbNgay.Text = "Ngày 日  " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + "";
        }
Ejemplo n.º 6
0
        public static bool CapNhatPhieuTao(pdna phieutao, string macongty)
        {
            try
            {
                // db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, phieutao);
                pdna phieu = new pdna();
                phieu = db.pdnas.Where(p => p.pdno == phieutao.pdno && p.GSBH == macongty).FirstOrDefault();

                phieu.pdno     = phieutao.pdno;
                phieu.GSBH     = macongty;
                phieu.CFMDate1 = phieutao.CFMDate1;
                phieu.pdmemovn = phieutao.pdmemovn;

                phieu.NoiDungDich   = phieutao.NoiDungDich;
                phieu.trangthaidich = false;
                phieu.IdnguoiDich   = phieutao.IdnguoiDich;
                phieu.mytitle       = phieutao.mytitle;
                phieu.bixoa         = false;

                phieu.CFMID0 = phieutao.CFMID0;

                phieu.dagui      = false;
                phieu.LevelDoing = 1;
                phieu.mytitle    = phieutao.mytitle;

                phieu.pddepid = phieutao.pddepid;

                phieu.USERID = phieutao.USERID;
                phieu.YN     = 5;


                db.SubmitChanges();
                return(true);
            }
            catch (System.Data.Linq.ChangeConflictException)
            {
                foreach (System.Data.Linq.ObjectChangeConflict occ in db.ChangeConflicts)
                {
                    //?

                    // ?Linq
                    occ.Resolve(System.Data.Linq.RefreshMode.OverwriteCurrentValues);

                    // Linq?
                    occ.Resolve(System.Data.Linq.RefreshMode.KeepCurrentValues);

                    // ?
                    occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
                }
                db.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 7
0
        protected void btnComplete_Click(object sender, EventArgs e)
        {
            string macongty = Session["congty"].ToString();
            string maphieu  = Session["maphieu"].ToString();
            pdna   phieu    = pnaDAO.TimVanBanTheoMa(maphieu, macongty, true);

            db.ExecuteCommand("update pdna set mytitle=N'" + txtTieuDe.Text.Trim() + "',CFMDate0=GETDATE()  where pdno='" + maphieu + "'and  GSBH='" + macongty + "'");
            Session["loaiphieu"] = phieu.Abtype.ToString();
            Response.Redirect("FrmViewCB.aspx");
        }
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            string   maphieu     = Session["maphieu"].ToString();
            string   macongty    = Session["congty"].ToString();
            string   ngonngu     = Session["languege"].ToString();
            string   manguoidung = Session["user"].ToString();
            string   NOIDUNG     = CKEditorControl1.Text;
            DateTime date        = DateTime.Now;

            PDNSheetFlow kiemtra = PDNSheetFlowDAO.LayPDNSheetFlowCuaBuoc1(maphieu, macongty);

            if (kiemtra == null)
            {
                // CKEditorControl1.ReadOnly = false;
                pdna phieu     = pnaDAO.LayVanBanDaDichTheoNguoiDich(maphieu, macongty, manguoidung);
                pdna phieudich = new pdna();
                phieudich.GSBH          = macongty;
                phieudich.pdno          = phieu.pdno;
                phieu.CFMDate2          = date;
                phieudich.CFMDate4      = date;
                phieudich.NoiDungDich   = CKEditorControl1.Text;
                phieudich.trangthaidich = true;
                phieudich.IdnguoiDich   = manguoidung;
                //  pnaDAO.CapNhatPhieuDich(phieudich, macongty);
                db.CapNhatPhieuDich(phieudich.pdno, phieudich.GSBH, phieudich.NoiDungDich, phieudich.CFMDate2, txtTieuDe.Text, phieudich.IdnguoiDich, phieudich.trangthaidich);
                // pdna phieu1 = pnaDAO.LayVanBanDaDichTheoNguoiDich(maphieu, macongty, manguoidung);
                db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + phieudich.pdno + "'and GSBH='" + macongty + "' and IdnguoiDich='" + manguoidung + "'"));
                var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + phieudich.pdno + "'and GSBH='" + macongty + "' and IdnguoiDich='" + manguoidung + "'");
                foreach (pdna phieu1 in list)
                {
                    if (phieu1.trangthaidich == true)
                    {
                        if (ngonngu == "lbl_VN")
                        {
                            lbThongBao.Text = "Lưu thành công, văn bản đã dịch sẽ gửi đến người nhờ dịch";
                        }
                        else if (ngonngu == "lbl_TW")
                        {
                            lbThongBao.Text = "审核成功";
                        }
                        else if (ngonngu == "lbl_EN")
                        {
                            lbThongBao.Text = "Save Success.";
                        }
                        Response.Redirect("frmChiTietDichND.aspx");
                    }
                }
            }
            else
            {
                lbThongbaoloi.Text = "Phiếu này đã được xét duyệt nên không thể sửa được";
            }
        }
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row     = GridView1.SelectedRow;
            string      maphieu = row.Cells[1].Text;

            Session["maphieu"] = maphieu;
            string macongty    = Session["congty"].ToString();
            pdna   timphieu    = pnaDAO.TimVanBanTheoMa(maphieu, macongty, true);
            string maloaiphieu = timphieu.Abtype;

            Session["loaiphieu"] = maloaiphieu;
        }
Ejemplo n.º 10
0
 public static bool InsertPDNA(pdna pd)
 {
     try
     {
         db.pdnas.InsertOnSubmit(pd);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            string maphieu     = Session["maphieu"].ToString();
            string macongty    = Session["congty"].ToString();
            string ngonngu     = Session["languege"].ToString();
            string manguoidung = Session["user"].ToString();

            DateTime date = DateTime.Now;
            //  string ngaydich = DateTime.Parse(date.ToShortDateString()).ToString("dd/MM/yyyy");
            pdna phieu     = pnaDAO.LayVanBanChuaDichTheoNguoiDich(maphieu, macongty, manguoidung);
            pdna phieudich = new pdna();

            phieudich.pdno     = maphieu;
            phieudich.CFMDate2 = date;
            phieudich.GSBH     = macongty;

            phieudich.NoiDungDich   = CKEditorControl1.Text;
            phieudich.trangthaidich = true;
            phieudich.IdnguoiDich   = manguoidung;

            //db.CapNhatPhieuDich(phieudich.pdno, phieudich.GSBH, phieudich.NoiDungDich, phieudich.CFMDate2,txtTieuDe.Text, phieudich.IdnguoiDich, phieudich.trangthaidich);
            dalPDN dal = new dalPDN();

            dal.CapNhatPhieuDich(manguoidung, macongty, maphieu, txtTieuDe.Text, CKEditorControl1.Text, date);
            db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + phieudich.pdno + "'and GSBH='" + macongty + "' and IdnguoiDich='" + manguoidung + "'"));
            var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + phieudich.pdno + "'and GSBH='" + macongty + "' and IdnguoiDich='" + manguoidung + "'");

            foreach (pdna phieu1 in list)
            //pdna phieu1 = pnaDAO.LayVanBanDaDichTheoNguoiDich(maphieu, macongty, manguoidung);
            {
                if (phieu1.trangthaidich == true)
                {
                    if (ngonngu == "lbl_VN")
                    {
                        lbThongBao.Text = "Lưu thành công, văn bản đã dịch sẽ gửi đến người nhờ dịch";
                    }
                    else if (ngonngu == "lbl_TW")
                    {
                        lbThongBao.Text = "存档成功,资料已经翻译完成请确认";
                    }
                    else if (ngonngu == "lbl_EN")
                    {
                        lbThongBao.Text = "Save Success.";
                    }
                    btnLuu.Enabled = false;
                    Response.Redirect("frmChiTietDichND.aspx");
                }
            }
        }
        public void CapNhatPhieu(pdna phieuchuadich)
        {
            iOfficeDataContext con = new iOfficeDataContext();
            pdna tim = pnaDAO.TimVanBanTheoMa(phieuchuadich.pdno, phieuchuadich.GSBH, true);

            if (tim == null)
            {
                con.pdnas.InsertOnSubmit(phieuchuadich);
            }
            else
            {
                con.pdnas.Attach(phieuchuadich, true);
            }
            db.SubmitChanges();
        }
Ejemplo n.º 13
0
 public static bool DeletePDNA(string id)
 {
     try
     {
         pdna p = new pdna();
         p = db.pdnas.Where(q => q.pdno == id).FirstOrDefault();
         db.pdnas.DeleteOnSubmit(p);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        private void HienThi()
        {
            string idphieu = Session["maphieu"].ToString();
            //string bophan = Session["bophan"].ToString();

            //string noidung = Session["noidung"].ToString();
            //string ngaytao = Session["ngaythang"].ToString();
            string      user   = Session["user"].ToString();
            string      bp     = Session["bp"].ToString();
            string      congty = Session["congty"].ToString();
            BDepartment bophan = BDepartmentBUS.TimMaDonVi(bp, congty);
            //string loaiphieu = Session["loaiphieu"].ToString();
            pdna  phieu     = pdnaBUS.TimVanBanTheoMa(idphieu, congty, true);
            abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype);

            string tenloaiphieuVN = loaiphieu.abname;
            string tenloaiphieuTW = loaiphieu.abnameTW;

            lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW;
            //    lbBoPhan.Text = bophan;
            //    lbNoiDung.Text = phieu.pdmemovn.ToString();
            //    lbNgay.Text =Convert.ToString(phieu.CFMDate0);
            //  Buser users = UserBUS.TimMaNhanVienTheoBoPhan(user, bp);
            lblTieuDe.Text        = phieu.mytitle + phieu.pdnsubject;
            lbldonvidenghi.Text   = bophan.DepName;
            lbSoPhieu.Text        = idphieu;
            lblMucDichSuDung.Text = phieu.UseIntent;

            //lbNgay.Text = phieu.CFMDate0.ToString();
            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 + "";


            Busers2 user0 = AbconBUS.LayMaNguoiTaoTheoIDVanBan(idphieu, congty);

            if (user0 != null)
            {
                TextBox1.Text = user0.USERID;
                //ImageLevel0.ImageUrl = users.signatue;
                ImageLevel0.Width    = 100;
                ImageLevel0.Height   = 100;
                ImageLevel0.ImageUrl = "~/MyPhoto.ashx?USERID=" + TextBox1.Text;
            }
        }
Ejemplo n.º 15
0
        public static bool CapNhatIdNguoiDangDuyetChoVanBan(string idVanBan, string idNguoiDangDuyet, bool kiemTraBiXoa = true)
        {
            pdna vanban = new pdna();

            if (kiemTraBiXoa)
            {
                vanban = db.pdnas.Where(v => v.pdno == idVanBan).FirstOrDefault();
            }
            else
            {
                vanban = db.pdnas.Where(v => v.pdno == idVanBan).FirstOrDefault();
            }
            if (vanban == null)
            {
                return(false);
            }

            try
            {
                vanban.CFMID2   = idNguoiDangDuyet;
                vanban.CFMDate2 = DateTime.Now;


                db.SubmitChanges();
                if (db != null)
                {
                    db.ToString();
                }
                else
                {
                    // don't
                }
                return(true);
                //return true;
            }
            catch (Exception)
            {
                // HeThong.khoiTaoData(HeThong.laychuoiketnoi());
                return(false);
            }
            finally
            {
                if (db != null)
                {
                    db.ToString();
                }
            }
        }
Ejemplo n.º 16
0
        public static bool XoaVanBan(pdna pVanBan, bool kiemTraBiXoa = true)
        {
            try
            {
                //VanBan vanban = TimKiemVanBanTheoMa(pVanBan.IdVanBan, kiemTraBiXoa);
                pdna vanban = new pdna();
                if (kiemTraBiXoa)
                {
                    vanban = db.pdnas.Where(v => v.pdno == pVanBan.pdno && v.bixoa == false).FirstOrDefault();
                }
                else
                {
                    vanban = db.pdnas.Where(v => v.pdno == pVanBan.pdno).FirstOrDefault();
                }

                if (vanban == null)
                {
                    return(false);
                }

                if (kiemTraBiXoa)
                {
                    vanban.bixoa = true;
                    db.SubmitChanges();
                    db.ToString();
                    return(true);
                }

                db.pdnas.DeleteOnSubmit(vanban);
                db.SubmitChanges();
                db.ToString();
                return(true);
            }
            catch (Exception ex)
            {
                Until.WriteFileLogServer("XoaVanBan\t\t" + "\tMessage Error:\t\t" + ex.Message);
                //  HeThong.khoiTaoData(HeThong.laychuoiketnoi());
                return(false);
            }
            finally
            {
                if (db != null)
                {
                    db.ToString();
                }
            }
        }
Ejemplo n.º 17
0
        public static bool CapNhatCapDangDuyetChoVanban(string idVanBan, int capDangDuyet, bool kiemTraBiXoa = true)
        {
            pdna vanban = new pdna();

            //var loai=(from p in db.abills
            //             from  q in db.pdnas where(p.abtype==q.a))
            if (kiemTraBiXoa)
            {
                vanban = db.pdnas.Where(v => v.pdno == idVanBan).FirstOrDefault();
            }
            else
            {
                vanban = db.pdnas.Where(v => v.pdno == idVanBan).FirstOrDefault();
            }
            //VanBan vanban = TimKiemVanBanTheoMa(idVanBan, kiemTraBiXoa);
            if (vanban == null)
            {
                return(false);
            }

            try
            {
                //vanban. = vanban.IdLoaiVanBan;
                vanban.LevelDoing = capDangDuyet;
                vanban.CFMDate2   = DateTime.Now;

                db.SubmitChanges();
                if (db != null)
                {
                    db.ToString();
                }
                return(true);
            }
            catch (Exception)
            {
                // HeThong.khoiTaoData(HeThong.laychuoiketnoi());
                return(false);
            }

            finally
            {
                if (db != null)
                {
                    db.ToString();
                }
            }
        }
Ejemplo n.º 18
0
        public static bool CapNhatTinhTrangVanBan(string idVanBan, int tinhTrang, bool kiemTraBiXoa = true)
        {
            var list = (from p in db.Abcons
                        from q in db.pdnas
                        where p.pdno == q.pdno && q.pdno == idVanBan
                        select q).FirstOrDefault();
            DateTime date = DateTime.Now;
            // string ngaythang = DateTime.Parse(date.ToShortDateString()).ToString("yyyy/MM/dd");
            pdna vanban = new pdna();

            //if (kiemTraBiXoa)
            //    //vanban = db.pdnas.Where(v => v.pdno == idVanBan && v.bixoa == false).FirstOrDefault();
            //    vanban = list;
            //else
            //    vanban = db.pdnas.Where(v => v.pdno == idVanBan).FirstOrDefault();

            if (vanban == null)
            {
                return(false);
            }
            try
            {
                vanban = list;
                {
                    vanban.pdno     = idVanBan;
                    vanban.YN       = tinhTrang;
                    vanban.CFMDate1 = DateTime.Today;
                }
                db.SubmitChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }

            finally
            {
                if (db != null)
                {
                    db.ToString();
                }
            }
        }
        protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string macongty    = Session["congty"].ToString();
            string manguoidung = Session["user"].ToString();
            string maphieu     = (string)GridView2.Rows[e.RowIndex].Cells[3].Text;

            Session["maphieu"] = maphieu;
            pdna phieu = pnaDAO.TimKiemVanBanTheoMaNguoiTaoCongTy(maphieu, manguoidung, macongty, true);

            if (phieu.Abtype == "PDN2")
            {
                Response.Redirect("chitietphieugui2ND.aspx");
            }
            else
            {
                Response.Redirect("chitietphieugui1ND.aspx");
            }
        }
Ejemplo n.º 20
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row     = GridView1.SelectedRow;
            string      maphieu = row.Cells[1].Text;

            Session["maphieu"] = maphieu;
            string macongty = Session["congty"].ToString();
            pdna   timphieu = pnaDAO.TimVanBanTheoMa(maphieu, macongty, true);

            if (timphieu != null && timphieu.Abtype == "PDN2")
            {
                Response.Redirect("frmSuaphieumuahangNV.aspx");
            }
            else
            {
                Response.Redirect("chitietphieuchuadichNV.aspx");
            }
        }
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string macongty    = Session["congty"].ToString();
            string manguoidung = Session["user"].ToString();
            string maphieu     = (string)GridView1.Rows[e.RowIndex].Cells[3].Text;

            Session["maphieu"] = maphieu;
            pdna phieu = pnaDAO.TimKiemVanBanTheoMaNguoiTaoCongTy(maphieu, manguoidung, macongty, true);

            if (phieu.Abtype == "PDN2")
            {
                Response.Redirect("chitietphieugui2NV.aspx");
            }
            else
            {
                Response.Redirect("chitietphieugui1NV.aspx");
            }
            // Abcon phieu = AbconDAO.TimMaPhieuTheoNguoiDuyet(maphieu, Until.uNhanVien.USERID, macongty);
        }
Ejemplo n.º 22
0
        public static bool CapNhatPhieuDich(pdna phieudich, string macongty)
        {
            try
            {
                pdna phieu = new pdna();
                phieu               = db.pdnas.Where(p => p.pdno == phieudich.pdno && p.GSBH == macongty).FirstOrDefault();
                phieu.pdno          = phieudich.pdno;
                phieu.GSBH          = macongty;
                phieu.CFMDate2      = phieudich.CFMDate2;
                phieu.CFMDate4      = phieudich.CFMDate4;
                phieu.NoiDungDich   = phieudich.NoiDungDich;
                phieu.trangthaidich = phieudich.trangthaidich;
                phieu.IdnguoiDich   = phieudich.IdnguoiDich;
                phieu.bixoa         = false;

                phieu.dagui = false;

                db.SubmitChanges();
                return(true);
            }
            catch (System.Data.Linq.ChangeConflictException)
            {
                foreach (System.Data.Linq.ObjectChangeConflict occ in db.ChangeConflicts)
                {
                    //?

                    // ?Linq
                    occ.Resolve(System.Data.Linq.RefreshMode.OverwriteCurrentValues);

                    // Linq?
                    occ.Resolve(System.Data.Linq.RefreshMode.KeepCurrentValues);

                    // ?
                    occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
                }
                db.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 23
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            string maphieu      = Session["maphieu"].ToString();
            string macongty     = Session["congty"].ToString();
            string manguoidung  = Session["user"].ToString();
            pdna   kiemtraphieu = pnaDAO.LayVanBanTheoNguoiTrinh(maphieu, macongty, manguoidung);

            if (kiemtraphieu.trangthaidich == true)
            {
                lbThongBao.Text = "Phiếu này đã được dịch rồi không thể sửa được nữa";
            }
            else
            {
                btnEdit.Enabled = false;
                btnEdit.Attributes.CssStyle.Add("opacity", "0.3");
                CKEditorControl1.Enabled = true;
                btnLuu.Enabled           = true;
                btnLuu.Attributes.CssStyle.Add("opacity", "100");
            }
        }
Ejemplo n.º 24
0
        private void HienThiThongTinBiHuy()
        {
            string maphieu  = Session["maphieu"].ToString();
            string macongty = Session["congty"].ToString();
            pdna   phieu    = pnaDAO.TimPhieuDaTungBiHuy(maphieu, macongty);

            if (phieu != null)
            {
                string sophieucu = phieu.oldpdno;
                Label1Sophieucu.Visible = true;
                Label2cophieucu.Visible = true;

                Session["sophieucu"] = sophieucu;
                Label2cophieucu.Text = sophieucu;
            }
            else
            {
                Label1Sophieucu.Visible = false;
                Label2cophieucu.Visible = false;
            }
        }
Ejemplo n.º 25
0
        public static bool CapNhatPhieuBiHuy(pdna pd)
        {
            try
            {
                DateTime date = DateTime.Now;
                //  string ngaythang = DateTime.Parse(date.ToShortDateString()).ToString("yyyy/MM/dd");
                pdna p = new pdna();
                p = db.pdnas.Where(q => q.pdno == pd.pdno).FirstOrDefault();
                {
                    p.GSBH = pd.GSBH;
                    p.pdno = pd.pdno;


                    p.USERDATE = date;
                    p.CFMDate0 = date;
                    p.YN       = pd.YN;


                    p.CFMDate1 = pd.CFMDate1;
                    p.CFMDate2 = pd.CFMDate2;
                    p.CFMDate4 = pd.CFMDate4;

                    p.NoiDungDich = pd.NoiDungDich;
                    p.bixoa       = false;
                    p.dagui       = false;
                    p.ABC         = pd.ABC;

                    p.IdnguoiDich   = pd.IdnguoiDich;
                    p.trangthaidich = false;
                    p.YN            = pd.YN;
                }
                db.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["user"] == null)
         {
             //Response.Redirect("~/presentationLayer/DangNhap.aspx");
             Response.Redirect("http://portal.footgear.com.vn");
         }
         string strNgonngu = (string)Session["languege"];
         if (strNgonngu != null)
         {
             LayngonNgu(33, strNgonngu);
         }
         else
         {
             Response.Redirect("http://portal.footgear.com.vn");
         }
         GanNgonNguVaoConTrol();
         string macongty = Session["congty"].ToString();
         string maphieu  = Session["maphieu"].ToString();
         pdna   phieu    = pnaDAO.TimVanBanTheoMa(maphieu, macongty);
         if (phieu.Abtype == "PDN2" && phieu != null)
         {
             divPhieuDeNghi.Visible  = false;
             divPhieuMuaHang.Visible = true;
             HienThiDanhSachMuaHang();
             HienThiPhieuMuaHang();
         }
         else
         {
             divPhieuDeNghi.Visible  = true;
             divPhieuMuaHang.Visible = false;
             HienThi();
         }
     }
 }
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row     = GridView1.SelectedRow;
            Label       lbl     = (Label)row.FindControl("lblPdno");
            string      maphieu = lbl.Text;

            Session["maphieu"] = maphieu;
            Label  lblisPause = (Label)row.FindControl("lblisPause");
            string ispause    = lblisPause.Text.Trim().ToLower();

            string macongty = Session["congty"].ToString();
            pdna   timphieu = pnaDAO.TimVanBanTheoMa(maphieu, macongty, true);

            if (timphieu != null && timphieu.Abtype == "PDN2")
            {
                if (ispause == "true")
                {
                    Response.Redirect("ChiTietPhieuTraVeChuaDich2.aspx");
                }
                else
                {
                    Response.Redirect("frmSuaphieumuahangND.aspx");
                }
            }
            else
            {
                if (ispause == "true")
                {
                    Response.Redirect("ChiTietPhieuTraVeChuaDich1.aspx");
                }
                else
                {
                    Response.Redirect("chitietphieuchuadichND.aspx");
                }
            }
        }
        protected void btnKhoiPhuc_Click(object sender, EventArgs e)
        {
            dalPDN   dal         = new dalPDN();
            string   maphieu     = Session["maphieu"].ToString();
            string   macongty    = Session["congty"].ToString();
            string   manguoidung = Session["user"].ToString();
            DateTime date        = DateTime.Now;

            //string ngaytao = DateTime.Parse(date.ToShortDateString()).ToString("dd/MM/yyyy");
            #region chua dung den
            //List<Abcon> DSphieu = AbconDAO.QryChiTietPhieuTheoPhieuKhongDuocDuyet(maphieu, macongty, manguoidung);
            //foreach (Abcon phieu in DSphieu)
            //{
            //    AbconDAO.XoaChiTietTheoSoPhieu(phieu.IDCT);
            //}
            //List<VanBanDen> DsVanBanden = VanBanDenDAO.QryVanBanDen(maphieu, macongty);
            //foreach (VanBanDen vanban in DsVanBanden)
            //{
            //    VanBanDenDAO.XoaVanBanDen(vanban.id);
            //}
            //List<PDNSheetFlow> DsChitiet = PDNSheetFlowDAO.QryPDNSheetFlowTheoPhieu(maphieu, macongty);
            //foreach (PDNSheetFlow chitiet in DsChitiet)
            //{
            //    PDNSheetFlowDAO.XoaPDNSheetFlow(chitiet.Id);
            //}
            //ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(maphieu, macongty);

            //TrangThaiDuyetDAO.XoaTrangThaiDuyet(trangthai.IDTrangThai);
            #endregion
            DataTable dt         = dal.DemSoLuongPhieu();
            string    aa         = dt.Rows[0]["pdno"].ToString().Trim();
            string    maphieumoi = "";
            if (dt.Rows.Count != 0 && aa != "")
            {
                string dem = (int.Parse(aa) + 1).ToString();
                maphieumoi = dem;
            }
            else
            {
                maphieumoi = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMM") + "00" + 1;
            }
            pdna timphieu = pnaDAO.TimVanBanTheoMa(maphieu, macongty, true);
            db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + timphieu.pdno.ToString() + "'and GSBH='" + timphieu.GSBH.ToString() + "' and CFMID0='" + timphieu.CFMID0.ToString() + "'"));
            if (timphieu != null && timphieu.Abtype == "PDN2")
            {
                pdna phieub = new pdna();
                phieub.pdno          = maphieumoi;
                phieub.YN            = 5;
                phieub.GSBH          = macongty;
                phieub.dagui         = false;
                phieub.bixoa         = false;
                phieub.CFMDate0      = DateTime.Today;
                phieub.UseIntent     = timphieu.UseIntent;
                phieub.IdnguoiDich   = null;
                phieub.trangthaidich = false;
                phieub.NoiDungDich   = null;
                phieub.LevelDoing    = 1;
                phieub.CFMID0        = manguoidung;
                phieub.Abtype        = timphieu.Abtype;
                phieub.ABC           = timphieu.ABC;
                phieub.mytitle       = timphieu.mytitle;
                phieub.pddepid       = timphieu.pddepid;
                phieub.pdmemovn      = timphieu.pdmemovn;
                phieub.oldpdno       = timphieu.pdno;
                pnaDAO.InsertPDNA(phieub);
                // lay danh sach vat tu theo so phieu

                List <pdna1> list = PDNA1DAO.QryHangTheoPhieu(macongty, maphieu);
                foreach (pdna1 vattu in list)
                {
                    dal.ThemHang1(macongty, vattu.CLBH, maphieumoi, vattu.Size, decimal.Parse(vattu.Qty.ToString()), vattu.Memo0, vattu.CLmemo);
                }
            }
            else
            {
                pdna phieub = new pdna();
                phieub.pdno          = maphieumoi;
                phieub.YN            = 5;
                phieub.GSBH          = macongty;
                phieub.dagui         = false;
                phieub.bixoa         = false;
                phieub.CFMDate0      = DateTime.Today;
                phieub.CFMDate1      = null;
                phieub.CFMDate2      = null;
                phieub.CFMDate4      = null;
                phieub.IdnguoiDich   = null;
                phieub.trangthaidich = false;
                phieub.NoiDungDich   = null;
                phieub.LevelDoing    = 1;
                phieub.CFMID0        = manguoidung;
                phieub.Abtype        = timphieu.Abtype;

                phieub.mytitle  = timphieu.mytitle;
                phieub.pddepid  = timphieu.pddepid;
                phieub.pdmemovn = timphieu.pdmemovn;
                phieub.oldpdno  = timphieu.pdno;
                phieub.ABC      = 1;
                pnaDAO.InsertPDNA(phieub);
            }
            #region chua dung den
            //pnaDAO.CapNhatPhieuBiHuy(phieub);
            //db.ExecuteCommand("update pdna set GSBH='" + phieub.GSBH.ToString() + "',NoiDungDich=N'" + phieub.NoiDungDich.ToString() + "',CFMDate1='" + phieub.CFMDate1 + "',trangthaidich='" + phieub.trangthaidich.Value + "',CFMDate0=N'" + phieub.CFMDate0 + "',CFMDate2=N'" + phieub.CFMDate2 + "',bixoa='" + phieub.bixoa.Value + "',dagui='" + phieub.dagui.Value + "',YN='" + int.Parse(phieub.YN.ToString()) + "',LevelDoing='" + int.Parse(phieub.LevelDoing.ToString()) + "',IdnguoiDich=N'" + phieub.IdnguoiDich.ToString() + "' where pdno=N'" + phieub.pdno.ToString() + "' ");
            // db.ExecuteCommand("update pdna set GSBH='" + phieub.GSBH.ToString() + "',NoiDungDich=N'" + phieub.NoiDungDich.ToString() + "',trangthaidich='" + phieub.trangthaidich.Value + "',CFMDate0=N'" + phieub.CFMDate0 + "',bixoa='" + phieub.bixoa.Value + "',dagui='" + phieub.dagui.Value + "',YN='" + int.Parse(phieub.YN.ToString()) + "',LevelDoing='" + int.Parse(phieub.LevelDoing.ToString()) + "',IdnguoiDich=N'" + phieub.IdnguoiDich.ToString() + "' where pdno=N'" + phieub.pdno.ToString() + "' ");
            // db.CapNhatPhieuDaBiHuy(phieub.pdno, phieub.GSBH, phieub.dagui, phieub.bixoa, phieub.YN, phieub.NoiDungDich, phieub.IdnguoiDich, phieub.trangthaidich, phieub.CFMDate1, phieub.CFMDate0, phieub.CFMDate2, phieub.CFMDate4, phieub.ABC, phieub.LevelDoing);
            #endregion
            Response.Redirect("DanhsachphieumoikhoitaoNV.aspx");
        }
        private void HienThi()
        {
            string nguoiduyet = Session["user"].ToString();
            string maphieu    = Session["maphieu"].ToString();


            string macongty = Session["congty"].ToString();
            //string madonvi = Session["mabophan"].ToString();
            pdna        chitietduyet   = pnaDAO.LayPhieuTheoNguoiGui(maphieu, nguoiduyet, macongty);
            BDepartment timbophan      = BDepartmentDAO.TimMaDonVi(chitietduyet.pddepid, macongty);
            Busers2     users          = UserBUS.TimNhanVienTheoMa(nguoiduyet, macongty);
            Abcon       lydokhongduyet = AbconDAO.LayPhieuKhongDuyetTheoPhieu(timbophan.ID, chitietduyet.Abtype, macongty, maphieu);

            if (lydokhongduyet == null)
            {
                lblLyDo.Visible     = false;
                lblNhanLyDo.Visible = false;
            }
            else
            {
                lblLyDo.Visible     = true;
                lblNhanLyDo.Visible = true;
                lblLyDo.Text        = lydokhongduyet.lydokhongduyet;
            }
            abill  loaiphieu      = abillBUS.SearchAbillByID(chitietduyet.Abtype);
            string tenloaiphieuVN = loaiphieu.abname;
            string tenloaiphieuTW = loaiphieu.abnameTW;

            lbLoaiPhieu.Text      = tenloaiphieuVN + " " + tenloaiphieuTW;
            lbldonvidenghi.Text   = timbophan.DepName;
            lbSoPhieu.Text        = maphieu;
            txtSoPhieu.Text       = maphieu.ToString().Trim();
            lblMucDichSuDung.Text = chitietduyet.UseIntent;
            lblTieuDe.Text        = chitietduyet.mytitle + chitietduyet.pdnsubject;
            // lbNgay.Text = chitietduyet.CFMDate0.ToString();
            string dinhdang = chitietduyet.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 + "";
            //Abcon abcon6 = AbconBUS.LaymaVanBanTheoCapDuyet6(maphieu, 6);
            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;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnDetail.Visible = false;
                string UserID   = (string)Request["UserID"];
                string macongty = (string)Request["GSBH"];
                string pdno     = (string)Request["pdno"];
                string ngonngu  = (string)Request["languege"];
                if (UserID != null && macongty != null && pdno != null && ngonngu != null)
                {
                    Session["user"]     = UserID.ToString().Trim();
                    Session["UserID"]   = UserID.ToString().Trim();
                    Session["maphieu"]  = pdno.ToString().Trim();
                    Session["congty"]   = macongty.ToString().Trim();
                    Session["languege"] = ngonngu.ToString().Trim();
                }
                string ghichu     = "";
                int    Yn         = 2;
                bool   duyet      = false;
                Abcon  timmaphieu = AbconDAO.TimPhieuTheoNguoiTao(pdno, macongty, UserID);
                if (timmaphieu != null && timmaphieu.Yn == 4)
                {
                    Dictionary <bool, Abcon> capDangDuyet = pnaDAO.LayCapDangDuyetCuaVanBanQuaMail(pdno, UserID, macongty, true, true);
                    Abcon   cd      = capDangDuyet.First().Value;
                    pdna    vb      = pnaDAO.TimVanBanTheoMa(pdno, macongty, true);
                    Busers2 nvkt    = UserDAO.LayNhanVienKhoiTaoCuaVanBan(pdno, true);
                    Busers2 nvduyet = UserDAO.TimNhanVienTheoMa(UserID, macongty);
                    AbconDAO.SuaChiTiet1(cd, UserID, ghichu, duyet, true);
                    PDNSheetFlow PDNSheetFlow = PDNSheetFlowBUS.LayPDNSheetFlowTheoIdVanBanBuocKy(pdno, cd.abps);
                    PDNSheetFlowBUS.SuaPDNSheetFlow(PDNSheetFlow, duyet);
                    ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(pdno, macongty);
                    TrangThaiDuyetDAO.SuaTrangThaiDuyet(trangthai, duyet);
                    dal.CapNhatPhieuPDNA(pdno, macongty, Yn, cd.Abstep, UserID);
                    string beginDiv = "<div style=\"border-style: solid; border-color: inherit; width:600px; border-width:1px;\"" + "><br/>";
                    string endDiv   = "</div> <br/>";
                    string thongtin = duyet ? "ĐÃ ĐƯỢC DUYỆT 已经审核" : "KHÔNG ĐƯỢC DUYỆT 未签" + "<br/>";
                    string noidung  = "Thông báo văn bản bị TẠM DỪNG do 本单暂时停用为" + "<br/>";
                    noidung += thongtin + "<br/>";
                    noidung  = "- Mã văn bản 单号: " + vb.pdno + "<br/>";
                    noidung += "- Tiêu đề 题目: " + vb.mytitle + vb.pdnsubject + "<br/>";

                    noidung += "- Ngày tạo 创建于: " + vb.CFMDate0.Value.ToShortDateString() + "<br/>";
                    noidung += "- Người duyệt 审核者: " + nvduyet.USERNAME + "<br/>";

                    Until.SendMailNguoiTao(nvduyet.EMAIL, nvkt.EMAIL, "[Ty Hung-eOffice] ", beginDiv + thongtin + noidung + endDiv);

                    btnDetail.Visible         = true;
                    lblThongBao.Text          = "Bạn đã không xét duyệt phiếu này - 本单未审核";
                    Session["maloaiphieutam"] = timmaphieu.abtype.Trim();
                }
                else
                {
                    Abcon timphieu = AbconDAO.TimPhieuTheoNguoiTao(pdno, macongty, UserID);
                    if (timphieu != null)
                    {
                        if (timphieu.Yn == 2 && timphieu.abrult == false)
                        {
                            btnDetail.Visible         = true;
                            Session["maloaiphieutam"] = timphieu.abtype.Trim();
                            lblThongBao.Text          = "Bạn đã duyệt phiếu này rồi - 您已经审核";
                        }
                        else
                        {
                            if (timphieu.Yn == 1 && timphieu.abrult == false)
                            {
                                btnDetail.Visible         = true;
                                Session["maloaiphieutam"] = timphieu.abtype.Trim();
                                lblThongBao.Text          = "Bạn đã duyệt phiếu này rồi - 您已经审核";
                            }
                        }
                    }
                }
            }
        }