コード例 #1
0
        public Prq_BillPayment SetToModelObject(PrqBillPayment model)
        {
            Prq_BillPayment Entity = new Prq_BillPayment();

            Entity.PaymentDate       = DalCommon.SetDate(model.PaymentDate);// Convert.ToDateTime(Convert.ToDateTime(model.PaymentDate).ToString("dd/MM/yyyy"));
            Entity.SupplierID        = model.SupplierID;
            Entity.SupplierAddressID = model.SupplierAddressID;
            Entity.PaymentType       = model.PaymentType;
            Entity.PaymentMethod     = model.PaymentMethod;
            Entity.Currency          = model.Currency;
            Entity.PaymentDoc        = model.PaymentDoc;
            Entity.BillAmount        = model.BillAmount;
            Entity.VatPercentage     = model.VatPercentage;
            Entity.VatAmount         = model.VatAmount;
            Entity.DeductAmount      = model.DeductAmount;
            Entity.PaymentAmount     = model.PaymentAmount;
            Entity.Remarks           = model.Remarks;
            Entity.RecordStatus      = "NCF";
            Entity.PurchaseYear      = model.PurchaseYear;
            Entity.PaymentStatus     = true;
            Entity.SetOn             = DateTime.Now;
            Entity.SetBy             = model.SetBy;
            Entity.IPAddress         = string.Empty;

            return(Entity);
        }
コード例 #2
0
        private LCM_PackingList ModelConversionPackingList(PackingListVM model, int userId, string url)
        {
            var entity = model.Plid == 0 ? new LCM_PackingList() : (from b in _context.LCM_PackingList.AsEnumerable()
                                                                    where b.PLID == model.Plid
                                                                    select b).FirstOrDefault();

            entity.PLID            = model.Plid;
            entity.PLNo            = model.Plid == 0 ? DalCommon.GetPreDefineNextCodeByUrl(url) : model.PlNo;
            entity.PLDate          = DalCommon.SetDate(model.PlDate);
            entity.LCID            = model.Lcid;
            entity.LCNo            = model.LcNo;
            entity.CIID            = model.Ciid;
            entity.CINo            = model.CiNo;
            entity.PLNetWeight     = model.NetWeight;
            entity.NetWeightUnit   = model.NetWeightUnit;
            entity.PLGrossWeight   = model.GrossWeight;
            entity.GrossWeightUnit = model.GrossWeightUnit;
            entity.PLNote          = model.PlNote;
            entity.RecordStatus    = model.Plid == 0 ? "NCF" : model.RecordStatus;
            entity.SetOn           = model.Plid == 0 ? DateTime.Now : _unit.PackingListRepository.GetByID(model.Plid).SetOn;
            entity.SetBy           = model.Plid == 0 ? userId : _unit.PackingListRepository.GetByID(model.Plid).SetBy;
            entity.ModifiedBy      = model.Plid == 0 ? (int?)null : userId;
            entity.ModifiedOn      = model.Plid == 0 ? (DateTime?)null : DateTime.Now;

            return(entity);
        }
コード例 #3
0
        public EXP_BankLoan SetToBankLoanEntityObject(EXPBankLoan model, int _userid)//int _userid
        {
            EXP_BankLoan entity = new EXP_BankLoan();

            entity.BankLoanID = model.BankLoanID;
            entity.BankLoanNo = model.BankLoanNo;
            //entity.BankID = model.BankID;
            //entity.BranchID = model.BranchID;
            entity.LoanHead  = model.LoanHead;
            entity.RefACNo   = model.RefACNo;
            entity.RefACName = model.RefACName;
            var GridloanRecieveDate = model.LoanReceiveDate.Contains("/") ? model.LoanReceiveDate : Convert.ToDateTime(model.LoanReceiveDate).ToString("dd/MM/yyyy");

            entity.LoanReceiveDate = DalCommon.SetDate(GridloanRecieveDate);
            entity.LoanAmt         = model.LoanAmt;
            entity.InterestPercent = model.InterestPercent;
            entity.LoanLimit       = model.LoanLimit;
            entity.ReturnedAmt     = model.ReturnedAmt;
            entity.BalanceAmt      = model.BalanceAmt;
            entity.CIID            = model.CIID;
            entity.Remarks         = model.Remarks;
            entity.RecordStatus    = "NCF";
            entity.RunningStatus   = "CLS";
            entity.SetOn           = DateTime.Now;
            entity.SetBy           = _userid;
            entity.IPAddress       = GetIPAddress.LocalIPAddress();

            return(entity);
        }
コード例 #4
0
        public EXP_BankDebitVoucher SetToModelObject(EXPBankDebitVoucher model, int userid)
        {
            EXP_BankDebitVoucher Entity = new EXP_BankDebitVoucher();

            Entity.BankID = model.BankID;
            //Entity.LCNo = model.LCNo.ToString();
            //Entity.LCID = model.LCID;
            Entity.BranchID = model.BranchID;
            //Entity.LCID = model.LCID;
            Entity.BDVNo             = model.BDVNo;
            Entity.BDVDate           = DalCommon.SetDate(model.BDVDate);
            Entity.ExchangeCurrency  = model.ExchangeCurrency;
            Entity.ExchangeRate      = model.ExchangeRate;
            Entity.ExchangeAmount    = model.ExchangeAmount;
            Entity.LCMargin          = model.LCMargin;
            Entity.Remarks           = model.Remarks;
            Entity.CommissionAmt     = model.CommissionAmt;
            Entity.PostageAmt        = model.PostageAmt;
            Entity.SwiftCharge       = model.SwiftCharge;
            Entity.SourceTaxAmt      = model.SourceTaxAmt;
            Entity.VatAmt            = model.VatAmt;
            Entity.StationaryExpense = model.StationaryExpense;
            Entity.OtherCost         = model.OtherCost;
            Entity.TotalAmount       = model.TotalAmount;
            Entity.RecordStatus      = "NCF";
            Entity.SetOn             = DateTime.Now;
            Entity.SetBy             = userid;
            Entity.IPAddress         = GetIPAddress.LocalIPAddress();

            return(Entity);
        }
コード例 #5
0
        public EXP_PackingList SetToModelObject(EXPPackingList model, int userid)
        {
            EXP_PackingList Entity = new EXP_PackingList();

            Entity.PLID            = model.PLID;
            Entity.PLNo            = model.PLNo;
            Entity.CIID            = model.CIID;
            Entity.PLDate          = DalCommon.SetDate(model.PLDate);
            Entity.BalesNo         = model.BalesNo;
            Entity.BaleQty         = model.BaleQty;
            Entity.TotalPcs        = model.TotalPcs;
            Entity.TotalSide       = model.TotalSide;
            Entity.MeterCIQty      = model.MeterCIQty;
            Entity.FootCIQty       = model.FootCIQty;
            Entity.PLNetWeight     = model.PLNetWeight;
            Entity.NetWeightUnit   = model.NetWeightUnit;
            Entity.PLGrossWeight   = model.PLGrossWeight;
            Entity.GrossWeightUnit = model.GrossWeightUnit;
            Entity.PLMarks         = model.PLMarks;
            Entity.PLNote          = model.PLNote;
            Entity.RecordStatus    = "NCF";
            Entity.SetOn           = DateTime.Now;
            Entity.SetBy           = userid;
            Entity.IPAddress       = GetIPAddress.LocalIPAddress();

            return(Entity);
        }
コード例 #6
0
 public ValidationMsg SaveAck(SlsBuyerOrder model, int userId)
 {
     try
     {
         var entity = _unit.SlsBuyerOrederRepository.GetByID(model.BuyerOrderID);
         entity.AcknowledgementStatus = model.AcknowledgementStatus;
         entity.AckDate = model.AckDate == null ? (DateTime?)null : DalCommon.SetDate(model.AckDate);
         entity.ProposedShipmentDate  = model.ProposedShipmentDate == null ? (DateTime?)null : DalCommon.SetDate(model.ProposedShipmentDate);
         entity.DeliveryLastDate      = model.DeliveryLastDate == null ? (DateTime?)null : DalCommon.SetDate(model.DeliveryLastDate);
         entity.ExpectedProdStartDate = model.ExpectedProdStartDate == null ? (DateTime?)null : DalCommon.SetDate(model.ExpectedProdStartDate);
         entity.AcknowledgeNote       = model.AcknowledgeNote;
         entity.ModifiedBy            = userId;
         entity.ModifiedOn            = DateTime.Now;
         _unit.SlsBuyerOrederRepository.Update(entity);
         _save = _unit.IsSaved();
         if (_save)
         {
             _validationMsg.ReturnId = entity.BuyerOrderID;
             _validationMsg.Type     = Enums.MessageType.Success;
             _validationMsg.Msg      = "Saved successfully.";
         }
     }
     catch
     {
         _validationMsg.Type = Enums.MessageType.Error;
         _validationMsg.Msg  = "Failed to save.";
     }
     return(_validationMsg);
 }
コード例 #7
0
        public EXP_AgentCommission SetToModelObject(EXPAgentCommission model, int userid)
        {
            EXP_AgentCommission Entity = new EXP_AgentCommission();

            Entity.AgentComID   = model.AgentComID;
            Entity.AgentComNo   = model.AgentComNo;
            Entity.AgentComDate = DalCommon.SetDate(model.AgentComDate);
            Entity.AgentComRef  = model.AgentComRef;

            Entity.BuyerID = Convert.ToInt32(model.BuyerID);
            Entity.CIID    = model.CIID;

            Entity.CIAmount    = model.CIAmount;
            Entity.ComOnAmount = model.ComOnAmount;
            Entity.CIDate      = DalCommon.SetDate(model.CIDate);

            Entity.InvoiceCurrency = model.InvoiceCurrency;
            //Entity.LocalCurrency = model.LocalCurrency;
            Entity.LocalCurrency = _context.Sys_Currency.Where(m => m.CurrencyName == "TK").FirstOrDefault().CurrencyID;

            Entity.RecordStatus = "NCF";
            Entity.SetOn        = DateTime.Now;
            Entity.SetBy        = userid;
            Entity.IPAddress    = GetIPAddress.LocalIPAddress();

            return(Entity);
        }
コード例 #8
0
        private LCM_BillofLading BillOfLadingModelConverter(LcmBillOfLadingVM model, int userId, string url)
        {
            var entity = model.Blid == 0 ? new LCM_BillofLading() : (from b in _context.LCM_BillofLading.AsEnumerable()
                                                                     where b.BLID == model.Blid select b).FirstOrDefault();

            entity.BLID                = model.Blid;
            entity.BLNo                = model.BlNo;
            entity.BLDate              = DalCommon.SetDate(model.BlDate);
            entity.CIID                = model.CIID;
            entity.CINo                = model.CINo;
            entity.LCID                = model.Lcid;
            entity.LCNo                = model.LcNo;
            entity.ShippedOnBoardDate  = DalCommon.SetDate(model.ShippedOnBoardDate);
            entity.ExpectedArrivalTime = DalCommon.SetDate(model.ExpectedArrivalTime);
            entity.Shipper             = model.Shipper;
            entity.ShipmentMode        = model.ShipmentMode;
            entity.VesselName          = model.VesselName;
            entity.VoyageNo            = model.VoyageNo;
            entity.TransShipmentPort   = model.TransShipmentPort;
            entity.ShipmentPort        = model.ShipmentPort;
            entity.BLNote              = model.BlNote;
            if (model.Blid == 0)
            {
                entity.RecordStatus = "NCF";
                entity.SetBy        = userId;
                entity.SetOn        = DateTime.Now;
            }
            else
            {
                entity.ModifiedBy = userId;
                entity.ModifiedOn = DateTime.Now;
            }
            return(entity);
        }
コード例 #9
0
        private EXP_TransportChallan ConvertTransportChallan(ExpTransportChallan model, int userId)
        {
            var entity = model.TransportChallanID == 0
                ? new EXP_TransportChallan()
                : (from b in _context.EXP_TransportChallan.AsEnumerable()
                   where b.TransportChallanID == model.TransportChallanID
                   select b).FirstOrDefault();

            entity.TransportChallanID   = model.TransportChallanID;
            entity.TransportChallanNo   = model.TransportChallanNo;
            entity.TransportChallanDate = DalCommon.SetDate(model.TransportChallanDate);
            entity.TransportChallanRef  = model.TransportChallanRef;
            entity.TransportChallanNote = model.TransportChallanNote;
            entity.DeliverChallanID     = model.DeliverChallanID;
            entity.Sender         = model.Sender;
            entity.SenderAddress  = model.SenderAddress;
            entity.Receiver       = model.Receiver;
            entity.ReceverAddress = model.ReceverAddress;
            entity.DeliveryFrom   = model.DeliveryFrom;
            entity.DEliveryTo     = model.DEliveryTo;
            entity.RecordStatus   = model.RecordStatus ?? "NCF";
            entity.SetBy          = model.TransportChallanID == 0
                ? userId
                : _context.EXP_TransportChallan.FirstOrDefault(ob => ob.TransportChallanID == model.TransportChallanID).SetBy;
            entity.SetOn = model.TransportChallanID == 0
                ? DateTime.Now
                : _context.EXP_TransportChallan.FirstOrDefault(ob => ob.TransportChallanID == model.TransportChallanID).SetOn;
            entity.ModifiedBy = model.TransportChallanID == 0 ? (int?)null : userId;
            entity.ModifiedOn = model.TransportChallanID == 0 ? (DateTime?)null : DateTime.Now;
            return(entity);
        }
コード例 #10
0
        public LCM_CommercialInvoice ModelConversionToLcmCommercialInvoice(CommercialInvoiceVM model, int userId, string url)
        {
            var entity = model.CIID == 0
                ? new LCM_CommercialInvoice()
                : (from b in _context.LCM_CommercialInvoice.AsEnumerable()
                   where b.CIID == model.CIID
                   select b).FirstOrDefault();

            entity.CIID             = model.CIID;
            entity.CINo             = model.CINo;
            entity.CIDate           = DalCommon.SetDate(model.CIDate);
            entity.CICurrency       = model.CICurrency;
            entity.LCID             = model.LCID;
            entity.LCNo             = model.LCNo;
            entity.CIStatus         = model.CIStatus;
            entity.ExchangeCurrency = model.ExchangeCurrency;
            entity.ExchangeRate     = model.ExchangeRate;
            entity.ExchangeValue    = model.ExchangeValue;
            entity.CINote           = model.CINote;
            entity.RecordStatus     = model.CIID == 0 ? "NCF" : _unit.CommercialInvoiceRepository.GetByID(model.CIID).RecordStatus;
            entity.SetBy            = model.CIID == 0 ? userId : _unit.CommercialInvoiceRepository.GetByID(model.CIID).SetBy;
            entity.SetOn            = model.CIID == 0 ? DateTime.Now : _unit.CommercialInvoiceRepository.GetByID(model.CIID).SetOn;
            entity.ModifiedBy       = model.CIID == 0 ? (int?)null : userId;
            entity.ModifiedOn       = model.CIID == 0 ? (DateTime?)null : DateTime.Now;
            return(entity);
        }
コード例 #11
0
        public List <Prq_Purchase> GetPurchaseListID(int supplier, string dateFrom, string dateTo)
        {
            DateTime fromdate = DalCommon.SetDate(dateFrom);
            DateTime toDate   = DalCommon.SetDate(dateTo);
            List <Prq_PreGradeSelection> result = (from temp in _context.Prq_PreGradeSelection
                                                   where temp.SupplierID == supplier && temp.RecordStatus == "CNF" && temp.SelectionDate >= fromdate && temp.SelectionDate <= toDate
                                                   select temp).ToList();
            var lstPurchase = (from temp in result
                               join temp2 in _context.Prq_Purchase on temp.PurchaseID equals temp2.PurchaseID
                               select new {
                PurchaseID = temp2.PurchaseID,
                PurchaseNo = temp2.PurchaseNo,
                PurchaseDate = temp2.PurchaseDate
            }).AsEnumerable();

            List <Prq_Purchase> lstPo = new List <Prq_Purchase>();

            foreach (var item in lstPurchase)
            {
                Prq_Purchase ob = new Prq_Purchase();
                ob.PurchaseID   = item.PurchaseID;
                ob.PurchaseNo   = item.PurchaseNo;
                ob.PurchaseDate = item.PurchaseDate;
                lstPo.Add(ob);
            }
            return(lstPo);
        }
コード例 #12
0
        public long AddNewRequisitionDate(string _ScheduleID, string _RequiredDate)
        {
            try
            {
                using (_context)
                {
                    PRD_YearMonthFinishReqDate obj = new PRD_YearMonthFinishReqDate();

                    obj.ScheduleID   = Convert.ToInt64(_ScheduleID);
                    obj.RequiredDate = DalCommon.SetDate(_RequiredDate);
                    //Random r = new Random();
                    //obj.RequisitionNo = r.Next().ToString();
                    obj.RequisitionNo = DalCommon.GetPreDefineNextCodeByUrl("WBRequisitionForCrusting/WBRequisitionForCrusting");
                    obj.RecordStatus  = "NCF";


                    _context.PRD_YearMonthFinishReqDate.Add(obj);
                    _context.SaveChanges();

                    return(obj.RequisitionDateID);
                }
            }
            catch
            {
                return(0);
            }
        }
コード例 #13
0
        private SLS_BuyerOrderDelivery ConvertOrderDelivery(SlsBuyerOrderDelivery model, int userId, long buyerOrderId)
        {
            var entity = model.BuyerOrderDeliveryID == 0
                ? new SLS_BuyerOrderDelivery()
                : (from b in _context.SLS_BuyerOrderDelivery.AsEnumerable()
                   where b.BuyerOrderDeliveryID == model.BuyerOrderDeliveryID
                   select b).FirstOrDefault();

            entity.BuyerOrderDeliveryID = model.BuyerOrderDeliveryID;
            entity.BuyerOrderID         = buyerOrderId;
            entity.OrdDeliverySL        = model.OrdDeliverySL;
            entity.OrdDeliveryDate      = model.OrdDeliveryDate.Contains("/")
                ? DalCommon.SetDate(model.OrdDeliveryDate.Trim())
                : DalCommon.SetDate(Convert.ToDateTime(model.OrdDeliveryDate).ToString("dd/MM/yyyy"));
            entity.ArticleID       = model.ArticleID;
            entity.ColorID         = model.ColorID;
            entity.OrdDateFootQty  = model.OrdDateFootQty;
            entity.OrdDateMeterQty = model.OrdDateMeterQty;
            entity.SetOn           = model.BuyerOrderDeliveryID == 0
                ? DateTime.Now
                : _unit.SlsBuyerOrderDeliveryRepository.GetByID(model.BuyerOrderDeliveryID).SetOn;
            entity.SetBy = model.BuyerOrderDeliveryID == 0
                ? userId
                : _unit.SlsBuyerOrderDeliveryRepository.GetByID(model.BuyerOrderDeliveryID).SetBy;
            entity.ModifiedOn = model.BuyerOrderDeliveryID == 0 ? (DateTime?)null : DateTime.Now;
            entity.ModifiedBy = model.BuyerOrderDeliveryID == 0 ? (int?)null : userId;
            entity.IsActive   = true;
            return(entity);
        }
コード例 #14
0
        public List <Prq_PreGradeSelection> GetSelectionListID(int store, int supplier, string dateFrom, string dateTo)
        {
            DateTime fromdate = DalCommon.SetDate(dateFrom);
            DateTime toDate   = DalCommon.SetDate(dateTo);
            List <Prq_PreGradeSelection> result = (from temp in _context.Prq_PreGradeSelection
                                                   where temp.SelectionStore == store && temp.SupplierID == supplier && temp.RecordStatus == "CNF" && temp.SelectionDate >= fromdate && temp.SelectionDate <= toDate
                                                   select temp).OrderByDescending(o => o.SelectionID).ToList();

            return(result.ToList());
        }
コード例 #15
0
        private EXP_ExportForm ConvertModel(ExpExportForm model, int userId, string url)
        {
            var entity = model.ExportFormID == 0 ? new EXP_ExportForm() : (from b in _context.EXP_ExportForm.AsEnumerable()
                                                                           where b.ExportFormID == model.ExportFormID
                                                                           select b).FirstOrDefault();

            entity.DealerID           = model.DealerID;
            entity.ExportFormID       = model.ExportFormID;
            entity.ExportFormNo       = model.ExportFormNo;
            entity.ExportFormDate4    = DalCommon.SetDate(model.ExportFormDate4);
            entity.ExportFormRef      = model.ExportFormRef;
            entity.ExportFormRef1     = model.ExportFormRef1;
            entity.ExportFormRef2     = model.ExportFormRef2;
            entity.ExportFormRef3     = model.ExportFormRef3;
            entity.CIID               = model.CIID;
            entity.PLID               = model.PLID;
            entity.Comodity           = model.Comodity;
            entity.ComodityCode       = model.ComodityCode;
            entity.DestinationCountry = model.DestinationCountry;
            entity.CountryCode        = model.CountryCode;
            entity.DestinationPort    = model.DestinationPort;
            entity.PortCode           = model.PortCode;
            entity.PackQTy            = model.PackQTy;
            entity.PackUnit           = model.PackUnit;
            entity.PackUnitCode       = model.PackUnitCode;
            entity.VolumeQty          = model.VolumeQty;
            entity.VolumeUnit         = model.VolumeUnit;
            entity.DeclaredCurrency   = model.DeclaredCurrency;
            entity.InvoiceValue       = model.InvoiceValue;
            entity.InvoiceCurrency    = model.InvoiceCurrency;
            entity.DeliveryTerm       = model.DeliveryTerm;
            entity.TermOfSaleNo       = model.TermOfSaleNo;
            entity.TermSaleDate       = DalCommon.SetDate(model.TermSaleDate);
            entity.Importer           = model.Importer;
            entity.CarryingVassal     = model.CarryingVassal;
            entity.ExportBillDtl      = model.ExportBillDtl;
            entity.PortOfShipment     = model.PortOfShipment;
            entity.LandCustomPort     = model.LandCustomPort;
            entity.ShipmentDate       = DalCommon.SetDate(model.ShipmentDate);
            entity.Exporter           = model.Exporter;
            entity.CCIESNo            = model.CCIESNo;
            entity.CCIESDate          = DalCommon.SetDate(model.CCIESDate);
            entity.Sector             = model.Sector;
            entity.SectorCode         = model.SectorCode;
            entity.SetOn              = model.ExportFormID == 0
                ? DateTime.Now
                : _unit.ExportFormRepository.GetByID(model.ExportFormID).SetOn;
            entity.SetBy = model.ExportFormID == 0
                ? userId
                : _unit.ExportFormRepository.GetByID(model.ExportFormID).SetBy;
            entity.ModifiedOn   = model.ExportFormID == 0 ? (DateTime?)null : DateTime.Now;
            entity.ModifiedBy   = model.ExportFormID == 0 ? (int?)null : userId;
            entity.RecordStatus = model.RecordStatus ?? "NCF";
            return(entity);
        }
コード例 #16
0
        public Prq_PurchaseYearPeriod SetToModelObject(PrqPurchaseYearPeriod model)
        {
            Prq_PurchaseYearPeriod Entity = new Prq_PurchaseYearPeriod();

            Entity.StartDate    = DalCommon.SetDate(model.StartDate); // Convert.ToDateTime(Convert.ToDateTime(model.StartDate).ToString("dd/MM/yyyy"));
            Entity.EndDate      = DalCommon.SetDate(model.EndDate);   // Convert.ToDateTime(Convert.ToDateTime(model.EndDate).ToString("dd/MM/yyyy"));
            Entity.YearID       = model.YearID;
            Entity.RecordStatus = "NCF";
            Entity.SetOn        = DateTime.Now;
            Entity.SetBy        = model.SetBy;

            return(Entity);
        }
コード例 #17
0
        public Prq_PurchaseYearTarget SetToModelObject(PrqPurchaseYearTarget model)
        {
            Prq_PurchaseYearTarget Entity = new Prq_PurchaseYearTarget();

            Entity.YearStartDate = DalCommon.SetDate(model.YearStartDate); // Convert.ToDateTime(Convert.ToDateTime(model.YearStartDate).ToString("dd/MM/yyyy"));
            Entity.YearEndDate   = DalCommon.SetDate(model.YearEndDate);   //Convert.ToDateTime(Convert.ToDateTime(model.YearEndDate).ToString("dd/MM/yyyy"));
            Entity.PurchaseYear  = model.PurchaseYear;
            Entity.SetOn         = DateTime.Now;
            Entity.SetBy         = model.SetBy;
            Entity.IPAddress     = string.Empty;

            return(Entity);
        }
コード例 #18
0
        public int SaveAdjustItemRequest(InvLeatherStockAdjustModel model, int userID)
        {
            var leatherTypeID   = DalCommon.GetLeatherTypeCode("Raw Hide");
            var leatherStatusID = DalCommon.GetLeatherStatusCode("Raw Hide");

            using (TransactionScope transaction = new TransactionScope())
            {
                #region Insert

                Inv_LeatherStockAdjustRequest objAdjustmentRequest = new Inv_LeatherStockAdjustRequest();

                objAdjustmentRequest.PurchaseYear = model.PurchaseYear;
                objAdjustmentRequest.RequestDate  = DalCommon.SetDate(model.RequestDate);
                objAdjustmentRequest.LeatherType  = model.LeatherType;
                objAdjustmentRequest.StoreID      = model.StoreID;
                objAdjustmentRequest.RecordStatus = "NCF";
                objAdjustmentRequest.SetBy        = userID;
                objAdjustmentRequest.SetOn        = DateTime.Now;

                _context.Inv_LeatherStockAdjustRequest.Add(objAdjustmentRequest);
                _context.SaveChanges();

                var currentRequestID = objAdjustmentRequest.RequestID;

                foreach (var item in model.StockAdjustItemList)
                {
                    Inv_LeatherStockAdjustItem objAdjustmentItems = new Inv_LeatherStockAdjustItem();

                    objAdjustmentItems.RequestID       = currentRequestID;
                    objAdjustmentItems.SupplierID      = item.SupplierID;
                    objAdjustmentItems.PurchaseID      = item.ChallanID;
                    objAdjustmentItems.ItemTypeID      = item.ItemTypeID;
                    objAdjustmentItems.LeatherType     = model.LeatherType;
                    objAdjustmentItems.LeatherStatus   = leatherStatusID;
                    objAdjustmentItems.ItemQty         = item.ItemQty;
                    objAdjustmentItems.Unit            = item.Unit;
                    objAdjustmentItems.Remarks         = item.Remarks;
                    objAdjustmentItems.AdjustmentCause = item.AdjustmentCause;



                    _context.Inv_LeatherStockAdjustItem.Add(objAdjustmentItems);
                    _context.SaveChanges();
                }

                transaction.Complete();
                return(currentRequestID);

                #endregion
            }
        }
コード例 #19
0
        public Inv_LeatherTransferRecieve SetToModelObject(InvLeatherTransferRecieve model)
        {
            Inv_LeatherTransferRecieve Entity = new Inv_LeatherTransferRecieve();

            Entity.ReceiveID       = model.ReceiveID;
            Entity.IssueID         = model.IssueID;
            Entity.ReceiveDate     = DalCommon.SetDate(model.ReceiveDate);
            Entity.ReceiveLocation = model.ReceiveLocation;
            Entity.PurchaseYear    = model.PurchaseYear;
            Entity.RecordStatus    = "NCF";
            Entity.SetOn           = DateTime.Now;
            Entity.SetBy           = model.SetBy;
            Entity.IPAddress       = string.Empty;

            return(Entity);
        }
コード例 #20
0
        public Inv_LeatherIssue SetToModelObject(InvLeatherIssue model)
        {
            Inv_LeatherIssue Entity = new Inv_LeatherIssue();

            Entity.IssueID      = model.IssueID;
            Entity.IssueDate    = DalCommon.SetDate(model.IssueDate);// Convert.ToDateTime(model.IssueDate).Date;
            Entity.IssueFor     = model.IssueFor;
            Entity.IssueRef     = model.IssueRef;
            Entity.IssueFrom    = model.IssueFrom;
            Entity.IssueTo      = model.IssueTo;
            Entity.JobOrderNo   = model.JobOrderNo;
            Entity.PurchaseYear = model.PurchaseYear;
            Entity.RecordStatus = "NCF";
            Entity.SetOn        = DateTime.Now;
            Entity.SetBy        = model.SetBy;
            Entity.IPAddress    = string.Empty;

            return(Entity);
        }
コード例 #21
0
        // ########################################### END OF SAVE,UPDATE,DELETE,CONFIRM #######################################################################


        //************************************************************ For Saving use Entity & Model Data Mapping **********************************
        public INV_FinishLeatherReceive SetToModelObject(InvFinishLeatherReceive model, int userid)
        {
            INV_FinishLeatherReceive Entity = new INV_FinishLeatherReceive();

            Entity.FNReceiveID     = model.FNReceiveID;
            Entity.FNReceiveNo     = model.FNReceiveNo;
            Entity.FNReceiveDate   = DalCommon.SetDate(model.FNReceiveDate);
            Entity.ReceiveCategory = "STTF";
            Entity.ReceiveFor      = model.ReceiveFor == null ? "" : model.ReceiveFor;
            Entity.IssueFrom       = model.IssueFrom == null ? 0 : model.IssueFrom;
            Entity.ReceiveAt       = model.ReceiveAt == null ? 0 : model.ReceiveAt;
            Entity.ReceiveNote     = model.ReceiveNote == null ? "" : model.ReceiveNote;
            Entity.CheckNote       = model.CheckNote == null ? "" : model.CheckNote;
            Entity.RecordStatus    = "NCF";
            Entity.SetOn           = DateTime.Now;
            //Entity.SetBy = userid;
            Entity.IPAddress = GetIPAddress.LocalIPAddress();

            return(Entity);
        }
コード例 #22
0
        public Prq_SupplierBill ConvertBill(PrqSupplierBill model, int userId)
        {
            var entity = model.SupplierBillID == 0
                ? new Prq_SupplierBill()
                : (from b in _context.Prq_SupplierBill.AsEnumerable()
                   where b.SupplierBillID == model.SupplierBillID
                   select b).FirstOrDefault();

            entity.SupplierBillID    = model.SupplierBillID;
            entity.SupplierBillNo    = model.SupplierBillID == 0 ? (Convert.ToInt64(_unit.SupplierBillRepository.Get().LastOrDefault().SupplierBillNo) + 1).ToString() : model.SupplierBillNo;//DalCommon.GetPreDefineNextCodeByUrl(model.SupplierBillNo);
            entity.SupplierBillRefNo = model.SupplierBillRefNo;
            entity.SupplierID        = model.SupplierID;
            entity.SupplierAddressID = model.SupplierAddressID;
            entity.PurchaseID        = model.PurchaseID;
            entity.BillCategory      = model.BillCategory;
            entity.BillType          = model.BillType;
            entity.BillDate          = DalCommon.SetDate(model.BillDate);
            entity.PurchaseYear      = model.PurchaseYear ?? "";
            entity.Remarks           = model.Remarks;
            entity.TotalQty          = model.TotalQty;
            entity.TotalRejectQty    = model.TotalRejectQty;
            entity.AvgPrice          = model.AvgPrice;
            entity.ApprovedPrice     = model.ApprovedPrice;
            entity.OtherCost         = model.OtherCost ?? 0;
            entity.DiscountAmt       = model.DiscountAmt ?? 0;
            entity.DiscountPercent   = model.DiscountPercent ?? 0;
            entity.ApprovedAmt       = model.ApprovedAmt ?? 0;
            entity.TotalAmt          = model.TotalAmt;
            entity.PayableAmt        = model.PayableAmt;
            entity.RecordStatus      = "NCF";
            entity.SetBy             = model.SupplierBillID == 0
                ? userId
                : _unit.SupplierBillRepository.GetByID(model.SupplierBillID).SetBy;
            entity.SetOn = model.SupplierBillID == 0
                ? DateTime.Now
                : _unit.SupplierBillRepository.GetByID(model.SupplierBillID).SetOn;
            entity.ModifiedBy = model.SupplierBillID == 0 ? (int?)null : userId;
            entity.ModifiedOn = model.SupplierBillID == 0 ? (DateTime?)null : DateTime.Now;
            entity.IsDelete   = false;
            return(entity);
        }
コード例 #23
0
        private EXP_BillofLading ConvertBol(ExpBillOfLading model, int userId)
        {
            var entity = model.BLID == 0
                ? new EXP_BillofLading()
                : (from b in _context.EXP_BillofLading.AsEnumerable()
                   where b.BLID == model.BLID
                   select b).FirstOrDefault();

            entity.BLID    = model.BLID;
            entity.BLNo    = model.BLNo ?? BillNoGenerate();
            entity.RefBLNo = model.RefBLNo;
            entity.BLDate  = model.BLDate == null ? DateTime.Now : DalCommon.SetDate(model.BLDate);
            entity.CIID    = model.CIID;
            //entity.PLID = model.PLID;
            entity.ShippedOnBoardDate = model.ShippedOnBoardDate == null
                ? DateTime.Now
                : DalCommon.SetDate(model.ShippedOnBoardDate);
            entity.ExpectedArrivalTime = model.ExpectedArrivalTime == null
                ? DateTime.Now
                : DalCommon.SetDate(model.ExpectedArrivalTime);
            entity.Shipper           = model.Shipper;
            entity.ShipmentMode      = model.ShipmentMode;
            entity.VesselName        = model.VesselName;
            entity.VoyageNo          = model.VoyageNo;
            entity.TransShipmentPort = model.TransShipmentPort;
            entity.ShipmentPort      = model.ShipmentPort;
            entity.RecordStatus      = model.BLID == 0
                ? "NCF"
                : _context.EXP_BillofLading.FirstOrDefault(ob => ob.BLID == model.BLID).RecordStatus;
            entity.SetBy = model.BLID == 0
                ? userId
                : _context.EXP_BillofLading.FirstOrDefault(ob => ob.BLID == model.BLID).SetBy;
            entity.SetOn = model.BLID == 0
                ? DateTime.Now
                : _context.EXP_BillofLading.FirstOrDefault(ob => ob.BLID == model.BLID).SetOn;
            entity.ModifiedBy = model.BLID == 0 ? (int?)null : userId;
            entity.ModifiedOn = model.BLID == 0 ? (DateTime?)null : DateTime.Now;
            return(entity);
        }
コード例 #24
0
        private PRQ_ChemLocalPurcBill BillConversion(PrqChemLocalPurcBill model, int userId, string url)
        {
            var entity = model.BillId == 0
                ? new PRQ_ChemLocalPurcBill()
                : (from b in _context.PRQ_ChemLocalPurcBill.AsEnumerable()
                   where b.BillID == model.BillId
                   select b).FirstOrDefault();

            entity.BillID            = model.BillId;
            entity.BillNo            = model.BillId == 0 ? DalCommon.GetPreDefineNextCodeByUrl(url) : model.BillNo;
            entity.BillDate          = DalCommon.SetDate(model.BillDate);
            entity.PurchaseYear      = model.PurchaseYear;
            entity.SupplierID        = model.SupplierId;
            entity.SupplierAddressID = model.SupplierAddressId;
            entity.SupplierBillNo    = model.SupplierBillNo;
            entity.SupBillDate       = DalCommon.SetDate(model.SupBillDate);
            entity.BillCategory      = "Real";
            entity.BillType          = "Supplier";
            entity.Currency          = model.Currency;
            entity.ExchangRate       = model.ExchangRate;
            entity.ExchangCurrency   = model.ExchangCurrency;
            entity.ExchangValue      = model.ExchangValue;
            entity.BillAmt           = model.BillAmt;
            entity.VatAmt            = model.VatAmt;
            entity.DiscountPercent   = model.DiscountPercent;
            entity.DiscountAmt       = model.DiscountAmt;
            entity.PayableAmt        = model.PayableAmt;
            entity.RecordStatus      = model.BillId == 0 ? "NCF" : model.RecordStatus;
            entity.SetBy             = model.BillId == 0
                ? userId
                : _unit.ChemicalLocalPurchaseBillRepository.GetByID(model.BillId).SetBy;
            entity.SetOn = model.BillId == 0
                ? DateTime.Now
                : _unit.ChemicalLocalPurchaseBillRepository.GetByID(model.BillId).SetOn;
            entity.ModifiedBy = model.BillId == 0 ? (int?)null : userId;
            entity.ModifiedOn = model.BillId == 0 ? (DateTime?)null : DateTime.Now;

            return(entity);
        }
コード例 #25
0
        private SLS_BuyerOrder ConvertOrder(SlsBuyerOrder model, int userId, string url)
        {
            var entity = model.BuyerOrderID == 0 ? new SLS_BuyerOrder() : (from b in _context.SLS_BuyerOrder.AsEnumerable()
                                                                           where b.BuyerOrderID == model.BuyerOrderID
                                                                           select b).FirstOrDefault();

            entity.BuyerOrderID         = model.BuyerOrderID;
            entity.BuyerOrderNo         = model.BuyerOrderNo ?? DalCommon.GetPreDefineNextCodeByUrl(url);
            entity.OrderNo              = model.OrderNo;
            entity.BuyerOrderDate       = model.BuyerOrderDate == null ? DateTime.Now : DalCommon.SetDate(model.BuyerOrderDate);
            entity.OrderFrom            = model.OrderFrom;
            entity.BuyerOrderCategory   = model.BuyerOrderCategory;
            entity.BuyerID              = model.BuyerID;
            entity.BuyerAddressID       = model.BuyerAddressID;
            entity.BuyerLocalAgentID    = model.BuyerLocalAgentID;
            entity.BuyerForeignAgentID  = model.BuyerForeignAgentID;
            entity.BuyerRef             = model.BuyerRef;
            entity.ExpectedShipmentDate = model.ExpectedShipmentDate == null ? DateTime.Now : DalCommon.SetDate(model.ExpectedShipmentDate);
            entity.RevisionNo           = model.RevisionNo;
            entity.RevisionDate         = DalCommon.SetDate(model.RevisionDate);
            entity.OrderCurrency        = model.OrderCurrency;
            entity.BuyerOrderStatus     = model.BuyerOrderStatus == null ? "OD" : DalCommon.ReverseOrderStatus(model.BuyerOrderStatus);
            entity.RecordStatus         = model.BuyerOrderID == 0
                ? "NCF"
                : _unit.SlsBuyerOrederRepository.GetByID(model.BuyerOrderID).RecordStatus;
            entity.SetOn = model.BuyerOrderID == 0
                ? DateTime.Now
                : _unit.SlsBuyerOrederRepository.GetByID(model.BuyerOrderID).SetOn;
            entity.SetBy = model.BuyerOrderID == 0
                ? userId
                : _unit.SlsBuyerOrederRepository.GetByID(model.BuyerOrderID).SetBy;
            entity.ModifiedBy    = model.BuyerOrderID == 0 ? (int?)null : userId;
            entity.ModifiedOn    = model.BuyerOrderID == 0 ? (DateTime?)null : DateTime.Now;
            entity.OrderCurrency = model.OrderCurrency;
            entity.TotalFootQty  = model.TotalFootQty;
            entity.TotalMeterQty = model.TotalMeterQty;
            entity.PriceLevel    = model.PriceLevel;
            return(entity);
        }
コード例 #26
0
        private PRQ_ChemLocalPurcBillPayment ConvertBillPayment(PrqChemLocalPurcBillPay model, int userId)
        {
            var entity = model.PaymentId == 0 ? new PRQ_ChemLocalPurcBillPayment() : (from b in _context.PRQ_ChemLocalPurcBillPayment.AsEnumerable()
                                                                                      where b.PaymentID == model.PaymentId
                                                                                      select b).FirstOrDefault();

            entity.PaymentID         = model.PaymentId;
            entity.PaymentNo         = model.PaymentNo;
            entity.PaymentDate       = DalCommon.SetDate(model.PaymentDate);
            entity.SupplierID        = model.SupplierId;
            entity.SupplierAddressID = model.SupplierAddressId;
            entity.PurchaseYear      = model.PurchaseYear;
            entity.PaymentType       = model.PaymentType;
            entity.PaymentMethod     = model.PaymentMethod;
            entity.Currency          = model.Currency;
            entity.PaymentDoc        = model.PaymentDoc;
            entity.BillAmount        = model.BillAmount;
            entity.VatAmount         = model.VatAmount;
            entity.DeductAmount      = model.DeductAmount;
            entity.PaymentAmount     = model.PaymentAmount;
            entity.PaymentStatus     = model.PaymentStatus;
            entity.Remarks           = model.Remarks;
            entity.RecordStatus      = model.PaymentId == 0
                ? "NCF"
                : _unit.ChemicalLocalPurchaseBillPaymentRepository.GetByID(model.PaymentId).RecordStatus;
            entity.SetOn = model.PaymentId == 0
                ? DateTime.Now
                : _unit.ChemicalLocalPurchaseBillPaymentRepository.GetByID(model.PaymentId).SetOn;
            entity.SetBy = model.PaymentId == 0
                ? userId
                : _unit.ChemicalLocalPurchaseBillPaymentRepository.GetByID(model.PaymentId).SetBy;
            entity.ModifiedBy = model.PaymentId == 0 ? (int?)null : userId;
            entity.ModifiedOn = model.PaymentId == 0 ? (DateTime?)null : DateTime.Now;

            return(entity);
        }
コード例 #27
0
        public ValidationMsg UpdateLCOpeningInfo(LcmLcOpening dataSet, int UserID)
        {
            try
            {
                LCM_LCOpening obLcOpening = repository.LCOpeningRepository.GetByID(Convert.ToInt32(dataSet.LCID));
                if (!obLcOpening.RecordStatus.Equals("CNF"))
                {
                    obLcOpening.LCNo          = dataSet.LCNo;
                    obLcOpening.LCDate        = DalCommon.SetDate(dataSet.LCDate.ToString());
                    obLcOpening.LCAmount      = dataSet.LCAmount;
                    obLcOpening.ExchangeRate  = dataSet.ExchangeRate;
                    obLcOpening.ExchangeValue = Convert.ToDecimal(dataSet.LCAmount * dataSet.ExchangeRate);
                    if (dataSet.LCAmountCurrency > 0)
                    {
                        obLcOpening.LCCurrencyID = (byte)dataSet.LCAmountCurrency;
                    }
                    if (dataSet.ExchangeCurrency > 0)
                    {
                        obLcOpening.ExchangeCurrency = (byte)dataSet.ExchangeCurrency;
                    }


                    obLcOpening.IssueDate        = Convert.ToDateTime(DalCommon.SetDate(dataSet.IssueDate));
                    obLcOpening.ExpiryDate       = DalCommon.SetDate(dataSet.ExpiryDate);
                    obLcOpening.ExpiryPlace      = dataSet.ExpiryPlace;
                    obLcOpening.NNDSendingTime   = dataSet.NNDSendingTime;
                    obLcOpening.ApprovalAdvice   = dataSet.ApprovalAdvice;
                    obLcOpening.LCANo            = dataSet.LCANo;
                    obLcOpening.IRCNo            = dataSet.IRCNo;
                    obLcOpening.VatRegNo         = dataSet.VatRegNo;
                    obLcOpening.TINNo            = dataSet.TINNo;
                    obLcOpening.BINNo            = dataSet.BINNo;
                    obLcOpening.ICNNo            = dataSet.ICNNo;
                    obLcOpening.ICNDate          = DalCommon.SetDate(dataSet.ICNDate);
                    obLcOpening.LastShipmentDate = DalCommon.SetDate(dataSet.LastShipmentDate);
                    if (dataSet.BranchID > 0)
                    {
                        obLcOpening.LCOpeningBank = dataSet.BranchID;
                    }
                    if (dataSet.AdvisingBank > 0)
                    {
                        obLcOpening.AdvisingBank = dataSet.AdvisingBank;
                    }

                    if (!string.IsNullOrEmpty(dataSet.Beneficiary))
                    {
                        obLcOpening.Beneficiary = Convert.ToInt32(dataSet.Beneficiary);
                    }

                    if (!string.IsNullOrEmpty(dataSet.PINo))
                    {
                        obLcOpening.PIID = dataSet.PIID;
                        obLcOpening.PINo = dataSet.PINo;
                    }

                    obLcOpening.ModifiedOn = DateTime.Now;
                    obLcOpening.ModifiedBy = UserID;
                    obLcOpening.IPAddress  = GetIPAddress.LocalIPAddress();
                    obLcOpening.LCMargin   = dataSet.LCMargin;
                    //   ##############        "": "", "": "", "": "", "": "", "": "",
                    if (!string.IsNullOrEmpty(dataSet.InsuranceID.ToString()))
                    {
                        obLcOpening.InsuranceID = Convert.ToInt32(dataSet.InsuranceID);
                    }
                    if (!string.IsNullOrEmpty(dataSet.PICurrency.ToString()))
                    {
                        obLcOpening.PICurrency = (byte)dataSet.PICurrency;
                    }
                    obLcOpening.PaymentTerm  = dataSet.PaymentTerm;
                    obLcOpening.PaymentMode  = dataSet.PaymentMode;
                    obLcOpening.DeferredDays = dataSet.DeferredDays;
                    if (!string.IsNullOrEmpty(dataSet.CountryOforigin.ToString()))
                    {
                        obLcOpening.CountryOforigin = Convert.ToInt32(dataSet.CountryOforigin);
                    }
                    if (!string.IsNullOrEmpty(dataSet.BeneficiaryBank.ToString()))
                    {
                        obLcOpening.BeneficiaryBank = Convert.ToInt32(dataSet.BeneficiaryBank);
                    }

                    obLcOpening.DeliveryTerm = dataSet.DeliveryTerm;
                    if (!string.IsNullOrEmpty(dataSet.PortofDischarge.ToString()))
                    {
                        obLcOpening.PortofDischarge = Convert.ToInt32(dataSet.PortofDischarge);
                    }

                    obLcOpening.DeliveryMode = dataSet.DeliveryMode;
                    if (!string.IsNullOrEmpty(dataSet.PortofLoading.ToString()))
                    {
                        obLcOpening.PortofLoading = Convert.ToInt32(dataSet.PortofLoading);
                    }

                    obLcOpening.Transshipment   = dataSet.Transshipment;
                    obLcOpening.PartialShipment = dataSet.PartialShipment;
                    obLcOpening.GoodDelivery    = dataSet.GoodDelivery;
                    obLcOpening.ShippingMark    = dataSet.ShippingMark;
                    if (!string.IsNullOrEmpty(dataSet.ExpectedShipmentTime))
                    {
                        obLcOpening.ExpectedShipmentTime = Convert.ToInt32(dataSet.ExpectedShipmentTime);
                    }

                    obLcOpening.Packing        = dataSet.Packing;
                    obLcOpening.PreShipmentIns = dataSet.PreShipmentIns;
                    if (!string.IsNullOrEmpty(dataSet.OfferValidityDays.ToString()))
                    {
                        obLcOpening.OfferValidityDays = Convert.ToInt32(dataSet.OfferValidityDays);
                    }

                    obLcOpening.PresentationDays = Convert.ToInt32(dataSet.PresentationDays);
                    obLcOpening.ConfirmStatus    = dataSet.ConfirmStatus;

                    repository.LCOpeningRepository.Update(obLcOpening);
                    int flag = repository.Save();
                    if (flag == 1)
                    {
                        _vmMsg.Type = Enums.MessageType.Success;
                        _vmMsg.Msg  = "Update Successfully.";
                    }
                    else
                    {
                        _vmMsg.Type = Enums.MessageType.Error;
                        _vmMsg.Msg  = "Saved Faild.";
                    }
                }
                else
                {
                    _vmMsg.Type = Enums.MessageType.Error;
                    _vmMsg.Msg  = "Data already confirmed. You can't update this.";
                }
            }
            catch (DbEntityValidationException e)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var eve in e.EntityValidationErrors)
                {
                    sb.AppendLine(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                eve.Entry.Entity.GetType().Name,
                                                eve.Entry.State));
                    foreach (var ve in eve.ValidationErrors)
                    {
                        sb.AppendLine(string.Format("- Property: \"{0}\", Error: \"{1}\"",
                                                    ve.PropertyName,
                                                    ve.ErrorMessage));
                    }
                }
                throw new DbEntityValidationException(sb.ToString(), e);
            }
            return(_vmMsg);
        }
コード例 #28
0
        public ValidationMsg UpdateLCM_LCRetirement(EXP_LCRetirement dataSet, int _userId)
        {
            try
            {
                EXP_LCRetirement obLCRetirement = repository.EXPLCRetirementRepository.GetByID(Convert.ToInt32(dataSet.LCRetirementID));


                obLCRetirement.LCRetirementNo   = dataSet.LCRetirementNo;
                obLCRetirement.LCRetirementDate = DalCommon.SetDate(dataSet.LCRetirementDate.ToString());
                obLCRetirement.LCNo             = dataSet.LCNo;
                obLCRetirement.LCID             = dataSet.LCID;


                obLCRetirement.BillValue       = (decimal)dataSet.BillValue;
                obLCRetirement.InterestPersent = (decimal)dataSet.InterestPersent;
                obLCRetirement.InterestAmount  = (decimal)dataSet.InterestAmount;

                obLCRetirement.BankCommissionAmt = dataSet.BankCommissionAmt == null ? 0 : (decimal)dataSet.BankCommissionAmt;
                obLCRetirement.SwiftCharge       = dataSet.SwiftCharge == null ? 0 : (decimal)dataSet.SwiftCharge;
                obLCRetirement.OtherCharge       = dataSet.OtherCharge == null ? 0 : (decimal)dataSet.OtherCharge;//(decimal)dataSet.BankCommissionAmt;
                obLCRetirement.TotalAmount       = (decimal)dataSet.TotalAmount;

                obLCRetirement.LCRCurrency      = (byte)dataSet.LCRCurrency;
                obLCRetirement.Remarks          = dataSet.Remarks;
                obLCRetirement.RecordStatus     = "NCF";
                obLCRetirement.ExchangeRate     = (decimal)dataSet.ExchangeRate == null ? 0 : (decimal)dataSet.ExchangeRate;
                obLCRetirement.ExchangeCurrency = (byte)(dataSet.ExchangeCurrency);
                obLCRetirement.ExchangeValue    = dataSet.ExchangeValue == null ? 0 : (decimal)dataSet.ExchangeValue;//(decimal)dataSet.ExchangeValue;

                obLCRetirement.ModifiedOn = DateTime.Now;
                obLCRetirement.ModifiedBy = _userId;
                obLCRetirement.IPAddress  = GetIPAddress.LocalIPAddress();

                repository.EXPLCRetirementRepository.Update(obLCRetirement);
                int flag = repository.Save();
                if (flag == 1)
                {
                    _vmMsg.Type = Enums.MessageType.Success;
                    _vmMsg.Msg  = "Updated Successfully.";
                }
                else
                {
                    _vmMsg.Type = Enums.MessageType.Error;
                    _vmMsg.Msg  = "Update Faild.";
                }


                //_vmMsg.Type = Enums.MessageType.Error;
                //_vmMsg.Msg = "Data already confirmed. You can't update this.";
            }
            catch (DbEntityValidationException e)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var eve in e.EntityValidationErrors)
                {
                    sb.AppendLine(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                eve.Entry.Entity.GetType().Name,
                                                eve.Entry.State));
                    foreach (var ve in eve.ValidationErrors)
                    {
                        sb.AppendLine(string.Format("- Property: \"{0}\", Error: \"{1}\"",
                                                    ve.PropertyName,
                                                    ve.ErrorMessage));
                    }
                }
                throw new DbEntityValidationException(sb.ToString(), e);
            }
            return(_vmMsg);
        }
コード例 #29
0
        public int Update(PRDChemProdReq model, int userId)
        {
            try
            {
                using (TransactionScope transaction = new TransactionScope())
                {
                    using (_context)
                    {
                        #region PI_Informaiton_Update
                        var CurrentRequisition = (from p in _context.PRD_ChemProdReq.AsEnumerable()
                                                  where p.RequisitionID == model.RequisitionID
                                                  select p).FirstOrDefault();

                        CurrentRequisition.RequisitionCategory = model.RequisitionCategory;
                        CurrentRequisition.RequisitionType     = model.RequisitionType;
                        CurrentRequisition.RequisitionFrom     = model.RequisitionFrom;
                        CurrentRequisition.RequisitionTo       = model.RequisitionTo;
                        CurrentRequisition.RequiredByTime      = model.RequiredByTime;
                        CurrentRequisition.ReqRaisedBy         = 1;
                        CurrentRequisition.ReqRaisedOn         = DalCommon.SetDate((model.ReqRaisedOn).ToString());

                        if (model.RecipeFor == 0)
                        {
                            CurrentRequisition.RecipeFor = null;
                        }
                        else
                        {
                            CurrentRequisition.RecipeFor = model.RecipeFor;
                        }
                        if (model.RecipeID == 0)
                        {
                            CurrentRequisition.RecipeID = null;
                        }
                        else
                        {
                            CurrentRequisition.RecipeID = model.RecipeID;
                        }

                        //CurrentRequisition.RecipeFor = model.RecipeFor;
                        //CurrentRequisition.RecipeID = model.RecipeID;
                        CurrentRequisition.ArticleNo = model.ArticleNo;

                        CurrentRequisition.Thickness = model.Thickness;
                        if (model.ThicknessUnit != null)
                        {
                            CurrentRequisition.ThicknessUnit = model.ThicknessUnit;
                        }
                        CurrentRequisition.LeatherSize = model.LeatherSize;
                        if (model.SizeUnit != null)
                        {
                            CurrentRequisition.SizeUnit = model.SizeUnit;
                        }
                        CurrentRequisition.Selection     = model.Selection;
                        CurrentRequisition.ProductionQty = model.ProductionQty;
                        CurrentRequisition.ModifiedBy    = userId;
                        CurrentRequisition.ModifiedOn    = DateTime.Now;

                        _context.SaveChanges();
                        #endregion

                        #region Update Requisition ItemList
                        if (model.RequisitionItemList != null)
                        {
                            foreach (var item in model.RequisitionItemList)
                            {
                                var checkRequisitionItem = (from i in _context.PRD_ChemProdReqItem.AsEnumerable()
                                                            where i.RequisitionItemID == item.RequisitionItemID
                                                            select i).Any();

                                #region New_Requisition_Insertion
                                if (!checkRequisitionItem)
                                {
                                    PRD_ChemProdReqItem objItem = new PRD_ChemProdReqItem();
                                    objItem.RequisitionID = model.RequisitionID;
                                    objItem.ItemID        = Convert.ToInt32(item.ItemID);

                                    if (item.SupplierID == 0)
                                    {
                                        objItem.SupplierID = null;
                                    }
                                    else
                                    {
                                        objItem.SupplierID = item.SupplierID;
                                    }

                                    objItem.RequiredQty = item.RequiredQty;


                                    if (item.RequiredUnitName == null)
                                    {
                                        objItem.RequiredUnit = null;
                                    }
                                    else
                                    {
                                        objItem.RequiredUnit = DalCommon.GetUnitCode(item.RequiredUnitName);
                                    }

                                    objItem.RequsitionQty   = Convert.ToDecimal(item.RequsitionQty);
                                    objItem.RequisitionUnit = DalCommon.GetUnitCode(item.RequisitionUnitName);

                                    if (item.PackSizeName == null)
                                    {
                                        objItem.PackSize = null;
                                    }
                                    else
                                    {
                                        objItem.PackSize = DalCommon.GetSizeCode(item.PackSizeName);
                                    }

                                    //objItem.PackSize = DalCommon.GetSizeCode(item.PackSizeName);

                                    if (item.SizeUnitName == null)
                                    {
                                        objItem.SizeUnit = null;
                                    }
                                    else
                                    {
                                        objItem.SizeUnit = DalCommon.GetUnitCode(item.SizeUnitName);
                                    }


                                    objItem.PackQty     = item.PackQty;
                                    objItem.ApproveQty  = item.ApproveQty;
                                    objItem.ApproveUnit = DalCommon.GetUnitCode(item.ApproveUnitName);
                                    //objItem.ManufacturerID = item.ManufacturerID;
                                    objItem.ItemSource = DalCommon.ReturnItemSource(item.ItemSource);
                                    objItem.SetOn      = DateTime.Now;
                                    objItem.SetBy      = userId;

                                    _context.PRD_ChemProdReqItem.Add(objItem);
                                    _context.SaveChanges();
                                }
                                #endregion

                                #region Existing_Requisition_Update
                                else
                                {
                                    var FoundRequisition = (from i in _context.PRD_ChemProdReqItem.AsEnumerable()
                                                            where i.RequisitionItemID == item.RequisitionItemID
                                                            select i).FirstOrDefault();

                                    FoundRequisition.RequisitionID = model.RequisitionID;
                                    FoundRequisition.ItemID        = Convert.ToInt32(item.ItemID);

                                    if (item.SupplierID == 0)
                                    {
                                        FoundRequisition.SupplierID = null;
                                    }
                                    else
                                    {
                                        FoundRequisition.SupplierID = item.SupplierID;
                                    }

                                    FoundRequisition.RequiredQty = item.RequiredQty;

                                    if (item.RequiredUnitName == null)
                                    {
                                        FoundRequisition.RequiredUnit = null;
                                    }
                                    else
                                    {
                                        FoundRequisition.RequiredUnit = DalCommon.GetUnitCode(item.RequiredUnitName);
                                    }

                                    FoundRequisition.RequsitionQty   = Convert.ToDecimal(item.RequsitionQty);
                                    FoundRequisition.RequisitionUnit = DalCommon.GetUnitCode(item.RequisitionUnitName);
                                    if (item.PackSizeName == null)
                                    {
                                        FoundRequisition.PackSize = null;
                                    }
                                    else
                                    {
                                        FoundRequisition.PackSize = DalCommon.GetSizeCode(item.PackSizeName);
                                    }

                                    //objItem.PackSize = DalCommon.GetSizeCode(item.PackSizeName);

                                    if (item.SizeUnitName == null)
                                    {
                                        FoundRequisition.SizeUnit = null;
                                    }
                                    else
                                    {
                                        FoundRequisition.SizeUnit = DalCommon.GetUnitCode(item.SizeUnitName);
                                    }
                                    FoundRequisition.PackQty     = item.PackQty;
                                    FoundRequisition.ApproveQty  = item.ApproveQty;
                                    FoundRequisition.ApproveUnit = DalCommon.GetUnitCode(item.ApproveUnitName);
                                    FoundRequisition.ItemSource  = DalCommon.ReturnItemSource(item.ItemSource);
                                    FoundRequisition.ModifiedOn  = DateTime.Now;
                                    FoundRequisition.ModifiedBy  = userId;

                                    _context.SaveChanges();
                                }
                                #endregion
                            }
                        }

                        #endregion
                    }

                    transaction.Complete();
                }
                return(1);
            }
            catch (Exception e)
            {
                return(0);
            }
        }
コード例 #30
0
        public int Save(PRDChemProdReq model, int userId, string pageUrl)
        {
            int CurrentRequisitionID = 0;

            try
            {
                using (TransactionScope transaction = new TransactionScope())
                {
                    using (_context)
                    {
                        var GetRequisitionNo = DalCommon.GetPreDefineNextCodeByUrl(pageUrl);

                        if (GetRequisitionNo != null)
                        {
                            #region New_Requisition_Insert

                            PRD_ChemProdReq objRequisition = new PRD_ChemProdReq();

                            objRequisition.RequisitionNo       = GetRequisitionNo;
                            objRequisition.RequisitionCategory = model.RequisitionCategory;
                            objRequisition.RequisitionType     = model.RequisitionType;
                            objRequisition.RequisitionFrom     = model.RequisitionFrom;
                            objRequisition.RequisitionTo       = model.RequisitionTo;
                            objRequisition.RequiredByTime      = model.RequiredByTime;
                            objRequisition.ReqRaisedBy         = userId;
                            objRequisition.ReqRaisedOn         = DalCommon.SetDate((model.ReqRaisedOn).ToString());
                            if (model.RecipeFor == 0)
                            {
                                objRequisition.RecipeFor = null;
                            }
                            else
                            {
                                objRequisition.RecipeFor = model.RecipeFor;
                            }
                            if (model.RecipeID == 0)
                            {
                                objRequisition.RecipeID = null;
                            }
                            else
                            {
                                objRequisition.RecipeID = model.RecipeID;
                            }
                            objRequisition.ArticleNo = model.ArticleNo;

                            objRequisition.Thickness = model.Thickness;
                            if (model.ThicknessUnit != null)
                            {
                                objRequisition.ThicknessUnit = model.ThicknessUnit;
                            }
                            objRequisition.LeatherSize = model.LeatherSize;
                            if (model.SizeUnit != null)
                            {
                                objRequisition.SizeUnit = model.SizeUnit;
                            }
                            objRequisition.Selection     = model.Selection;
                            objRequisition.ProductionQty = model.ProductionQty;

                            objRequisition.RequisitionState  = "RNG";
                            objRequisition.RequisitionStatus = "PND";
                            objRequisition.RecordStatus      = "NCF";
                            objRequisition.SetBy             = userId;
                            objRequisition.SetOn             = DateTime.Now;



                            //if (model.BuyerAddressID == 0)
                            //    objPI.BeneficiaryAddressID = null;
                            //else
                            //    objPI.BeneficiaryAddressID = model.BuyerAddressID;

                            _context.PRD_ChemProdReq.Add(objRequisition);
                            _context.SaveChanges();
                            CurrentRequisitionID = objRequisition.RequisitionID;
                            #endregion

                            #region Item Insert
                            if (model.RequisitionItemList != null)
                            {
                                foreach (var item in model.RequisitionItemList)
                                {
                                    PRD_ChemProdReqItem objItem = new PRD_ChemProdReqItem();
                                    objItem.RequisitionID = CurrentRequisitionID;
                                    objItem.ItemID        = Convert.ToInt32(item.ItemID);

                                    if (item.SupplierID == 0)
                                    {
                                        objItem.SupplierID = null;
                                    }
                                    else
                                    {
                                        objItem.SupplierID = item.SupplierID;
                                    }
                                    //objItem.SupplierID = item.SupplierID;

                                    objItem.RequiredQty = item.RequiredQty;


                                    if (item.RequiredUnitName == null)
                                    {
                                        objItem.RequiredUnit = null;
                                    }
                                    else
                                    {
                                        objItem.RequiredUnit = DalCommon.GetUnitCode(item.RequiredUnitName);
                                    }


                                    objItem.RequsitionQty   = Convert.ToDecimal(item.RequsitionQty);
                                    objItem.RequisitionUnit = DalCommon.GetUnitCode(item.RequisitionUnitName);

                                    if (item.PackSizeName == null)
                                    {
                                        objItem.PackSize = null;
                                    }
                                    else
                                    {
                                        objItem.PackSize = DalCommon.GetSizeCode(item.PackSizeName);
                                    }

                                    //objItem.PackSize = DalCommon.GetSizeCode(item.PackSizeName);

                                    if (item.SizeUnitName == null)
                                    {
                                        objItem.SizeUnit = null;
                                    }
                                    else
                                    {
                                        objItem.SizeUnit = DalCommon.GetUnitCode(item.SizeUnitName);
                                    }
                                    //objItem.SizeUnit = DalCommon.GetUnitCode(item.SizeUnitName);


                                    objItem.PackQty     = item.PackQty;
                                    objItem.ApproveQty  = item.ApproveQty;
                                    objItem.ApproveUnit = DalCommon.GetUnitCode(item.ApproveUnitName);
                                    //objItem.ManufacturerID = item.ManufacturerID;
                                    objItem.ItemSource = DalCommon.ReturnItemSource(item.ItemSource);
                                    objItem.SetOn      = DateTime.Now;
                                    objItem.SetBy      = userId;

                                    _context.PRD_ChemProdReqItem.Add(objItem);
                                    _context.SaveChanges();
                                }
                            }
                            #endregion
                        }
                    }
                    transaction.Complete();
                }
                return(CurrentRequisitionID);
            }
            catch (Exception e)
            {
                return(0);
            }
        }