Beispiel #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);
        }
Beispiel #2
0
        private List <StackBLL> MergeWithCommodityGrade(List <StackBLL> list)
        {
            List <StackBLL>          mergedListComplete = new List <StackBLL>();
            List <CommodityGradeBLL> CommodityGradeList = new List <CommodityGradeBLL>();

            CommodityGradeList = CommodityGradeBLL.GetAllCommodityDetail();
            List <ShedBLL> listShed = new List <ShedBLL>();

            listShed = ShedBLL.GetAllShed();
            List <WarehouseBLL> listWarehouse = new List <WarehouseBLL>();

            listWarehouse = WarehouseBLL.GetAllActiveWarehouse();
            if (CommodityGradeList == null)
            {
                throw new Exception("Can not get Commodity Grade list.");
            }
            if (listShed == null)
            {
                throw new Exception("Can not get Shed list.");
            }
            if (listWarehouse == null)
            {
                throw new Exception("Can not get Warehouse list.");
            }

            var q = from stack in list
                    join CommGrade in CommodityGradeList on stack.CommodityGradeid equals CommGrade.CommodityGradeId
                    join Shed in listShed on stack.ShedId equals Shed.Id
                    join warehouse in listWarehouse on Shed.WarehouseId equals warehouse.WarehouseId
                    select new { stack.Id, stack.ShedId, stack.StackNumber, stack.Status, stack.DateStarted, stack.CommodityGradeid, Shed.ShedNumber, warehouse.WarehouseName, CommGrade.GradeName };

            foreach (var i in q)
            {
                StackBLL obj = new StackBLL();
                obj.Id                 = i.Id;
                obj.ShedId             = i.ShedId;
                obj.ShedName           = i.ShedNumber;
                obj.CommodityGradeName = i.GradeName;
                obj.StackNumber        = i.StackNumber;
                obj.Status             = i.Status;
                obj.DateStarted        = DateTime.Parse(i.DateStarted.ToShortDateString());
                obj.WarehouseName      = i.WarehouseName;
                mergedListComplete.Add(obj);
            }

            return(mergedListComplete);
        }
Beispiel #3
0
        public List <GRNSentBLL> getCount(DateTime dataSent, out int totalCount)
        {
            totalCount = 0;
            List <GRNSentBLL>   list   = null;
            List <WarehouseBLL> listWH = null;

            listWH = WarehouseBLL.GetAllActiveWarehouse();
            // intailize for all WH.
            list = new List <GRNSentBLL>();
            foreach (WarehouseBLL w in listWH)
            {
                GRNSentBLL oSentGRN = new GRNSentBLL();
                oSentGRN.warehouseId   = w.WarehouseId;
                oSentGRN.warehousename = w.WarehouseName;
                oSentGRN.count         = 0;
                oSentGRN.dataSent      = dataSent;
                list.Add(oSentGRN);
            }

            List <GRNSentBLL> listTemp = null;

            listTemp = GRNSentDAL.getCountApprovedGRNSentbyDate(dataSent);
            if (listTemp != null)
            {
                foreach (GRNSentBLL w in list)
                {
                    foreach (GRNSentBLL s in listTemp)
                    {
                        if (s.warehouseId == w.warehouseId)
                        {
                            totalCount += s.count;
                            w.count     = s.count;
                        }
                    }
                }
            }

            return(list);
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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);
        }