public IActionResult Upsert(int?id) { CoverType coverType = new CoverType(); if (id == null) { //create return(View(coverType)); } else { //edit var parameter = new DynamicParameters(); parameter.Add("@Id", id); coverType = _unitOfWork.SP_Call.OneRecord <CoverType>(SD.Proc_CoverType_Get, parameter); if (coverType == null) { return(NotFound()); } return(View(coverType)); } }
public IActionResult Upsert(int?id) { CoverType coverType = new CoverType(); if (id == null) { //This for create return(View(coverType)); } var parameter = new DynamicParameters(); parameter.Add("@Id", id); coverType = _unitOfWork.sp_call.OneRecord <CoverType>(ProjectConstant.Proc_CoverType_Get, parameter); //cat = _unitOfWork.CoverType.Get((int)id); if (coverType != null) { return(View(coverType)); } return(NotFound()); }
[ValidateAntiForgeryToken] //writes the unique value to an HTTP only cookie and the same value if written to the form //when the page is submitted, an error is reaised if cookie value is not matched with the form value //prevent cross site forgery. public IActionResult Upsert(CoverType coverType) { if (ModelState.IsValid) //check data annotation and validation in model to see if everything is valid or not { var parameter = new DynamicParameters(); //whenever we work with Stored Procedures we need a dynamic parameters parameter.Add("@Name", coverType.Name); //@Name from the stored procedures command if (coverType.Id == 0) { //create new cover Type _unitOfWork.SP_Call.Execute(SD.Proc_CoverType_Create, parameter); //since we have SaveChanges in Update but not in Add } else { //update new cover Type parameter.Add("@Id", coverType.Name); _unitOfWork.SP_Call.Execute(SD.Proc_CoverType_Update, parameter); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } return(View(coverType)); }
public IActionResult Upsert(int?id) { CoverType coverType = new CoverType(); if (id == null) { // Create return(View(coverType)); } // Edit var parameter = new DynamicParameters(); parameter.Add("id", id); //Console.WriteLine("EDIT ID: {0}", id); coverType = _unitOfWork.SP_Call.OneRecord <CoverType>(SD.Proc_CoverType_Get, parameter); if (coverType == null) { return(NotFound()); } return(View(coverType)); }
public IActionResult Upsert(CoverType coverType) { if (ModelState.IsValid) { var parameter = new DynamicParameters(); parameter.Add("name", coverType.Name); //Console.WriteLine("NAME: {0}", coverType.Name); if (coverType.Id == 0) { _unitOfWork.SP_Call.Execute(SD.Proc_CoverType_Create, parameter); } else { parameter.Add("id", coverType.Id); //Console.WriteLine("Update ID: {0}", coverType.Id); _unitOfWork.SP_Call.Execute(SD.Proc_CoverType_Update, parameter); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } return(View(coverType)); }
public IActionResult Upsert(int?id) { CoverType coverType = new CoverType(); if (id == null) { // this if for create return(View(coverType)); } // this is for edit // coverType = _unitOfWork.CoverType.Get(id.GetValueOrDefault()); var parameter = new DynamicParameters(); parameter.Add("@Id", id); coverType = _unitOfWork.SP_Call.OneRecord <CoverType>(SD.Proc_CoverType_Get, parameter); // passing the id as parameter if (coverType == null) { return(NotFound()); } return(View(coverType)); }
public IActionResult Upsert(int?id) { var coverType = new CoverType(); //this is for create if (id == null) { return(View(coverType)); } //this is for edit var parameter = new DynamicParameters(); parameter.Add("@Id", id); coverType = _unitOfWork.SpCall.OneRecord <CoverType>(Sd.ProcCoverTypeGet, parameter); if (coverType == null) { return(NotFound()); } return(View(coverType)); }
public IActionResult Upsert(CoverType сoverType) { if (ModelState.IsValid) { var parameter = new DynamicParameters(); parameter.Add("@Name", сoverType.Name); if (сoverType.Id == 0) { _uniofWork.SP_Call.Execute(SD.Proc_CoverType_Create, parameter); } else { parameter.Add("@Id", сoverType.Id); _uniofWork.SP_Call.Execute(SD.Proc_CoverType_Update, parameter); } _uniofWork.Save(); // return RedirectToAction("Index"); return(RedirectToAction(nameof(Index))); } return(View(сoverType)); }
/// <summary> /// Constructs an AlbumArt with an already known full-size image /// </summary> public AlbumArt(Source source, string name, string infoUri, int width, int height, byte[] fullSizeImageData, CoverType coverType) { mSource = source; ResultName = name; InfoUri = infoUri; CoverType = coverType; BitmapData = fullSizeImageData; FileSize = fullSizeImageData.LongLength; if (width == -1 && height == -1 && Image != null) { //Have to decode the image data to get width and height SetImageDimensions(Image.PixelWidth, Image.PixelHeight); } else { //Believe the dimensions specified SetImageDimensions(width, height); } mIsFullSize = true; }
public IActionResult InsertOrUpdate(CoverType coverType) { if (ModelState.IsValid) { var parameter = new DynamicParameters(); parameter.Add("@Name", coverType.Name); if (coverType.Id == 0) { _unitOfWork.StoredProc_Call.Execute(SD.Proc_CoverType_Create, parameter); } else { parameter.Add("@Id", coverType.Id); _unitOfWork.StoredProc_Call.Execute(SD.Proc_CoverType_Update, parameter); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } return(View(coverType)); }
public IActionResult Upsert(int?id) { CoverType coverType = new CoverType(); if (id == null) { //Create new CoverType return(View(coverType)); } // Edit CoverType //coverType = _unitOfWork.CoverType.Get(id.GetValueOrDefault()); var dynamicParameter = new DynamicParameters(); dynamicParameter.Add("@Id", id); coverType = _unitOfWork.SP_Call.OneRecord <CoverType>(SD.Proc_CoverType_Get, dynamicParameter); if (coverType == null) { return(NotFound()); } return(View(coverType)); }
public IActionResult Upsert(CoverType coverType) { if (!ModelState.IsValid) { return(View(coverType)); } var parameter = new DynamicParameters(); parameter.Add("@Name", coverType.Name); if (coverType.Id != 0) { parameter.Add("@Id", coverType.Id); _unitOfWork.SP_Call.Execute(SD.Proc_CoverType_Update, parameter); // _unitOfWork.CoverType.Update(coverType); } else { _unitOfWork.SP_Call.Execute(SD.Proc_CoverType_Create, parameter); // _unitOfWork.CoverType.Add(coverType); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); }
public IActionResult Upsert(CoverType coverType) { if (ModelState.IsValid) { var parameter = new DynamicParameters(); if (coverType.Id == 0) { //_unitOfWork.coverType.Add(coverType); parameter.Add("@Name", coverType.Name); _unitOfWork.spCall.Execute(ProjectConstant.Proc_CoverType_Create, parameter); } else { //_unitOfWork.coverType.Update(coverType); parameter.Add("@Id", coverType.Id); _unitOfWork.spCall.Execute(ProjectConstant.Proc_CoverType_Update, parameter); } _unitOfWork.Save(); return(RedirectToAction("Index")); } return(View(coverType)); }
public IActionResult Upsert(int?id) { CoverType coverType = new CoverType(); if (id == null) { //This to create return(View(coverType)); } //Entity //coverType = _unitOfWork.coverType.Get(id.Value); //Dapper var parameter = new DynamicParameters(); coverType = _unitOfWork.spCall.OneRecord <CoverType>(ProjectConstant.Proc_CoverType_Get, parameter); if (coverType == null) { return(NotFound()); } return(View(coverType)); }
public IActionResult Upsert(int?id) { CoverType coverType = new CoverType(); // create if (id == null) { return(View(coverType)); } // stored procedure // var parameter = new DynamicParameters(); // parameter.Add("@Id", id); // coverType = _unitOfWork.SP_Call.OneRecord<CoverType>(SD.Proc_CoverType_Get, parameter); // edit coverType = _unitOfWork.CoverType.Get(id.GetValueOrDefault()); if (coverType == null) { return(NotFound()); } return(View(coverType)); }
internal static AllowedCoverType MakeAllowedCoverType(CoverType scriptCoverType) { switch (scriptCoverType) { case CoverType.Unknown: return(AllowedCoverType.Unknown); case CoverType.Front: return(AllowedCoverType.Front); case CoverType.Back: return(AllowedCoverType.Back); case CoverType.Inside: return(AllowedCoverType.Inside); case CoverType.CD: return(AllowedCoverType.CD); case CoverType.Booklet: return(AllowedCoverType.Booklet); } return(AllowedCoverType.Unknown); }
public IActionResult UpSert(CoverType covertype) { if (ModelState.IsValid) { if (covertype.Id == 0) { covertype.Inserted = DateTime.Now; covertype.InsertedBy = 1; covertype.Updated = DateTime.Now; covertype.UpdatedBy = 1; _unitOfWork.CoverType.Add(covertype); } else { _unitOfWork.CoverType.Update(covertype); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } else { return(NotFound()); } }
public IActionResult Upsert(CoverType CoverType) { if (ModelState.IsValid) { var parameter = new DynamicParameters(); parameter.Add("@Name", CoverType.Name); if (CoverType.Id == 0) { //create //_uow.CoverType.Add(CoverType); _uow.sp_call.Execute(ProjectConstant.Proc_CoverType_Create, parameter); } else { //update parameter.Add("@Id", CoverType.Id); // _uow.CoverType.Update(CoverType); _uow.sp_call.Execute(ProjectConstant.Proc_CoverType_Update, parameter); } _uow.Save(); return(RedirectToAction("Index")); } return(View(CoverType)); }
public IActionResult Upsert(CoverType coverType) { // Save if the model is valid if (ModelState.IsValid) { var parameter = new DynamicParameters(); parameter.Add("@Name", coverType.Name); if (coverType.Id == 0) { _unitOfWork.SP_Call.Execute(StaticDetails.Proc_CoverType_Create, parameter); } else { parameter.Add("@Id", coverType.Id); _unitOfWork.SP_Call.Execute(StaticDetails.Proc_CoverType_Update, parameter); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } return(View(coverType)); }
public async Task <double> BasicPremium() { double percentage = 0; _value = _motor.Value; var result = results.BasicPremium; var covertype = new CoverType(); switch (covertype) { case CoverType.PrivateIndividual: percentage = 0.05; break; case CoverType.Corporate: percentage = 0.06; break; case CoverType.Taxi: percentage = 0.07; break; case CoverType.Hiring: percentage = 0.07; break; case CoverType.MiniBus: percentage = 0.07; break; case CoverType.MaxiBus: percentage = 0.07; break; case CoverType.MotorCycle: percentage = 0.03; break; case CoverType.Ambulance: percentage = 0.07; break; case CoverType.OwnGoods: percentage = 0.04; break; case CoverType.ArticulatorOrTanker: percentage = 0.08; break; case CoverType.GeneralCartage: percentage = 0.06; break; case CoverType.SpecialOnSite: percentage = 0.015; break; case CoverType.SpecialOnRoad: percentage = 0.03; break; case CoverType.GW1Class1: percentage = 0.05; break; case CoverType.GW1Class2: percentage = 0.06; break; case CoverType.GW1Class3: percentage = 0.07; break; default: break; } result = percentage * _value; return(await Task.FromResult(result)); }
public void Add(object thumbnail, string name, object fullSizeImageCallback, CoverType coverType) { Add(thumbnail, name, String.Empty, -1, -1, fullSizeImageCallback, coverType); }
public void Add(object thumbnail, string name, string infoUri, int fullSizeImageWidth, int fullSizeImageHeight, object fullSizeImageCallback, CoverType coverType, string suggestedFilenameExtension) { //InfoUri and suggestedFilenameExtension are ignored. mResults.Add(new ScriptResult(mScript, thumbnail, name, fullSizeImageWidth, fullSizeImageHeight, fullSizeImageCallback, coverType)); }
public void Add(object thumbnail, string name, string infoUri, int fullSizeImageWidth, int fullSizeImageHeight, object fullSizeImageCallback, CoverType coverType) { Add(thumbnail, name, infoUri, fullSizeImageWidth, fullSizeImageHeight, fullSizeImageCallback, coverType, null); }
public Task OfficeCharge() { var covertype = new CoverType(); var value = 0; switch (covertype) { case CoverType.PrivateIndividual: value = 55; break; case CoverType.Corporate: value = 55; break; case CoverType.Taxi: value = 60; break; case CoverType.Hiring: value = 60; break; case CoverType.MiniBus: value = 60; break; case CoverType.MaxiBus: value = 60; break; case CoverType.MotorCycle: value = 50; break; case CoverType.Ambulance: value = 57; break; case CoverType.OwnGoods: value = 65; break; case CoverType.ArticulatorOrTanker: value = 65; break; case CoverType.GeneralCartage: value = 65; break; case CoverType.SpecialOnSite: value = 40; break; case CoverType.SpecialOnRoad: value = 65; break; case CoverType.GW1Class1: value = 60; break; case CoverType.GW1Class2: value = 60; break; case CoverType.GW1Class3: value = 60; break; default: value = 0; break; } var result = value / 1; return(Task.FromResult(result)); }
public BulkOrderBookCover(CoverType type) : this(type, 30) { }
public Task ThirdPartyBasicPremium() { double value; var result = results.THirdPartyBasicPre; var covertype = new CoverType(); switch (covertype) { case CoverType.PrivateIndividual: value = 272; break; case CoverType.Corporate: value = 272; break; case CoverType.Taxi: value = 378; break; case CoverType.Hiring: value = 387; break; case CoverType.MiniBus: value = 387; break; case CoverType.MaxiBus: value = 387; break; case CoverType.MotorCycle: value = 99; break; case CoverType.Ambulance: value = 297; break; case CoverType.OwnGoods: value = 387; break; case CoverType.ArticulatorOrTanker: value = 594; break; case CoverType.GeneralCartage: value = 486; break; case CoverType.SpecialOnSite: value = 198; break; case CoverType.SpecialOnRoad: value = 387; break; case CoverType.GW1Class1: value = 330; break; case CoverType.GW1Class2: value = 440; break; case CoverType.GW1Class3: value = 550; break; default: value = 0; break; } result = ((value) / (1)); return(Task.FromResult(result)); }
public void Add(CoverType cover) { _db.Add(cover); }
public CoverItemInfo(CoverType coverType) { this.cov_name = coverType.ToString(); }
public void Add(object thumbnail, string name, string infoUri, int fullSizeImageWidth, int fullSizeImageHeight, object fullSizeImageCallback, CoverType coverType, string suggestedFilenameExtension) { if (!mSource.QueryContinueSearchInternal()) { //Break out of this search mSource.AbortSearch(); return; } if (mSource.FullSizeOnly || fullSizeImageCallback == null) { byte[] fullSizeData = null; if (fullSizeImageCallback != null) //If fullSizeImageCallback == null, then no full size image supplied, so the thumbnail is the full size image { //Try to get the full size image without getting the thumbnail fullSizeData = mSource.RetrieveFullSizeImageData(fullSizeImageCallback); } if (fullSizeData == null) { //Fall back on using the thumbnail as the full size fullSizeData = BitmapHelpers.GetBitmapData(thumbnail); } if (fullSizeData != null) { mDispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { mSource.Results.Add(new AlbumArt(mSource, name, infoUri, fullSizeImageWidth, fullSizeImageHeight, fullSizeData, coverType)); })); } } else { byte[] thumbnailBitmapData = BitmapHelpers.GetBitmapData(thumbnail); if (thumbnailBitmapData != null) { mDispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { mSource.Results.Add(new AlbumArt(mSource, thumbnailBitmapData, name, infoUri, fullSizeImageWidth, fullSizeImageHeight, fullSizeImageCallback, coverType, suggestedFilenameExtension)); })); } } if (!mSource.QueryContinueSearchInternal()) { //Break out of this search mSource.AbortSearch(); return; } }
public void Remove(int id) { CoverType coverToDelete = _db.Covers.Find(id); _db.Covers.Remove(coverToDelete); }