コード例 #1
0
        public ServiceResponse Edit(TagsModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    var result = _ent.Core_Tags.Where(x => x.TagId == model.PId).FirstOrDefault();
                    if (result != null)
                    {
                        result.Name = model.Name;

                        _ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                        _ent.SaveChanges();
                    }
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully updated!!", MessageType.Success, true, "Edit");
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }
コード例 #2
0
ファイル: NewsProvider.cs プロジェクト: Zeew0n/Travel-Portal
        public ServiceResponse Save(NewsModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    Core_News obj = new Core_News
                    {
                        Title       = model.Title.Trim(),
                        URL         = model.URL.Trim(),
                        Summary     = model.Summary,
                        Description = model.Description,
                        IsPublish   = model.IsPublish,

                        CreatedBy   = session.AppUserId,
                        CreatedDate = currentDate,
                    };
                    _ent.AddToCore_News(obj);
                    _ent.SaveChanges();
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Edit");
                    return(_response);
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }
コード例 #3
0
        public App_Class.ServiceResponse Delete(int PId)
        {
            B2CFlightInquiry result = _ent.B2CFlightInquiry.Where(x => x.FlightInquiryId == PId).FirstOrDefault();
            var resultInquiryPax    = _ent.B2CFlightInquiryPax.Where(x => x.FlightInquiryId == PId);

            try
            {
                foreach (var item in resultInquiryPax)
                {
                    var delResult = _ent.B2CFlightInquiryPax.Where(x => x.FlightInquiryId == item.FlightInquiryPaxId).FirstOrDefault();
                    _ent.DeleteObject(delResult);
                    _ent.SaveChanges();
                }

                _ent.DeleteObject(result);
                _ent.SaveChanges();
                _response = new ServiceResponse("Successfully deleted!!", MessageType.Success, true, "Delete");
                return(_response);
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Delete");
            }
            return(_response);
        }
コード例 #4
0
ファイル: NewsProvider.cs プロジェクト: Zeew0n/Travel-Portal
        public ServiceResponse ActionSaveUpdate(NewsModel model, string tranMode)
        {
            try
            {
                bool isExist = IsTitleExist(model.PId, model.Title);
                if (isExist == true)
                {
                    _response = new ServiceResponse("Core_News with same title already exist!!", MessageType.Warning, false, "Add");
                    return(_response);
                }
                if (tranMode == "N")
                {
                    return(Save(model));
                }
                else if (tranMode == "U")
                {
                    return(Edit(model));
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false);
            }

            return(_response);
        }
コード例 #5
0
ファイル: NewsProvider.cs プロジェクト: Zeew0n/Travel-Portal
 public ServiceResponse Edit(NewsModel model)
 {
     try
     {
         using (var ts = new TransactionScope(TransactionScopeOption.Required))
         {
             var result = _ent.Core_News.Where(x => x.NewsId == model.PId).FirstOrDefault();
             if (result != null)
             {
                 result.Title        = model.Title.Trim();
                 result.URL          = model.URL.Trim();
                 result.Summary      = model.Summary;
                 result.Description  = model.Description;
                 result.IsPublish    = model.IsPublish;
                 result.ModifiedBy   = session.AppUserId;
                 result.ModifiedDate = currentDate;
                 _ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                 _ent.SaveChanges();
             }
             ts.Complete();
             _response = new ServiceResponse("Record successfully updated!!", MessageType.Success, true, "Edit");
         }
     }
     catch (SqlException ex)
     {
         _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
     }
     catch (Exception ex)
     {
         _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
     }
     return(_response);
 }
コード例 #6
0
        public App_Class.ServiceResponse Delete(int PackageImageId)
        {
            Air_PackagesImage result = _ent.Air_PackagesImage.Where(x => x.PackageImageId == PackageImageId).FirstOrDefault();

            try
            {
                AirPackageProvider _p = new AirPackageProvider();
                string             PackageImageFolder = _p.GetPackageImageFolderName(result.PackageId);
                string             imageName          = result.ImageName;

                _ent.DeleteObject(result);
                _ent.SaveChanges();
                if (!string.IsNullOrEmpty(PackageImageFolder) && !string.IsNullOrEmpty(imageName))
                {
                    AirPackageImageModel model = new AirPackageImageModel();
                    AppUploader.DeleteFileByName(model.PackageImageRootPath + "\\" + PackageImageFolder, imageName);
                    AppUploader.DeleteFileByName(model.PackageImageRootPath + "\\" + PackageImageFolder + "\\Images", imageName);
                    AppUploader.DeleteFileByName(model.PackageImageRootPath + "\\" + PackageImageFolder + "\\Thumbnail", imageName);
                }
                _response = new ServiceResponse("Successfully deleted!!", MessageType.Success, true, "Delete");
                return(_response);
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Delete");
            }
            return(_response);
        }
コード例 #7
0
 public ServiceResponse Save(TagsModel model)
 {
     try
     {
         using (var ts = new TransactionScope(TransactionScopeOption.Required))
         {
             Core_Tags obj = new Core_Tags
             {
                 Name = model.Name,
             };
             _ent.AddToCore_Tags(obj);
             _ent.SaveChanges();
             ts.Complete();
             _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Edit");
             return(_response);
         }
     }
     catch (SqlException ex)
     {
         _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
     }
     catch (Exception ex)
     {
         _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
     }
     return(_response);
 }
コード例 #8
0
 public ServiceResponse Save(TrainingInquiryModel model)
 {
     try
     {
         using (var ts = new TransactionScope(TransactionScopeOption.Required))
         {
             Core_TrainingSession obj = new Core_TrainingSession
             {
                 FullName           = model.FullName,
                 CompanyName        = model.CompanyName,
                 EmailAddress       = model.EmailAddress,
                 ContactNo          = model.ContactNo,
                 IsAgent            = model.IsAgent,
                 ObjectiveOfTraning = model.ObjectiveOfTraning,
                 PreferredDay       = model.PreferredDay,
                 PrefferedTime      = model.PrefferedTime,
                 Remarks            = model.Remarks,
             };
             _ent.AddToCore_TrainingSession(obj);
             _ent.SaveChanges();
             ts.Complete();
             _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Edit");
             return(_response);
         }
     }
     catch (SqlException ex)
     {
         _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
     }
     catch (Exception ex)
     {
         _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
     }
     return(_response);
 }
コード例 #9
0
        public ServiceResponse Edit(AirPackageModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    var result = _ent.Air_Packages.Where(x => x.PackageId == model.PackageId).FirstOrDefault();
                    if (result != null)
                    {
                        result.PackageId = model.PackageId;
                        result.CountryId = model.CountryId;
                        result.ZoneId    = model.ZoneId;
                        //result.CityId = model.CityId;
                        result.PackageGroupId = model.PackageGroupId;
                        result.Name           = model.Name.Trim();
                        result.PackageCode    = model.PackageCode;
                        result.URL            = model.URL.Trim();
                        //result.Tags = model.Tags;
                        result.StartingPrice         = model.StartingPrice;
                        result.StartingPriceINR      = model.StartingINR;
                        result.StartingPriceUSD      = model.StartingUSD;
                        result.Overview              = model.Overview;
                        result.Itineary              = model.Itineary;
                        result.Destination           = model.Destination;
                        result.TermAndConditions     = model.TermAndConditions;
                        result.InclusiveAndExclusive = model.InclusiveAndExclusive;
                        result.Rate          = model.Rate;
                        result.EffectiveFrom = DateTime.UtcNow;
                        result.ExpireOn      = DateTime.UtcNow;

                        result.UpdatedBy   = session.AppUserId;
                        result.UpdatedDate = currentDate;
                        result.IsPublish   = model.IsPublish;

                        result.Duration     = model.Duration;
                        result.Description  = model.PackageSummary;
                        result.IsB2CPackage = true;
                        //result.IsB2BPackage = model.IsB2BPackage;
                        //result.B2CMarkup = model.B2CMarkup;
                        //result.B2BMarkUp = model.B2BMarkUp;
                        result.isFeatured = false;

                        _ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                        _ent.SaveChanges();
                    }
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully updated!!", MessageType.Success, true, "Edit");
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }
コード例 #10
0
        public ServiceResponse Save(AirPackageModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    Air_Packages obj = new Air_Packages
                    {
                        PackageId = model.PackageId,
                        CountryId = model.CountryId,
                        ZoneId    = model.ZoneId,
                        //CityId = model.CityId,
                        PackageGroupId = model.PackageGroupId,
                        Name           = model.Name.Trim(),
                        PackageCode    = model.PackageCode,
                        URL            = model.URL.Trim(),
                        //Tags = model.Tags,
                        StartingPrice         = model.StartingPrice,
                        StartingPriceINR      = model.StartingINR,
                        StartingPriceUSD      = model.StartingUSD,
                        Overview              = model.Overview,
                        Itineary              = model.Itineary,
                        Destination           = model.Destination,
                        TermAndConditions     = model.TermAndConditions,
                        InclusiveAndExclusive = model.InclusiveAndExclusive,
                        Rate            = model.Rate,
                        ImageFolderName = AppGuid.NewGuid(Convert.ToChar("D")),
                        EffectiveFrom   = DateTime.UtcNow,
                        ExpireOn        = DateTime.UtcNow,
                        CreatedBy       = session.AppUserId,
                        CreatedDate     = currentDate,
                        IsPublish       = model.IsPublish,

                        Duration     = model.Duration,
                        Description  = model.PackageSummary,
                        IsB2CPackage = true,
                        //IsB2BPackage = model.IsB2BPackage,
                        //B2CMarkup = model.B2CMarkup,
                        //B2BMarkUp = model.B2BMarkUp,
                        isFeatured = false
                    };
                    _ent.AddToAir_Packages(obj);
                    _ent.SaveChanges();
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Edit");
                    return(_response);
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }
コード例 #11
0
        public ServiceResponse ActionSaveUpdate(AirPackageImageModel model, string tranMode)
        {
            try
            {
                return(Save(model));
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false);
            }

            return(_response);
        }
コード例 #12
0
        public ServiceResponse Save(AirPackageImageModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    _response = ManagePackageFolder(model);
                    if (!_response.ResponseStatus)
                    {
                        return(_response);
                    }

                    foreach (var item in model.ImageUploader)
                    {
                        var    file             = item.UploadedFile;
                        string UploadedFileName = ManageImage(file);

                        Air_PackagesImage obj = new Air_PackagesImage
                        {
                            PackageId    = model.PackageId,
                            ImageName    = UploadedFileName,
                            ImageCaption = item.UploadedImageCaption,
                        };
                        _ent.AddToAir_PackagesImage(obj);
                        _ent.SaveChanges();
                    }
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Save");
                    return(_response);
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }
コード例 #13
0
ファイル: NewsProvider.cs プロジェクト: Zeew0n/Travel-Portal
        public App_Class.ServiceResponse Delete(int PId)
        {
            Core_News result = _ent.Core_News.Where(x => x.NewsId == PId).FirstOrDefault();

            try
            {
                _ent.DeleteObject(result);
                _ent.SaveChanges();
                _response = new ServiceResponse("Successfully deleted!!", MessageType.Success, true, "Delete");
                return(_response);
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Delete");
            }
            return(_response);
        }
コード例 #14
0
        public App_Class.ServiceResponse SetDefaultImage(int PackageImageId)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    Air_PackagesImage result = _ent.Air_PackagesImage.Where(x => x.PackageImageId == PackageImageId).FirstOrDefault();
                    if (result != null)
                    {
                        var resultAll = _ent.Air_PackagesImage.Where(x => x.PackageId == result.PackageId && x.PackageImageId != PackageImageId);
                        if (resultAll != null)
                        {
                            foreach (var item in resultAll)
                            {
                                item.IsDefault = false;
                                _ent.ApplyCurrentValues(item.EntityKey.EntitySetName, item);
                                _ent.SaveChanges();
                            }
                        }

                        result.IsDefault = true;
                        _ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                        _ent.SaveChanges();
                    }
                    ts.Complete();
                }

                _response = new ServiceResponse("Successfully updated!!", MessageType.Success, true, "SetDefault");
                return(_response);
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Delete");
            }
            return(_response);
        }
コード例 #15
0
        public ServiceResponse Edit(AirPackageInquiryModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    var result = _ent.Core_PackagesInquiries.Where(x => x.PackagesInquiryId == model.PId).FirstOrDefault();
                    if (result != null)
                    {
                        result.PackagesInquiryId = model.PId;
                        result.AgentId           = model.AgentId;
                        result.PackageId         = model.PackageId;
                        result.Title             = model.Title;
                        result.TravelDate        = model.TravelDate;
                        result.Name         = model.Name;
                        result.EmailAddress = model.EmailAddress;
                        result.NoOfAdult    = model.NoOfAdult;
                        result.NoOfChild    = model.NoOfChild;
                        result.ContactNo    = model.ContactNo;
                        result.Remark       = model.Remark;
                        result.CreatedBy    = model.CreatedBy;
                        result.CreatedDate  = model.CreatedDate;

                        _ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                        _ent.SaveChanges();
                    }
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully updated!!", MessageType.Success, true, "Edit");
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }
コード例 #16
0
 public ServiceResponse Save(AirPackageInquiryModel model)
 {
     try
     {
         using (var ts = new TransactionScope(TransactionScopeOption.Required))
         {
             Core_PackagesInquiries obj = new Core_PackagesInquiries
             {
                 AgentId      = model.AgentId,
                 PackageId    = model.PackageId,
                 Title        = model.Title,
                 TravelDate   = model.TravelDate,
                 Name         = model.Name,
                 EmailAddress = model.EmailAddress,
                 NoOfAdult    = model.NoOfAdult,
                 NoOfChild    = model.NoOfChild,
                 ContactNo    = model.ContactNo,
                 Remark       = model.Remark,
                 CreatedBy    = model.CreatedBy,
                 CreatedDate  = model.CreatedDate,
             };
             _ent.AddToCore_PackagesInquiries(obj);
             _ent.SaveChanges();
             ts.Complete();
             _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Edit");
             return(_response);
         }
     }
     catch (SqlException ex)
     {
         _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
     }
     catch (Exception ex)
     {
         _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
     }
     return(_response);
 }
コード例 #17
0
 public ServiceResponse ActionSaveUpdate(OfflineBookViewModel model, string tranMode)
 {
     try
     {
         if (tranMode == "N")
         {
             return(Save(model));
         }
         else if (tranMode == "U")
         {
             return(Edit(model));
         }
     }
     catch (SqlException ex)
     {
         _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
     }
     catch (Exception ex)
     {
         _response = new ServiceResponse(ex.Message, MessageType.Exception, false);
     }
     return(_response);
 }
コード例 #18
0
        public ServiceResponse Edit(TrainingInquiryModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    var result = _ent.Core_TrainingSession.Where(x => x.TrainingSessionId == model.PId).FirstOrDefault();
                    if (result != null)
                    {
                        result.FullName           = model.FullName;
                        result.CompanyName        = model.CompanyName;
                        result.EmailAddress       = model.EmailAddress;
                        result.ContactNo          = model.ContactNo;
                        result.IsAgent            = model.IsAgent;
                        result.ObjectiveOfTraning = model.ObjectiveOfTraning;
                        result.PreferredDay       = model.PreferredDay;
                        result.PrefferedTime      = model.PrefferedTime;
                        result.Remarks            = model.Remarks;

                        _ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                        _ent.SaveChanges();
                    }
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully updated!!", MessageType.Success, true, "Edit");
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }