public ActionResult GetPartID(string BDNO, string MSG_NO)//besok { string flag = ""; IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WLooingFormatVal", new { BDNO = @BDNO }); List <SIMPLEGRID> listSTR = new List <SIMPLEGRID>(); listSTR = result.ToList(); List <string> newstrVal = new List <string>(); newstrVal = listSTR.Select(p => p.FORMAT_VAL).ToList(); List <string> newstrVal2 = new List <string>(); newstrVal2 = listSTR.Select(p => p.VAL).ToList(); for (int i = 0; i < newstrVal.Count(); i++) { if (newstrVal[i].Length == newstrVal2[i].Length) { List <string> format = getFormatList(newstrVal[i]); if (validationFormat(newstrVal2[i], format)) { db.Execute("CENTRAL010301W/CENTRAL010301WUpdateSFNCntralOK", new { BDNO = BDNO, MSG_NO = MSG_NO }); db.Close(); flag = newstrVal2[i].ToString(); //Insert to log monitoring (TB_R_LOG_H and TB_R_LOG_D) } if (!validationFormat(newstrVal2[i], format)) { db.Execute("CENTRAL010301W/CENTRAL010301WUpdateNG", new { BDNO = BDNO, MSG_NO = MSG_NO }); db.Close(); //Insert to log monitoring (TB_R_LOG_H and TB_R_LOG_D) } else { flag = newstrVal2[i].ToString(); } } else { db.Execute("CENTRAL010301W/CENTRAL010301WUpdateNG", new { BDNO = BDNO, MSG_NO = MSG_NO }); db.Close(); //Insert to log monitoring (TB_R_LOG_H and TB_R_LOG_D) } } db.Close(); return(Json(flag, JsonRequestBehavior.AllowGet)); }
public int CountData(string plant, string terminal, string partcode, string partdesc) { int ResCount = 0; IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Fetch <SIMPLEGRID>("CENTRAL020105W/CENTRAL020105WGetCountDataCentral"); List <SIMPLEGRID> intCount = new List <SIMPLEGRID>(); intCount = result.ToList(); if (plant != null || !String.IsNullOrEmpty(plant)) { intCount = intCount.Where(p => p.PLANT_CD == plant).ToList(); } if (terminal != null || !String.IsNullOrEmpty(terminal)) { intCount = intCount.Where(p => p.TERM_CD == terminal).ToList(); } if (partcode != null || !String.IsNullOrEmpty(partcode)) { intCount = intCount.Where(p => p.PART_CD == partcode).ToList(); } if (partdesc != null || !String.IsNullOrEmpty(partdesc)) { intCount = intCount.Where(p => p.PART_DESC == partdesc).ToList(); } ResCount = intCount.Count(); db.Close(); return(ResCount); }
public static void CloseDb() { IDBContext db = null; bool hasDb = false; if (HttpContext.Current != null) { if (HttpContext.Current.Items.Contains(PROP_DBCONTEXT)) { db = HttpContext.Current.Items[PROP_DBCONTEXT] as IDBContext; hasDb = (db != null); } } if (hasDb) { Util.TraceCall("db", "Close @ {0}"); db.Close(); HttpContext.Current.Items.Remove(PROP_DBCONTEXT); } else { Util.TraceCall("db", "NotClosed@{0}"); } }
public IEnumerable <SIMPLEGRID> GetSimpleGrid(string BDNO, int p_page, int p_length) { #region old IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WGetSimpleGrid"); List <SIMPLEGRID> NewList = new List <SIMPLEGRID>(); NewList = result.ToList(); if (BDNO != null || !String.IsNullOrEmpty(BDNO)) { NewList = NewList.Where(p => p.BDNO.Trim() == BDNO.Trim()).ToList(); } //if (FR_CD != null || !String.IsNullOrEmpty(FR_CD)) //{ // NewList = NewList.Where(p => p.ASD_VINNO.Trim() == FR_CD.Trim()).ToList(); //} //if (MSG_NO != null || !String.IsNullOrEmpty(MSG_NO)) //{ // NewList = NewList.Where(p => p.MSG_NO.Trim() == MSG_NO.Trim()).ToList(); //} if (p_page > 0 || p_length > 0) { NewList = NewList.Where(p => p.ROW_NUM >= p_page && p.ROW_NUM <= p_length).ToList(); } db.Close(); return(NewList); #endregion }
public IEnumerable <SIMPLEGRID> GetSimpleGrid(string plant, string terminal, string partcode, string partdesc, int p_page, int p_length) { IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Fetch <SIMPLEGRID>("CENTRAL020105W/CENTRAL020105WGetSimpleGrid"); List <SIMPLEGRID> NewList = new List <SIMPLEGRID>(); NewList = result.ToList(); if (plant != null || !String.IsNullOrEmpty(plant)) { NewList = NewList.Where(p => p.PLANT_CD == plant).ToList(); } if (terminal != null || !String.IsNullOrEmpty(terminal)) { NewList = NewList.Where(p => p.TERM_CD == terminal).ToList(); } if (partcode != null || !String.IsNullOrEmpty(partcode)) { NewList = NewList.Where(p => p.PART_CD == partcode).ToList(); } if (partdesc != null || !String.IsNullOrEmpty(partdesc)) { NewList = NewList.Where(p => p.PART_DESC == partdesc).ToList(); } if (p_length != 0 || p_page != 0) { NewList = NewList.Where(p => p.ROW_NUM >= p_page && p.ROW_NUM <= p_length).ToList(); } db.Close(); return(NewList); }
public ActionResult CheckBodyNo(string BDNO, string FR_CD, string MSG_NO) { IDBContext db2 = DatabaseManager.Instance.GetContext(); var result2 = db2.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WCheckBodyNo", new { BDNO = BDNO }); List <SIMPLEGRID> newListCheck2 = new List <SIMPLEGRID>(); newListCheck2 = result2.ToList(); string result = ""; if (newListCheck2.Where(p => p.STS == "C").Count() > 0) { result = "C"; } if (newListCheck2.Where(p => p.STS == "R").Count() > 0) { result = "RC"; } if (newListCheck2.Count() <= 0) { result = "R"; } if (newListCheck2.Where(p => p.STS == null || p.STS == "").Count() <= 0) { result = "RC"; } db2.Close(); return(Json(result, JsonRequestBehavior.AllowGet)); }
public bool InsertCentralLog(string ASD_VINNO, string MSG_NO, string BDNO, string IDNO, string VAL, string FORMAT_VAL, string FORMAT_START, string FORMAT_LENGHT, string USER) { bool result = false; try { IDBContext db = DatabaseManager.Instance.GetContext(); result = db.Execute("CENTRAL010101W/CENTRAL010101WInsertCentralLog", new { ASD_VINNO = ASD_VINNO, MSG_NO = MSG_NO, BDNO = BDNO, IDNO = IDNO, VAL = VAL, FORMAT_VAL = FORMAT_VAL, FORMAT_START = FORMAT_START, FORMAT_LENGHT = FORMAT_LENGHT, USER = USER }) > 0; db.Close(); } catch { } return(result); }
public JsonResult GetByKey(string itemscode) { AjaxResult ajaxResult = new AjaxResult(); Items result = null; IDBContext db = databaseManager.GetContext(); try { result = itemRepo.GetByKey(itemscode); ajaxResult.Result = AjaxResult.VALUE_SUCCESS; ajaxResult.Params = new object[] { result }; } catch (Exception ex) { ajaxResult.Result = AjaxResult.VALUE_ERROR; ajaxResult.ErrMesgs = new string[] { string.Format("{0} = {1}", ex.GetType().FullName, ex.Message) }; } finally { db.Close(); } return(Json(ajaxResult)); }
public bool InsertCentralHeader(string BDNO, string IDNO, int COUNTING_PARTID, string TM_CD, string SUMM_STS, string STS, string USER) { bool result = false; try { IDBContext db = DatabaseManager.Instance.GetContext(); result = db.Execute("CENTRAL010101W/CENTRAL010101WInsertCentralHeader", new { BDNO = BDNO, IDNO = IDNO, COUNTING_PARTID = COUNTING_PARTID, TM_CD = TM_CD, SUMM_STS = SUMM_STS, STS = STS, USER = USER }) > 0; db.Close(); } catch { } return(result); }
public string SaveEditGridRepo(string ID, string PlanCD_val, string termCD_val, string partCD_val, string PartDesc_val, string ColV1_val, string ConsVal1_val, string ColVI2_val, string ConsVal2_val, string ColVI3_val, string ConsVal3_val, string format_No_val, string format_val_val, string format_start_val, string format_length_val, string valid_fr_val, string valid_to_val, string changeBy_val, string changeDt_val, string UpdateBy_val, string UpdateDt_val) { IDBContext db = DatabaseManager.Instance.GetContext(); if (!String.IsNullOrEmpty(valid_fr_val) || !String.IsNullOrEmpty(valid_to_val) || !String.IsNullOrEmpty(changeDt_val) || !String.IsNullOrEmpty(UpdateDt_val)) { DateTime val_from = DateTime.ParseExact(valid_fr_val, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); valid_fr_val = val_from.ToString("yyyy-MM-dd"); DateTime val_to = DateTime.ParseExact(valid_to_val, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); valid_to_val = val_to.ToString("yyyy-MM-dd"); DateTime cr_DT = DateTime.ParseExact(changeDt_val, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); changeDt_val = cr_DT.ToString("yyyy-MM-dd"); DateTime Up_DT = DateTime.ParseExact(UpdateDt_val, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); UpdateDt_val = Up_DT.ToString("yyyy-MM-dd"); } dynamic args = new { PLANT_CDID = ID, PLANT_CD = PlanCD_val, TERM_CD = termCD_val, PART_CD = partCD_val, PART_DESC = PartDesc_val, COL_VI1 = ColV1_val, CONS_VAL1 = ConsVal1_val, COL_VI2 = ColVI2_val, CONS_VAL2 = ConsVal2_val, COL_VI3 = ColVI3_val, CONS_VAL3 = ConsVal3_val, FORMAT_SEQ = format_No_val, FORMAT_VAL = format_val_val, FORMAT_START = format_start_val, FORMAT_LENGTH = format_length_val, VALID_FR = valid_fr_val, VALID_TO = valid_to_val, CREATED_BY = changeBy_val, CREATED_DT = changeDt_val, UPDATED_BY = UpdateBy_val, UPDATED_DT = UpdateDt_val }; try { int result = db.Execute("CENTRAL020105W/CENTRAL020105SaveEditGrid", args); db.Close(); if (result > 0) { return("Edit Finished Successfully."); } else { return("Edit Failed."); } } catch (Exception e) { return(e.Message.ToString()); } }
public ActionResult UploadDataFile(HttpPostedFileBase file, string uploadMode) { AjaxResult ajaxResult = new AjaxResult(); RepoResult repoResult = null; IDBContext db = databaseManager.GetContext(); IList <string> errMesgs = new List <string>(); IList <Items> data = new List <Items>(); Toyota.Common.Credential.User u = Lookup.Get <Toyota.Common.Credential.User>(); string userName = u.Username; try { data = this.GetDataLocalUploadExcel(file, errMesgs); if (errMesgs.Count >= 1) { ajaxResult.Result = AjaxResult.VALUE_ERROR; ajaxResult.ErrMesgs = new string[] { string.Format("{0}", errMesgs[0]) }; } else { db.BeginTransaction(); foreach (Items loopInsert in data) { repoResult = itemRepo.InsertUpdate(db, userName, loopInsert, uploadMode); } CopyPropertiesRepoToAjaxResult(repoResult, ajaxResult); if (AjaxResult.VALUE_ERROR.Equals(ajaxResult.Result)) { db.AbortTransaction(); } else { db.CommitTransaction(); } } } catch (Exception ex) { db.AbortTransaction(); ajaxResult.Result = AjaxResult.VALUE_ERROR; ajaxResult.ErrMesgs = new string[] { string.Format("{0} = {1}", ex.GetType().FullName, ex.Message) }; } finally { db.Close(); } return(Json(ajaxResult)); }
public string GetPartDescRepo(string PlanCD_val) { IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.SingleOrDefault <string>("CENTRAL020106W/CENTRAL020106WGetPartDesc", new { PLANT_CD = PlanCD_val }); db.Close(); return(result); }
public string getAPIUrl() { IDBContext db = dbManager.GetContext(); string result = db.SingleOrDefault <string>("GetAPIUrl"); db.Close(); return(result); }
public ActionResult GetTblFormatting(string BDNO, string FR_CD, string MSG_NO) { IDBContext db = DatabaseManager.Instance.GetContext(); var result7 = db.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WGetTblFtmttng", new { BDNO = BDNO }); db.Close(); return(Json(result7, JsonRequestBehavior.AllowGet)); }
public List <InterfaceADMObj> InsertTemp() { IDBContext db = dbManager.GetContext(); var Result = db.Fetch <InterfaceADMObj>("insertTP", new { }); db.Close(); return(Result.ToList()); }
public List <FTPCredential> GetFtpCredentialSucc(string param, string ID, string sql) { IDBContext db = dbManager.GetContext(); var Result = db.Fetch <FTPCredential>(sql, new { ID = ID, PARAM = param }); db.Close(); return(Result.ToList()); }
public List <SimpleMasterCustomModel> getTables() { IDBContext db = DatabaseManager.Instance.GetContext(); var res = db.Query <SimpleMasterCustomModel>("Master/SimpleMasterCustom_getTablesName"); db.Close(); return(res.ToList()); }
public List <SysvalObj> getSystemVal() { IDBContext db = dbManager.GetContext(); var result = db.Fetch <SysvalObj>("GetSystemVal", new { }); db.Close(); return(result.ToList()); }
public List <InterfaceADMObj> ResultAfterAllValidation() { IDBContext db = dbManager.GetContext(); var Result = db.Fetch <InterfaceADMObj>("GetTPDataAfterAllValidation"); db.Close(); return(Result.ToList()); }
public int GetDeleteGrid(string PlantID) { IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Execute("CENTRAL020105W/CENTRAL020105WGetDeleteGrid", new { PLANT_CD = PlantID }); db.Close(); return(result); }
public int CountData2(string source, string frameNo, string katashik, string suffix, string parttype, string partNo, string prodFrom, string status, string format, string prodTo, string start, string len, string from, string to) { int ResCount = 0; IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Fetch <SIMPLEGRID>("CENTRAL030102W/CENTRAL030102WGetCountDataCentral2"); List <SIMPLEGRID> intCount = new List <SIMPLEGRID>(); intCount = result.ToList(); if (source != null || !String.IsNullOrEmpty(source)) { intCount = intCount.Where(p => p.STS == katashik).ToList(); } if (frameNo != null || !String.IsNullOrEmpty(frameNo)) { intCount = intCount.Where(p => p.ASD_VINNO == frameNo).ToList(); } if (katashik != null || !String.IsNullOrEmpty(katashik)) { intCount = intCount.Where(p => p.KATASHIKI == katashik).ToList(); } if (suffix != null || !String.IsNullOrEmpty(suffix)) { intCount = intCount.Where(p => p.SALES_SFX == suffix).ToList(); } if (parttype != null || !String.IsNullOrEmpty(parttype)) { intCount = intCount.Where(p => p.PART_CD == parttype).ToList(); } if (partNo != null || !String.IsNullOrEmpty(partNo)) { intCount = intCount.Where(p => p.VAL == partNo).ToList(); } if (prodFrom != null && prodTo != null) { DateTime?date_fr = DateTime.ParseExact(prodFrom, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); DateTime?date_to = DateTime.ParseExact(prodTo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); DateTime?date_LO = DateTime.ParseExact(prodTo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); intCount = intCount.Where(p => p.LO_DATE >= date_fr && p.LO_DATE <= date_to).ToList(); } if (status != null || !String.IsNullOrEmpty(status)) { intCount = intCount.Where(p => p.STS == status).ToList(); } if (format != null || !String.IsNullOrEmpty(format)) { intCount = intCount.Where(p => p.FR_CD == format).ToList(); } ResCount = intCount.Count(); db.Close(); return(ResCount); }
public IEnumerable <CENTRAL030101W> GetComboIDNO12(string ID) { IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Fetch <CENTRAL030101W>("CENTRAL030101W/CENTRAL030101GetComboIDNO2", new { IDNO = ID }); db.Close(); return(result); }
public string getFilename() { IDBContext db = dbManager.GetContext(); var result = db.Fetch <string>("getFilename"); db.Close(); return(result.FirstOrDefault()); }
public Int64 CreateLogFinish(Common model) { IDBContext db = dbManager.GetContext(); Int64 result = db.SingleOrDefault <Int64>("CreateLogFinish", model); db.Close(); return(result); }
public IEnumerable <CENTRAL030101W> GetSystem() { IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Fetch <CENTRAL030101W>("CENTRAL030101W/CENTRAL030101WGetSystemImg"); db.Close(); return(result); }
public IEnumerable <SIMPLEGRID> GetSimpleGrid(string source, string frameNo, string katashik, string suffix, string parttype, string partNo, string prodFrom, string status, string format, string prodTo, string start, string len, string from, string to, int Page, int length) { IDBContext db = DatabaseManager.Instance.GetContext(); var result = db.Fetch <SIMPLEGRID>("CENTRAL030102W/CENTRAL030102WGetSimpleGrid"); List <SIMPLEGRID> NewList = new List <SIMPLEGRID>(); NewList = result.ToList(); //if (source != null || !String.IsNullOrEmpty(source)) //{ // NewList = NewList.Where(p => p.STS.Trim() == source).ToList(); //} if (frameNo != null || !String.IsNullOrEmpty(frameNo)) { NewList = NewList.Where(p => p.ASD_VINNO.Trim() == frameNo).ToList(); } if (katashik != null || !String.IsNullOrEmpty(katashik)) { NewList = NewList.Where(p => p.KATASHIKI.Trim() == katashik).ToList(); } if (suffix != null || !String.IsNullOrEmpty(suffix)) { NewList = NewList.Where(p => p.SALES_SFX.Trim() == suffix).ToList(); } if (parttype != null || !String.IsNullOrEmpty(parttype)) { NewList = NewList.Where(p => p.PART_CD.Trim() == parttype).ToList(); } if (partNo != null || !String.IsNullOrEmpty(partNo)) { NewList = NewList.Where(p => p.VAL.Trim() == partNo).ToList(); } if (prodFrom != null && prodTo != null) { DateTime?date_fr = DateTime.ParseExact(prodFrom, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); DateTime?date_to = DateTime.ParseExact(prodTo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); NewList = NewList.Where(p => p.LO_DATE >= date_fr && p.LO_DATE <= date_to).ToList(); } if (status != null || !String.IsNullOrEmpty(status)) { NewList = NewList.Where(p => p.SYSTEM_VALUE_TXT.Trim() == status).ToList(); } if (format != null || !String.IsNullOrEmpty(format)) { NewList = NewList.Where(p => p.FR_CD.Trim() == format).ToList(); } if (Page > 0 || length > 0) { NewList = NewList.Where(p => p.ROW_NUM >= Page && p.ROW_NUM <= length).ToList(); } db.Close(); return(NewList); }
public List <SimpleMasterCustomModel> data_Table(string sc_TABLE_NAME) { IDBContext db = DatabaseManager.Instance.GetContext(); var res = db.Query <SimpleMasterCustomModel>("Master/SimpleMasterCustom_dataTablesName", new { TABLE_NAME = sc_TABLE_NAME }); db.Close(); return(res.ToList()); }
//public List<HeaderNotification> GetHeaderNotification(string noreg) //{ // IDBContext db = DatabaseManager.Instance.GetContext(); // return db.Query<HeaderNotification>("Standards/GetNotificationHeader", new { NOREG = noreg }).ToList(); //} //public IEnumerable<HeaderNotification> GetHeaderNotification(string noreg) //{ // IDBContext db = DatabaseManager.Instance.GetContext(); // return db.Fetch<HeaderNotification>("Standards/GetNotificationHeader", new { NOREG = noreg }).ToList(); //} public string doUpdateNotif(string data, string noreg) { IDBContext db = DatabaseManager.Instance.GetContext(); string result = "1"; db.Execute("Standards/UpdateNotification", new { NOTIF_ID = data, NOREG = noreg }); db.Close(); return(result); }
public ActionResult GetLoopSfnLog(string result5, string BDNO, string MSG_NO) { string flag = ""; IDBContext db = DatabaseManager.Instance.GetContext(); var result7 = db.Fetch <GETDATA>("CENTRAL010301W/CENTRAL010301WGetLoopSFNLog", new{ VAL = result5, BDNO = BDNO }); db.Close(); if (result7.Count() > 0) { db.Execute("CENTRAL010301W/CENTRAL010301WUpdateSFNCntralOK", new { BDNO = BDNO, MSG_NO = MSG_NO }); db.Close(); //Insert to log monitoring (TB_R_LOG_H and TB_R_LOG_D) flag = "valid"; } return(Json(flag, JsonRequestBehavior.AllowGet)); }
public string updateTemp(string val, string key) { IDBContext db = dbManager.GetContext(); string result = db.SingleOrDefault <string>("updateTP", new { param = val, PROCESS_KEY = key }); db.Close(); return(result); }