public List <string> GetRepairItemsList(string ITEM_NAME, OleExec DB) { string strSql = string.Empty; //if (string.IsNullOrEmpty(ITEM_NAME)) //{ strSql = $@" select * from c_repair_items where 1=1 order by id "; //} //else //{ // strSql = $@" select * from c_repair_items where item_name='{ITEM_NAME}' "; //} List <string> result = new List <string>(); DataTable res = DB.ExecSelect(strSql).Tables[0]; result.Add(""); ///BY SDL 加載頁面默認賦予空值,操作員必須點選其他有內容選項 if (res.Rows.Count > 0) { for (int i = 0; i < res.Rows.Count; i++) { Row_C_REPAIR_ITEMS ret = (Row_C_REPAIR_ITEMS)NewRow(); ret.loadData(res.Rows[i]); result.Add(ret.GetDataObject().ITEM_NAME); } } return(result); }
public Row_C_REPAIR_ITEMS GetIDByItemName(string _ItemName, OleExec DB) { string strsql = ""; if (DBType == DB_TYPE_ENUM.Oracle) { strsql = $@"select ID from c_repair_items where item_name='{_ItemName.Replace("'", "''")}'"; string ID = DB.ExecSelectOneValue(strsql)?.ToString(); if (ID == null) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "ItemName:" + _ItemName }); throw new MESReturnMessage(errMsg); } Row_C_REPAIR_ITEMS R = (Row_C_REPAIR_ITEMS)this.GetObjByID(ID, DB); return(R); } else { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() }); throw new MESReturnMessage(errMsg); } }