private MediaItem GetMEById(string id) { RecordRequest req = new RecordRequest(); req.RecordID = id; return(_mediaGalleryService.ChildGetRecord <MediaItem>(req).result); }
private EmployeeBackgroundCheck GetBCById(string id) { RecordRequest req = new RecordRequest(); req.RecordID = id; return(_employeeService.ChildGetRecord <EmployeeBackgroundCheck>(req).result); }
private CompanyRightToWork GetRWById(string id) { RecordRequest req = new RecordRequest(); req.RecordID = id; return(_systemService.ChildGetRecord <CompanyRightToWork>(req).result); }
private void FillJobInfo() { try { if (_systemService.SessionHelper.GetEmployeeId() != null) { RecordRequest req = new RecordRequest(); req.RecordID = _systemService.SessionHelper.GetEmployeeId(); RecordResponse <Employee> response = _employeeService.Get <Employee>(req); if (!response.Success) { Common.errorMessage(response); } if (response.result != null) { defaultDepartmentId = response.result.departmentId.ToString(); defaultBranchId = response.result.branchId.ToString(); defaultDivisiontId = response.result.divisionId.ToString(); } } FillDepartment(); FillPosition(); FillBranch(); FillDivision(); } catch (Exception exp) { X.MessageBox.Alert(GetGlobalResourceObject("Common", "Error").ToString(), exp.Message); } }
private EmployeeRightToWork GetRWById(string Id) { RecordRequest req = new RecordRequest(); req.RecordID = Id; return(_employeeService.ChildGetRecord <EmployeeRightToWork>(req).result); }
//public static void ConvertToHtml(string file, string outputDirectory) //{ // var fi = new FileInfo(file); // Console.WriteLine(fi.Name); // var byteArray = System.IO.File.ReadAllBytes(fi.FullName); // using (var memoryStream = new MemoryStream()) // { // memoryStream.Write(byteArray, 0, byteArray.Length); // using (var wDoc = WordprocessingDocument.Open(memoryStream, true)) // { // var destFileName = new FileInfo(fi.Name.Replace(".docx", ".html")); // if (!string.IsNullOrEmpty(outputDirectory)) // { // var di = new DirectoryInfo(outputDirectory); // if (!di.Exists) // { // throw new OpenXmlPowerToolsException("Output directory does not exist"); // } // destFileName = new FileInfo(Path.Combine(di.FullName, destFileName.Name)); // } // var imageDirectoryName = destFileName.FullName.Substring(0, destFileName.FullName.Length - 5) + "_files"; // var imageCounter = 0; // var pageTitle = fi.FullName; // var part = wDoc.CoreFilePropertiesPart; // if (part != null) // { // pageTitle = (string)part.GetXDocument().Descendants(DC.title).FirstOrDefault() ?? fi.FullName; // } // // TODO: Determine max-width from size of content area. // var settings = new HtmlConverterSettings() // { // AdditionalCss = "body { margin: 1cm auto; max-width: 20cm; padding: 0; }", // PageTitle = pageTitle, // FabricateCssClasses = true, // CssClassPrefix = "pt-", // RestrictToSupportedLanguages = false, // RestrictToSupportedNumberingFormats = false, // ImageHandler = imageInfo => // { // var localDirInfo = new DirectoryInfo(imageDirectoryName); // if (!localDirInfo.Exists) // localDirInfo.Create(); // ++imageCounter; // var extension = imageInfo.ContentType.Split('/')[1].ToLower(); // ImageFormat imageFormat = null; // switch (extension) // { // case "png": // imageFormat = ImageFormat.Png; // break; // case "gif": // imageFormat = ImageFormat.Gif; // break; // case "bmp": // imageFormat = ImageFormat.Bmp; // break; // case "jpeg": // imageFormat = ImageFormat.Jpeg; // break; // case "tiff": // // Convert tiff to gif. // extension = "gif"; // imageFormat = ImageFormat.Gif; // break; // case "x-wmf": // extension = "wmf"; // imageFormat = ImageFormat.Wmf; // break; // } // // If the image format isn't one that we expect, ignore it, // // and don't return markup for the link. // if (imageFormat == null) // return null; // var imageFileName = imageDirectoryName + "/image" + // imageCounter.ToString() + "." + extension; // try // { // imageInfo.Bitmap.Save(imageFileName, imageFormat); // } // catch (System.Runtime.InteropServices.ExternalException) // { // return null; // } // var imageSource = localDirInfo.Name + "/image" + // imageCounter.ToString() + "." + extension; // var img = new XElement(Xhtml.img, // new XAttribute(NoNamespace.src, imageSource), // imageInfo.ImgStyleAttribute, // imageInfo.AltText != null ? // new XAttribute(NoNamespace.alt, imageInfo.AltText) : null); // return img; // } // }; // var htmlElement = HtmlConverter.ConvertToHtml(wDoc, settings); // // Produce HTML document with <!DOCTYPE html > declaration to tell the browser // // we are using HTML5. // var html = new XDocument( // new XDocumentType("html", null, null, null), // htmlElement); // // Note: the xhtml returned by ConvertToHtmlTransform contains objects of type // // XEntity. PtOpenXmlUtil.cs define the XEntity class. See // // http://blogs.msdn.com/ericwhite/archive/2010/01/21/writing-entity-references-using-linq-to-xml.aspx // // for detailed explanation. // // // // If you further transform the XML tree returned by ConvertToHtmlTransform, you // // must do it correctly, or entities will not be serialized properly. // var htmlString = html.ToString(SaveOptions.DisableFormatting); // System.IO.File.WriteAllText(destFileName.FullName, htmlString, Encoding.UTF8); // } // } //} public JsonResult RefreshRecord([FromUri] RecordRequest recordRequest) { var conn = new InforConnection(tu: _tu, tup: _tup); var id = recordRequest.Id; return(id != null?this.Jsonp(conn.GetRecordWeb((long)id, AppUserState.UserName, AppUserState.Wgs, AppUserState.Ds)) : null); }
protected void ADDNewRecord(object sender, DirectEventArgs e) { BasicInfoTab.Reset(); //Reset all values of the relative object this.EditRecordWindow.Title = Resources.Common.AddNewRecord; date.SelectedDate = effectiveDate.SelectedDate = DateTime.Now; panelRecordDetails.ActiveIndex = 0; SetTabPanelEnable(false); FillLoanType(); //FillBranchField(); FillCurrency(); RecordRequest req1 = new RecordRequest(); req1.RecordID = _systemService.SessionHelper.GetEmployeeId(); RecordResponse <MyInfo> r = _selfServiceService.ChildGetRecord <MyInfo>(req1); if (!r.Success)//it maybe be another condition { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(r); return; } branchId.Select(r.result.branchId); effectiveDate.ReadOnly = false; this.EditRecordWindow.Show(); }
protected void ADDNewJI(object sender, DirectEventArgs e) { //Reset all values of the relative object EditJobInfoTab.Reset(); this.EditJobInfoWindow.Title = Resources.Common.AddNewRecord; FillDivision(); FillDepartment(); FillBranch(); FillPosition(); date.SelectedDate = DateTime.Today; RecordRequest request = new RecordRequest(); request.RecordID = CurrentEmployee.Text; RecordResponse <Employee> qv = _employeeService.Get <Employee>(request); departmentId.Select(qv.result.departmentId); branchId.Select(qv.result.branchId); divisionId.Select(qv.result.divisionId); positionId.Select(qv.result.positionId); reportToId.Select(qv.result.reportToId); if (!string.IsNullOrEmpty(TotalJIRecords.Text)) { if (TotalJIRecords.Text == "0") { if (qv.result.hireDate != null) { date.SelectedDate = (DateTime)qv.result.hireDate; } } } this.EditJobInfoWindow.Show(); }
protected void PoPuP(object sender, DirectEventArgs e) { int id = Convert.ToInt32(e.ExtraParams["id"]); string type = e.ExtraParams["type"]; switch (type) { case "imgEdit": //Step 1 : get the object from the Web Service RecordRequest r = new RecordRequest(); r.RecordID = id.ToString(); RecordResponse <TransactionLog> log = _systemService.ChildGetRecord <TransactionLog>(r); string x = ""; try { JObject json = JObject.Parse(log.result.data); string formatted = json.ToString(); x = formatted; } catch { x = log.result.data; } log.result.data = x; logBodyForm.SetValues(log.result); logBodyScreen.Show(); break; default: break; } }
public void RejectRecord(string index) { try { //Step 1 Code to delete the object from the database RecordRequest req = new RecordRequest(); req.RecordID = index; RecordResponse <DashBoardTimeVariation> r = _timeAttendanceService.ChildGetRecord <DashBoardTimeVariation>(req); //Step 1 Selecting the object or building up the object for update purpose if (!r.Success) { Common.errorMessage(r); return; } else { RejectTimeVariationc rejectObject = new RejectTimeVariationc(); rejectObject.clockDuration = r.result.clockDuration; rejectObject.damageLevel = r.result.damageLevel; rejectObject.date = r.result.date; rejectObject.dayId = r.result.dayId; rejectObject.dtFrom = r.result.dtFrom; rejectObject.dtTo = r.result.dtTo; rejectObject.duration = r.result.duration; rejectObject.employeeId = r.result.employeeId; rejectObject.recordId = r.result.recordId; rejectObject.shiftId = r.result.shiftId; rejectObject.timeCode = r.result.timeCode; rejectObject.justification = r.result.justification; rejectObject.apId = r.result.apId; PostRequest <RejectTimeVariationc> rejReq = new PostRequest <RejectTimeVariationc>(); rejReq.entity = rejectObject; rejReq.entity.apStatus = -1; PostResponse <RejectTimeVariationc> rejResp = _timeAttendanceService.ChildAddOrUpdate <RejectTimeVariationc>(rejReq); Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordUpdatedSucc }); } Store1.Reload(); } catch (Exception ex) { //In case of error, showing a message box to the user X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show(); } }
protected void PoPuP(object sender, DirectEventArgs e) { int id = Convert.ToInt32(e.ExtraParams["id"]); string type = e.ExtraParams["type"]; switch (type) { case "ColName": //Step 1 : get the object from the Web Service panelRecordDetails.ActiveIndex = 0; RecordRequest r = new RecordRequest(); r.RecordID = id.ToString(); RecordResponse <VacationSchedule> response = _branchService.ChildGetRecord <VacationSchedule>(r); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, response.Summary).Show(); return; } //Step 2 : call setvalues with the retrieved object this.BasicInfoTab.SetValues(response.result); VacationPeriodsListRequest req = new VacationPeriodsListRequest(); req.VacationScheduleId = r.RecordID; ListResponse <VacationSchedulePeriod> periods = _branchService.ChildGetAll <VacationSchedulePeriod>(req); periodsGrid.Store[0].DataSource = periods.Items; periodsGrid.Store[0].DataBind(); periodsGrid.DataBind(); // InitCombos(response.result); this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "colDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "colAttach": //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
protected void PoPuP(object sender, DirectEventArgs e) { string id = e.ExtraParams["id"]; string type = e.ExtraParams["type"]; CurrentFunctionId.Text = id; switch (type) { case "imgEdit": //Step 1 : get the object from the Web Service RecordRequest r = new RecordRequest(); r.RecordID = id; RecordResponse <PayrollFunction> response = _payrollService.ChildGetRecord <PayrollFunction>(r); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(response); return; } //Step 2 : call setvalues with the retrieved object this.BasicInfoTab.SetValues(response.result); FillFUNConstStore(e.ExtraParams["id"]); FunConstGridPanel.Enable(); this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "imgDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "imgAttach": //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
protected void DayPilotScheduler1_EventClick(object sender, DayPilot.Web.Ui.Events.EventClickEventArgs e) { RecordRequest r = new RecordRequest(); r.RecordID = e.Id; leaveRequest1.Update(e.Id); }
private DayType GetDayType(string id) { RecordRequest req = new RecordRequest(); req.RecordID = id; RecordResponse <DayType> day = _branchService.ChildGetRecord <DayType>(req); return(day.result); }
protected void PoPuP(object sender, DirectEventArgs e) { panelRecordDetails.ActiveIndex = 0; conditionsGrid.Disabled = false; messagesGrid.Disabled = false; string id = e.ExtraParams["id"]; string type = e.ExtraParams["type"]; switch (type) { case "imgEdit": //Step 1 : get the object from the Web Service RecordRequest r = new RecordRequest(); r.RecordID = id; RecordResponse <Model.Company.Structure.Rule> response = _companyStructureService.ChildGetRecord <Model.Company.Structure.Rule>(r); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(response); return; } //Step 2 : call setvalues with the retrieved object this.BasicInfoTab.SetValues(response.result); expressionCombo1.setExpression(response.result.expressionId); currentRuId.Text = id; FillConditionStore(); FillMessageStore(); this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "imgDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "imgAttach": //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
protected void PoPuPBC(object sender, DirectEventArgs e) { int id = Convert.ToInt32(e.ExtraParams["id"]); string type = e.ExtraParams["type"]; string path = e.ExtraParams["path"]; switch (type) { case "imgEdit": RecordRequest r2 = new RecordRequest(); r2.RecordID = id.ToString(); RecordResponse <EmployeeBackgroundCheck> response2 = _employeeService.ChildGetRecord <EmployeeBackgroundCheck>(r2); if (!response2.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, response2.Summary).Show(); return; } //Step 2 : call setvalues with the retrieved object this.EditBCTab.SetValues(response2.result); FillBCCheckType(); ctId.Select(response2.result.ctId.ToString()); this.EditBCWindow.Title = Resources.Common.EditWindowsTitle; this.EditBCWindow.Show(); break; case "imgDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteBC({0},'{1}')", id, path), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "imgAttach": DownloadFile(path); break; case "imgDeleteAttach": DeleteFile(path, id); BCStore.Reload(); //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
protected void PoPuP(object sender, DirectEventArgs e) { string id = e.ExtraParams["id"]; string type = e.ExtraParams["type"]; X.Call("clearMap"); switch (type) { case "imgEdit": //Step 1 : get the object from the Web Service RecordRequest r = new RecordRequest(); r.RecordID = id; FillBranch(); RecordResponse <Geofence> response = _timeAttendanceService.ChildGetRecord <Geofence>(r); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(response); return; } FillGeofenceOnMap(response.result); //Step 2 : call setvalues with the retrieved object this.BasicInfoTab.SetValues(response.result); //recordId.Text = id; branchId.Select(response.result.branchId.ToString()); this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "imgDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord('{0}')", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "colAttach": //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
protected void PoPuP(object sender, DirectEventArgs e) { PropertiesGrid.Disabled = false; int id = Convert.ToInt32(e.ExtraParams["id"]); string type = e.ExtraParams["type"]; currentCategory.Text = id.ToString(); PropertiesStore.Reload(); panelRecordDetails.ActiveIndex = 0; switch (type) { case "imgEdit": //Step 1 : get the object from the Web Service RecordRequest r = new RecordRequest(); r.RecordID = id.ToString(); RecordResponse <AssetManagementCategory> response = _assetManagementService.ChildGetRecord <AssetManagementCategory>(r); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(response); return; } //Step 2 : call setvalues with the retrieved object FillParent(); //ApprovalStore.Reload(); this.BasicInfoTab.SetValues(response.result); this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "imgDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "imgAttach": //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
protected void PoPuP(object sender, DirectEventArgs e) { int id = Convert.ToInt32(e.ExtraParams["id"]); string type = e.ExtraParams["type"]; switch (type) { case "ColName": //Step 1 : get the object from the Web Service RecordRequest r = new RecordRequest(); r.RecordID = id.ToString(); RecordResponse <Employee> response = _employeeService.Get <Employee>(r); BasicInfoTab.Reset(); picturePath.Clear(); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, response.Summary).Show(); return; } //Step 2 : call setvalues with the retrieved object this.BasicInfoTab.SetValues(response.result); FillNameFields(response.result.name); InitCombos(); SelectCombos(response.result); //timeZoneCombo.Select(response.result.timeZone.ToString()); this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "colDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "colAttach": //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
public void UpdateStateParkCells(RecordRequest record) { // ALQU DIS ParkCells parkcell = db.ParkCells.Find(record.idCell); parkcell.state = "OCUP"; parkcell.license = record.license; db.Entry(parkcell).State = EntityState.Modified; db.SaveChanges(); }
private async Task <RecordResponse> CreateRecordAsync(string context) { var request = new RecordRequest { RecordType = "TXT", Name = "", Content = context }; return(await _dnSimpleClient.Records.CreateRecordByDomainNameAsync(MockDomainName, request)); }
protected void PoPuP(object sender, DirectEventArgs e) { string id = e.ExtraParams["id"]; string type = e.ExtraParams["type"]; switch (type) { case "ColName": //Step 1 : get the object from the Web Service RecordRequest r = new RecordRequest(); r.RecordID = id; RecordResponse <CertificateLevel> response = _employeeService.ChildGetRecord <CertificateLevel>(r); if (!response.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, response.Summary).Show(); return; } //Step 2 : call setvalues with the retrieved object this.BasicInfoTab.SetValues(response.result); this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle; this.EditRecordWindow.Show(); break; case "colDelete": X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { //We are call a direct request metho for deleting a record Handler = String.Format("App.direct.DeleteRecord({0})", id), Text = Resources.Common.Yes }, No = new MessageBoxButtonConfig { Text = Resources.Common.No } }).Show(); break; case "colAttach": //Here will show up a winow relatice to attachement depending on the case we are working on break; default: break; } }
public void UpdateStateParkCellsQuit(RecordRequest record, int id) { // ALQU DIS ParkCells parkcell = db.ParkCells.Find(record.idCell); Record rq = db.Record.Find(id); rq.timeOut = DateTime.UtcNow.ToLocalTime(); parkcell.state = "DISP"; parkcell.license = null; db.Entry(parkcell).State = EntityState.Modified; db.Entry(rq).State = EntityState.Modified; db.SaveChanges(); }
public string GetLinkEditorEdit([FromUri] RecordRequest recordRequest) { var conn = new InforConnection(tu: _tu, tup: _tup); var id = recordRequest.Id; var ip = Request.UserHostName; var compName = Classes.Helpers.DetermineCompName(ip); var fileName = conn.GetRecordDocumentWeb((long)id, true, AppUserState.UserName, AppUserState.Wgs, AppUserState.Ds).ToLower(); return(fileName); }
public StatusResponse Delete <T>(RecordRequest request) { StatusResponse response = new StatusResponse(); var headers = SessionHelper.GetAuthorizationHeadersForUser(); Dictionary <string, string> queryParams = new Dictionary <string, string>(); queryParams.Add("_recordId", request.RecordID); var webResponse = GetRepository().Delete(headers, queryParams); response = CreateServiceResponse <StatusResponse>(webResponse); return(response); }
public override RecordResponse <T> Get <T>(RecordRequest request) { RecordResponse <T> f = base.Get <T>(request); if (f != null && f.result != null) { if (string.IsNullOrEmpty(((f.result) as Employee).pictureUrl)) { ((f.result) as Employee).pictureUrl = "images/empPhoto.jpg"; } } return(f); }
public Invoice QuitRecord(RecordRequest rq) { Record recordReturn = new Record(); Invoice invoice = new Invoice(); try { int id = idrecordwithplaca(rq); Record record = db.Record.Find(id); Price price = db.Price.Find(rq.idprice); record.timeEntry = record.timeEntry; record.timeOut = DateTime.UtcNow.ToLocalTime(); decimal valor = 0; int diferenciadias = record.timeOut.Value.Day - record.timeEntry.Day; int diferenciaHoras = record.timeOut.Value.Hour - record.timeEntry.Hour; int diferenciaminutos = record.timeOut.Value.Minute - record.timeEntry.Minute; diferenciaHoras = diferenciaHoras * 60; if (diferenciadias == 0) { decimal value = price.valueMinute; valor = Convert.ToDecimal(diferenciaminutos + diferenciaHoras) * value; } else if (record.timeOut > record.timeEntry) { diferenciadias = (24 * 60) * diferenciadias; decimal value = price.valueMinute; valor = Convert.ToDecimal(diferenciaminutos + diferenciaHoras) * value; } else { diferenciaHoras = record.timeEntry.Hour - record.timeOut.Value.Hour; diferenciaminutos = record.timeEntry.Minute - record.timeOut.Value.Minute; diferenciadias = (24 * 60) * diferenciadias; decimal value = price.valueMinute; valor = Convert.ToDecimal(diferenciaminutos + diferenciaHoras) * value; } invoice.ValorPago = valor; invoice.HoraEntrada = record.timeEntry; invoice.HoraSalida = DateTime.UtcNow.ToLocalTime(); UpdateStateParkCellsQuit(rq, id); } catch (DbEntityValidationException e) { mensaje = "Error retirar vehiculo" + e; } return(invoice); }
public async Task <RecordResult> RecordAsync(RecordRequest request) { // scrape var resultStream = new MemoryStream(); using (var textWriter = new StreamWriter(resultStream, new UTF8Encoding(false), 4096, true)) using (var jsonWriter = new JsonTextWriter(textWriter)) { var writer = new JsonScrapeResultWriter(jsonWriter); await _scraper.RealTimeScrapeAsync(writer); } resultStream.Seek(0, SeekOrigin.Begin); // initialize storage var blobUploadRequest = new UniqueUploadRequest { ConnectionString = request.StorageConnectionString, Container = request.StorageContainer, ContentType = "application/json", PathFormat = request.BlobPathFormat, Stream = resultStream, Trace = TextWriter.Null, UploadDirect = true, EqualsAsync = async x => { var comparer = new ScrapeResultEqualityComparer(); var equals = await comparer.EqualsAsync(x.Stream, resultStream, CancellationToken.None); resultStream.Seek(0, SeekOrigin.Begin); return(equals); } }; // upload UploadResult blobUploadResult; using (resultStream) { blobUploadResult = await _uniqueClient.UploadAsync(blobUploadRequest); } // record status var statusUploadResult = await _statusRecorder.RecordStatusAsync(blobUploadResult, request); return(new RecordResult { BlobUploadResult = blobUploadResult, StatusUploadResult = statusUploadResult }); }
private List <Employee> GetEmployeeByID(string id) { RecordRequest req = new RecordRequest(); req.RecordID = id; List <Employee> emps = new List <Employee>(); RecordResponse <Employee> emp = _employeeService.Get <Employee>(req); emps.Add(emp.result); return(emps); }
public async Task <Stream> GetLatestAsync(RecordRequest request) { var getLatestRequest = new GetLatestRequest { ConnectionString = request.StorageConnectionString, PathFormat = request.BlobPathFormat, Container = request.StorageContainer, Trace = TextWriter.Null }; var result = await _storageClient.GetLatestStreamAsync(getLatestRequest); return(result?.Stream); }