/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator), Id, PlacerAppointmentId?.ToDelimitedString(), FillerAppointmentId?.ToDelimitedString(), OccurrenceNumber.HasValue ? OccurrenceNumber.Value.ToString(Consts.NumericFormat, culture) : null, PlacerGroupNumber?.ToDelimitedString(), ScheduleId?.ToDelimitedString(), EventReason?.ToDelimitedString(), AppointmentReason?.ToDelimitedString(), AppointmentType?.ToDelimitedString(), AppointmentDuration.HasValue ? AppointmentDuration.Value.ToString(Consts.NumericFormat, culture) : null, AppointmentDurationUnits?.ToDelimitedString(), AppointmentTimingQuantity != null ? string.Join(Configuration.FieldRepeatSeparator, AppointmentTimingQuantity.Select(x => x.ToDelimitedString())) : null, PlacerContactPerson?.ToDelimitedString(), PlacerContactPhoneNumber?.ToDelimitedString(), PlacerContactAddress?.ToDelimitedString(), PlacerContactLocation?.ToDelimitedString(), FillerContactPerson?.ToDelimitedString(), FillerContactPhoneNumber?.ToDelimitedString(), FillerContactAddress?.ToDelimitedString(), FillerContactLocation?.ToDelimitedString(), EnteredByPerson?.ToDelimitedString(), EnteredByPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, EnteredByPhoneNumber.Select(x => x.ToDelimitedString())) : null, EnteredByLocation?.ToDelimitedString(), ParentPlacerAppointmentId?.ToDelimitedString(), ParentFillerAppointmentId?.ToDelimitedString(), FillerStatusCode?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public ActionResult DeleteConfirmed(int id) { EventReason eventReason = db.EventReasons.Find(id); db.EventReasons.Remove(eventReason); db.SaveChanges(); return(RedirectToAction("Create")); }
protected ElementEventArgs(Guid correlationId, EventReason reason, IElement subject, UInt64 revision, Object oldValue, Object newValue) { Id = Guid.NewGuid(); Reason = reason; Subject = subject; OldRevision = revision; OldValue = oldValue; NewValue = newValue; }
public AlarmNotifyEventArgs(int id_comp, EventReason reason, DateTime dtReg, int situation) : base() { m_id_comp = id_comp; m_reason = reason; m_dtRegistred = dtReg; m_situation = situation; m_message_shr = GetMessage(id_comp, situation); }
public ActionResult DeleteConfirmed(int id) { EventReason eventReason = db.EventReasons.Find(id); db.EventReasons.Remove(eventReason); db.SaveChanges(); TempData["Success"] = "Event Reasons is deleted Successfully"; return(RedirectToAction("Create")); }
protected ElementEventArgs(Guid correlationId, EventReason reason, IElement subject, UInt64 revision, Object oldValue, Object newValue) { Id = Guid.NewGuid(); Reason = reason; Subject = subject; OldRevision = revision; OldValue = oldValue; NewValue = newValue; }
public CamEvent(int id, string name, string camName, DateTime startTime, DateTime stopTime, EventReason reason, string snapshotData) { Name = name; CamName = camName; Reason = reason; _snapShot = snapshotData; StartTime = startTime; StopTime = stopTime; Id = id; }
public CamEvent(int id, string name, string camName, DateTime startTime, DateTime stopTime, EventReason reason, string snapshotData) { Name = name; CamName = camName; Reason = reason; _snapShot = snapshotData; StartTime = startTime; StopTime = stopTime; Id = id; }
internal void ReportChanged(Guid correlationId, EventReason reason, IElement subject, Object oldValue, Object newValue) { int internalExpositions; using (InternalExpose(out internalExpositions)) { if (internalExpositions != 0 || IsSystemEvent(subject, oldValue, newValue)) { return; } ReportChanged(new ElementChangedEventArgs(correlationId, reason, subject, Revision, oldValue, newValue)); } }
public ActionResult Edit([Bind(Include = "Id,name")] EventReason eventReason) { if (ModelState.IsValid) { db.Entry(eventReason).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Create")); } ViewBag.Status = "Update"; return(View("CreateList", new EventReasonViewModel { EventReasons = db.EventReasons.ToList() })); }
internal void ReportChanged <T1, T2>(Guid correlationId, EventReason reason, IElement subject, Func <T1> oldValue, Func <T2> newValue) { int internalExpositions; using (InternalExpose(out internalExpositions)) { if (internalExpositions != 0 || IsSystemEvent(subject, oldValue, newValue)) { return; } ReportChanged(new ElementChangedEventArgs(correlationId, reason, subject, Revision, (Func <Object>)(() => (Object)oldValue()), (Func <Object>)(() => (Object)newValue()))); } }
// GET: EventReasons/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EventReason eventReason = db.EventReasons.Find(id); if (eventReason == null) { return(HttpNotFound()); } return(View(eventReason)); }
public ActionResult Create([Bind(Include = "Id,name")] EventReason eventReason) { if (ModelState.IsValid) { db.EventReasons.Add(eventReason); db.SaveChanges(); return(RedirectToAction("Create")); } ViewBag.Status = "Add"; return(View("CreateList", new EventReasonViewModel { EventReasons = db.EventReasons.ToList() })); }
internal Guid ReportChanging(EventReason reason, IElement subject, Object oldValue, Object newValue) { var corrId = Guid.NewGuid(); int internalExpositions; using (InternalExpose(out internalExpositions)) { if (internalExpositions != 0 || IsSystemEvent(subject, oldValue, newValue)) { return(corrId); } ReportChanging(new ElementChangingEventArgs(corrId, reason, subject, Revision, oldValue, newValue)); return(corrId); } }
public ActionResult Edit([Bind(Include = "Id,name")] EventReason eventReason) { if (ModelState.IsValid) { db.Entry(eventReason).State = EntityState.Modified; db.SaveChanges(); TempData["Success"] = "Event Reasons has been Updated Successfully"; return(RedirectToAction("Create")); } TempData["Fail"] = "Enter fields properly"; ViewBag.Status = "Update"; return(View("CreateList", new EventReasonViewModel { EventReasons = db.EventReasons.ToList() })); }
internal Guid ReportChanging <T1, T2>(EventReason reason, IElement subject, Func <T1> oldValue, Func <T2> newValue) { var corrId = Guid.NewGuid(); int internalExpositions; using (InternalExpose(out internalExpositions)) { if (internalExpositions != 0 || IsSystemEvent(subject, oldValue, newValue)) { return(corrId); } ReportChanging(new ElementChangingEventArgs(corrId, reason, subject, Revision, (Func <Object>)(() => (Object)oldValue()), (Func <Object>)(() => (Object)newValue()))); return(corrId); } }
// GET: EventReasons/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EventReason eventReason = db.EventReasons.Find(id); if (eventReason == null) { return(HttpNotFound()); } ViewBag.Status = "Update"; return(View("CreateList", new EventReasonViewModel { eventReason = eventReason, EventReasons = db.EventReasons.ToList() })); }
public OperatorEventInfo(string operatorNumber, EventReason reason, string hostName) { this.OperatorNumber = operatorNumber; this.Reason = reason; this.HostInfo = new HostInfo {HostName = hostName}; }
public LoadedSourceEventBody(EventReason reason, Source source) { Reason = reason; Source = source; }
public ValueChangedEventArgs(Guid correlationId, EventReason reason, IValue subject, UInt64 revision, Object oldValue, Object newValue) : base(correlationId, reason, subject, revision, oldValue, newValue) { }
/// <summary> /// <para>The event indicates that some information about a breakpoint has changed.</para> /// </summary> /// <param name="reason"> /// <para>The reason for the event.</para> /// <para>Values: 'changed', 'new', 'removed', etc.</para> /// </param> /// <param name="breakpoint"> /// <para>The 'id' attribute is used to find the target breakpoint and the other attributes are used as the new values.</para> /// </param> public static void SendBreakpointEvent(this ProtocolServer server, EventReason reason, Breakpoint breakpoint) { BreakpointEvent breakpointEvent = new BreakpointEvent(new BreakpointEvent.BreakpointEventBody(reason, breakpoint)); server.SendMessage(breakpointEvent); }
public ModuleEventBody(EventReason reason, Module module) { Reason = reason; Module = module; }
public ActionResult Index(UploadFile UploadFile) { if (ModelState.IsValid) { if (UploadFile.ExcelFile.ContentLength > 0) { if (UploadFile.ExcelFile.FileName.EndsWith(".xlsx") || UploadFile.ExcelFile.FileName.EndsWith(".xls")) { XLWorkbook Workbook; try { Workbook = new XLWorkbook(UploadFile.ExcelFile.InputStream); } catch (Exception ex) { ModelState.AddModelError(String.Empty, $"Check your file. {ex.Message}"); return(View()); } IXLWorksheet WorkSheet = null; try { WorkSheet = Workbook.Worksheet(1); } catch (Exception ex) { ex.StackTrace.ToArray(); ModelState.AddModelError(String.Empty, "sheet1 not found!"); return(View()); } try { var count = WorkSheet.Columns().Count(); if (count < 37) { ModelState.AddModelError(String.Empty, "File data not same as sample file shown in above image"); return(View()); } } catch (Exception e) { } WorkSheet.FirstRow().Delete();//if you want to remove ist row var x = 1; foreach (var row in WorkSheet.RowsUsed()) { Debug.Print(row.Cell(1).Value.ToString() + "------"); try { int empId = Convert.ToInt32(row.Cell(1).Value.ToString()); context.Configuration.AutoDetectChangesEnabled = false; context.Configuration.ValidateOnSaveEnabled = false; if (context.Users.FirstOrDefault(u => u.EmployeeId == empId) == null) { ApplicationUser user = new ApplicationUser(); user.EmployeeId = Convert.ToInt32(row.Cell(1).Value.ToString()); user.FirstName = row.Cell(2).Value.ToString(); user.MiddleName = row.Cell(3).IsEmpty() ? null : row.Cell(3).Value.ToString(); user.LastName = row.Cell(4).Value.ToString(); user.UserName = "******" + user.EmployeeId + "*****@*****.**"; var departmentname = row.Cell(5).Value.ToString().Contains("Operations") ? "Operations" : row.Cell(5).Value.ToString(); Department department = context.Departments.Where(m => m.name == departmentname) .SingleOrDefault(); if (department == null) { Department dp = new Department(); dp.name = departmentname; //dp.departmntNumber = departmentId; context.Departments.Add(dp); context.SaveChanges(); user.DepartmentId = dp.Id; //context.SaveChanges(); } else { user.DepartmentId = department.Id; // context.SaveChanges(); } var costcentercode = row.Cell(6).IsEmpty() ? null : row.Cell(6).Value.ToString(); var costcentername = row.Cell(7).Value.ToString(); CostCenter costCenter = context.CostCenters.Where(m => m.name == costcentername) .SingleOrDefault(); if (costCenter == null) { CostCenter cs = new CostCenter(); cs.name = costcentername; cs.CostCenterCode = costcentercode; context.CostCenters.Add(cs); context.SaveChanges(); user.CostCenterId = cs.Id; } else { user.CostCenterId = costCenter.Id; } // user.EmployeeHireDate = row.Cell(8).GetDateTime(); var nationalityname = row.Cell(9).Value.ToString(); Nationality nationality = context.Nationalities.Where(m => m.name == nationalityname) .SingleOrDefault(); if (nationality == null) { Nationality ps = new Nationality(); ps.name = nationalityname; context.Nationalities.Add(ps); context.SaveChanges(); user.NationalityId = ps.Id; //context.SaveChanges(); } else { user.NationalityId = nationality.Id; //context.SaveChanges(); } // user.EmployeeFireDate = row.Cell(10).GetDateTime(); user.EmployeeStatus = row.Cell(11).IsEmpty() ? null : row.Cell(11).Value.ToString(); var eventreason = row.Cell(12).Value.ToString(); EventReason eventReason = context.EventReasons.Where(m => m.name == eventreason) .SingleOrDefault(); if (eventReason == null) { EventReason ev = new EventReason(); ev.name = eventreason; context.EventReasons.Add(ev); context.SaveChanges(); user.EventReasonId = ev.Id; //context.SaveChanges(); } else { user.EventReasonId = eventReason.Id; //context.SaveChanges(); } var locationId = row.Cell(13).Value.ToString(); Location location = context.Locations.Where(m => m.name == locationId) .SingleOrDefault(); if (location == null) { Location lc = new Location(); lc.name = locationId; context.Locations.Add(lc); context.SaveChanges(); user.LocationId = lc.Id; //context.SaveChanges(); } else { user.LocationId = location.Id; // context.SaveChanges(); } var locationgroupId = row.Cell(14).Value.ToString(); LocationGroup locationgrp = context.LocationGroups.Where(m => m.name == locationgroupId) .SingleOrDefault(); if (locationgrp == null) { LocationGroup lc = new LocationGroup(); lc.name = locationgroupId; context.LocationGroups.Add(lc); context.SaveChanges(); user.LocationGroupId = lc.Id; //context.SaveChanges(); } else { user.LocationGroupId = locationgrp.Id; // context.SaveChanges(); } var jobtitlename = row.Cell(15).Value.ToString(); JobTitle jobTitle = context.JobTitles.Where(m => m.name == jobtitlename) .SingleOrDefault(); if (jobTitle == null) { JobTitle jb = new JobTitle(); jb.name = jobtitlename; context.JobTitles.Add(jb); context.SaveChanges(); user.JobTitleId = jb.Id; //context.SaveChanges(); } else { user.JobTitleId = jobTitle.Id; // context.SaveChanges(); } user.GOSINumber = row.Cell(16).IsEmpty() ? null : row.Cell(16).Value.ToString(); user.saudiNationalId = row.Cell(17).IsEmpty() ? null : row.Cell(17).Value.ToString(); user.saudiResidentialId = row.Cell(18).IsEmpty() ? null : row.Cell(18).Value.ToString(); var employeeclass = row.Cell(19).Value.ToString(); EmployeeClass employeeClass = context.employeeClasses .Where(m => m.name == employeeclass).SingleOrDefault(); if (employeeClass == null) { EmployeeClass ec = new EmployeeClass(); ec.name = employeeclass; context.employeeClasses.Add(ec); context.SaveChanges(); user.EmployeeClassId = ec.Id; //context.SaveChanges(); } else { user.EmployeeClassId = employeeClass.Id; // context.SaveChanges(); } var ethincity = row.Cell(20).Value.ToString(); Ethnicity ethnicity = context.Ethnicities.Where(m => m.name == ethincity) .SingleOrDefault(); if (ethnicity == null) { Ethnicity ec = new Ethnicity(); ec.name = ethincity; context.Ethnicities.Add(ec); context.SaveChanges(); user.EthincityId = ec.Id; //context.SaveChanges(); } else { user.EthincityId = ethnicity.Id; // context.SaveChanges(); } user.HasSwipeAccess = row.Cell(21).Value.ToString().Equals("No Swipe Access") ? false : true; user.bussinessPhoneNumber = row.Cell(22).IsEmpty() ? null : row.Cell(22).Value.ToString(); user.homePhoneNumber = row.Cell(23).IsEmpty() ? null : row.Cell(23).Value.ToString(); user.cellPhoneNumber = row.Cell(24).IsEmpty() ? null : row.Cell(24).Value.ToString(); ; user.otherPhoneNumber = row.Cell(25).IsEmpty() ? null : row.Cell(25).Value.ToString(); var payscalename = row.Cell(26).Value.ToString(); PayScaleType payscale = context.PayScaleTypes.Where(m => m.name == payscalename) .SingleOrDefault(); if (payscale == null) { PayScaleType ps = new PayScaleType(); ps.name = payscalename; context.PayScaleTypes.Add(ps); context.SaveChanges(); user.PayScaleTypeId = ps.Id; //context.SaveChanges(); } else { user.PayScaleTypeId = payscale.Id; //context.SaveChanges(); } var religionname = row.Cell(27).Value.ToString(); Religion religion = context.Religions.Where(m => m.name == religionname) .SingleOrDefault(); if (religion == null) { Religion ps = new Religion(); ps.name = religionname.Equals(null) ? "Others" : religionname; context.Religions.Add(ps); context.SaveChanges(); user.ReligionId = ps.Id; //context.SaveChanges(); } else { user.ReligionId = religion.Id; //context.SaveChanges(); } user.personalInfoString = row.Cell(28).IsEmpty() ? null : row.Cell(28).Value.ToString(); ; //user.DOB = row.Cell(29).GetDateTime(); var gendername = row.Cell(30).Value.ToString(); Gender gender = context.Genders.Where(m => m.name == gendername).SingleOrDefault(); if (gender == null) { Gender gn = new Gender(); gn.name = gendername; context.Genders.Add(gn); context.SaveChanges(); user.GenderId = gn.Id; //context.SaveChanges(); } else { user.GenderId = gender.Id; //context.SaveChanges(); } user.otherEmail = row.Cell(31).IsEmpty() ? null : row.Cell(31).Value.ToString(); user.bussinessEmail = row.Cell(32).IsEmpty() ? null : row.Cell(32).Value.ToString(); user.personalEmail = row.Cell(33).IsEmpty() ? null : row.Cell(33).Value.ToString(); var employertypename = row.Cell(34).Value.ToString(); EmployerType employerType = context.employerTypes.Where(m => m.name == employertypename) .SingleOrDefault(); if (employerType == null) { EmployerType ty = new EmployerType(); ty.name = employertypename; context.employerTypes.Add(ty); context.SaveChanges(); user.EmployerTypeId = ty.Id; //context.SaveChanges(); } else { user.EmployerTypeId = employerType.Id; //context.SaveChanges(); } var vendorname = row.Cell(35).Value.ToString(); Vendor vendor = context.vendors.Where(m => m.name == vendorname).SingleOrDefault(); if (vendor == null) { Vendor vn = new Vendor(); vn.name = vendorname; context.vendors.Add(vn); context.SaveChanges(); user.VendorId = vn.Id; //context.SaveChanges(); } else { user.VendorId = vendor.Id; //context.SaveChanges(); } user.outSourcedId = row.Cell(36).IsEmpty() ? null : row.Cell(36).Value.ToString(); var bandname = row.Cell(37).Value.ToString(); Band band = context.bands.Where(m => m.name == bandname).SingleOrDefault(); if (band == null) { Band bnd = new Band(); bnd.name = bandname; context.bands.Add(bnd); context.SaveChanges(); user.BandId = bnd.Id; //context.SaveChanges(); } else { user.BandId = band.Id; //context.SaveChanges(); } context.Users.Add(user); try { context.SaveChanges(); } catch (DbEntityValidationException ex) { Debug.WriteLine(ex.Message); } } else { Debug.Print("Employee exists " + row.Cell(1).Value.ToString()); } } catch (Exception e) { Debug.Print(e.InnerException + "File row issue" + e.StackTrace); ModelState.AddModelError(String.Empty, "Something went wrong while processing row " + (Convert.ToInt32(x) + 1) + ".Employees data till that row has been stored."); return(View()); } x++; } } else { ModelState.AddModelError(String.Empty, "Only .xlsx and .xls files are allowed"); return(View()); } } else { ModelState.AddModelError(String.Empty, "Not a valid file"); return(View()); } } TempData["success"] = "File uploaded successfully"; return(View()); }
public AlarmTecViewEventArgs(int id_comp, EventReason r, DateTime dtReg, int s, List <EventDetail> listEventDetail) : base(id_comp, r, dtReg, s) { m_listEventDetail = listEventDetail; }
public CumulativeOperation(IBranch host, IElement subject, EventReason reason) { Host = host; Subject = subject; Reason = reason; }
public BreakpointEventBody(EventReason reason, Breakpoint breakpoint) { Reason = reason; Breakpoint = breakpoint; }
/// <summary> /// <para>The event indicates that some information about a module has changed.</para> /// </summary> /// <param name="eventReason"><para>The reason for the event.</para></param> /// <param name="module"><para>The new, changed, or removed module. In case of 'removed' only the module id is used.</para></param> public static void SendModuleEvent(this ProtocolServer server, EventReason eventReason, Module module) { ModuleEvent moduleEvent = new ModuleEvent(new ModuleEvent.ModuleEventBody(eventReason, module)); server.SendMessage(moduleEvent); }
public OperatorEventInfo(string operatorNumber, EventReason reason, IHostInfo hostInfo) { this.OperatorNumber = operatorNumber; this.Reason = reason; this.HostInfo = hostInfo; }
/// <summary> /// <para>The event indicates that some source has been added, changed, or removed from the set of all loaded sources.</para> /// </summary> /// <param name="reason"><para>The reason for the event.</para></param> /// <param name="source"><para>The new, changed, or removed source.</para></param> public static void SendLoadedSourceEvent(this ProtocolServer server, EventReason reason, Source source) { LoadedSourceEvent loadedSourceEvent = new LoadedSourceEvent(new LoadedSourceEvent.LoadedSourceEventBody(reason, source)); server.SendMessage(loadedSourceEvent); }
// no possibility to cancel, because often cancelling a modification would leave system in inconsistent state // however, if the change is inappropriate, you can always throw an exception public ElementChangingEventArgs(Guid correlationId, EventReason reason, IElement subject, UInt64 revision, Object oldValue, Object newValue) : base(correlationId, reason, subject, revision, oldValue, newValue) { }
public ValueChangingEventArgs(Guid correlationId, EventReason reason, IValue subject, UInt64 revision, Object oldValue, Object newValue) : base(correlationId, reason, subject, revision, oldValue, newValue) { }
public ElementChangedEventArgs(Guid correlationId, EventReason reason, IElement subject, UInt64 revision, Object oldValue, Object newValue) : base(correlationId, reason, subject, revision, oldValue, newValue) { }