public JsonResult OPCSendCommand(string Equipment, string Command, string Type) { Dictionary <string, object> response = new Dictionary <string, object>(); string port = EquipmentModels.GetPort(Equipment); //for forcing values for testing purposes //Equipment = "AMPICIMAPPDEV1"; //port = "6666"; if (port != "" && port != null) { if (Type.ToString().ToUpper() == "LASER MARK TEST") { Command = "<C>" + Command + "</C>"; } var Duration = Convert.ToInt32(SettingModels.GetOPCTimeout()); var isTimer = SettingModels.IsOPCTimeout(); EquipmentModels.insertTCPNotification(Equipment, Command, "MACHINE_REQUEST"); var result = HttpHandler.OPCSendCommand(Equipment, port, Command, Duration, isTimer); if (result != null) { response.Add("Result", result.Result); response.Add("Error", Convert.ToBoolean(result.Error)); } } return(Json(response, JsonRequestBehavior.AllowGet)); }
public void CheckFileExist() { if (!File.Exists(referrer1)) { var defaultReferrer1 = new SettingModels() { Referrer = new List <string>() }; File.WriteAllLines(referrer1, defaultReferrer1.Referrer.ToArray()); } if (!File.Exists(referrer2)) { var defaultReferrer2 = new SettingModels() { Referrer = new List <string>() }; File.WriteAllLines(referrer2, defaultReferrer2.Referrer.ToArray()); } if (!File.Exists(referrer3)) { var defaultReferrer3 = new SettingModels() { Referrer = new List <string>() }; File.WriteAllLines(referrer3, defaultReferrer3.Referrer.ToArray()); } }
public ActionResult Settings() { var setting = new SettingModels(); setting.Login = "******"; return(View(setting)); }
public SettingModels GetUA() { var UA = new SettingModels(); string[] fileUA = File.ReadAllLines(userAgentFileName); UA.UserAgent = fileUA.ToList(); return(UA); }
public SettingModels GetReferrer3() { var referrer = new SettingModels(); string[] fileReferrer = File.ReadAllLines(referrer3); referrer.Referrer = fileReferrer.ToList(); return(referrer); }
//get template data public static DataTable getData(string ProductName) { string query = ""; //query = "Select a.PartNo,a.PackageType,a.Specs,a.MarkingInstructionID,b.CASName,b.CASLink,a.PkgTemp,a.VLMName,a.EffectiveWorkWeek from PESubmissionTable a left join DCCSubmissionTable b on a.DCCSubmissionID=b.DCCSubmissionID where a.ProductName ='" + ProductName + "' and a.EffectiveWorkWeek<>'' and a.EffectiveWorkWeek is not null order by a.EffectiveWorkWeek desc" ; bool isEffectiveDate = SettingModels.isEffectiveDate(); if (isEffectiveDate == false) { query = "Select top 1 a.PartNo,a.PackageType,a.Specs,a.MarkingInstructionID,b.CASName,b.CASLink,a.PkgTemp,a.VLMName,a.EffectiveWorkWeek from PESubmissionTable a left join DCCSubmissionTable b on a.DCCSubmissionID=b.DCCSubmissionID where a.ProductName ='" + ProductName + "' and a.EffectiveWorkWeek<>'' and a.EffectiveWorkWeek is not null order by a.EffectiveWorkWeek desc"; } else { query = "Select top 1 a.PartNo,a.PackageType,a.Specs,a.MarkingInstructionID,b.CASName,b.CASLink,a.PkgTemp,a.VLMName,a.EffectiveWorkWeek from PESubmissionTable a left join DCCSubmissionTable b on a.DCCSubmissionID=b.DCCSubmissionID where a.ProductName ='" + ProductName + "' and a.EffectiveWorkWeek<>'' and a.EffectiveWorkWeek is not null and convert(datetime,a.EffectiveWorkWeek,101)<getdate() order by a.EffectiveWorkWeek desc"; } SqlConnection conn = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(query, conn); //cmd.CommandTimeout = 3600; DataSet ds = new DataSet(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); try { conn.Open(); da.Fill(ds); dt = ds.Tables[0]; da.Dispose(); cmd.Dispose(); conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } catch { conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } } return(dt); }
public SettingController() { if (!File.Exists(userAgentFileName)) { var defaultSettings = new SettingModels() { UserAgent = new List <string>(), }; var fileUA = defaultSettings.UserAgent; File.WriteAllLines(userAgentFileName, fileUA.ToArray()); } }
public ActionResult Index() { SettingModels viewModels = new SettingModels(); try { var settings = settingRepository.Get(); viewModels = new SettingModels() { settings = settings }; } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } return(View(viewModels)); }
public ActionResult Ajindex(MyClinic.Infrastructure.SettingEdit settingEdit) { string resultReturn = String.Empty; SettingModels viewModels = null; try { var objSession = Session["user"] as MyClinic.Infrastructure.SessUser; var setting = settingRepository.GetById(settingEdit.Id); if (ModelState.IsValid) { string strValue = settingEdit.KeyValue; MyClinic.Infrastructure.Log logTran = new MyClinic.Infrastructure.Log(); if (settingEdit.KeyType == "3") { strValue = "campany.jpg"; var savePathImage = Server.MapPath("~/Uploads/Logo/"); ImageHelper.SaveImage(savePathImage, strValue, settingEdit.KeyValue); } setting.KeyValue = strValue; settingRepository.Update(setting); /*For Add New Record to LogTable*/ logTran.UserId = objSession.UserId; logTran.ProcessType = "Edit Setting"; logTran.Description = "Edit Setting " + setting.KeyDes + "=" + settingEdit.KeyValue; logTran.LogDate = DateTime.Now; logRepository.Add(logTran); resultReturn = "success"; } viewModels = new SettingModels() { setting = setting }; } catch (Exception ex) { log.Error(ex); resultReturn = "failure"; } return(Json(new { result = resultReturn })); }
public ActionResult Index(SettingModels setting) { if (ModelState.IsValid) { var listSetting = GenericModel.SetGeneric(setting, db.Settings); foreach (var s in listSetting) { if (s.Id == 0) { db.Settings.Add(s); } else { db.Entry(s).State = EntityState.Modified; } } db.SaveChanges(); } return(View(setting)); }
public JsonResult GetIsEffectiveDate() { var result = SettingModels.isEffectiveDate(); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public JsonResult GetNoMarkTemplate() { var result = SettingModels.NoMarkTemplate(); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { //Check cookie and session variables for retaining login status //if true go to page, else return to login page if (HttpHandler.CheckSession()) { string username = Session["Username"].ToString(); string userType = UserModels.GetUserType(username); string thumbnailPhoto = UserModels.GetThumbnailPhoto(username); try { HttpContext.Session.Add("ThumbnailPhoto", thumbnailPhoto); HttpContext.Session.Add("Name", Request.Cookies["Name"].Value.ToString()); HttpContext.Session.Add("Position", Request.Cookies["Position"].Value.ToString()); HttpContext.Session.Add("EmployeeNumber", Request.Cookies["EmployeeNumber"].Value.ToString()); } catch { } //get the module var modName = "Configuration"; var module = ModuleModels.getModule(modName); ViewBag.Title = "Cell Controller"; bool check = false; if (module != null) { //generate the menus ViewBag.Menu = custom_helper.GenerateMenu(module.Id, module.ParentId, userType); ViewBag.PageHeader = module.ParentName + " / " + module.Name; ViewBag.Breadcrumbs = module.Name; check = true; } else { check = false; } //get the configuration settings var signalR = SettingModels.IsSignalR(); ViewBag.SignalR = signalR; var tolerance = SettingModels.GetTolerance(); ViewBag.Tolerance = tolerance; var isOPCTimeout = SettingModels.IsOPCTimeout(); ViewBag.isOPCTimeout = isOPCTimeout; var OPCTimeout = SettingModels.GetOPCTimeout(); ViewBag.OPCTimeout = OPCTimeout; var isScanner = SettingModels.IsScanner(); ViewBag.isScanner = isScanner; var isHostEnabled = SettingModels.isHostEnabled(); ViewBag.isHostEnabled = isHostEnabled; var isEffectiveDate = SettingModels.isEffectiveDate(); ViewBag.isEffectiveDate = isEffectiveDate; //check access for module, if no access redirect to error page if (ModuleModels.checkAccessForURL(userType, module.Id) && check) { try { Session.Remove("ModuleErrorHeader"); Session.Remove("ModuleErrorBreadCrumbs"); } catch { } return(View()); } else { Session.Add("ModuleErrorHeader", ViewBag.PageHeader); Session.Add("ModuleErrorBreadCrumbs", ViewBag.Breadcrumbs); return(RedirectToAction("Index", "Error")); } } else { return(RedirectToAction("Login", "Account")); } }
public JsonResult GetDefaultPassword() { var result = SettingModels.DefaultPassword(); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public JsonResult GetIsScanner() { var result = SettingModels.IsScanner(); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public JsonResult GetIsHostEnabled() { var result = SettingModels.isHostEnabled(); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public JsonResult SaveConfig(bool isSignalR, double tolerance, bool isOPCTimeout, double OPCTimeout, string DefaultPassword, string NoMarkTemplate, bool isScanner, bool isHost, bool isEffectiveDate) { var result = SettingModels.SaveConfig(isSignalR, tolerance, isOPCTimeout, OPCTimeout, DefaultPassword, NoMarkTemplate, isScanner, isHost, isEffectiveDate); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public void UpdateReferrer3(SettingModels referrer) { File.WriteAllLines(referrer3, referrer.Referrer); }
public JsonResult GetTolerance() { var result = SettingModels.GetTolerance(); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public JsonResult GetOPCTimeoout() { var result = SettingModels.GetOPCTimeout(); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public void UpdateUA(SettingModels fileUA) { File.WriteAllLines(userAgentFileName, fileUA.UserAgent); }
//get template data public static DataTable getData(string ProductName, string EquipID, string ID) { string query = ""; bool isEffectiveDate = SettingModels.isEffectiveDate(); string type = EquipmentModels.GetEquipmentTypeJoin(Convert.ToInt32(ID)); if (type == "") { var child = EquipmentModels.getChildEquipments(EquipID); if (child != null) { if (child.Count > 0) { DataTable total_dt = new DataTable(); for (int x = 0; x < child.Count; x++) { if (isEffectiveDate == false) { query = "select top 1 a.RecipeID, a.RecipeName, a.RecipeBody, b.ProductName, c.EquipID, a.EffectiveDate, a.RecipeSize from RecipeTable a left join ProductTable b on a.ProductID=b.ProductID left join EquipRecipeTable c on a.RecipeID=c.RecipeID where b.ProductName='" + ProductName + "' and c.EquipID='" + child[x] + "' and a.EffectiveDate is not null and a.DeactivationDate is null order by a.DateApproved desc"; } else { query = "select top 1 a.RecipeID, a.RecipeName, a.RecipeBody, b.ProductName, c.EquipID, a.EffectiveDate, a.RecipeSize from RecipeTable a left join ProductTable b on a.ProductID=b.ProductID left join EquipRecipeTable c on a.RecipeID=c.RecipeID where b.ProductName='" + ProductName + "' and c.EquipID='" + child[x] + "' and a.EffectiveDate is not null and convert(datetime,a.EffectiveDate,101)<getdate() and a.DeactivationDate is null order by a.DateApproved desc"; } SqlConnection conn = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(query, conn); //cmd.CommandTimeout = 3600; DataSet ds = new DataSet(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); try { conn.Open(); da.Fill(ds); dt = ds.Tables[0]; da.Dispose(); cmd.Dispose(); conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } catch { conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } } total_dt.Merge(dt); } total_dt.DefaultView.Sort = "EquipID asc"; total_dt = total_dt.DefaultView.ToTable(); return(total_dt); } else { return(null); } } else { return(null); } } else { if (isEffectiveDate == false) { query = "select top 1 a.RecipeID, a.RecipeName, a.RecipeBody, b.ProductName, c.EquipID, a.EffectiveDate, a.RecipeSize from RecipeTable a left join ProductTable b on a.ProductID=b.ProductID left join EquipRecipeTable c on a.RecipeID=c.RecipeID where b.ProductName='" + ProductName + "' and c.EquipID='" + EquipID + "' and a.EffectiveDate is not null and a.DeactivationDate is null order by a.DateApproved desc"; } else { query = "select top 1 a.RecipeID, a.RecipeName, a.RecipeBody, b.ProductName, c.EquipID, a.EffectiveDate, a.RecipeSize from RecipeTable a left join ProductTable b on a.ProductID=b.ProductID left join EquipRecipeTable c on a.RecipeID=c.RecipeID where b.ProductName='" + ProductName + "' and c.EquipID='" + EquipID + "' and a.EffectiveDate is not null and convert(datetime,a.EffectiveDate,101)<getdate() and a.DeactivationDate is null order by a.DateApproved desc"; } SqlConnection conn = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(query, conn); //cmd.CommandTimeout = 3600; DataSet ds = new DataSet(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); try { conn.Open(); da.Fill(ds); dt = ds.Tables[0]; da.Dispose(); cmd.Dispose(); conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } catch { conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); conn.Dispose(); SqlConnection.ClearPool(conn); } } return(dt); } }