// public ActionResult Index(int pid = 0, int cid = 0) { try { int take; int skip; take = 10; skip = take * pid; ModulesModel ModuleModel = new ModulesModel(); ModuleModel.PageID = pid; ModuleModel.Current = pid + 1; var modulelist = new ModuleBLL { }.GetAllModules(skip, take); if (modulelist != null) { double count = Convert.ToDouble(new ModuleBLL { }.GetPageCount()); var res = count / take; ModuleModel.Pagecount = (int)Math.Ceiling(res); ModuleModel.ModuleList = modulelist; } CustomMethods.ValidateRoles("Module"); return(View(ModuleModel)); } catch (Exception e) { throw e; } }
private void gửiMailThôngBáoGiảiPhápTạmThờiToolStripMenuItem_Click(object sender, EventArgs e) { try { ModuleErrorModel errorModel = (ModuleErrorModel)ModuleErrorBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID))); ModulesModel product = (ModulesModel)ModulesBO.Instance.FindByPK(errorModel.ModuleID); frmSendEmailAttach frm = new frmSendEmailAttach(); frm.To = "*****@*****.**"; //frm.CC = "*****@*****.**"; frm.CC = "[email protected];[email protected];[email protected];[email protected];"; frm.Subject = string.Format("ERROR REPORT - {0} - {1} - Khắc phục tạm thời", errorModel.Code, product.Code); DataTable dtConfig = TextUtils.Select("select KeyValue from [ConfigSystem] where [KeyName]='TKToKCS_Email'"); string content = dtConfig.Rows[0][0].ToString(); frm.Content = content.Replace("<ErrorCode>", "<b>" + errorModel.Code + "</b>") .Replace("<ProjectCode>", "<b>" + errorModel.ProjectCode + "</b>") .Replace("<ProductCode>", "<b>" + product.Code + "</b>") .Replace("<ProductName>", product.Name) .Replace("<ErrorStatus>", "<b>Khắc phục tạm thời</b>") .Replace("<ErrorUser>", grvData.GetFocusedRowCellValue(colErrorUser).ToString()) .Replace("<TamThoi>", errorModel.HuongKhacPhucTamThoi) .Replace("<LauDai>", errorModel.HuongKhacPhuc == "" ? "Chưa có" : errorModel.HuongKhacPhuc) .Replace("<Description>", errorModel.Description); if (frm.ShowDialog() == DialogResult.OK) { errorModel.ReceiveMailContent = Global.AppFullName + " - " + Environment.MachineName + " đã gửi mail vào ngày: " + DateTime.Now; ModuleErrorBO.Instance.Update(errorModel); loadGrid(); } } catch (Exception) { } }
void loadInit() { DocUtils.InitFTPQLSX(); selectedModule = (ModulesModel)ModulesBO.Instance.FindByCode(_moduleCode); //cboMaterialType.SelectedIndex = 0; _pathCkFTP = "Thietke.Ck/" + _moduleCode.Substring(0, 6) + "/" + _moduleCode + ".Ck"; _pathDnFTP = "Thietke.Dn/" + _moduleCode.Substring(0, 6) + "/" + _moduleCode + ".Dn"; _pathCkNormal = @"\\SERVER\data2\Thietke\Luutru\Thietkechuan\" + _pathCkFTP; //_pathDnNormal = @"\\SERVER\data2\Thietke\Luutru\Thietkechuan\" + _pathDnFTP; //_pathDtNormal = @"\\SERVER\data2\Thietke\Luutru\Thietkechuan\ThietKe.Dt\" + _moduleCode.Substring(0, 5); if (Status == 2) { if (!DocUtils.CheckExits(_pathCkFTP)) { MessageBox.Show("Không tồn tại thiết kế cơ khí trên nguồn thiết kế!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } try { dtDMVT = getDmvtFTP(); dtDMVT_DT = dtDMVT.Select("F4 like '%PCB%'").Distinct().CopyToDataTable(); } catch { } getFolderFTP(_pathCkFTP); } }
protected override IUnitsModel GetModel() { IModuleCollection collection = ProfilingViewModel.Application.ServiceContainer.Resolve <IModuleCollection>(); ModulesModel model = new ModulesModel(collection); return(model); }
public EmptyResult MapModuletoApplication(string listId, string attributename, int ordinalposition) { string token = HttpContext.Session.GetString("access_token"); List <ModulesModel> listModulesModel = APIservice.GetList <ModulesModel>("synapsenamespace=meta&synapseentityname=module", token); List <Mappedmodule> listMappedmodules = APIservice.GetListById <Mappedmodule>(listId.Trim(), "synapsenamespace=meta&synapseentityname=applicationmodulemapping&synapseattributename=application_id&attributevalue=", token).OrderBy(o => o.displayorder).ToList(); Mappedmodule Model = new Mappedmodule(); Guid id = Guid.NewGuid(); ModulesModel moduleobj = listModulesModel.Single(s => s.module_id == attributename); Model.applicationmodulemapping_id = id.ToString(); Model.application_id = listId.Trim(); Model.module_id = attributename; Model.displayname = moduleobj.modulename; Model.isdefaultmodule = false; if (listMappedmodules.Count == 0) { Model.displayorder = 1; } else { Model.displayorder = listMappedmodules.Max(x => x.displayorder.Value) + 1; } string results = APIservice.PostObject <Mappedmodule>(Model, "synapsenamespace=meta&synapseentityname=applicationmodulemapping", token); return(new EmptyResult()); }
private void toolStripButton1_Click(object sender, EventArgs e) { int count = 0; DataTable dt = TextUtils.ExcelToDatatable(@"D:\\123.xlsx", "Sheet1"); DataTable tblLink = TextUtils.Select("exec spGetModuleOfProject"); foreach (DataRow item in dt.Rows) { try { string code = item[0].ToString(); ModuleErrorModel error = (ModuleErrorModel)ModuleErrorBO.Instance.FindByAttribute("Code", code)[0]; if (error.ProjectCode != "") { continue; } string projectText = item["F3"].ToString(); ModulesModel module = (ModulesModel)ModulesBO.Instance.FindByPK(error.ModuleID); DataRow[] dt1 = tblLink.Select("ProjectCode like '%" + projectText + "%' and ProductCode = '" + module.Code + "'"); if (dt1.Length > 0) { error.ProjectCode = dt1[0]["ProjectCode"].ToString(); ModuleErrorBO.Instance.Update(error); count++; } } catch (Exception) { } } MessageBox.Show(count + " OK"); }
public ActionResult saveNewModule(ModulesModel ModulesModel) { string token = HttpContext.Session.GetString("access_token"); List <ModulesModel> result = APIservice.GetList <ModulesModel>("synapsenamespace=meta&synapseentityname=module", token); int count = result.Where(x => x.modulename == ModulesModel.modulename.Trim()).Count(); if (count == 0) { ModulesModel Model = new ModulesModel(); Guid id = Guid.NewGuid(); Model.module_id = id.ToString(); Model.modulename = ModulesModel.modulename.Trim(); Model.jsurl = ModulesModel.jsurl ?? ""; Model.moduledescription = ModulesModel.moduledescription; Model.domselector = ModulesModel.domselector ?? ""; Model.displayorder = result.Max(x => x.displayorder); Model.displayorder++; APIservice.PostObject <ModulesModel>(Model, "synapsenamespace=meta&synapseentityname=module", token); return(RedirectToAction(nameof(ApplicationManager))); } else { @ViewBag.errormessage = "(Module name already Exists "; return(View("AddNewModule")); } }
/// <summary> /// Download Bản Cad tổng của tất cả các thiết kế /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button8_Click(object sender, EventArgs e) { DocUtils.InitFTPQLSX(); using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang download file CAD tổng...")) { ArrayList listModules = ModulesBO.Instance.FindByExpression(new Expression("Status", 2).And(new Expression("Code", "TPAD", "like"))); string pathLocal = "D:/File Tong IAM"; Directory.CreateDirectory(pathLocal); foreach (var item in listModules) { ModulesModel module = (ModulesModel)item; string code = module.Code; string filePathCAD = string.Format(@"Thietke.Ck\{0}\{1}.Ck\3D.{1}\{1}.iam", code.Substring(0, 6), code); try { DocUtils.DownloadFile(pathLocal, code + ".iam", filePathCAD); } catch { } } } MessageBox.Show("Thành công!"); }
void sendEmail() { ModulesModel product = (ModulesModel)ModulesBO.Instance.FindByPK(ErrorModel.ModuleID); string productCode = product.Code; string nguoiGayLoi = ""; string userMails = ""; foreach (DataGridViewRow item in grvData.Rows) { nguoiGayLoi += item.Cells[colFullName.Index].Value.ToString() + ","; userMails += item.Cells[colLoginName.Index].Value.ToString() + ";"; } frmSendEmailAttach frm = new frmSendEmailAttach(); frm.To = "*****@*****.**"; frm.CC = //"*****@*****.**"; "[email protected];[email protected];[email protected];[email protected];"; frm.Subject = string.Format("ERROR REPORT - {0} - {1}", ErrorModel.Code, productCode); DataTable dtConfig = TextUtils.Select("select KeyValue from [ConfigSystem] where [KeyName]='TKToKCS_Email'"); string content = dtConfig.Rows[0][0].ToString(); frm.Content = content.Replace("<ErrorCode>", "<b>" + ErrorModel.Code + "</b>") .Replace("<ProjectCode>", "<b>" + ErrorModel.ProjectCode + "</b>") .Replace("<ProductCode>", "<b>" + productCode + "</b>") .Replace("<ProductName>", product.Name) .Replace("<ErrorStatus>", "<b>" + cboStatus.Text + "</b>") .Replace("<ErrorUser>", nguoiGayLoi) .Replace("<TamThoi>", ErrorModel.HuongKhacPhucTamThoi) .Replace("<LauDai>", ErrorModel.HuongKhacPhuc == "" ? "Chưa có" : ErrorModel.HuongKhacPhuc); frm.Show(); }
public bool CheckDuplicate(string ModuleName) { bool result = false; try { ModulesModel modulesModel = objDb.Modules.Where(x => x.ModuleName == ModuleName.Trim()).Select(x => new ModulesModel { ModuleId = x.ModuleId, ModuleName = x.ModuleName, IsActive = x.IsActive }).SingleOrDefault(); if (modulesModel != null) { result = true; } return(result); } catch (Exception) { return(result); throw; } }
public int AddEditModule(ModulesModel objModel) { try { if (objModel.ModuleId == 0) { Module objModule = new Module { ModuleName = objModel.ModuleName, CreatedDate = DateTime.Now, IsActive = objModel.IsActive }; objDb.Modules.Add(objModule); objDb.SaveChanges(); return(objModule.ModuleId); } else { var module = objDb.Modules.Find(objModel.ModuleId); module.ModuleName = objModel.ModuleName; module.IsActive = objModel.IsActive; module.UpdatedDate = DateTime.Now; //module.UpdatedBy = objModel.UpdatedBy; objDb.SaveChanges(); return(module.ModuleId); } } catch (Exception) { return(0); throw; } }
void sendKcsMail() { int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); ModulesModel product = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", grvData.GetFocusedRowCellValue(colModule).ToString())[0]; string productCode = product.Code; string projectCode = grvData.GetFocusedRowCellValue(colProjectCode).ToString(); List <string> listEmail = getListMail(productCode); #region Mở outlook //int count = Process.GetProcesses().Where(o => o.ProcessName.Contains("OUTLOOK")).Count(); //if (count == 0) //{ // try // { // Process.Start("outlook.exe"); // } // catch (Exception) // { // } //} #endregion Mở outlook string subject = string.Format("Không phù hợp - {0} - {1}", grvData.GetFocusedRowCellValue(colCode).ToString(), productCode); DataTable dtProjectUser = LibQLSX.Select("SELECT p.ProjectCode, u.UserName FROM Project p INNER JOIN Users u ON p.UserId = u.UserId where p.ProjectCode='" + projectCode + "'"); string projectUser = dtProjectUser.Rows[0][1] != null ? dtProjectUser.Rows[0][1].ToString() : ""; DataTable dtConfig = TextUtils.Select("select KeyValue from [ConfigSystem] where [KeyName]='KPH_To_TK_Email'"); string content = dtConfig.Rows[0][0].ToString(); content = content.Replace("<ErrorCode>", "<b>" + grvData.GetFocusedRowCellValue(colCode).ToString() + "</b>") .Replace("<ProjectCode>", "<b>" + projectCode + "</b>") .Replace("<ProjectUser>", "<b>" + projectUser == "" ? "Không tìm thấy" : projectUser + "</b>") .Replace("<ProductCode>", "<b>" + productCode + "</b>") .Replace("<ProductName>", product.Name) .Replace("<UserFind>", grvData.GetFocusedRowCellValue(colUserFindText).ToString()) .Replace("<Description>", grvData.GetFocusedRowCellValue(colDes).ToString()) .Replace("<Ck>", NVCoKhi == "" ? "Không tìm thấy" : NVCoKhi) .Replace("<Dn>", NVDien == "" ? "Không tìm thấy" : NVDien) .Replace("<Dt>", NVDT == "" ? "Không tìm thấy" : NVDT); string to = ""; foreach (string item in listEmail) { to += item.ToLower() + ";"; } frmSendEmailAttach frm = new frmSendEmailAttach(); frm.Subject = subject; frm.CC = //"*****@*****.**"; "[email protected];[email protected];[email protected];[email protected];"; frm.To = to; frm.Content = content; if (frm.ShowDialog() == DialogResult.OK) { ModuleErrorModel errorModel = (ModuleErrorModel)ModuleErrorBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID))); errorModel.CreateMailContent = Global.AppFullName + " đã gửi mail vào ngày: " + DateTime.Now; ModuleErrorBO.Instance.Update(errorModel); } }
/// <summary> /// Initiate an instance of ModulesViewModel /// </summary> public ModulesViewModel() { Model = new ModulesModel(); Model.ImportModules(); OpenModuleCommand = new RelayCommand(OpenModule); RunModuleCommand = new RelayCommand(Run, CanRun); AbortCommand = new RelayCommand(AbortModule); }
public ActionResult Edit(ModulesModel tblModule) { if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty)) { return(RedirectToAction("Login", "Login", null)); } ViewBag.UserName = Session["Username"]; ViewBag.roleid = Session["RoleID"]; String Username = Session["Username"].ToString(); int UserID1 = Convert.ToInt32(Session["UserID"].ToString()); ViewBag.IsEmailEscalation = 0; if (ModelState.IsValid) { using (i_facility_shaktiEntities1 db = new i_facility_shaktiEntities1()) { var DupModule = db.tblmodules.Where(m => m.IsDeleted == 0 && m.Module == tblModule.Modules.Module && m.ModuleId != tblModule.Modules.ModuleId).FirstOrDefault(); if (DupModule == null) { var ModuleData = db.tblmodules.Find(tblModule.Modules.ModuleId); ModuleData.Module = tblModule.Modules.Module; ModuleData.ModuleDesc = tblModule.Modules.ModuleDesc; ModuleData.ModuleDispName = tblModule.Modules.ModuleDispName; ModuleData.ModifiedBy = 1; ModuleData.ModifiedOn = DateTime.Now; db.Entry(ModuleData).State = EntityState.Modified; db.SaveChanges(); ////Updating in module helper not necessary as we are not changing the ModuleID. //int ID = Convert.ToInt32(Session["ID"]); //masterrolemodulehelper module = db.masterrolemodulehelpers.Find(ID); //module.ModuleID = tblModule.ModuleId; //db.Entry(tblModule).State = EntityState.Modified; //db.SaveChanges(); return(RedirectToAction("Index")); } else { Session["Error"] = "Duplicate ModuleName: " + tblModule.Modules.Module; return(View(tblModule)); } } } else { return(View(tblModule)); } }
void sendMail() { if (ErrorModel.DepartmentID == 1)//Phong TK { //ModulesModel product = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", cboModule.EditValue.ToString())[0]; ModulesModel product = (ModulesModel)ModulesBO.Instance.FindByPK(TextUtils.ToInt(cboModule.EditValue)); string productCode = product.Code; List <string> listEmail = getListMail(productCode); #region Mở outlook int count = Process.GetProcesses().Where(o => o.ProcessName.Contains("OUTLOOK")).Count(); if (count == 0) { try { Process.Start("outlook.exe"); } catch (Exception) { } } #endregion Mở outlook string subject = string.Format("ERROR REPORT - {0} - {1}", ErrorModel.Code, productCode); string content = "Mã lỗi: <b>" + ErrorModel.Code + "</b><br>" + "Mã dự án: <b>" + cboProject.EditValue.ToString() + "<b><br>" + "Mã sản phẩm: <b>" + productCode + "<b><br>" + "Tên sản phẩm: <b>" + product.Name + "<b><br>" + "Mô tả lỗi: " + ErrorModel.Description + "<br>" + "Hình ảnh lỗi: <a>" + ErrorModel.FolderPathError + "</a>" + "<br>" + "Danh sách nhân viên thiết kế: " + "<br>" + "Thiết kế cơ khí: " + NVCoKhi + "<br>" + "Thiết kế điện: " + NVDien + "<br>" + "Thiết kế điện tử: " + NVDT ; string to = ""; foreach (string item in listEmail) { to += item.ToLower() + ";"; } frmSendEmailAttach frm = new frmSendEmailAttach(); frm.Subject = subject; frm.CC = "*****@*****.**"; frm.To = to; frm.Content = content; TextUtils.OpenForm(frm); //bool success = TextUtils.SetEmailSend(subject, content, to.Substring(0, to.Length - 1), "*****@*****.**"); //if (!success) //{ // TextUtils.SetEmailSend(subject, content, "*****@*****.**", ""); //} } }
private void xemChiTiếtGiáModuleToolStripMenuItem_Click(object sender, EventArgs e) { string moduleCode = grvModule.GetFocusedRowCellValue(colMCode).ToString(); if (moduleCode.StartsWith("TPAD.")) { frmModulePrice frm = new frmModulePrice(); ModulesModel model = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", moduleCode)[0]; frm.Module = model; TextUtils.OpenForm(frm); } }
private void showHistoryToolStripMenuItem_Click(object sender, EventArgs e) { int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); if (id > 0) { ModulesModel module = (ModulesModel)ModulesBO.Instance.FindByPK(id); frmModuleHistory frm = new frmModuleHistory(); frm.Module = module; frm.Show(); } }
private void gửiMailBáoKhôngPhùHợpToolStripMenuItem_Click(object sender, EventArgs e) { string subject; string to; string content; using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load dữ liệu...")) { int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); ModulesModel product = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", grvData.GetFocusedRowCellValue(colModuleCode).ToString())[0]; string productCode = product.Code; string projectCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colProjectCode)); List <string> listEmail = getListMail(productCode); subject = string.Format("INVALID REPORT - {0} - {1}", grvData.GetFocusedRowCellValue(colCode).ToString(), productCode); DataTable dtProjectUser = LibQLSX.Select("SELECT p.ProjectCode, u.UserName FROM Project p INNER JOIN Users u ON p.UserId = u.UserId where p.ProjectCode='" + projectCode + "'"); string projectUser = dtProjectUser.Rows.Count > 0 ? TextUtils.ToString(dtProjectUser.Rows[0][1]) : ""; DataTable dtConfig = TextUtils.Select("select KeyValue from [ConfigSystem] where [KeyName]='KPH_To_TK_Email'"); content = dtConfig.Rows[0][0].ToString(); content = content.Replace("<ErrorCode>", "<b>" + grvData.GetFocusedRowCellValue(colCode).ToString() + "</b>") .Replace("<ProjectCode>", "<b>" + projectCode + "</b>") .Replace("<ProjectUser>", "<b>" + projectUser == "" ? "Không tìm thấy" : projectUser + "</b>") .Replace("<ProductCode>", "<b>" + productCode + "</b>") .Replace("<ProductName>", product.Name) .Replace("<UserFind>", grvData.GetFocusedRowCellValue(colUserFindText).ToString()) .Replace("<Description>", grvData.GetFocusedRowCellValue(colDes).ToString()) .Replace("<Ck>", NVCoKhi == "" ? "Không tìm thấy" : NVCoKhi) .Replace("<Dn>", NVDien == "" ? "Không tìm thấy" : NVDien) .Replace("<Dt>", NVDT == "" ? "Không tìm thấy" : NVDT); to = ""; foreach (string item in listEmail) { to += item.ToLower() + ";"; } } frmSendEmailAttach frm = new frmSendEmailAttach(); frm.Subject = subject; frm.CC = //"*****@*****.**"; "[email protected];[email protected];[email protected];[email protected];"; frm.To = to; frm.Content = content; if (frm.ShowDialog() == DialogResult.OK) { MisMatchModel errorModel = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID))); errorModel.ConfirmSendMailKCS = Global.AppFullName + " - " + Environment.MachineName + " đã gửi mail vào ngày: " + DateTime.Now; MisMatchBO.Instance.Update(errorModel); loadGrid(); } }
public int AddEditModule(ModulesModel objModel) { try { return(moduleDAL.AddEditModule(objModel)); } catch (Exception) { return(0); throw; } }
public string ADDNewModule() { ModulesModel Model = new ModulesModel(); Guid id = Guid.NewGuid(); Model.module_id = id.ToString(); Model.modulename = txtmodulename.Text.Trim(); Model.jsurl = txtjsurl.Text.Trim(); Model.moduledescription = txtmoduledescription.Text; Model.domselector = txtdomselector.Text.Trim(); Model.displayorder = Convert.ToInt32(Request.QueryString["displayorder"]); string result = APIservice.PostObject <ModulesModel>(Model, "synapsenamespace=meta&synapseentityname=module"); return(result); }
private void frmElectronicMaterial_Load(object sender, EventArgs e) { DocUtils.InitFTPQLSX(); selectedModule = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", ProductCode)[0]; _pathDtFTP = "Thietke.Dt/PCB/" + ProductCode; dt.Columns.Add("PathName"); dt.Columns.Add("FolderNumber"); dt.Columns.Add("ParentID", typeof(int)); dt.Columns.Add("FileNumber"); dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("FullPathName"); getFolderFTP(_pathDtFTP); }
private void xemDanhSáchDựÁnChứaModuleToolStripMenuItem_Click(object sender, EventArgs e) { string code = TextUtils.ToString(gridView1.GetFocusedRowCellValue(colModuleCode)); ModulesModel model = (ModulesModel)ModulesBO.Instance.FindByCode(code); if (model.Status != 2) { MessageBox.Show("Module chưa có trên nguồn chuẩn!"); return; } frmListProjectContainModule frm = new frmListProjectContainModule(); frm.Module = model; frm.Show(); }
private void xemGiáToolStripMenuItem_Click(object sender, EventArgs e) { string code = TextUtils.ToString(grvData.GetFocusedRowCellValue(colMaCode)); if (code.StartsWith("PCB.") || (code.StartsWith("TPAD.") && code.Length == 10)) { ModulesModel model = (ModulesModel)ModulesBO.Instance.FindByCode(code); if (model.Status != 2) { MessageBox.Show("Module chưa có trên nguồn chuẩn!"); return; } frmModulePrice frm = new frmModulePrice(); frm.Module = model; frm.Show(); } }
// //GET: /Admin/Module/Detaiil/Id public ActionResult Details(int Id, int pid = 0) { try { ModulesModel module = moduleBLL.GetModuleById(Id); int take = 10; int skip = take * pid; module.PageID = pid; module.Current = pid + 1; ViewBag.c = module.PageID; return(View(module)); } catch (Exception e) { throw e; } }
void DownloadDMVT() { DocUtils.InitFTPQLSX(); ArrayList listModules = ModulesBO.Instance.FindByExpression(new Expression("Status", 2).And(new Expression("Code", "TPAD", "like"))); int count = 0; foreach (var item in listModules) { ModulesModel module = (ModulesModel)item; string moduleCode = module.Code; string dmvtPath = string.Format("Thietke.Ck/{0}/{1}.Ck/VT.{1}.xlsm", moduleCode.Substring(0, 6), moduleCode); if (DocUtils.CheckExits(dmvtPath)) { DocUtils.DownloadFile("D:/ListDMVT", Path.GetFileName(dmvtPath), dmvtPath); count++; } } MessageBox.Show(count.ToString()); }
void ChangeModuleName() { using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang lấy mã mới")) { string tableCodeFilePath = @"\\server\data2\Thietke\ISO\ISO.Thietke\TAI LIEU DAO TAO\TAI LIEU HO TRO PHONG THIET KE\TK09- Huong dan doi ma san pham TK\TK09-BM01 - Bang thay doi ma TK.xlsx"; List <string> listSheet = TextUtils.ListSheetInExcel(tableCodeFilePath); foreach (string sheetName in listSheet) { if (!sheetName.ToUpper().StartsWith("TPAD.")) { continue; } DataTable dt = TextUtils.ExcelToDatatableNoHeader(tableCodeFilePath, sheetName); foreach (DataRow item in dt.Rows) { string newCode = item["F3"] == null ? "" : item["F3"].ToString(); if (newCode == "") { continue; } ModulesModel model = null; try { model = (ModulesModel)ModulesBO.Instance.FindByCode(newCode); } catch (Exception) { } if (model != null) { string oldName = item["F5"] == null ? "" : item["F5"].ToString(); string newName = item["F6"] == null ? "" : item["F6"].ToString(); string name = (newName == "" ? oldName : newName); model.Name = name; ModulesBO.Instance.Update(model); } } } } }
// Get All Roles to Display in View. public ActionResult Index() { if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty)) { return(RedirectToAction("Login", "Login", null)); } ViewBag.UserName = Session["Username"]; ViewBag.roleid = Session["RoleID"]; String Username = Session["Username"].ToString(); i_facility_shaktiEntities1 db = new i_facility_shaktiEntities1(); ModulesModel ma = new ModulesModel(); tblmodule mo = new tblmodule(); ma.Modules = mo; ma.ModuleList = db.tblmodules.Where(m => m.IsDeleted == 0); return(View(ma)); //var ModulesData = db.mastermoduledet_tbl.Where(m => m.IsDeleted == 0).ToList(); //return View(ModulesData); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { //return base.AuthorizeCore(httpContext); string json; ModulesModel module = null; try { //Appel de l'API pour vérification que le user à acces au module renseigné var windowsIdentity = System.Web.HttpContext.Current.Request.LogonUserIdentity as System.Security.Principal.WindowsIdentity; if (windowsIdentity == null) { _reason = "Identity not a valid windows identity. "; return(false); } using (windowsIdentity.Impersonate()) { using (var client = new System.Net.WebClient { UseDefaultCredentials = true }) { string fullUri = ConfigurationManager.AppSettings["UrlApiSuma"].ToString(); client.Headers.Add("Content-Type:application/json; charset=utf-8"); client.Headers.Add("Accept:application/json"); client.Headers.Add("SessionID", Guid.NewGuid().ToString()); json = client.DownloadString(fullUri); module = JsonConvert.DeserializeObject <ModulesModel>(json); return(true); } } } catch (Exception e) { _reason = e.Message; return(false); } }
private void danhSáchVersionToolStripMenuItem_Click(object sender, EventArgs e) { int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); if (id == 0) { return; } ModulesModel model = (ModulesModel)ModulesBO.Instance.FindByPK(id); if (model.Status != 2) { MessageBox.Show("Module chưa có trên nguồn chuẩn!"); return; } frmModuleVersion frm = new frmModuleVersion(); frm.Module = model; frm.Show(); }
public ActionResult Create(ModulesModel tblModule) { if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty)) { return(RedirectToAction("Login", "Login", null)); } ViewBag.Logout = Session["Username"]; ViewBag.roleid = Session["RoleID"]; int UserID1 = Convert.ToInt32(Session["UserID"].ToString()); tblModule.Modules.InsertedBy = UserID1; tblModule.Modules.InsertedOn = System.DateTime.Now; tblModule.Modules.IsDeleted = 0; using (i_facility_shaktiEntities1 db = new i_facility_shaktiEntities1()) { var DupModule = db.tblmodules.Where(m => m.IsDeleted == 0 && m.Module == tblModule.Modules.Module).FirstOrDefault(); if (DupModule == null) { db.tblmodules.Add(tblModule.Modules); db.SaveChanges(); //Insert new row into Module Helper table tblrolemodulelink rl = new tblrolemodulelink(); rl.RoleID = Convert.ToInt32(Session["RoleID"]); rl.ModuleID = tblModule.Modules.ModuleId; rl.InsertedBy = UserID1; rl.InsertedOn = System.DateTime.Now; db.tblrolemodulelinks.Add(rl); db.SaveChanges(); } else { Session["Error"] = "Duplicate ModuleName: " + tblModule.Modules.Module; return(View(tblModule)); } } return(RedirectToAction("Index")); }