private void KiemTraPhieu() { string macongty = Session["congty"].ToString(); string maphieu = Session["maphieu"].ToString(); List <BOfSupply> kiemtra = SuppliesDAO.QryHangTheoPhieu(maphieu, macongty); if (kiemtra.Count == 0) { tablePMH.Visible = true; } else { tablePMH.Visible = false; } }
protected void Button1_Click(object sender, EventArgs e) { StringBuilder html = new StringBuilder(); string userid = "00002"; string congty = "LTY"; string pdno = "201411180094"; string maphieu = "201411180094"; string macongty = "LTY"; pdna layphieu = pnaDAO.TimVanBanTheoMa(maphieu, macongty, true); string noidung2 = "- Mã văn bản 单号: " + "<br/>"; noidung2 += "- Tiêu đề 题目:" + " <br/>"; noidung2 += "- Ngày tạo 创建于:" + " <br/>"; noidung2 += "- Người trình duyệt 寄件者:" + " <br/>"; noidung2 += "noi dung" + layphieu.pdmemovn + "<br/>"; noidung2 += "Hoac thay vao day " + "<br/>"; noidung2 += "<a href=\"http://*****:*****@footgear.com.vn"; string touser = "******"; // Until.SendMailNguoiDich(from, touser, pdno, noidung2); // Until.SendMailNguoiTao(from, touser, YourSubject.Text, noidung2); Until.SendMailNguoiDuyet(from, touser, YourSubject.Text, noidung2 + strBody); lblMsgSend.Text = "Your Comments after sending the mail"; lblMsgSend.Visible = true; YourSubject.Text = ""; YourEmail.Text = ""; YourName.Text = ""; Comments.Text = ""; }
protected void btnKhoiPhuc_Click(object sender, EventArgs e) { 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("yyyy/MM/dd"); #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 //string dem = (pdnaBUS.DemSoLuongVanBan() + 1).ToString(); //string maphieumoi = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMMdd") + dem; string maphieumoi = ""; dalPDN dal = new dalPDN(); DataTable dt = dal.DemSoLuongPhieu(); string aa = dt.Rows[0]["pdno"].ToString().Trim(); 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<BOfSupply> list = SuppliesDAO.QryHangTheoPhieu(timphieu.pdno, macongty); foreach (BOfSupply vattu in list) { BOfSupply vt = new BOfSupply(); vt.GSBH = macongty; vt.OfSuppliesName = vattu.OfSuppliesName; vt.pdno = maphieumoi; vt.BUnit = vattu.BUnit; vt.BNumber = vattu.BNumber; vt.BCommnent = vattu.BCommnent; SuppliesDAO.ThemVatTu(vt); } } 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 = 0; phieub.CFMID0 = manguoidung; phieub.Abtype = timphieu.Abtype; phieub.ABC = 1; phieub.mytitle = timphieu.mytitle; phieub.pddepid = timphieu.pddepid; phieub.pdmemovn = timphieu.pdmemovn; phieub.oldpdno = timphieu.pdno; 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("Danhsachphieumoikhoitao.aspx"); }