/// <summary> /// 查詢標簽語言 /// </summary> /// <param name="requestValue"></param> /// <param name="Data"></param> /// <param name="StationReturn"></param> public void QueryPageLanguage(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec sfcdb = null; T_C_LANGUAGE_PAGE language; List <C_LANGUAGE_PAGE> LanguageList; string PageName = Data["PageName"].ToString().Trim(); string LabelName = Data["LabelName"].ToString().Trim(); string Chinese_TW = Data["Chinese_TW"].ToString().Trim(); try { sfcdb = this.DBPools["SFCDB"].Borrow(); language = new T_C_LANGUAGE_PAGE(sfcdb, DBTYPE); LanguageList = language.QueryPageLanguage(PageName, LabelName, Chinese_TW, sfcdb); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000001"; StationReturn.Data = LanguageList; this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); throw e; } }
/// <summary> /// 刪除標簽顯示語言數據 /// </summary> /// <param name="requestValue"></param> /// <param name="Data"></param> /// <param name="StationReturn"></param> public void DeletePageLanguage(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec sfcdb = null; string DeleteSql = ""; string StrID = ""; T_C_LANGUAGE_PAGE language; // string[] ID = Newtonsoft.Json.Linq.JArray(Data["ID"].); Newtonsoft.Json.Linq.JArray ID = (Newtonsoft.Json.Linq.JArray)Data["ID"]; try { sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.BeginTrain(); language = new T_C_LANGUAGE_PAGE(sfcdb, DBTYPE); for (int i = 0; i < ID.Count; i++) { StrID = ID[i].ToString(); Row_C_LANGUAGE_PAGE row = (Row_C_LANGUAGE_PAGE)language.GetObjByID(StrID, sfcdb); DeleteSql = row.GetDeleteString(DBTYPE); sfcdb.ExecSQL(DeleteSql); } sfcdb.CommitTrain(); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000004"; this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { sfcdb.RollbackTrain(); this.DBPools["SFCDB"].Return(sfcdb); throw e; } }
/// <summary> /// 添加標簽顯示語言數據 /// </summary> /// <param name="requestValue"></param> /// <param name="Data"></param> /// <param name="StationReturn"></param> public void AddPageLanguage(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec sfcdb = null; string InsertSql = ""; T_C_LANGUAGE_PAGE language; string PageName = Data["PageName"].ToString().Trim(); string LabelName = Data["LabelName"].ToString().Trim(); string Chinese = Data["Chinese"].ToString().Trim(); string ChineseWT = Data["ChineseWT"].ToString().Trim(); string English = Data["English"].ToString().Trim(); try { sfcdb = this.DBPools["SFCDB"].Borrow(); language = new T_C_LANGUAGE_PAGE(sfcdb, DBTYPE); if (language.CheckDataExist(PageName, LabelName, sfcdb)) { Row_C_LANGUAGE_PAGE row = (Row_C_LANGUAGE_PAGE)language.NewRow(); row.ID = language.GetNewID(BU, sfcdb); row.PAGE_NAME = PageName; row.LABEL_NAME = LabelName; row.CHINESE = Chinese; row.CHINESE_TW = ChineseWT; row.ENGLISH = English; row.EDIT_EMP = LoginUser.EMP_NO; row.SYSTEM_NAME = SystemName; row.EDIT_TIME = GetDBDateTime(); InsertSql = row.GetInsertString(DBTYPE); sfcdb.ExecSQL(InsertSql); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000002"; this.DBPools["SFCDB"].Return(sfcdb); // StationReturn.MessagePara.Add("46545645674"); } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000005"; } } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); throw e; } }
/// <summary> /// 更新標簽顯示語言數據 /// </summary> /// <param name="requestValue"></param> /// <param name="Data"></param> /// <param name="StationReturn"></param> public void UpdatePageLanguage(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec sfcdb = null; string UpdateSql = ""; T_C_LANGUAGE_PAGE language; string ID = Data["ID"].ToString().Trim(); string PageName = Data["PageName"].ToString().Trim(); string LabelName = Data["LabelName"].ToString().Trim(); string Chinese = Data["Chinese"].ToString().Trim(); string ChineseWT = Data["ChineseWT"].ToString().Trim(); string English = Data["English"].ToString().Trim(); try { sfcdb = this.DBPools["SFCDB"].Borrow(); language = new T_C_LANGUAGE_PAGE(sfcdb, DBTYPE); Row_C_LANGUAGE_PAGE row = (Row_C_LANGUAGE_PAGE)language.GetObjByID(Data["ID"].ToString().Trim(), sfcdb); row.ID = ID; row.PAGE_NAME = PageName; row.LABEL_NAME = LabelName; row.CHINESE = Chinese; row.CHINESE_TW = ChineseWT; row.ENGLISH = English; row.EDIT_EMP = LoginUser.EMP_NO; row.SYSTEM_NAME = SystemName; row.EDIT_TIME = GetDBDateTime(); UpdateSql = row.GetUpdateString(DBTYPE); sfcdb.ExecSQL(UpdateSql); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000003"; this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); throw e; } }
/// <summary> /// Excel導入多語言數據 /// </summary> /// <param name="requestValue"></param> /// <param name="Data"></param> /// <param name="StationReturn"></param> public void ExcelImport(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec sfcdb = null; T_C_LANGUAGE_PAGE language; string InsertSql = ""; string repeat = ""; string Fail = ""; string IsNull = ""; string Messaeg = ""; string LabelName = ""; string ChineseTW = ""; string Chinese = ""; string English = ""; string PageName = ""; List <C_LanguagePage> LanguagePage = JsonConvert.DeserializeObject <List <C_LanguagePage> >(Data["jsond"].ToString()); sfcdb = this.DBPools["SFCDB"].Borrow(); for (int i = 0; i < LanguagePage.Count; i++) { try { PageName = LanguagePage[i].PageName.ToString().Trim(); LabelName = LanguagePage[i].labelName.ToString().Trim(); ChineseTW = LanguagePage[i].ChineseTW.ToString().Trim(); Chinese = LanguagePage[i].Chinese.ToString().Trim(); English = LanguagePage[i].English.ToString().Trim(); } catch (Exception e) { IsNull = IsNull + LabelName + ","; } try { language = new T_C_LANGUAGE_PAGE(sfcdb, DBTYPE); if (language.CheckDataExist(PageName, LabelName, sfcdb)) { Row_C_LANGUAGE_PAGE row = (Row_C_LANGUAGE_PAGE)language.NewRow(); row.ID = language.GetNewID(BU, sfcdb); row.PAGE_NAME = PageName; row.LABEL_NAME = LabelName; row.CHINESE = Chinese; row.CHINESE_TW = ChineseTW; row.ENGLISH = English; row.EDIT_EMP = LoginUser.EMP_NO; row.SYSTEM_NAME = SystemName; row.EDIT_TIME = GetDBDateTime(); InsertSql = row.GetInsertString(DBTYPE); sfcdb.ExecSQL(InsertSql); //StationReturn.Status = StationReturnStatusValue.Pass; //StationReturn.MessageCode = "MES00000002"; // StationReturn.MessagePara.Add("46545645674"); } else { repeat = repeat + LabelName + ","; //StationReturn.Status = StationReturnStatusValue.Fail; //StationReturn.MessageCode = "MES00000005"; } } catch (Exception e) { Fail = Fail + LabelName + ","; //this.DBPools["SFCDB"].Return(sfcdb); //throw e; } } if (repeat != "") { Messaeg = Messaeg + "標籤名" + repeat + "已存在 "; } if (Fail != "") { Messaeg = Messaeg + "標籤名" + Fail + "導入失敗 "; } if (IsNull != "") { Messaeg = Messaeg + "標籤名" + Fail + "數據為空 "; } if (Messaeg == "") { StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000002"; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = Messaeg; } this.DBPools["SFCDB"].Return(sfcdb); }