Пример #1
0
        public List <VesselModel> Get(VesselModel filter)
        {
            PagerModel pager    = new PagerModel(0, Int32.MaxValue - 1, "", "");
            VesselDA   vesselDA = new VesselDA();

            return(vesselDA.Get(pager, filter));
        }
Пример #2
0
        public RequestResult <VesselModel> InsUpd(VesselModel model)
        {
            bool           isAdd             = model.VesselId == null;
            ImagesServices ImageServ         = new ImagesServices();
            FileServices   FileServ          = new FileServices();
            VesselDA       vesselDA          = new VesselDA();
            RequestResult <VesselModel> resp = new RequestResult <VesselModel>()
            {
                Status = Status.Success
            };
            TransactionOptions scopeOptions = new TransactionOptions();

            //scopeOptions.IsolationLevel = IsolationLevel.ReadCommitted;
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scopeOptions))
            {
                try
                {
                    resp = vesselDA.InsUpd(model);

                    if (model.Image.FileContent != null && model.Image.FileContent.Length > 0)
                    {
                        Stream ProcessedImage = ImageServ.ResizeProfileImage(model.Image.FileContent);

                        ProcessedImage.Position = 0;

                        var FileNameExtension = ".jpg";
                        model.Image.FileName = "vesselimage-" + model.VesselId + FileNameExtension;
                        var path = "vessels/" + model.VesselId + "/images/";

                        model.Image.ContentType = "image/jpeg";
                        model.Image.Path        = path;
                        model.Image.FileContent = ProcessedImage;

                        FileServ.SaveFile(model.Image);

                        if (isAdd)
                        {
                            resp = vesselDA.InsUpd(model);
                        }
                    }

                    ts.Complete();
                }
                catch (Exception ex)
                {
                    ts.Dispose();
                    resp = new RequestResult <VesselModel>()
                    {
                        Status = Status.Error, Message = ex.Message
                    };
                    Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                    throw ex;
                }
            }
            return(resp);
        }
Пример #3
0
        public RequestResult <VesselCostModel> InsUpdCost(VesselCostModel model)
        {
            VesselDA vesselDA = new VesselDA();
            RequestResult <VesselCostModel> resp = new RequestResult <VesselCostModel>()
            {
                Status = Status.Success
            };

            return(vesselDA.InsUpdCost(model));
        }
Пример #4
0
        public RequestResult <VesselSpecificInfoModel> InsUpdSpecificInfo(VesselSpecificInfoModel model)
        {
            VesselDA vesselDA = new VesselDA();
            RequestResult <VesselSpecificInfoModel> resp = new RequestResult <VesselSpecificInfoModel>()
            {
                Status = Status.Success
            };

            return(vesselDA.InsUpdSpecificInfo(model));
        }
Пример #5
0
        public VesselModel GetFirst(VesselModel filter)
        {
            VesselDA    vesselDA = new VesselDA();
            PagerModel  pager    = new PagerModel(0, 1, "", "");
            VesselModel resp     = Get(pager, filter).FirstOrDefault();

            if (resp != null)
            {
                resp.Suitability = vesselDA.GetSuitability((int)resp.VesselId);
            }
            return(resp);
        }
Пример #6
0
        public List <VesselModel> Get(PagerModel pager, VesselModel filter)
        {
            VesselDA vesselDA = new VesselDA();

            return(vesselDA.Get(pager, filter));
        }
Пример #7
0
        public List <VesselModel> VesselAvailableProject(int CompanyId, int ProjectId, int OfferId)
        {
            VesselDA da = new VesselDA();

            return(da.VesselAvailableProject(CompanyId, ProjectId, OfferId));
        }
Пример #8
0
        public VesselCostModel GetCost(int VesselId)
        {
            VesselDA vesselDA = new VesselDA();

            return(vesselDA.GetCost(VesselId));
        }
Пример #9
0
        public VesselSpecificInfoModel GetSpecificInfo(int VesselId)
        {
            VesselDA vesselDA = new VesselDA();

            return(vesselDA.GetSpecificInfo(VesselId));
        }
Пример #10
0
        public int EvalAvailability(VesselAvailabilityModel model)
        {
            VesselDA vesselDA = new VesselDA();

            return(vesselDA.ValAvailability(model));
        }
Пример #11
0
        public RequestResult <string> Eval(VesselModel model)
        {
            VesselDA vesselDA = new VesselDA();

            return(vesselDA.Val(model));
        }