示例#1
0
        public static string GetTransaction(Guid TransactionTypeId)
        {
            string TransactionNo;

            bool isSaved = false;


            ECXWF.ECXEngine eng = new WarehouseApplication.ECXWF.ECXEngine();
            eng.OpenTransaction(TransactionTypeId, UserBLL.GetCurrentUser(),
                                new string[] { "" }, WarehouseBLL.GetWarehouseCode(UserBLL.GetCurrentWarehouse()), out TransactionNo);

            return(TransactionNo);
        }
示例#2
0
        public static string GetTransaction(Guid TransactionTypeId, SqlTransaction tran)
        {
            string TransactionNo;

            bool isSaved = false;


            ECXWF.ECXEngine eng = new WarehouseApplication.ECXWF.ECXEngine();
            eng.OpenTransaction(TransactionTypeId, UserBLL.GetCurrentUser(),
                                new string[] { "" }, WarehouseBLL.GetWarehouseCode(UserBLL.GetCurrentWarehouse()), out TransactionNo);
            isSaved = WarehouseTrackingNoBLL.Save(TransactionNo, tran);
            if (isSaved == false)
            {
                WFTransaction.Remove(TransactionNo);

                throw new Exception("Unable to get Transaction.WFTransaction.");
            }
            else
            {
                return(TransactionNo);
            }
        }
示例#3
0
        /// <summary>
        /// Gets the net weight by deducting the tare
        /// </summary>
        /// <param name="GrossWeight"></param>
        /// <param name="BagTypeId"></param>
        /// <param name="NoBags"></param>
        /// <returns></returns>
        ///
        public Nullable <Guid> Add(List <GRNServiceBLL> listGRNService)
        {
            bool IsSaved   = false;
            bool canCreate = false;;

            try
            {
                canCreate = this.CanCreateGRNforGradingId(this.GradingId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (canCreate == false)
            {
                return(null);
            }

            Nullable <Guid> id = null;
            SqlTransaction  tran;
            string          warehousecode;

            warehousecode = WarehouseBLL.GetWarehouseCode(this.WarehouseId);
            SqlConnection conn = new SqlConnection();

            conn = Connection.getConnection();
            tran = conn.BeginTransaction();
            try
            {
                id = GRNDAL.InsertNewGRN(this, warehousecode, tran);

                if (id != null)
                {
                    if (listGRNService != null)
                    {
                        GRNServiceBLL objSer = new GRNServiceBLL();
                        IsSaved = objSer.Save((Guid)id, listGRNService, tran);
                        //Audit Trail Both GRN And GRN Service.
                        int           at    = -1;
                        AuditTrailBLL objAt = new AuditTrailBLL();
                        this.Id = (Guid)id;
                        at      = objAt.saveAuditTrail(this, WFStepsName.AddGRN.ToString(), UserBLL.GetCurrentUser(), "Add New GRN");
                        if (at == 1)
                        {
                            IsSaved = true;
                        }
                        else
                        {
                            IsSaved = false;
                        }
                    }
                    else
                    {
                        IsSaved = true;
                    }

                    if (IsSaved == true)
                    {
                        WFTransaction.WorkFlowManager(this.TrackingNo);
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
                else
                {
                    tran.Rollback();
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception("Unable to update database.", ex);
            }
            finally
            {
                tran.Dispose();
                conn.Close();
            }
            return(id);
        }