/// <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> /// 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> /// 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); }