コード例 #1
0
        public bool AddQuotation(QuotationEntities qe)
        {
            var          config = new MapperConfiguration(cfg => cfg.CreateMap <QuotationEntities, tblQuotation>());
            IMapper      mapper = config.CreateMapper();
            tblQuotation quot   = mapper.Map <QuotationEntities, tblQuotation>(qe);

            return(quotationRepository.BookQuotation(quot));
            //if (UserLogin.IsUserLogin())
            //{
            //}
            //else
            //{
            //    return false;
            //}
        }
コード例 #2
0
        public IHttpActionResult BookQuotation(CommonQuotationEntities objCommon, string Userid)
        {
            try
            {
                int _userId = Convert.ToInt32(Userid);
                //Add package To DB
                PackageEntities pe = new PackageEntities();

                pe.CreatedBy   = _userId;
                pe.Height      = objCommon.Height;
                pe.IsActive    = true;
                pe.Lenght      = objCommon.Lenght;
                pe.Packagename = objCommon.Packagename;
                pe.Quantity    = objCommon.Quantity;
                pe.UserId      = _userId;
                pe.Weight      = objCommon.Weight;
                pe.Width       = objCommon.Width;
                int PackageId = quotationManager.AddPackage(pe);

                //Add Quotation To DB
                QuotationEntities qe = new QuotationEntities();
                qe.DestinationAddress1 = objCommon.DestinationAddress1;
                qe.DestinationAddress2 = objCommon.DestinationAddress2;
                qe.DestinationCity     = objCommon.DestinationCity;
                qe.DestinationState    = objCommon.DestinationState;
                qe.DestinationCountry  = objCommon.DestinationCountry;
                qe.DestinationPincode  = objCommon.DestinationPincode;
                qe.SourceAddress1      = objCommon.SourceAddress1;
                qe.SourceAddress2      = objCommon.SourceAddress2;
                qe.SourceCity          = objCommon.SourceCity;
                qe.SourceState         = objCommon.SourceState;
                qe.SourceCountry       = objCommon.SourceCountry;
                qe.SourcePincode       = objCommon.SourcePincode;
                qe.CreateBy            = _userId;
                qe.CreatedDate         = DateTime.Now;
                qe.PackageDeatilsId    = PackageId;
                qe.UpdatedBy           = _userId;
                qe.UpdatedDate         = DateTime.Now;
                qe.Amount = objCommon.Amount;
                qe.UserId = _userId;
                string City = "Ahmedabad";
                int    OfficeId;
                int    oid          = db.Offices.Where(m => m.City == City).Select(m => m.Id).First();
                int    OfficeUserId = db.Offices.Where(m => m.City == City).Select(m => m.UserId).FirstOrDefault();
                if (oid > 0)
                {
                    OfficeId = oid;
                }
                else
                {
                    OfficeId = 3;
                }
                qe.OfficeId = OfficeId;
                qe.IsActive = true;
                return(Ok(quotationManager.AddQuotation(qe)));
            }
            catch (Exception e)
            {
                return(NotFound());
            }
        }