/// <summary> /// get the content of product datas from DB to List of ProductElement-s /// </summary> /// <param name="mode">mode of method - true = active / false = deleted</param> /// <returns>list of product-elements</returns> public List <ProductFullRow> getProductsFullList(bool mode) { mdi.openConnection(); List <string[]> tableContent; if (mode) { tableContent = mdi.executeQueryGetStringArrayListOfRows(queryProductsFullTableAct); } else { tableContent = mdi.executeQueryGetStringArrayListOfRows(queryProdtsFullTableDeleted); } mdi.closeConnection(); try { productQuantityList = new List <ProductFullRow>(); foreach (string[] record in tableContent) { productQuantityList.Add(fullRecordToListProdFullElem(record)); } return(productQuantityList); } catch (Exception e) { throw new ErrorServiceCreateDataList("Termékek adtlista megalkotása sikertelen (ModProdList): " + e.Message); } }
/// <summary> /// create new reocord in 'raktminoseg' table /// </summary> /// <param name="modif">set of ProductionPartRow is needed to create</param> public void createNewProdQualityRecord(ProductQualityPart row, string userId) { try { parameters = new List <KeyValuePair <string, string> >(); KeyValuePair <string, string> name = new KeyValuePair <string, string>("@nev", row.productName); KeyValuePair <string, string> subcon = new KeyValuePair <string, string>("@beszallito", row.productSubcontr); KeyValuePair <string, string> descr = new KeyValuePair <string, string>("@leiras", row.productDescr); KeyValuePair <string, string> unit = new KeyValuePair <string, string>("@menyegys", row.productQantUnit); KeyValuePair <string, string> dange = new KeyValuePair <string, string>("@veszely", row.productDanger.ToString()); KeyValuePair <string, string> sheet = new KeyValuePair <string, string>("@adatlap", row.productSheet); KeyValuePair <string, string> who = new KeyValuePair <string, string>("@userId", userId); parameters.Add(name); parameters.Add(subcon); parameters.Add(descr); parameters.Add(dange); parameters.Add(sheet); parameters.Add(unit); parameters.Add(who); } catch (Exception e) { throw new ErrorServiceNewRecord("Adatbátzis felé a kérés megalkotása sikertelen (ModProdQualNewRec): " + e.Message); } mdi.openConnection(); mdi.execPrepDMQueryWithKVPList(queryProductsNewRowQuality, parameters, 7); mdi.closeConnection(); }
/// <summary> /// setTheChosen noted records at booked /// </summary> /// <param name="listToChange">list of ordId-s</param> public void setTheseRecordAsBookedBunch(List <string> listToChange) { List <KeyValuePair <string, string> > listOfParam; try { listOfParam = new List <KeyValuePair <string, string> >(); foreach (string row in listToChange) { KeyValuePair <string, string> param = new KeyValuePair <string, string>("@ordId", row); listOfParam.Add(param); } } catch (Exception e) { throw new ErrorOrderingSetNotedAsBooked("A kéréshez a paraméterlista összeállítása sikertelen (ModOrdBook) " + e.Message); } try { if (listOfParam.Count > 0) { mdi.openConnection(); foreach (KeyValuePair <string, string> param in listOfParam) { mdi.execPrepDMQueryWithKVP(queryToSetNotedAsBooked, param); } mdi.closeConnection(); } } catch (Exception e) { throw new ErrorOrderingSetNotedAsBooked("A kéréssorozat végrehajtása sikertelen (ModOrdBook) " + e.Message); } }
/// <summary> /// collects the usrRightGroups from DB in string[] /// </summary> /// <returns>result of collection</returns> public List <string[]> collectTheUserRightGroups() { mdi.openConnection(); List <string[]> result = mdi.executeQueryGetStringArrayListOfRows(queryOfCollectTheUserRightGroups); mdi.closeConnection(); if (result == null) { throw new ErrorServiceCreateDataList("Adatok gyűjtés sikertelen (ModRightRead)"); } else { return(result); } }
/// <summary> /// start to indentify the user - must be the first query step /// </summary> /// <param name="parent">LoginWindow</param> /// <param name="userName">given name by user</param> /// <param name="userPwd">given password by user</param> /// <returns></returns> public string checkDBForThisUser(string userName) { try { param = new KeyValuePair <string, string>("@userName", userName); } catch (Exception e) { throw new ErrorServiceLoginDBAccess("A lekérdezés összeállítása sikertelen (ModLoginUserSeek) " + e.Message); } mdi.openConnection(); List <string[]> resultIdentify = mdi.execPrepQueryInListStringArrWithKVP(queryOfUserIdentify, param); mdi.closeConnection(); if (resultIdentify.Count == 1) { userId = resultIdentify[0][0]; return(hashedPwd = resultIdentify[0][1]); } else if (resultIdentify.Count == 0) { throw new ErrorServiceLoginDBAccess("Nem megfelelő felhasználónév vagy jelszó"); } else { throw new ErrorServiceLoginDBAccess("Az adatbázis sérült, több találat is érkezett (ModLoginUserSeek)"); } }
/// <summary> /// process of inactivete a request and charge the inventroy pool in the specific stripping /// </summary> /// <param name="modUserId">userID who makes the process</param> /// <param name="reqStartDate">startDate of the target request</param> /// <param name="recQuantId">stripping ID of the target request</param> /// <param name="reqUserId">user ID, who asked and credits for</param> /// <param name="newAmountInStripp">teh amount that will be in the strore after the process - less</param> public void deleteRequestTableGiveOutARecord(string modUserId, string reqStartDate, string recQuantId, string reqUserId, string newAmountInStripp) { try { KeyValuePair <string, string> modUser = new KeyValuePair <string, string>("@modUserId", modUserId); KeyValuePair <string, string> reqStart = new KeyValuePair <string, string>("@reqStartDate", reqStartDate); KeyValuePair <string, string> quantId = new KeyValuePair <string, string>("@kiszerelId", recQuantId); KeyValuePair <string, string> reqUser = new KeyValuePair <string, string>("@reqUserId", reqUserId); parameters = new List <KeyValuePair <string, string> >(); parameters.Add(modUser); parameters.Add(reqStart); parameters.Add(quantId); parameters.Add(reqUser); } catch (Exception e) { throw new ErrorServiceDeleteRecord("Termék kiadásával kapcsolatos kérés összeállítása sikertelen (ModReqGiveOut) " + e.Message); } mdi.openConnection(); mdi.execPrepDMQueryWithKVPList(queryGiveOutTheRequest, parameters, 4); //delete try { KeyValuePair <string, string> newAmount = new KeyValuePair <string, string>("@ujabbMennyiseg", newAmountInStripp); KeyValuePair <string, string> quantId = new KeyValuePair <string, string>("@kiszerelId", recQuantId); parameters = new List <KeyValuePair <string, string> >(); parameters.Add(newAmount); parameters.Add(quantId); } catch (Exception e) { mdi.closeConnection(); throw new ErrorServiceUpdateRecord("Termék kiadáshoz raktárfrissítő kérés összeállítása sikertelen (ModReqGivenOut) " + e.Message); } mdi.execPrepDMQueryWithKVPList(queryUpdateStrippingTableAmountChangeCase, parameters, 2); mdi.closeConnection(); }
/// <summary> /// checks out in 'raktmennyiseg' table the uniquity of barcode /// </summary> /// <param name="text">barcode that is needed with store the product</param> /// <returns>result of seeking - true already exists / false unique barcode</returns> public bool checkBarcodeUniquity(string text) { try { KeyValuePair <string, string> seekBarcode = new KeyValuePair <string, string>("@kod", text); mdi.openConnection(); string result = mdi.execPrepScalarQueryInStringWithKVP(queryBarcodeIsUnique, seekBarcode); mdi.closeConnection(); if (result == "0") { return(false); } else { return(true); } } catch (Exception e) { throw new ErrorServiceProdBarcodeSeek("Adatbázis felé a kérés megalkotása siekrtelen (ModProdBar) " + e.Message); } }
/// <summary> /// process of collect user personal details and rights of its group /// </summary> public void collectDatasOfVerifiedUser() { try { param = new KeyValuePair <string, string>("@userID", userId); } catch (Exception e) { throw new ErrorServiceLoginDBAccess("Lekérdezés összeállítási hiba (ModLoginUserDetSeek) " + e.Message); } mdi = startDBconnect.kapcsolodas(dbci, parent); mdi.openConnection(); rightFromDB = mdi.execPrepScalarQueryInStringWithKVP(queryOfRights, param); userDatas = mdi.execPrepQueryOneRowInStringArrWithKVP(queryOfUserPersonalDet, param); mdi.closeConnection(); }
/// <summary> /// gets the list of OrderingCancelled to show them the user /// </summary> /// <returns>list of OrderingCancelled</returns> public List <OrderingCancelled> getListOfCancelledOrderings() { List <OrderingCancelled> listCancelled = new List <OrderingCancelled>(); KeyValuePair <string, string> param = new KeyValuePair <string, string>("@erveny", "0"); mdi.openConnection(); List <string[]> rows = mdi.execPrepQueryInListStringArrWithKVP( queryForReadInRecords, param); mdi.closeConnection(); try { foreach (string[] rec in rows) { listCancelled.Add(convertCancelledOrdering(rec)); } } catch (Exception e) { throw new ErrorOrderingGetTheCancelledPool("A visszavont rendelések adatlista megalkotása sikertelen (ModOrdNorm) " + e.Message); } return(listCancelled); }
/// <summary> /// gets the user_name valu from 'felhaszn' table by the specific id /// </summary> /// <param name="userId">the DB id of the user</param> /// <returns>user_name of the user</returns> public string[] getNameAndTajOfUser(string userId) { string[] result = null; try { param = new KeyValuePair <string, string>("@userId", userId); } catch (Exception e) { throw new ErrorServiceProfileDetailsManage("Az adatbázis felé a kérés összeállítása sikertelen (ModProfUNTaj) " + e.Message); } mdi.openConnection(); result = mdi.execPrepQueryOneRowInStringArrWithKVP(queryGettingTheUserNameofUser, param); mdi.closeConnection(); return(result); }
/// <summary> /// reads in the active requests /// </summary> /// <returns>Kist of RecordActive container</returns> public List <RequestRecordActive> getActiveRequests() { mdi.openConnection(); List <string[]> result = mdi.executeQueryGetStringArrayListOfRows(queryGetRequestsActive); resultUsers = mdi.executeQueryGetStringArrayListOfRows(queryGetThePoolOfUsersWhoModifyedRecord); mdi.closeConnection(); List <RequestRecordActive> rows = new List <RequestRecordActive>(); try { foreach (string[] rec in result) { rows.Add(convertNormRecord(rec)); } } catch (Exception e) { throw new ErrorServiceCreateDataList("Kérések adatlista megalkotása sikertelen (ModReqNorm) " + e.Message); } return(rows); }