/// <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> /// revises the old password in case the user wants to change - autentification /// </summary> /// <param name="userId">DB identifier of the user</param> /// <returns>hashed pwd of the old pwd from DB</returns> public string reviseOldPwdVailidity(string userId) { string hashedPwd = ""; try { param = new KeyValuePair <string, string>("@userId", userId); } catch (Exception e) { throw new ErrorServiceProfileReviseOldPwd("A kérés összeállítása sikertelen (ModProfOldPwd) " + e.Message); } mdi.openConnection(); hashedPwd = mdi.execPrepScalarQueryInStringWithKVP(queryToGetTheOldHashedPwd, param); mdi.closeConnection(); return(hashedPwd); }
/// <summary> /// read in the specified amount of the chosen product - case of givingOut-getBack process /// </summary> /// <param name="termekQuantId">the DB id of the target stripping</param> /// <returns>DB id of the stripping is needed to modify</returns> public int getTheActualAmountOfTheStripping(string termekQuantId) { KeyValuePair <string, string> param = new KeyValuePair <string, string>("kiszerelID", termekQuantId); mdi.openConnection(); string result = mdi.execPrepScalarQueryInStringWithKVP(queryGetTHeActualAmountOfStripping, param); mdi.closeConnection(); try { int amount = Convert.ToInt32(result); return(amount); } catch (Exception e) { throw new ErrorServiceGetTheAmount ("A raktári mennyiség lekérdezése sikertelen (ModelRequProdMove) " + e.Message); } }
/// <summary> /// revise if the userRightGroup amoung users is not in use /// </summary> /// <param name="groupName">the groupName is needed to revise</param> /// <returns>true = under use / false is free to delete</returns> public int checkTheRecordInUse(string groupName) { string result = "1"; //if exception appears more secure - no mistace upper to let deletion KeyValuePair <string, string> param; try { param = new KeyValuePair <string, string>("@groupname", groupName); } catch (Exception e) { throw new ErrorServiceRightsGroupFreeToDelet("A lekérdezéshez kérés összeállítása sikertelen (ModRightChekcDel) " + e.Message); } mdi.openConnection(); result = mdi.execPrepScalarQueryInStringWithKVP(queryToCheckTheUsageOfTheRigthGroup, param); mdi.closeConnection(); return(Convert.ToInt32(result)); }