public IHttpActionResult EditFormData(int id, [FromBody] EquipmentModels.Edit Equipment) { JavaScriptSerializer js = new JavaScriptSerializer(); string logForm = "Form : " + js.Serialize(Equipment); string logAPI = "[Put] " + Request.RequestUri.ToString(); if (!ModelState.IsValid || Equipment == null) { Startup._sfAppLogger.Warn(logAPI + " || Input Parameter not expected || " + logForm); return(BadRequest("Invalid data")); } try { EquipmentModels equipmentModel = new EquipmentModels(); equipmentModel.updateEquipment(id, Equipment); return(Ok()); } catch (Exception ex) { StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex); logMessage.AppendLine(logForm); Startup._sfAppLogger.Error(logAPI + logMessage); return(InternalServerError(ex)); } }
public IHttpActionResult AddFormData([FromBody] EquipmentModels.Edit Equipment) { string logForm = "Form : " + Startup._jsSerializer.Serialize(Equipment); string logAPI = "[Post] " + Request.RequestUri.ToString(); if (!ModelState.IsValid || Equipment == null) { Startup._sfAppLogger.Warn(logAPI + " || Input Parameter not expected || " + logForm); return(BadRequest("Invalid data")); } try { EquipmentModels equipmentModel = new EquipmentModels(); int newEquipmentId = equipmentModel.addEquipment(Equipment); return(Json(new { id = newEquipmentId })); } catch (Exception ex) { StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex); logMessage.AppendLine(logForm); Startup._sfAppLogger.Error(logAPI + logMessage); return(InternalServerError(ex)); } }
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 IHttpActionResult GetAlarmMessageByEquipmentId(int equipmentId, [FromUri] int top = 10, [FromUri] int hours = 168, [FromUri] string order = "desc") { try { EquipmentModels equipmentModel = new EquipmentModels(); EquipmentModels.Detail equipment = equipmentModel.getEquipmentById(equipmentId); CompanyModel companyModel = new CompanyModel(); var companySubscription = companyModel.GetValidSubscriptionPlanByCompanyId(equipment.CompanyId); DocumentDBHelper docDBHelpler = new DocumentDBHelper(equipment.CompanyId, companySubscription.CosmosDBConnectionString); return(Ok(docDBHelpler.GetAlarmMessageByEquipmentId(equipment.EquipmentId, top, hours, order))); } catch (CDSException cdsEx) { IHttpActionResult response; HttpResponseMessage responseMsg = new HttpResponseMessage(HttpStatusCode.BadRequest); string body = new JavaScriptSerializer().Serialize(CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId)); responseMsg.Content = new StringContent(body, Encoding.UTF8, "application/json"); response = ResponseMessage(responseMsg); return(response); } catch (Exception ex) { StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex); string logAPI = "[Get] " + Request.RequestUri.ToString(); Global._appLogger.Error(logAPI + logMessage); return(Content(HttpStatusCode.InternalServerError, ex)); } }
public JsonResult getChildEquipments(string parent) { List <string> child = new List <string>(); child = EquipmentModels.getChildEquipments(parent); return(Json(child, JsonRequestBehavior.AllowGet)); }
public IHttpActionResult GetMessageByEquipmentId(int equipmentId, [FromUri] int top = 10, [FromUri] int hours = 168, [FromUri] string order = "desc") { try { int companyId = Global.GetCompanyIdFromToken(); if (!General.IsEquipmentUnderCompany(equipmentId, companyId)) { return(Unauthorized()); } CompanyModel companyModel = new CompanyModel(); CompanyModel.Format_Detail company = companyModel.GetById(companyId); var companySubscription = companyModel.GetValidSubscriptionPlanByCompanyId(companyId); if (companySubscription == null) { throw new Exception("can't find valid subscription plan."); } DocumentDBHelper docDBHelpler = new DocumentDBHelper(companyId, companySubscription.CosmosDBConnectionString); EquipmentModels equipmentModel = new EquipmentModels(); return(Ok(docDBHelpler.GetMessageByEquipmentId(equipmentModel.getEquipmentById(equipmentId).EquipmentId, top, hours, order, companyId))); } catch (Exception ex) { StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex); string logAPI = "[Get] " + Request.RequestUri.ToString(); Global._appLogger.Error(logAPI + logMessage); return(Content(HttpStatusCode.InternalServerError, ex)); } }
public string getParentEquipment(string equipment) { string parent = ""; parent = EquipmentModels.getParentEquipment(equipment); return(parent); }
public bool IsChildEquipment(string equipment) { bool check = false; check = EquipmentModels.IsChildEquipment(equipment); return(check); }
public async Task <HttpResponseMessage> UploadLogoFile(int id) { // Check if the request contains multipart/form-data. if (!Request.Content.IsMimeMultipartContent()) { return(Request.CreateResponse(HttpStatusCode.UnsupportedMediaType)); } EquipmentModels equipmentModel = new EquipmentModels(); FileUtility fileHelper = new FileUtility(); string root = Path.GetTempPath(); var provider = new MultipartFormDataStreamProvider(root); try { EquipmentModels.Detail equipment = equipmentModel.getEquipmentById(id); } catch { return(Request.CreateResponse(HttpStatusCode.NotFound)); } try { // Read the form data. string fileAbsoluteUri = ""; await Request.Content.ReadAsMultipartAsync(provider); //FileData foreach (MultipartFileData fileData in provider.FileData) { string formColumnName = fileData.Headers.ContentDisposition.Name; string fileExtenionName = fileData.Headers.ContentDisposition.FileName.Split('.')[1]; if (fileHelper.CheckImageExtensionName(formColumnName, fileExtenionName)) { string uploadFilePath = "company-" + equipmentModel.getCompanyId(id) + "/equipment/" + id + "-default." + fileHelper.LowerAndFilterString(fileExtenionName); fileAbsoluteUri = fileHelper.SaveFiletoStorage(fileData.LocalFileName, uploadFilePath, "images"); } } if (fileAbsoluteUri.Equals("")) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "File is empty or wrong extension name")); } //Edit company logo path equipmentModel.updateEquipmentLogoURL(id, fileAbsoluteUri); return(Request.CreateResponse(HttpStatusCode.OK, new { imageURL = fileAbsoluteUri })); } catch (System.Exception ex) { string logAPI = "[Put] " + Request.RequestUri.ToString(); StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex); Startup._sfAppLogger.Error(logAPI + logMessage); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public JsonResult getAllAlarmsTCP(string Equipment) { var result = EquipmentModels.getAllAlarmsTCP(Equipment); var jsonSerialiser = new JavaScriptSerializer(); var json = jsonSerialiser.Serialize(result); return(Json(json, JsonRequestBehavior.AllowGet)); }
public IHttpActionResult GetMetaDataById(int Id) { EquipmentModels equipmentModel = new EquipmentModels(); try { return(Ok(equipmentModel.GetMetaDataById(Id))); } catch { return(NotFound()); } }
public IHttpActionResult GeById(int id) { EquipmentModels equipmentModel = new EquipmentModels(); try { EquipmentModels.Detail company = equipmentModel.getEquipmentById(id); return(Ok(company)); } catch { return(NotFound()); } }
public static int GetNewAlarmCountTCP(string Equipment) { int alarms = 0; try { alarms = EquipmentModels.getNewAlarmCountTCP(Equipment); } catch { alarms = 0; } return(alarms); }
public IHttpActionResult Delete(int id) { try { EquipmentModels equipmentModel = new EquipmentModels(); equipmentModel.deleteEquipment(id); return(Ok("Success")); } catch (Exception ex) { string logAPI = "[Delete] " + Request.RequestUri.ToString(); StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex); Startup._sfAppLogger.Error(logAPI + logMessage); return(InternalServerError()); } }
public JsonResult DeleteEquipmentType(string ID) { var result = EquipTypeModels.DeleteEquipmentType(ID); DataTable dt = new DataTable(); if (result == true) { dt = EquipmentModels.GetEquipmentByType(ID); int count = 0; try { count = dt.Rows.Count; } catch { count = 0; } if (count > 0) { result = EquipmentModels.DeleteEquipmentByType(ID); } bool temp = result; if (result == true) { foreach (DataRow dr in dt.Rows) { int EquipID = Convert.ToInt32(dr["ID"].ToString()); result = UserEquipmentModels.DeleteUserEquipmentByBatch(EquipID.ToString()); if (result == true) { temp = true; } } } result = temp; } return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public IHttpActionResult GetMessageByEquipmentId(string equipmentId, [FromUri] int top = 10, [FromUri] int hours = 168, [FromUri] string order = "desc") { try { EquipmentModels equipmentModel = new EquipmentModels(); int companyId = equipmentModel.getCompanyId(equipmentId); CompanyModels companyModel = new CompanyModels(); CompanyModels.Detail company = companyModel.getCompanyById(companyId); DocumentDBHelper docDBHelpler = new DocumentDBHelper(companyId, company.DocDBConnectionString); return(Ok(docDBHelpler.GetMessageByEquipmentId(equipmentId, top, hours, order))); } catch (Exception ex) { StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex); string logAPI = "[Get] " + Request.RequestUri.ToString(); Startup._sfAppLogger.Error(logAPI + logMessage); return(InternalServerError(ex)); } }
public IHttpActionResult GetEquipmentWithMetaDataById(string equipmentId) { try { int companyId = GetCompanyIdFromToken(); if (!General.IsEquipmentUnderCompany(equipmentId, companyId)) { return(Unauthorized()); } EquipmentModels equipmentModel = new EquipmentModels(); return(Ok(equipmentModel.getEquipmentWithMetaDataById(equipmentId))); } catch (Exception ex) { StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex); string logAPI = "[Get] " + Request.RequestUri.ToString(); Startup._sfAppLogger.Error(logAPI + logMessage); return(InternalServerError()); } }
public JsonResult getProcessedQTY(string equipment) { var res = EquipmentModels.getProcessedQTY(equipment); return(Json(res, JsonRequestBehavior.AllowGet)); }
public JsonResult markAsBrand(string equipment, string isBrand) { var res = EquipmentModels.markAsBrand(equipment, isBrand); return(Json(res, JsonRequestBehavior.AllowGet)); }
public JsonResult isBrand(string equipment) { var res = EquipmentModels.isBrand(equipment); return(Json(res, JsonRequestBehavior.AllowGet)); }
//function for Report Setup public static List <SECSGEMDefaultReplyObject> SetupReport(string Equipment) { try { int ID = EquipmentModels.GetEquipmentID(Equipment); string type = EquipmentModels.GetEquipmentTypeJoin(ID); List <SECSGEMDefaultReplyObject> obj = new List <SECSGEMDefaultReplyObject>(); SECSGEMDefaultReplyObject temp_obj = new SECSGEMDefaultReplyObject(); if (type == "") { var child = EquipmentModels.getChildEquipments(Equipment); foreach (var x in child) { string ChildEquipment = x; int ChildID = EquipmentModels.GetEquipmentID(ChildEquipment); string childtype = EquipmentModels.GetEquipmentTypeJoin(ChildID); if (childtype.ToUpper() == "DEK PRINTER") { //Product Data modified (CEID 31346) //Equipment constant change (CEID 31440) //Configuration change (CEID 31287) //Configuration Parameter modified(CEID 31345) //Adjust Parameter modified (CEID 31347) //for processed quantity temp_obj = HttpHandler.DisableCollection(ChildEquipment, 31277); //31277 Board printed obj.Add(temp_obj); temp_obj = HttpHandler.DeleteReport(ChildEquipment, 301); //301 RPTID = User Defined ID obj.Add(temp_obj); temp_obj = HttpHandler.UnlinkCollection(ChildEquipment, 31277); obj.Add(temp_obj); temp_obj = HttpHandler.AddToReport_Single(ChildEquipment, 301, 1020); //SVID = 1020 (batch_count) obj.Add(temp_obj); temp_obj = HttpHandler.LinkCollection(ChildEquipment, 31277, 301); obj.Add(temp_obj); temp_obj = HttpHandler.EnableCollection(ChildEquipment, 31277); obj.Add(temp_obj); //for multi vid sample //List<int> lstVID = new List<int>(); //lstVID.Add(456); //lstVID.Add(789); //temp_obj = HttpHandler.AddToReport_Multi(ChildEquipment, 301, lstVID); //obj.Add(temp_obj); } else if (childtype.ToUpper() == "HELLER OVEN") { //for lane 1 temp_obj = HttpHandler.DisableCollection(ChildEquipment, 1080); //1080 HellerBoardExitLane1 obj.Add(temp_obj); temp_obj = HttpHandler.DeleteReport(ChildEquipment, 401); //401 RPTID = User Defined ID obj.Add(temp_obj); temp_obj = HttpHandler.UnlinkCollection(ChildEquipment, 1080); obj.Add(temp_obj); temp_obj = HttpHandler.AddToReport_Single(ChildEquipment, 401, 13049); //SVID = 13049 (HellerPVChannel49) Boards processed Lane1 obj.Add(temp_obj); temp_obj = HttpHandler.LinkCollection(ChildEquipment, 1080, 401); obj.Add(temp_obj); temp_obj = HttpHandler.EnableCollection(ChildEquipment, 1080); obj.Add(temp_obj); //for lane 2 temp_obj = HttpHandler.DisableCollection(ChildEquipment, 1081); //1080 HellerBoardExitLane2 obj.Add(temp_obj); temp_obj = HttpHandler.DeleteReport(ChildEquipment, 402); //402 RPTID = User Defined ID obj.Add(temp_obj); temp_obj = HttpHandler.UnlinkCollection(ChildEquipment, 1081); obj.Add(temp_obj); temp_obj = HttpHandler.AddToReport_Single(ChildEquipment, 402, 13050); //SVID = 13050 (HellerPVChannel50) Boards processed Lane2 obj.Add(temp_obj); temp_obj = HttpHandler.LinkCollection(ChildEquipment, 1081, 402); obj.Add(temp_obj); temp_obj = HttpHandler.EnableCollection(ChildEquipment, 1081); obj.Add(temp_obj); } else if (childtype.ToUpper() == "PANASONIC COMPONENT ATTACH") { if (EnablePanasonic == true) { temp_obj = HttpHandler.DisableCollection(ChildEquipment, 16016); //16016 (Product1BoardEnd)?? obj.Add(temp_obj); temp_obj = HttpHandler.DeleteReport(ChildEquipment, 501); //501 RPTID = User Defined ID obj.Add(temp_obj); temp_obj = HttpHandler.UnlinkCollection(ChildEquipment, 16016); obj.Add(temp_obj); temp_obj = HttpHandler.AddToReport_Single(ChildEquipment, 501, 7003); //SVID = 7003 (Board) obj.Add(temp_obj); temp_obj = HttpHandler.LinkCollection(ChildEquipment, 16016, 501); obj.Add(temp_obj); temp_obj = HttpHandler.EnableCollection(ChildEquipment, 16016); obj.Add(temp_obj); } else { //Override //Disable Collection temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = ChildEquipment; temp_obj.EquipmentType = childtype; temp_obj.StreamFunction = "S2F37_DISABLE_COLLECTION"; temp_obj.Value = 0; obj.Add(temp_obj); //Delete Report temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = ChildEquipment; temp_obj.EquipmentType = childtype; temp_obj.StreamFunction = "S2F33_DELETE_REPORT"; temp_obj.Value = 0; obj.Add(temp_obj); //Unlink Collection temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = ChildEquipment; temp_obj.EquipmentType = childtype; temp_obj.StreamFunction = "S2F35_UNLINK_COLLECTION"; temp_obj.Value = 0; obj.Add(temp_obj); //Add Report temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = ChildEquipment; temp_obj.EquipmentType = childtype; temp_obj.StreamFunction = "S2F33_ADD_REPORT"; temp_obj.Value = 0; obj.Add(temp_obj); //Link Collection temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = ChildEquipment; temp_obj.EquipmentType = childtype; temp_obj.StreamFunction = "S2F35_LINK_COLLECTION"; temp_obj.Value = 0; obj.Add(temp_obj); //Enable Collection temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = ChildEquipment; temp_obj.EquipmentType = childtype; temp_obj.StreamFunction = "S2F37_ENABLE_COLLECTION"; temp_obj.Value = 0; obj.Add(temp_obj); } } } } else { if (type.ToUpper() == "DEK PRINTER") { temp_obj = HttpHandler.DisableCollection(Equipment, 31277); //31277 Board printed obj.Add(temp_obj); temp_obj = HttpHandler.DeleteReport(Equipment, 301); //301 RPTID = User Defined ID obj.Add(temp_obj); temp_obj = HttpHandler.UnlinkCollection(Equipment, 31277); obj.Add(temp_obj); temp_obj = HttpHandler.AddToReport_Single(Equipment, 301, 1020); //SVID = 1020 (batch_count) obj.Add(temp_obj); temp_obj = HttpHandler.LinkCollection(Equipment, 31277, 301); obj.Add(temp_obj); temp_obj = HttpHandler.EnableCollection(Equipment, 31277); obj.Add(temp_obj); //Product Data modified (CEID 31346) //Equipment constant change (CEID 31440) //Configuration change (CEID 31287) //Configuration Parameter modified(CEID 31345) //Adjust Parameter modified (CEID 31347) //testing ceids //temp_obj = HttpHandler.DisableCollection(Equipment, 31346); //obj.Add(temp_obj); //temp_obj = HttpHandler.DeleteReport(Equipment, 302); //obj.Add(temp_obj); //temp_obj = HttpHandler.UnlinkCollection(Equipment, 31346); //obj.Add(temp_obj); ////temp_obj = HttpHandler.AddToReport_Single(Equipment, 302, 2009); //SVID = 2009 (rear_print_pressure) ////obj.Add(temp_obj); //List<int> lstVID = new List<int>(); //lstVID.Add(2009); //SVID = 2009 (rear_print_pressure) //lstVID.Add(2008); //SVID = 2008 (front_print_pressure) //temp_obj = HttpHandler.AddToReport_Multi(Equipment, 302, lstVID); //obj.Add(temp_obj); //temp_obj = HttpHandler.LinkCollection(Equipment, 31346, 302); //obj.Add(temp_obj); //temp_obj = HttpHandler.EnableCollection(Equipment, 31346); //obj.Add(temp_obj); //end of testing ceid } else if (type.ToUpper() == "HELLER OVEN") { //for lane 1 temp_obj = HttpHandler.DisableCollection(Equipment, 1080); //1080 HellerBoardExitLane1 obj.Add(temp_obj); temp_obj = HttpHandler.DeleteReport(Equipment, 401); //401 RPTID = User Defined ID obj.Add(temp_obj); temp_obj = HttpHandler.UnlinkCollection(Equipment, 1080); obj.Add(temp_obj); temp_obj = HttpHandler.AddToReport_Single(Equipment, 401, 13049); //SVID = 13049 (HellerPVChannel49) Boards processed Lane1 obj.Add(temp_obj); temp_obj = HttpHandler.LinkCollection(Equipment, 1080, 401); obj.Add(temp_obj); temp_obj = HttpHandler.EnableCollection(Equipment, 1080); obj.Add(temp_obj); //for lane 2 temp_obj = HttpHandler.DisableCollection(Equipment, 1081); //1080 HellerBoardExitLane2 obj.Add(temp_obj); temp_obj = HttpHandler.DeleteReport(Equipment, 402); //402 RPTID = User Defined ID obj.Add(temp_obj); temp_obj = HttpHandler.UnlinkCollection(Equipment, 1081); obj.Add(temp_obj); temp_obj = HttpHandler.AddToReport_Single(Equipment, 402, 13050); //SVID = 13050 (HellerPVChannel50) Boards processed Lane2 obj.Add(temp_obj); temp_obj = HttpHandler.LinkCollection(Equipment, 1081, 402); obj.Add(temp_obj); temp_obj = HttpHandler.EnableCollection(Equipment, 1081); obj.Add(temp_obj); } else if (type.ToUpper() == "PANASONIC COMPONENT ATTACH") { if (EnablePanasonic == true) { temp_obj = HttpHandler.DisableCollection(Equipment, 16016); //16016 (Product1BoardEnd)?? obj.Add(temp_obj); temp_obj = HttpHandler.DeleteReport(Equipment, 501); //501 RPTID = User Defined ID obj.Add(temp_obj); temp_obj = HttpHandler.UnlinkCollection(Equipment, 16016); obj.Add(temp_obj); temp_obj = HttpHandler.AddToReport_Single(Equipment, 501, 7003); //SVID = 7003 (Board) obj.Add(temp_obj); temp_obj = HttpHandler.LinkCollection(Equipment, 16016, 501); obj.Add(temp_obj); temp_obj = HttpHandler.EnableCollection(Equipment, 16016); obj.Add(temp_obj); } else { //Override //Disable Collection temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = Equipment; temp_obj.EquipmentType = type; temp_obj.StreamFunction = "S2F37_DISABLE_COLLECTION"; temp_obj.Value = 0; obj.Add(temp_obj); //Delete Report temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = Equipment; temp_obj.EquipmentType = type; temp_obj.StreamFunction = "S2F33_DELETE_REPORT"; temp_obj.Value = 0; obj.Add(temp_obj); //Unlink Collection temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = Equipment; temp_obj.EquipmentType = type; temp_obj.StreamFunction = "S2F35_UNLINK_COLLECTION"; temp_obj.Value = 0; obj.Add(temp_obj); //Add Report temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = Equipment; temp_obj.EquipmentType = type; temp_obj.StreamFunction = "S2F33_ADD_REPORT"; temp_obj.Value = 0; obj.Add(temp_obj); //Link Collection temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = Equipment; temp_obj.EquipmentType = type; temp_obj.StreamFunction = "S2F35_LINK_COLLECTION"; temp_obj.Value = 0; obj.Add(temp_obj); //Enable Collection temp_obj = new SECSGEMDefaultReplyObject(); temp_obj.Equipment = Equipment; temp_obj.EquipmentType = type; temp_obj.StreamFunction = "S2F37_ENABLE_COLLECTION"; temp_obj.Value = 0; obj.Add(temp_obj); } } } //if any machine fail its transaction dont let continue if (obj.Contains(null)) { return(null); } else { if (obj == null) { return(null); } else { if (obj.Count == 0) { return(null); } } } return(obj); } catch { return(null); } }
public static string GetLotInProcess(string equipment) { var lot = EquipmentModels.getLotInProcess(equipment); return(lot); }
public JsonResult GetEquipmentType() { var types = EquipmentModels.GetEquipmentType(); return(Json(types, JsonRequestBehavior.AllowGet)); }
public static int GetSECSGEMProcessedQtyInUnits(string Equipment) { var qty = EquipmentModels.getSECSGEMProcessedQTYInUnits(Equipment); return(qty); }
public static int GetProcessedQty(string Equipment) { var qty = EquipmentModels.getProcessedQTY(Equipment); return(qty); }
public static int GetUnbrandedQty(string Equipment) { var qty = EquipmentModels.getUnbrandedQty(Equipment); return(qty); }
public static int GetTrackInQty(string Equipment) { var qty = EquipmentModels.getTrackInQTY(Equipment); return(qty); }
public JsonResult CheckEquipment(string equipment) { var result = EquipmentModels.EquipmentExist(equipment); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }
public JsonResult GetEquipmentList() { //create a dictionary that will contain the column + datafied config for the grid Dictionary <string, object> result_config = new Dictionary <string, object>(); //get columns Dictionary <string, string> columns = EquipmentModels.GetCols(); //check for filters string where = ""; Dictionary <string, string> filters = new Dictionary <string, string>(); if (Request["filterscount"] != null && Int32.Parse(Request["filterscount"]) > 0) { for (int i = 0; i < Int32.Parse(Request["filterscount"]); i++) { filters.Add("filtervalue" + i, Request["filtervalue" + i]); filters.Add("filtercondition" + i, Request["filtercondition" + i]); filters.Add("filterdatafield" + i, Request["filterdatafield" + i]); filters.Add("filteroperator" + i, Request["filteroperator" + i]); } where = custom_helper.FormatFilterConditions(filters, Int32.Parse(Request["filterscount"]), columns); } //check for sorting ops string sorting = ""; if (Request["sortdatafield"] != null) { sorting = Request["sortdatafield"].ToString() + " " + Request["sortorder"].ToString().ToUpper(); } //determine if cols_only if (Request["cols_only"] != null && bool.Parse(Request["cols_only"]) == true) { //get total row count int totalRows = EquipmentModels.GetCount(where, ((Request["searchStr"] == null) ? "" : Request["searchStr"].ToString())); //prepare column config var cols = new List <string>(); foreach (var item in columns) { cols.Add(item.Value); } Dictionary <string, object> cols_arr = custom_helper.PrepareStaticColumns(cols); result_config.Add("column_config", custom_helper.PrepareColumns(cols_arr)); result_config.Add("TotalRows", totalRows); } else { //pagination initialization int pagenum = Request["pagenum"] == null ? 0 : Int32.Parse(Request["pagenum"].ToString()); int pagesize = Request["pagesize"] == null ? 0 : Int32.Parse(Request["pagesize"].ToString()); int start = pagenum * pagesize; //get data DataTable transactions = new DataTable(); if (Request["showAll"] != null && bool.Parse(Request["showAll"]) == true) { transactions = EquipmentModels.GetData(0, 0, where, sorting, ((Request["searchStr"] == null) ? "" : Request["searchStr"].ToString())); } else { transactions = EquipmentModels.GetData(start, pagesize, where, sorting, ((Request["searchStr"] == null) ? "" : Request["searchStr"].ToString())); } //convert data into json object var data = custom_helper.DataTableToJson(transactions); result_config.Add("data", data); //prepare column config var cols = new List <string>(); foreach (DataColumn column in transactions.Columns) { cols.Add(column.ColumnName); } Dictionary <string, object> cols_arr = custom_helper.PrepareStaticColumns(cols); result_config.Add("column_config", custom_helper.PrepareColumns(cols_arr)); result_config.Add("TotalRows", EquipmentModels.GetCount(where, ((Request["searchStr"] == null) ? "" : Request["searchStr"].ToString()))); } string temp = Request["searchStr"]; response.Add("success", true); response.Add("error", false); response.Add("message", result_config); return(Json(response, JsonRequestBehavior.AllowGet)); }
public JsonResult CheckEquipmentForUpdate(string equipment, int ID) { var result = EquipmentModels.EquipmentExistForUpdate(equipment, ID); return(Json(result.ToString(), JsonRequestBehavior.AllowGet)); }