protected void Page_Load(object sender, EventArgs e) { 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(25, strNgonngu); } else { Response.Redirect("http://portal.footgear.com.vn"); } GanNgonNguVaoConTrol(); if (!IsPostBack) { string maphieu = Session["maphieu"].ToString(); string macongty = Session["congty"].ToString(); string manguoidung = Session["user"].ToString(); //pdna phieu = pnaDAO.LayVanBanChuaDichTheoNguoiDich(maphieu, macongty, manguoidung); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + maphieu + "'and GSBH='" + macongty + "' and IDNguoiDich='" + manguoidung + "'")); var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + maphieu + "'and GSBH='" + macongty + "' and IDNguoiDich='" + manguoidung + "'"); foreach (pdna phieu in list) { // string ngaythang = DateTime.Parse(phieu.CFMDate0.ToString("dd/MM/yyyy")); BDepartment bophan = BDepartmentBUS.TimMaDonVi(phieu.pddepid, macongty); abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype); string tenloaiphieuVN = loaiphieu.abname; string tenloaiphieuTW = loaiphieu.abnameTW; lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW; lbBoPhan.Text = bophan.DepName; txtNguoiDUyet.Text = phieu.CFMID1; //lbNgay.Text = ; lbNoiDung.Text = phieu.pdmemovn; lbSoPhieu.Text = phieu.pdno; lblTieuDe.Text = phieu.mytitle; txtTieuDe.Text = phieu.pdnsubject; CKEditorControl1.Text = phieu.NoiDungDich; string dinhdang = phieu.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 + ""; } } }
public void HienThiDanhSachMuaHang() { string macongty = Session["congty"].ToString(); string idphieu = Session["maphieu"].ToString(); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + idphieu + "' and b.GSBH='" + macongty + "'")); GridView1.DataSource = db.ExecuteQuery <BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + idphieu + "' and b.GSBH='" + macongty + "'"); GridView1.DataBind(); //GridView1.DataSource = pnaDAO.LayPhieuMuaHang(idphieu, macongty); //GridView1.DataBind(); }
private void HienThiPhieuMuaHang() { string macongty = Session["congty"].ToString(); string idphieu = Session["maphieu"].ToString(); string manguoidung = Session["user"].ToString(); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + idphieu + "'and GSBH='" + macongty + "' and CFMID0='" + manguoidung + "'")); var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + idphieu + "'and GSBH='" + macongty + "' and CFMID0='" + manguoidung + "'"); foreach (pdna phieu in list) { abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype); BDepartment donvi = BDepartmentDAO.TimMaDonVi(phieu.pddepid, macongty); string tenloaiphieuVN = loaiphieu.abname; string tenloaiphieuTW = loaiphieu.abnameTW; txtTieuDe.Text = phieu.mytitle; lblPhieuMuaHang.Text = tenloaiphieuVN + " " + tenloaiphieuTW; lbldonvidenghi.Text = donvi.DepName; lblsophieu.Text = idphieu; lblMucDichSuDung.Text = phieu.UseIntent; 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 + ""; } }
private void HienThiPhieuMuaHang() { string macongty = Session["congty"].ToString(); string idphieu = Session["maphieu"].ToString(); string bophan = Session["bophan"].ToString(); string manguoidung = Session["user"].ToString(); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + idphieu + "'and GSBH='" + macongty + "' and CFMID0='" + manguoidung + "'")); var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + idphieu + "'and GSBH='" + macongty + "' and CFMID0='" + manguoidung + "'"); foreach (pdna phieu in list) { // pdna phieu = pdnaBUS.TimVanBanTheoMa(idphieu,macongty, true); if (phieu == null) { string noidung = Session["noidung"].ToString(); string ngaytao = Session["ngaytao"].ToString(); lbldonvidenghi.Text = bophan; lblsophieu.Text = idphieu; DateTime date = DateTime.Now; string dinhdang = DateTime.Parse(date.ToShortDateString()).ToString("dd/MM/yyyy"); 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 + ""; } else { abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype); string tenloaiphieuVN = loaiphieu.abname; string tenloaiphieuTW = loaiphieu.abnameTW; TenLblLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW; lbldonvidenghi.Text = bophan; lblsophieu.Text = idphieu; lblMucDichSuDung.Text = phieu.UseIntent; 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 + ""; } } }
private void HienThi() { string macongty = Session["congty"].ToString(); string idphieu = Session["maphieu"].ToString(); //string bophan = Session["bophan"].ToString(); string manguoidung = Session["user"].ToString(); //string tenloaiphieu = Session["loaiP"].ToString(); DateTime date = DateTime.Now; //pdna phieu = pdnaBUS.TimVanBanTheoMa(idphieu, macongty, true); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + idphieu + "'and GSBH='" + macongty + "' and CFMID0='" + manguoidung + "'")); var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + idphieu + "'and GSBH='" + macongty + "' and CFMID0='" + manguoidung + "'"); foreach (pdna phieu in list) { if (phieu == null) { string noidung = Session["noidung"].ToString(); string ngaytao = Session["ngaytao"].ToString(); abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype); string tenloaiphieuVN = loaiphieu.abname; string tenloaiphieuTW = loaiphieu.abnameTW; BDepartment donvi = BDepartmentBUS.TimMaDonVi(phieu.pddepid, macongty); lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW; lbBoPhan.Text = donvi.DepName; lbSoPhieu.Text = idphieu; lbNoiDung.Text = noidung; //lbNgay.Text = ngaytao; string dinhdang = DateTime.Parse(date.ToShortDateString()).ToString("dd/MM/yyyy"); string ngay = dinhdang.Substring(3, 2); string thang = dinhdang.Substring(0, 2); string nam = dinhdang.Substring(6, 4); lbNgay.Text = "Ngày 日 " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + ""; } else { BDepartment donvi = BDepartmentBUS.TimMaDonVi(phieu.pddepid, macongty); lbBoPhan.Text = donvi.DepName; lbSoPhieu.Text = idphieu; lbNoiDung.Text = phieu.pdmemovn; //lbNgay.Text = phieu.CFMDate0.ToString(); abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype); string tenloaiphieuVN = loaiphieu.abname; string tenloaiphieuTW = loaiphieu.abnameTW; lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW; lblNoiDungDich.Text = phieu.NoiDungDich; string dinhdang = phieu.CFMDate0.ToString(); string ngay = dinhdang.Substring(3, 2); string thang = dinhdang.Substring(0, 2); string nam = dinhdang.Substring(6, 4); lbNgay.Text = "Ngày 日 " + ngay + " Tháng 月 " + thang + " Năm 年 " + nam + ""; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { //Response.Redirect("~/presentationLayer/DangNhap.aspx"); Response.Redirect("http://portal.footgear.com.vn"); } string maphieu = Session["maphieu"].ToString(); string macongty = Session["congty"].ToString(); string manguoidung = Session["user"].ToString(); //pdna phieu = pnaDAO.LayVanBanDaDichTheoNguoiDich(maphieu, macongty, manguoidung); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + maphieu + "'and GSBH='" + macongty + "' and IdnguoiDich='" + manguoidung + "'")); var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + maphieu + "'and GSBH='" + macongty + "' and IdnguoiDich='" + manguoidung + "'"); foreach (pdna phieu in list) { BDepartment bophan = BDepartmentBUS.TimMaDonVi(phieu.pddepid, macongty); abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype); if (!IsPostBack) { string tenloaiphieuVN = loaiphieu.abname; string tenloaiphieuTW = loaiphieu.abnameTW; lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW; lbBoPhan.Text = bophan.DepName; lbLoaiPhieu.Text = loaiphieu.abname; //lbNgay.Text = ; txtTieuDe.Text = phieu.pdnsubject; lbNoiDung.Text = phieu.pdmemovn; lbSoPhieu.Text = phieu.pdno; string dinhdang = phieu.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 + ""; CKEditorControl1.Text = phieu.NoiDungDich; CKEditorControl1.ReadOnly = true; CKEditorControl1.Enabled = false; btnLuu.Enabled = false; } } }
protected void Page_Load(object sender, EventArgs e) { string strNgonngu = (string)Session["languege"]; if (strNgonngu != null) { LayngonNgu(2, strNgonngu); } else { Response.Redirect("http://portal.footgear.com.vn"); } GanNgonNguVaoConTrol(); if (!IsPostBack) { if (Session["user"] == null) { //Response.Redirect("~/presentationLayer/DangNhap.aspx"); Response.Redirect("http://portal.footgear.com.vn"); } string macongty = Session["congty"].ToString(); string idphieu = Session["maphieu"].ToString(); string bophan = Session["bophan"].ToString(); string manguoidung = Session["user"].ToString(); // pdna phieu = pdnaBUS.TimVanBanTheoMa(idphieu, macongty, true); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + idphieu + "'and GSBH='" + macongty + "' and CFMID0='" + manguoidung + "'")); var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + idphieu + "'and GSBH='" + macongty + "' and CFMID0='" + manguoidung + "'"); foreach (pdna phieu in list) { abill loaiphieu = abillBUS.SearchAbillByID(phieu.Abtype); string tenloaiphieuVN = loaiphieu.abname; string tenloaiphieuTW = loaiphieu.abnameTW; lbLoaiPhieu.Text = tenloaiphieuVN + " " + tenloaiphieuTW; lbBoPhan.Text = bophan; lbSoPhieu.Text = idphieu; CKEditorControl1.Text = phieu.pdmemovn; } } }
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"); }
public static bool CapNhatPhieuTao1(pdna phieutao, string macongty) { try { db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.pdnas.Where(p => p.pdno == phieutao.pdno && p.GSBH == macongty).FirstOrDefault()); 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 = phieutao.trangthaidich; phieu.IdnguoiDich = phieutao.IdnguoiDich; phieu.mytitle = phieutao.mytitle; phieu.bixoa = phieutao.bixoa; phieu.CFMID0 = phieutao.CFMID0; phieu.dagui = phieutao.dagui; phieu.LevelDoing = phieutao.LevelDoing; phieu.mytitle = phieutao.mytitle; phieu.USERID = phieutao.USERID; phieu.YN = phieutao.YN; db.SubmitChanges(); return(true); } catch (System.Data.Linq.ChangeConflictException) { // db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.pdnas.ToList()); 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 (System.Data.Linq.ChangeConflictException ex) //{ // foreach (ObjectChangeConflict conflict in db.ChangeConflicts) // { // conflict.Resolve(RefreshMode.OverwriteCurrentValues); // } // db.SubmitChanges(); // return true; //} catch (Exception) { throw; } }
protected void Button1_Click1(object sender, EventArgs e) { // tao phieu mua hang string ngonngu = Session["languege"].ToString(); //string dem = (pdnaBUS.DemSoLuongVanBan() + 1).ToString(); //string maphieu = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMMdd") + "00" + dem; string maphieu = ""; 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(); 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 macongty = Session["congty"].ToString(); string user = Session["user"].ToString(); string ngaythang = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("dd/MM/yyyy"); 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 timnguoitao = UserBUS.TimNhanVienTheoMa(user, macongty); if (timnguoitao.IDCapDuyet >= 12) { string madonvi = "CBCC"; Session["bp"] = madonvi; BDepartment bd = BDepartmentBUS.TimMaDonVi(madonvi, macongty); Busers2 us = UserBUS.TimMaNhanVienTheoBoPhan(user, madonvi, macongty); if (us == null) { Busers2 kiemtra = UserDAO.TimNhanVienQuanLyDonVi(user, madonvi, macongty); if (kiemtra == null) { if (ngonngu == "lbl_VN") { lbthongbao.Text = "Người dùng này không thuộc bộ phận " + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } else if (ngonngu == "lbl_TW") { lbthongbao.Text = "该用户不属于部门 " + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } else if (ngonngu == "lbl_EN") { lbthongbao.Text = "The user does not belong to the department" + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } } else { pdna phieun = new pdna(); { phieun.GSBH = macongty; phieun.pdno = maphieu; phieun.pddepid = bophan; phieun.mytitle = tieude; phieun.pdmemovn = noidung; phieun.CFMDate0 = DateTime.Parse(ngaythang); phieun.USERID = user; phieun.Abtype = DropLoaiPhieu.SelectedValue.ToString(); phieun.bixoa = false; phieun.CFMID0 = user; phieun.YN = 5; phieun.bixoa = false; phieun.USERDATE = DateTime.Parse(ngaythang); phieun.UseIntent = txtMucDich.Text; } db.pdnas.InsertOnSubmit(phieun); db.SubmitChanges(); string tenhang = txtTenHang.Text; //string tenhang = dropTenHang.SelectedValue; string donvitinh = txtdonvitinh.Text; string soluong = txtSoLuong.Text; string ghichu = txtGhiChu.Text; string Size = ""; if (txtSize.Text.Trim() == "") { Size = "."; } else { Size = txtSize.Text.Trim(); } pdna1 hang = new pdna1(); hang.GSBH = macongty; hang.pdNO = maphieu; db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + maphieu + "' and b.GSBH='" + macongty + "'")); //GridView1.DataSource = db.ExecuteQuery<BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + maphieu + "' and b.GSBH='" + macongty + "'"); //GridView1.DataBind(); tablePMH.Visible = false; btnLuuTam.Enabled = true; btnTiepTu.Enabled = true; } Busers2 usertao = UserBUS.TimNhanVienTheoMa(user, macongty); if (usertao != null && usertao.IDCapDuyet > 12) { Response.Redirect("FrmViewCB.aspx"); } else { if (ngonngu == "lbl_VN") { lbthongbao.Text = "Người dùng này không thuộc bộ phận " + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } else if (ngonngu == "lbl_TW") { lbthongbao.Text = "该用户不属于部门 " + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } else if (ngonngu == "lbl_EN") { lbthongbao.Text = "The user does not belong to the department" + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } } } else { pdna phieun = new pdna(); { phieun.GSBH = macongty; phieun.pdno = maphieu; phieun.pddepid = bophan; phieun.mytitle = tieude; phieun.pdmemovn = noidung; phieun.CFMDate0 = DateTime.Parse(ngaythang); phieun.USERID = user; phieun.Abtype = DropLoaiPhieu.SelectedValue.ToString(); phieun.bixoa = false; phieun.CFMID0 = user; phieun.YN = 5; phieun.bixoa = false; phieun.USERDATE = DateTime.Parse(ngaythang); phieun.UseIntent = txtMucDich.Text; } db.pdnas.InsertOnSubmit(phieun); db.SubmitChanges(); string tenhang = txtTenHang.Text; //string tenhang = dropTenHang.SelectedValue; string donvitinh = txtdonvitinh.Text; string soluong = txtSoLuong.Text; string ghichu = txtGhiChu.Text; BOfSupply hang = new BOfSupply(); hang.GSBH = macongty; hang.pdno = maphieu; hang.OfSuppliesName = tenhang; hang.BUnit = donvitinh; hang.BNumber = int.Parse(soluong); hang.BCommnent = ghichu; SuppliesDAO.ThemVatTu(hang); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + maphieu + "' and b.GSBH='" + macongty + "'")); //GridView1.DataSource = db.ExecuteQuery<BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + maphieu + "' and b.GSBH='" + macongty + "'"); //GridView1.DataBind(); tablePMH.Visible = false; btnLuuTam.Enabled = true; btnTiepTu.Enabled = true; } } else { BDepartment bd = BDepartmentBUS.TimMaDonVi(bophan, macongty); Busers2 us = UserBUS.TimMaNhanVienTheoBoPhan(user, bophan, macongty); if (us == null) { Busers2 kiemtra = UserDAO.TimNhanVienQuanLyDonVi(user, bophan, macongty); if (kiemtra == null) { if (ngonngu == "lbl_VN") { lbthongbao.Text = "Người dùng này không thuộc bộ phận " + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } else if (ngonngu == "lbl_TW") { lbthongbao.Text = "该用户不属于部门 " + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } else if (ngonngu == "lbl_EN") { lbthongbao.Text = "The user does not belong to the department" + bd.DepName; tablePMH.Visible = true; btnLuuTam.Enabled = false; btnTiepTu.Enabled = false; } } else { pdna phieun = new pdna(); { phieun.GSBH = macongty; phieun.pdno = maphieu; phieun.pddepid = bophan; phieun.mytitle = tieude; phieun.pdmemovn = noidung; phieun.CFMDate0 = DateTime.Parse(ngaythang); phieun.USERID = user; phieun.Abtype = DropLoaiPhieu.SelectedValue.ToString(); phieun.bixoa = false; phieun.CFMID0 = user; phieun.YN = 5; phieun.bixoa = false; phieun.USERDATE = DateTime.Parse(ngaythang); phieun.UseIntent = txtMucDich.Text; } db.pdnas.InsertOnSubmit(phieun); db.SubmitChanges(); string tenhang = txtTenHang.Text.ToUpper(); //string tenhang = dropTenHang.SelectedValue; string donvitinh = txtdonvitinh.Text.ToUpper(); string soluong = txtSoLuong.Text; string ghichu = txtGhiChu.Text; BOfSupply hang = new BOfSupply(); hang.GSBH = macongty; hang.pdno = maphieu; hang.OfSuppliesName = tenhang; hang.BUnit = donvitinh; hang.BNumber = int.Parse(soluong); hang.BCommnent = ghichu; SuppliesDAO.ThemVatTu(hang); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + maphieu + "' and b.GSBH='" + macongty + "'")); //GridView1.DataSource = db.ExecuteQuery<BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + maphieu + "' and b.GSBH='" + macongty + "'"); //GridView1.DataBind(); tablePMH.Visible = false; btnLuuTam.Enabled = true; btnTiepTu.Enabled = true; } //Busers2 usertao = UserBUS.TimNhanVienTheoMa(user, macongty); //if (usertao != null && usertao.IDCapDuyet > 12) //{ //} //else //{ // 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 { pdna phieun = new pdna(); { phieun.GSBH = macongty; phieun.pdno = maphieu; phieun.pddepid = bophan; phieun.mytitle = tieude; phieun.pdmemovn = noidung; phieun.CFMDate0 = DateTime.Parse(ngaythang); phieun.USERID = user; phieun.Abtype = DropLoaiPhieu.SelectedValue.ToString(); phieun.bixoa = false; phieun.CFMID0 = user; phieun.YN = 5; phieun.bixoa = false; phieun.USERDATE = DateTime.Parse(ngaythang); phieun.UseIntent = txtMucDich.Text; } db.pdnas.InsertOnSubmit(phieun); db.SubmitChanges(); string tenhang = txtTenHang.Text; //string tenhang = dropTenHang.SelectedValue; string donvitinh = txtdonvitinh.Text; string soluong = txtSoLuong.Text; string ghichu = txtGhiChu.Text; BOfSupply hang = new BOfSupply(); hang.GSBH = macongty; hang.pdno = maphieu; hang.OfSuppliesName = tenhang; hang.BUnit = donvitinh; hang.BNumber = int.Parse(soluong); hang.BCommnent = ghichu; SuppliesDAO.ThemVatTu(hang); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + maphieu + "' and b.GSBH='" + macongty + "'")); //GridView1.DataSource = db.ExecuteQuery<BOfSupply>("select b.IDOfSupplies,b.OfSuppliesName,b.pdno,b.GSBH,b.BUnit,b.BNumber,b.BCommnent from pdna p left join BOfSupplies b on p.pdno=b.pdno and p.GSBH=b.GSBH where b.pdno='" + maphieu + "' and b.GSBH='" + macongty + "'"); //GridView1.DataBind(); tablePMH.Visible = false; btnLuuTam.Enabled = true; btnTiepTu.Enabled = true; } } // them vat tu Session["bp"] = bophan; Session["bophan"] = bp; Session["loaiP"] = loaiP; Session["loaiphieu"] = loaiphieu; Session["maphieu"] = maphieu; Session["noidung"] = noidung; Session["ngaytao"] = ngaythang; Session["tieude"] = tieude; }
protected void Button1_Click(object sender, EventArgs e) { try { // string maloai = Session["loaiphieu"].ToString(); string phieu = Session["maphieu"].ToString(); string idnguoidich = DropDownNguoiDich.SelectedValue.ToString(); string congty = Session["congty"].ToString(); string user = Session["user"].ToString(); pdna kiemtra = pnaDAO.TimVanBanTheoMa(phieu, congty); if (kiemtra != null && kiemtra.trangthaidich == false && kiemtra.YN == 6) { //string ngonngu = Session["languege"].ToString(); //if (ngonngu == "lbl_VN") //{ // LbThongBao.Text = "Phiếu đã được gửi đến người dịch"; //} //else if (ngonngu == "lbl_TW") //{ // LbThongBao.Text = "资料已经转送翻译成中文(越文)。请巡查名单"; //} //else if (ngonngu == "lbl_EN") //{ // LbThongBao.Text = "Phiếu đã được gửi đến người dịch"; //} } else { pdna phieun = new pdna(); phieun.GSBH = congty; phieun.pdno = phieu; phieun.trangthaidich = false; db.CapNhaPhieuGuiNguoiKhacDich(phieun.pdno, phieun.GSBH, idnguoidich, phieun.trangthaidich); } // pdna layvanban = pdnaBUS.LayVanBanDaGuiDenNguoiDuyetTheoNGuoiTrinhDuyet(phieu, manguoiduyet, congty); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + phieu + "'and GSBH='" + congty + "' and CFMID0='" + idnguoidich + "'")); var list = db.ExecuteQuery <pdna>("select * from pdna where pdno='" + phieu + "'and GSBH='" + congty + "' and CFMID0='" + idnguoidich + "'"); if (list == null) { //LbThongBao.Text = "Lỗi không thể gửi được đến người cần dịch. Xin liên hệ bộ phận IT"; string ngonngu = Session["languege"].ToString(); if (ngonngu == "lbl_VN") { LbThongBao.Text = "Lỗi không thể gửi được đến người cần dịch. Xin liên hệ bộ phận IT"; } else if (ngonngu == "lbl_TW") { LbThongBao.Text = "Error! "; } else if (ngonngu == "lbl_EN") { LbThongBao.Text = "Error can not be sent to people who need services. Please contact the IT department"; } } else { Busers2 nhanvientao = UserDAO.TimNhanVienTheoMa(user, congty); Busers2 nhanviendich = UserBUS.TimMaNhanVienDich(idnguoidich, congty); if (nhanvientao != null && nhanviendich != null) { string ngonngu = Session["languege"].ToString(); String noidung2 = "Chào anh/chị. Tôi có 1 phiếu nhờ anh/chị dịch giúp với"; noidung2 += "- Mã văn bản: " + kiemtra.pdno + "\n"; noidung2 += "- Tiêu đề: " + kiemtra.mytitle + "\n"; noidung2 += "- Ngày tạo: " + kiemtra.CFMDate0.Value.ToShortDateString() + "\n"; noidung2 += "- Người nhờ dịch: " + nhanvientao.USERNAME + "\n"; //noidung2 += "Click on link " + "http://192.168.11.8/pdn/presentationLayer/NguoiDich/danhsachphieuchuadich.aspx"; Until.SendMailNguoiDich(nhanvientao.EMAIL, nhanviendich.EMAIL, "[Ty Hung-eOffice] Thông báo có phiếu cần dịch ", noidung2, nhanviendich.USERID, congty, ngonngu); if (ngonngu == "lbl_VN") { LbThongBao.Text = "Phiếu đã được gửi đến người dịch"; } else if (ngonngu == "lbl_TW") { LbThongBao.Text = "资料已经转送翻译成中文(越文)。请巡查名单"; } else if (ngonngu == "lbl_EN") { LbThongBao.Text = "Phiếu đã được gửi đến người dịch"; } } } Button1.Enabled = false; Button1.Attributes.CssStyle.Add("opacity", "0.5"); } catch (Exception) { throw; } }