Exemple #1
0
        //tested
        #region makes the changes between active-givenOut record-state
        /// <summary>
        /// books down the giving out process - charges the store by an amount
        /// </summary>
        /// <param name="quantId">strippingID, to target the request</param>
        /// <param name="amountAbout">the amount of the request, to charge the store</param>
        /// <param name="keresDatum">startDate of the request</param>
        /// <param name="keroUserId">userID, who wanted that</param>
        public void giveOutTheChosenProduct(int quantId, int amountAbout,
                                            string keresDatum, int keroUserId)
        {
            modelRequestRead  = new RequestsModelReadIn(dbci, parent);
            modelRequestWrite = new RequestsModelWirteOut(dbci, parent);
            string finalAmountAfterTheGivingOut;
            string qualityIdThatUnderProcess;

            try
            {
                qualityIdThatUnderProcess = Convert.ToString(quantId);
                int amountBeforeTheChange = modelRequestRead.getTheActualAmountOfTheStripping(qualityIdThatUnderProcess);
                if (amountBeforeTheChange >= amountAbout)
                {
                    finalAmountAfterTheGivingOut = Convert.ToString(amountBeforeTheChange - amountAbout);
                }
                else
                {
                    throw new ErrorServiceRequests("Nincs megfeleő mennyiség a raktárban (ServReq_giveOutAct)");
                }
            }
            catch (ErrorServiceGetTheAmount e)
            {
                throw new ErrorServiceRequests(e.Message);
            }
            catch (Exception e)
            {
                throw new ErrorServiceRequests("Ismeretlen hiba történt (ServReq_giveOutActAmount) " + e.Message);
            }
            try
            {
                modelRequestWrite.deleteRequestTableGiveOutARecord(userIdOfPoerator, keresDatum.Replace(".", "-"),
                                                                   qualityIdThatUnderProcess, keroUserId.ToString(), finalAmountAfterTheGivingOut);
            }
            catch (ErrorServiceDeleteRecord e)
            {
                throw new ErrorServiceRequests(e.Message);
            }
            catch (ErrorServiceUpdateRecord e)
            {
                throw new ErrorServiceRequests(e.Message);
            }
            catch (Exception e)
            {
                throw new ErrorServiceRequests("Ismeretlen hiba történt (ServRequ_giveOutAct) " + e.Message);
            }
        }
Exemple #2
0
 //tested
 #region delet-undelet an active request by the stock-keeper
 /// <summary>
 /// it inactivates an active record
 /// </summary>
 /// <param name="modUserId">userId, who does that</param>
 /// <param name="reqStartDate">startDate of the target equest</param>
 /// <param name="reqQuantId">strippingId of the target equest</param>
 /// <param name="reqUserId">userId, who wanted that</param>
 public void deletAnActiveRequest(string reqStartDate, int reqQuantId, int reqUserId)
 {
     modelRequestWrite = new RequestsModelWirteOut(dbci, parent);
     try
     {
         modelRequestWrite.deleteRequestTableActiveRecord(userIdOfPoerator, reqStartDate.Replace(".", "-"),
                                                          reqQuantId.ToString(), reqUserId.ToString());
     }
     catch (ErrorServiceDeleteRecord e)
     {
         throw new ErrorServiceRequests(e.Message);
     }
     catch (Exception e)
     {
         throw new ErrorServiceRequests("Ismeretlen hiba történt (ServRequ_delAct) " + e.Message);
     }
 }
 /// <summary>
 /// it reactivates a direct-deleted record by the stock-keeper
 /// </summary>
 /// <param name="requId">DB identifier of the target request</param>
 /// <param name="reqUserId">userId, who wanted that</param>
 public void undeletADeletedRequest(int requId, int reqUserId)
 {
     modelRequestWrite = new RequestsModelWirteOut(dbci, parentMain);
     try
     {
         modelRequestWrite.undeletRequestTableDeletedRecord(userIdOfOperator, requId.ToString(),
                                                            reqUserId.ToString());
     }
     catch (ErrorServiceRenewRecord e)
     {
         throw new ErrorServiceRequests(e.Message);
     }
     catch (Exception e)
     {
         throw new ErrorServiceRequests("Ismeretlen hiba történt (ServRequ_undelAct) " + e.Message);
     }
 }
 //tested
 #region makes change in Active Request
 /// <summary>
 /// mediate the request change at active records
 /// </summary>
 /// <param name="newAmount">the new amount from the stripping</param>
 /// <param name="newQuantId">the new stripping identifier</param>
 /// <param name="requId">DB identifier of the request</param>
 /// <param name="oldRequUserId">DB identifier of the requester</param>
 public void modifyTheActiveRecord(int newAmount, int newQuantId, int requId, int oldRequUserId)
 {
     try
     {
         modelRequestWrite = new RequestsModelWirteOut(dbci, parentMain);
         modelRequestWrite.updateRequestTableAtARecord(userIdOfOperator, newAmount.ToString(),
                                                       newQuantId.ToString(), requId.ToString(), oldRequUserId.ToString());
     }
     catch (ErrorServiceUpdateRecord e)
     {
         throw new ErrorServiceRequests(e.Message);
     }
     catch (Exception e)
     {
         throw new ErrorServiceRequests("Ismeretlen eredetű hiba történt (ServReq_modifAct) " + e.Message);
     }
 }
        /// <summary>
        /// makes the given out product being get-back, credit that amount to the store
        /// </summary>
        /// <param name="modosUserId">userID, who makes the prodess</param>
        /// <param name="quantId">strippingID, target request</param>
        /// <param name="amountAbout">the amount, that the request is about, needed to credit to the store</param>
        /// <param name="requId">DB identifier to target the request</param>
        /// <param name="userIdOfRequester">userId, who wanted that request</param>
        public void getBackTheChosenProductThatWereGivenOut(int quantId, int amountAbout,
                                                            int requId, int userIdOfRequester)
        {
            modelRequestRead  = new RequestsModelReadIn(dbci, parentMain);
            modelRequestWrite = new RequestsModelWirteOut(dbci, parentMain);
            string finalAmountAfterTheGivingOut;
            string qualityIdThatUnderProcess;

            try
            {
                qualityIdThatUnderProcess = Convert.ToString(quantId);
                int amountBeforeTheChange = modelRequestRead.getTheActualAmountOfTheStripping(qualityIdThatUnderProcess);

                finalAmountAfterTheGivingOut = Convert.ToString(amountBeforeTheChange + amountAbout);
            }
            catch (ErrorServiceGetTheAmount e)
            {
                throw new ErrorServiceRequests(e.Message);
            }
            catch (Exception e)
            {
                throw new ErrorServiceRequests("Ismeretlen hiba történt (ServRequ_getBackGivenOut) " + e.Message);
            }
            try
            {
                modelRequestWrite.undeleteRequestTableGetBackARecord(userIdOfOperator, requId.ToString(),
                                                                     qualityIdThatUnderProcess, userIdOfRequester.ToString(), finalAmountAfterTheGivingOut);
            }
            catch (ErrorServiceRenewRecord e)
            {
                throw new ErrorServiceRequests(e.Message);
            }
            catch (ErrorServiceUpdateRecord e)
            {
                throw new ErrorServiceRequests(e.Message);
            }
            catch (Exception e)
            {
                throw new ErrorServiceRequests("Ismeretlen hiba történt (ServRequ_getBackGivenOut) " + e.Message);
            }
        }