public ActionResult Deleted(string DataJson) { JsonResult Data = new JsonResult(); JObject json = JObject.Parse(DataJson); string macuochop = json["uploadfile"].ToString(); string filename = json["tenfile"].ToString(); string maphongban = json["maphongban"].ToString(); //int phongban_congtruong = (int)json["phongban_congtruong"]; DaotaoServices servicevpp = new DaotaoServices(); string nguoitao = Session["userid"].ToString(); string iresult = servicevpp.Delete_WeedMeeting(DataJson, nguoitao); var directoryPath = Server.MapPath("~/FileUpload/") + macuochop.Replace("/", "."); if (!System.IO.Directory.Exists(directoryPath)) { System.IO.Directory.CreateDirectory(directoryPath); } string path = Path.Combine(directoryPath, filename); if (iresult != "-1") { iresult = "1"; //MailLich("TEST", path, filename, maphongban, phongban_congtruong); return(Json(new { success = true, macuochop = int.Parse(iresult) }, JsonRequestBehavior.AllowGet)); //return View(); } else { return(Json(new { success = false, macuochop = int.Parse(macuochop) }, JsonRequestBehavior.AllowGet)); //return View(); } }
public ActionResult Deleted(string madangky) { if (!IsLogged()) { return(BackToLogin()); } if (madangky != null) { FunctionXML function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkeyEncodeLink.config")); madangky = AES.DecryptText(madangky, function.ReadXMLGetKeyEncrypt()); DaotaoServices service = new DaotaoServices(); bool kq = service.DeletedRow_Dangky_vpp(madangky, Session["userid"].ToString()); if (kq) { } } return(RedirectToAction("Index")); }
public JsonResult SelectRows_WeedMeeting(WeedMeetingModels model, int curentPage) { WeedMeetingModels param = new WeedMeetingModels(); DaotaoServices service = new DaotaoServices(); DanhmucServices service_danhmuc = new DanhmucServices(); //param.nguoitao = int.Parse(Session["userid"].ToString()); param.maphongban = model.maphongban; param.loaibaocao = model.loaibaocao; //if (Session["loginid"].ToString().Trim().ToLower() == "admin" || Session["grouptk"].ToString().Trim() == "1") //{ param.nguoitao = 0; //} string thudientu = Session["thudientu"].ToString().Trim(); List <PhongBanModels> y = null; var lstcaptrentt = y; PhongBanModels parampb = new PhongBanModels(); List <PhongBanModels> lstResult_phongban = service_danhmuc.SelectRows2(parampb); lstcaptrentt = lstResult_phongban.Where(p => p.maphongban == model.maphongban).ToList(); //StringBuilder sbloaibaocao = new StringBuilder(); //sbloaibaocao.Append(string.Format("<option value={0}>{1}</option>", "1", "Báo cáo tuần CHT/TPB")); if (lstcaptrentt[0].email == thudientu || lstcaptrentt[0].ghichu == thudientu || lstcaptrentt[0].sodienthoai == thudientu || lstcaptrentt[0].ghichu1 == thudientu || lstcaptrentt[0].ghichu2 == thudientu || Session["loginid"].ToString().Trim().ToLower() == "admin" || Session["grouptk"].ToString().Trim() == "1") { param.loaibaocao = param.loaibaocao; } else if (model.loaibaocao == 2 && (lstcaptrentt[0].cv_thietbi == thudientu || lstcaptrentt[0].gs_thietbi == thudientu)) { param.loaibaocao = 2; } else if (model.loaibaocao == 3 && (lstcaptrentt[0].cv_hsse == thudientu || lstcaptrentt[0].gs_hsse == thudientu)) { param.loaibaocao = 3; } else if (model.loaibaocao == 4 && (lstcaptrentt[0].cv_qaqc == thudientu || lstcaptrentt[0].gs_qaqc == thudientu)) { param.loaibaocao = 4; } else if (model.loaibaocao == 5 && (lstcaptrentt[0].cv_mep == thudientu || lstcaptrentt[0].gs_mep == thudientu)) { param.loaibaocao = 5; } else { param.loaibaocao = 6; } int tongsodong = service.CountRows_WeedMeeting2(param); int sotrang = 1; if (tongsodong > 20) { if (tongsodong % 20 > 0) { sotrang = (tongsodong / 20) + 1; } else { sotrang = (tongsodong / 20); } } int trangbd = 1; int trangkt = 20; if (curentPage != 1 && curentPage <= sotrang) { trangbd = (trangkt * (curentPage - 1)) + 1; trangkt = trangkt * curentPage; } List <WeedMeetingModels> lstResult = new List <WeedMeetingModels>(); if (curentPage <= sotrang) { lstResult = service.SelectRows_WeedMeeting2(param, trangbd, trangkt); } else if (curentPage != 1 && curentPage > sotrang) { curentPage = curentPage - 1; } StringBuilder sbResult = new StringBuilder(); StringBuilder sbRows = new StringBuilder(); int tongdong = 0; if (lstResult.Count > 0) { string strSTT = ""; int i = trangbd; foreach (var item in lstResult) { strSTT = i.ToString(); if (item.loaicuochop == "1") { item.tenloaicuochop = "Họp tuần phòng"; } else if (item.loaicuochop == "2") { item.tenloaicuochop = "Họp tuần BGĐ"; } else if (item.loaicuochop == "3") { item.tenloaicuochop = "Họp khác"; } else { item.tenloaicuochop = ""; } if (item.phonghop == "1") { item.tenphonghop = "Tầng 3 - Phòng họp 1"; } else if (item.phonghop == "2") { item.tenphonghop = "Tầng 3 - Phòng họp 2"; } else if (item.phonghop == "3") { item.tenphonghop = "Tầng 3 - Phòng họp lớn"; } else if (item.phonghop == "4") { item.tenphonghop = "Tầng 3A - Phòng họp nhỏ"; } else if (item.phonghop == "5") { item.tenphonghop = "Tầng 3A - Phòng họp lớn"; } else if (item.phonghop == "6") { item.tenphonghop = "Khác"; } else { item.tenphonghop = ""; } sbRows.Append(PrepareDataJson_WeedMeeting(item, strSTT)); i++; } tongdong = i - 1; if (sbRows.Length > 0) { sbRows.Remove(sbRows.Length - 1, 1); } } if (tongsodong == 0) { sotrang = 0; } sbResult.Append("{"); sbResult.Append("\"isHeader\":\"" + "111" + "\","); sbResult.Append("\"tongdong\":\"" + "" + tongsodong + "" + "\","); sbResult.Append("\"Pages\":\"" + "" + sotrang + "" + "\","); sbResult.Append("\"SubRow\":\"" + "false" + "\","); sbResult.Append("\"data\":[" + sbRows.ToString() + "]"); sbResult.Append("}"); return(Json(sbResult.ToString(), JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(string macuochop) { if (!IsLogged()) { return(BackToLogin()); } Item_weedModels param = new Item_weedModels(); DanhmucServices service = new DanhmucServices(); List <Item_weedModels> lstResult_Tuan = service.SelectRows_giaovien(param); StringBuilder sbtuan = new StringBuilder(); foreach (var item in lstResult_Tuan) { item.tentuan = item.tentuan + " " + item.tungay + " - " + item.denngay; sbtuan.Append(string.Format("<option value='{0}'>{1}</option>", item.matuan, item.tentuan)); } ViewBag.sbtuan = sbtuan.ToString(); //phong ban PhongBanModels parampb = new PhongBanModels(); List <PhongBanModels> lstResult_phongban = service.SelectRows2(parampb); StringBuilder sbphongban = new StringBuilder(); string pb = ""; string maphongban = Session["maphongban"].ToString().Trim(); if (Session["loginid"].ToString().Trim().ToLower() == "admin" || Session["grouptk"].ToString().Trim() == "1") { pb = pb + "<option value=0>Chọn phòng ban</option>"; foreach (var item in lstResult_phongban) { pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>"; } } else { foreach (var item in lstResult_phongban.Where(p => p.maphongban == maphongban)) { pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>"; } } ViewBag.sbphongban = pb.ToString(); StringBuilder sbphonghop = new StringBuilder(); sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "0", "Lựa chọn Phòng họp")); sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "1", "Tầng 3 - Phòng họp 1")); sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "2", "Tầng 3 - Phòng họp 2")); sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "3", "Tầng 3 - Phòng họp lớn")); sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "4", "Tầng 3A - Phòng họp nhỏ")); sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "5", "Tầng 3A - Phòng họp lớn")); sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "6", "Khác")); ViewBag.sbphonghop = sbphonghop.ToString(); FunctionXML function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkeyEncodeLink.config")); macuochop = AES.DecryptText(macuochop, function.ReadXMLGetKeyEncrypt()); DaotaoServices servicevpp = new DaotaoServices(); List <WeedMeetingModels> lstResult = new List <WeedMeetingModels>(); lstResult = servicevpp.SelectRows_WeedMeeting_hieuchinh(macuochop); if (lstResult.Count > 0) { //replace(/'/g, "daunhaydon").replace(/"/g, '').replace(/&/g, 'daukytuva') + "',"; lstResult[0].lydobuoihop = lstResult[0].lydobuoihop.Replace("daunhaydon", "'").Replace("daukytuva", "&"); lstResult[0].thanhphanthamdu = lstResult[0].thanhphanthamdu.Replace("daunhaydon", "'").Replace("daukytuva", "&"); //System.Text.RegularExpressions.Regex.Replace(json["noidungcuochop"].ToString().Trim(), @"\n", "\\n").Replace("'", ""); string chuoinoidungs = ""; string chuoinoidung = System.Text.RegularExpressions.Regex.Replace(lstResult[0].noidungcuochop, @"\\n", "\n"); string[] noisungcuochop = chuoinoidung.Split(new char[] { '\n' }); for (int i = 0; i < noisungcuochop.Length; i++) { chuoinoidungs = chuoinoidungs + noisungcuochop[i].Replace("daunhaydon", "'").Replace("daukytuva", "&") + Environment.NewLine; } lstResult[0].noidungcuochop = chuoinoidungs; return(View(lstResult[0])); } return(View()); }
public JsonResult SelectRows_WeedMeeting(WeedMeetingModels model, int curentPage) { WeedMeetingModels param = new WeedMeetingModels(); DaotaoServices service = new DaotaoServices(); //param.nguoitao = int.Parse(Session["userid"].ToString()); param.maphongban = model.maphongban; if (Session["loginid"].ToString().Trim().ToLower() == "admin" || Session["grouptk"].ToString().Trim() == "1") { param.nguoitao = 0; } int tongsodong = service.CountRows_WeedMeeting(param); int sotrang = 1; if (tongsodong > 20) { if (tongsodong % 20 > 0) { sotrang = (tongsodong / 20) + 1; } else { sotrang = (tongsodong / 20); } } int trangbd = 1; int trangkt = 20; if (curentPage != 1 && curentPage <= sotrang) { trangbd = (trangkt * (curentPage - 1)) + 1; trangkt = trangkt * curentPage; } List <WeedMeetingModels> lstResult = new List <WeedMeetingModels>(); if (curentPage <= sotrang) { lstResult = service.SelectRows_WeedMeeting(param, trangbd, trangkt); } else if (curentPage != 1 && curentPage > sotrang) { curentPage = curentPage - 1; } StringBuilder sbResult = new StringBuilder(); StringBuilder sbRows = new StringBuilder(); int tongdong = 0; if (lstResult.Count > 0) { string strSTT = ""; int i = trangbd; foreach (var item in lstResult) { strSTT = i.ToString(); if (item.loaicuochop == "1") { item.tenloaicuochop = "Họp tuần phòng"; } else if (item.loaicuochop == "2") { item.tenloaicuochop = "Họp tuần BGĐ"; } else if (item.loaicuochop == "3") { item.tenloaicuochop = "Họp khác"; } else { item.tenloaicuochop = ""; } if (item.phonghop == "1") { item.tenphonghop = "Tầng 3 - Phòng họp 1"; } else if (item.phonghop == "2") { item.tenphonghop = "Tầng 3 - Phòng họp 2"; } else if (item.phonghop == "3") { item.tenphonghop = "Tầng 3 - Phòng họp lớn"; } else if (item.phonghop == "4") { item.tenphonghop = "Tầng 3A - Phòng họp nhỏ"; } else if (item.phonghop == "5") { item.tenphonghop = "Tầng 3A - Phòng họp lớn"; } else if (item.phonghop == "6") { item.tenphonghop = "Khác"; } else { item.tenphonghop = ""; } sbRows.Append(PrepareDataJson_WeedMeeting(item, strSTT)); i++; } tongdong = i - 1; if (sbRows.Length > 0) { sbRows.Remove(sbRows.Length - 1, 1); } } if (tongsodong == 0) { sotrang = 0; } sbResult.Append("{"); sbResult.Append("\"isHeader\":\"" + "111" + "\","); sbResult.Append("\"tongdong\":\"" + "" + tongsodong + "" + "\","); sbResult.Append("\"Pages\":\"" + "" + sotrang + "" + "\","); sbResult.Append("\"SubRow\":\"" + "false" + "\","); sbResult.Append("\"data\":[" + sbRows.ToString() + "]"); sbResult.Append("}"); return(Json(sbResult.ToString(), JsonRequestBehavior.AllowGet)); }