Exemple #1
0
 /// <summary>
 /// A function that collects values of CDR, Driver and Voucher information and Save it using
 /// DataAccessPoint Class from DAL through Stored Procedure called "ExecuteProcedure"
 /// </summary>
 /// <param name="TransactionTypeId"></param>
 /// <param name="objDriver"></param>
 /// <param name="objVoucher"></param>
 /// <returns>
 /// Id with type Guid to form. Id is PK for CDR and FK for Driver and Voucher Information
 /// </returns>
 public Guid AddArrival(Guid TransactionTypeId, DriverInformationBLL objDriver, VoucherInformationBLL objVoucher)
 {
     try
     {
         this.Id = Guid.NewGuid();
         string TransactionNo = WFTransaction.GetTransaction(TransactionTypeId);
         this.TransactionId = TransactionNo;
         DataAccessPoint objDAL = new DataAccessPoint();
         objDAL.ExcuteProcedure("spInsertArrival", ParamList(this, objDriver, objVoucher));
         return(Id);
         //1st argument is the procedure name
         //2nd arguemnt is a method found in this class that returns all tables parameter list
         //SaveByText found at DAL and it executes the procedure
     }
     catch (Exception ex)
     {
         throw new Exception("Failed to save arrival information! " + ex.Message.ToString());
     }
 }
Exemple #2
0
        /// <summary>
        /// Collectes all existing values of selected information and assign to scalar variables
        /// And Update old values using DataAccessPoint class from DAL through stored Procedure
        /// called "ExecuteProcedure"
        /// </summary>
        /// <param name="objDriver"></param>
        /// <param name="objVoucher"></param>
        public void UpdateArrival(DriverInformationBLL objDriver, VoucherInformationBLL objVoucher)
        {
            SqlParameter[] paramList = new SqlParameter[23];
            //COMMODITY DEPOSIT REQUEST PARAMETERS
            paramList[0] = this.param("@CommodityDepositRequestId", SqlDbType.UniqueIdentifier, this.Id);
            paramList[1] = this.param("@ClientId", SqlDbType.UniqueIdentifier, this.ClientId);
            paramList[2] = this.param("@CommodityId", SqlDbType.UniqueIdentifier, this.CommodityId);
            paramList[3] = this.param("@WoredaId", SqlDbType.UniqueIdentifier, this.WoredaId);
            paramList[4] = this.param("@ProductionYear", SqlDbType.Int, this.ProductionYear);
            paramList[5] = this.param("@Weight", SqlDbType.Float, this.Weight);
            paramList[6] = this.param("@DateTimeRecived", SqlDbType.DateTime, this.DateTimeRecived);
            paramList[7] = this.param("@StatusC", SqlDbType.Int, this.Status);
            paramList[8] = this.param("@RemarkC", SqlDbType.Text, this.Remark);
            paramList[9] = this.param("@LastModifiedBy", SqlDbType.UniqueIdentifier, this.LastModifiedBy);
            //DRIVER INFORMATION PARAMETERS
            paramList[10] = this.param("@DriverName", SqlDbType.NVarChar, objDriver.DriverName, 50);
            paramList[11] = this.param("@LicenseNumber", SqlDbType.NVarChar, objDriver.LicenseNumber, 50);
            paramList[12] = this.param("@PlateNumber", SqlDbType.NVarChar, objDriver.PlateNumber, 50);
            paramList[13] = this.param("@LicenseIssuedPlace", SqlDbType.NVarChar, objDriver.LicenseIssuedPlace, 50);
            paramList[14] = this.param("@TrailerPlateNumber", SqlDbType.NVarChar, objDriver.TrailerPlateNumber, 50);
            paramList[15] = this.param("@RemarkD", SqlDbType.Text, objDriver.Remark);
            paramList[16] = this.param("@StatusD", SqlDbType.Int, objDriver.Status);//????????????????
            //VOUCHER INFORMATION PARAMETERS
            paramList[17] = this.param("@VoucherNo", SqlDbType.NVarChar, objVoucher.VoucherNo, 50);
            paramList[18] = this.param("@CoffeeTypeId", SqlDbType.UniqueIdentifier, objVoucher.CoffeeTypeId);
            paramList[19] = this.param("@SpecificArea", SqlDbType.NVarChar, objVoucher.SpecificArea);
            paramList[20] = this.param("@NumberOfBags", SqlDbType.Int, objVoucher.NumberofBags);
            paramList[21] = this.param("@NumberOfPlomps", SqlDbType.Int, objVoucher.NumberOfPlomps);
            paramList[22] = this.param("@NumberOfPlompsTrailer", SqlDbType.Int, objVoucher.NumberOfPlompsTrailer);
            DataAccessPoint dal = new DataAccessPoint();

            try
            {
                dal.ExcuteProcedure("spUpdateArrival", paramList);
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to update arrival! " + ex.Message.ToString());
            }
        }
Exemple #3
0
 public RedisController()
 {
     _dataAccessPoint = new DataAccessPoint();
 }
 public CommonController()
 {
     elasticSearch    = new ElasticSearchRepository(new Uri("http://localhost:9200/"));
     _dataAccessPoint = new DataAccessPoint();
 }
Exemple #5
0
        public bool AddNew()
        {
            DriverInformationBLL objDriverInfo = new DriverInformationBLL();

            objDriverInfo = objDriverInfo.GetById(this.DriverInformationId);
            TruckWeight objTruckWeight = null;

            if (objDriverInfo == null)
            {
                throw new Exception("Unbale To get Driver Information");
            }

            else
            {
                objTruckWeight                = new TruckWeight();
                objTruckWeight.Id             = Guid.NewGuid();
                objTruckWeight.TruckPlateNo   = objDriverInfo.PlateNumber;
                objTruckWeight.TrailerPlateNo = objDriverInfo.TrailerPlateNumber;
                if ((string.IsNullOrEmpty(objDriverInfo.PlateNumber) == true) && (string.IsNullOrEmpty(objDriverInfo.TrailerPlateNumber) == true))
                {
                    this.TruckWeightId = null;
                }
                else
                {
                    objTruckWeight.DateWeighed = this.DateWeighed;
                    objTruckWeight.Weight      = this.TruckWeight;
                    this.TruckWeightId         = objTruckWeight.Id;
                }
            }

            bool isSaved = false;

            DateTime currDate    = DateTime.Today;
            Guid     WarehouseId = UserBLL.GetCurrentWarehouse();

            string Code             = currDate.Day.ToString() + currDate.Year.ToString().Substring(2, 2);
            int?   QueueNo          = null;
            int?   PreWeightQueueNo = null;

            try
            {
                ScalingDAL.GetQueueNumber(Code, WarehouseId, currDate, out QueueNo, out PreWeightQueueNo);
                if (QueueNo == null || PreWeightQueueNo == null)
                {
                    throw new Exception("Invalid Queue.");
                }
                this.Id               = Guid.NewGuid();
                this.QueueDate        = currDate;
                this.QueueNo          = (int)QueueNo;
                this.PreWeightQueueNo = (int)PreWeightQueueNo;
                this.WarehouseId      = WarehouseId;

                SqlParameter[] paramList = new SqlParameter[18];
                string         spName    = "spInsertScaling";
                paramList[0]  = DataAccessPoint.param("@ReceivigRequestId", SqlDbType.UniqueIdentifier, this.ReceivigRequestId);
                paramList[1]  = DataAccessPoint.param("@DriverInformationId", SqlDbType.UniqueIdentifier, this.DriverInformationId);
                paramList[2]  = DataAccessPoint.param("@GradingResultId", SqlDbType.UniqueIdentifier, this.GradingResultId);
                paramList[3]  = DataAccessPoint.param("@ScaleTicketNumber", SqlDbType.NChar, this.ScaleTicketNumber, 50);
                paramList[4]  = DataAccessPoint.param("@DateWeighed", SqlDbType.DateTime, this.DateWeighed);
                paramList[5]  = DataAccessPoint.param("@GrossWeightWithTruck", SqlDbType.Float, this.GrossWeightWithTruck);
                paramList[6]  = DataAccessPoint.param("@TruckWeight", SqlDbType.Float, this.TruckWeight);
                paramList[7]  = DataAccessPoint.param("@GrossWeight", SqlDbType.Float, this.GrossWeight);
                paramList[8]  = DataAccessPoint.param("@Status", SqlDbType.Int, this.Status);
                paramList[9]  = DataAccessPoint.param("@Remark", SqlDbType.Text, this.Remark);
                paramList[10] = DataAccessPoint.param("@CreatedBy", SqlDbType.UniqueIdentifier, UserBLL.GetCurrentUser());
                paramList[11] = DataAccessPoint.param("@WarehouseId", SqlDbType.UniqueIdentifier, this.WarehouseId);
                paramList[12] = DataAccessPoint.param("@PreWeightQueueNo", SqlDbType.Int, this.PreWeightQueueNo);
                paramList[13] = DataAccessPoint.param("@QueueNo", SqlDbType.Int, this.QueueNo);
                paramList[14] = DataAccessPoint.param("@QueueDate", SqlDbType.DateTime, this.QueueDate);
                paramList[15] = DataAccessPoint.param("@WeigherId", SqlDbType.UniqueIdentifier, this.WeigherId);
                paramList[16] = DataAccessPoint.param("@Id", SqlDbType.UniqueIdentifier, this.Id);
                paramList[17] = DataAccessPoint.param("@TruckWeightId", SqlDbType.UniqueIdentifier, this.TruckWeightId);
                DataAccessPoint dal = new DataAccessPoint();

                if (dal.ExcuteProcedure(spName, paramList))
                {
                    isSaved = true;
                }

                //THE FOLLOWING METHOD [SaveNew()] ADDED BY SINISHAW
                if (isSaved == true && this.TruckWeightId != null && objTruckWeight != null && objTruckWeight.SaveNew() != true)
                {
                    isSaved = false;
                }

                int at = -1;
                if (isSaved == true)
                {
                    AuditTrailBLL objAt = new AuditTrailBLL();
                    at = objAt.saveAuditTrail(this, WFStepsName.AddScalingInfo.ToString(), UserBLL.GetCurrentUser(), "Add Scaling");
                }
                if (at == 1 && isSaved == true)
                {
                    WFTransaction.WorkFlowManager(this.TrackingNo);
                }
                else
                {
                    isSaved = false;
                }

                if (isSaved == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }