/// <summary> /// /// </summary> /// <param name="id">ID of tech</param> /// <returns>Tech with matching ID</returns> public static Technician CreateTechnician(int id) { var tech = new Technician(); using (var cn = new MySqlConnection(Global.ConnectionString())) { cn.Open(); using (var cmd = cn.CreateCommand()) { cmd.Parameters.AddWithValue("@techID", id); cmd.CommandText = "select * from Technicians where ID = @techID"; using(var dr = cmd.ExecuteReader()) { if(dr.Read()) { tech.ID = id; tech.Name = dr["Name"].ToString(); } else { //TODO: no tech found. } } } } return tech; }
static void Main(string[] args) { // DBRepository<Technician> techrepo = new DBRepository<Technician>(); ServiceCRMClient client = new ServiceCRMClient(); Technician technician = new Technician(); technician.TechnicianID = 1; client.AddCustomer("firstname", "email", "lastname", "password","username", technician); }
public static bool TryCreateTechnician(string alias, string fullName, string telNumber) { bool isCreated = false; if (alias == "" || fullName == "" || telNumber == "") return isCreated; using (var db = new RepairCenterModelFirstContainer()) { Technician newTech = new Technician() { Alias = alias, FullName = fullName, TelephoneNumber = telNumber, Status = TechnicianStatus.Free }; db.Technicians.Add(newTech); db.SaveChanges(); isCreated = true; //\(?\d{3}\)?-? *\d{3}-? *-?\d{4} } return isCreated; }
public static Technician GetSpecificTech(int techID) { Technician returnTech = new Technician(); SqlConnection connection = TechSupportDBConnection.GetConnection(); string selectStatement = "SELECT TechID, Name, Email, Phone " + "FROM Technicians WHERE TechID = @TechID"; SqlCommand selectCommand = new SqlCommand(selectStatement, connection); selectCommand.Parameters.AddWithValue("@TechID", techID); try { connection.Open(); SqlDataReader reader = selectCommand.ExecuteReader(CommandBehavior.SingleRow); if (reader.Read()) { returnTech.TechID = (int)reader["TechID"]; returnTech.Name = reader["Name"].ToString(); returnTech.Email = reader["Email"].ToString(); returnTech.Phone = reader["Phone"].ToString(); } else { returnTech = null; } reader.Close(); } catch (SqlException ex) { throw ex; } finally { connection.Close(); } return returnTech; }
public Card(string name) { this.name = name; if(!name.ToLower().Equals("no counter")) { string[] card = name.Split('_'); Character temp; num = int.Parse(card[1]); if (card[0].Equals("cardHero")) { temp = new Hero(); makeCard(temp.cards[num]); } else if (card[0].Equals("cardLuchador")) { temp = new Luchador(); makeCard(temp.cards[num]); } else if (card[0].Equals("cardBrawler")) { temp = new Brawler(); makeCard(temp.cards[num]); } else if (card[0].Equals("cardGiant")) { temp = new Giant(); makeCard(temp.cards[num]); } else if (card[0].Equals("cardTechnician")) { temp = new Technician(); makeCard(temp.cards[num]); } } }
partial void InsertTechnician(Technician instance);
public static Technician ToEntity(this TechnicianModel model, Technician destination) { return(model.MapTo(destination)); }
public RentCarService(IDbContext context, Technician technician) { this.context = context; this.technician = technician; }
public IActionResult Delete(Technician technician) { Context.Technicians.Remove(technician); Context.SaveChanges(); return(RedirectToAction("List", "Technician")); }
public void Update(Technician technician) { DAOFactory.GetTechnicianDAO().Update(technician); }
public ActionResult Edit(Technician technician) { _db.Entry(technician).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Details", new { id = technician.TechnicianId })); }
private void btnTechnician_Click(object sender, EventArgs e) { Technician form = new Technician(); showForm(form); }
public ActionResult Create() { var technician = new Technician { IsNew = true }; _technicianRepository.InsertAndCommit(technician); return Json(new { Id = technician.Id }); }
public static List<Technician> GetAllTechnicians() { var result = new List<Technician>(); using (var cn = new MySqlConnection(Global.ConnectionString())) { cn.Open(); using (var cmd = cn.CreateCommand()) { cmd.CommandText = "select * from Technicians order by ID"; using (var dr = cmd.ExecuteReader()) { while (dr.Read()) { var tempTech = new Technician() { ID = (int)dr["ID"], Name = dr["Name"] as string ?? "" }; result.Add(tempTech); } } } } return result; }
public static List<Technician> GetTechnician() { List<Technician> techList = new List<Technician>(); string selectStatement = "SELECT TechID, Name, Email, Phone " + "FROM Technicians " + "ORDER BY Name"; try { using (SqlConnection connection = TechSupportDBConnection.GetConnection()) { try { connection.Open(); } catch (SqlException ex) { throw ex; } using (SqlCommand selectCommand = new SqlCommand(selectStatement, connection)) using (SqlDataReader reader = selectCommand.ExecuteReader()) { int techNameOrd = reader.GetOrdinal("Name"); while (reader.Read()) { Technician tech = new Technician(); tech.TechID = (int)reader["TechID"]; tech.Name = reader.GetString(techNameOrd); techList.Add(tech); } connection.Close(); } } } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } return techList; }
partial void DeleteTechnician(Technician instance);
public FrmTechnicalComputers(Technician tech) { InitializeComponent(); this.tech = tech; this.showIndex = 2; }
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user // Attempt to register the user try { string confirmationToken = WebSecurity.CreateUserAndAccount(model.UserName, model.Password, new { Email = model.Email }, true); SendEmailConfirmation(model.Email, model.UserName, confirmationToken); if (model.SelectedVal.Contains("0")) { UserProfile userProfile = db.UserProfiles.FirstOrDefault(s => s.UserName == model.UserName); Student student = new Student { FirstName = model.FirstName, LastName = model.LastName, MiddleName = model.MiddleName, UserProfile = userProfile }; userProfile.UserType = "Student"; if (ModelState.IsValid) { db.Entry <UserProfile>(userProfile).State = EntityState.Modified; db.Students.Add(student); db.SaveChanges(); } } // if dropdown list for supervisor is selected then do the below else if (model.SelectedVal.Contains("1")) { UserProfile userProfile = db.UserProfiles.FirstOrDefault(s => s.UserName == model.UserName); userProfile.Email = userProfile.Email.ToLower(); Supervisor supervisor = new Supervisor { FirstName = model.FirstName, LastName = model.LastName, MiddleName = model.MiddleName, UserProfile = userProfile }; userProfile.UserType = "Supervisor"; if (ModelState.IsValid) { db.Entry <UserProfile>(userProfile).State = EntityState.Modified; db.Supervisors.Add(supervisor); db.SaveChanges(); } } else if (model.SelectedVal.Contains("2")) { UserProfile userProfile = db.UserProfiles.FirstOrDefault(s => s.UserName == model.UserName); Technician technician = new Technician { FirstName = model.FirstName, LastName = model.LastName, MiddleName = model.MiddleName, UserProfile = userProfile }; userProfile.UserType = "Technician"; if (ModelState.IsValid) { db.Entry <UserProfile>(userProfile).State = EntityState.Modified; db.Technicians.Add(technician); db.SaveChanges(); } } return(RedirectToAction("RegisterStepTwo", "Account")); } catch (MembershipCreateUserException e) { ModelState.AddModelError("", ErrorCodeToString(e.StatusCode)); } } // redisplay form, something is wrong if we got this far return(View(model)); }
public static List<Technician> GetTechsWithOpenIncidents() { List<Technician> techList = new List<Technician>(); //string selectStatement = "SELECT Technicians.TechID, Technicians.Name, Technicians.Email, " + //"Technicians.Phone, Incidents.ProductCode, Incidents.DateOpened, Incidents.CustomerID, Incidents.Title " //+ "FROM Technicians join Incidents on Technicians.TechID = Incidents.TechID " + // "Where Incidents.DateClosed IS NULL ORDER BY Technicians.TechID"; string selectStatement = "SELECT Technicians.TechID, Technicians.Name, Technicians.Email, " + "Technicians.Phone " + "FROM Technicians join Incidents on Technicians.TechID = Incidents.TechID " + "Where Incidents.DateClosed IS NULL GROUP BY Technicians.TechID, Technicians.Name, Technicians.Email, Technicians.Phone ORDER BY Technicians.TechID"; try { using (SqlConnection connection = TechSupportDBConnection.GetConnection()) { try { connection.Open(); } catch (SqlException ex) { throw ex; } using (SqlCommand selectCommand = new SqlCommand(selectStatement, connection)) using (SqlDataReader reader = selectCommand.ExecuteReader()) { int techNameOrd = reader.GetOrdinal("Name"); int techEmailOrd = reader.GetOrdinal("Email"); int techPhoneOrd = reader.GetOrdinal("Phone"); while (reader.Read()) { Technician tech = new Technician(); tech.TechID = (int)reader["TechID"]; tech.Name = reader.GetString(techNameOrd); tech.Email = reader.GetString(techEmailOrd); tech.Phone = reader.GetString(techPhoneOrd); techList.Add(tech); } connection.Close(); } } } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } return techList; }
public MobileResponseModel Post([FromBody] UserLoginModel model) { var authenticationModel = new MobileResponseModel { IsSuccess = false }; if (string.IsNullOrEmpty(model.Password) || string.IsNullOrEmpty(model.UserName) || string.IsNullOrEmpty(model.DeviceKey)) { authenticationModel.Message = "UserName or Password can not be empty"; return(authenticationModel); } var isValid = _userLoginRepository.ValidateUser(model.UserName, model.Password); if (isValid) { try { var userSession = _userLoginService.GetUserSessionModel(model.UserName); if (userSession.CurrentOrganizationRole == null) { authenticationModel.Message = "Your default role has been removed. Please contact your administrator."; return(authenticationModel); } if (!userSession.CurrentOrganizationRole.CheckRole((long)Roles.Technician) && !userSession.CurrentOrganizationRole.CheckRole((long)Roles.NursePractitioner)) { authenticationModel.Message = "Your default role must be Technician or Nurse Practitioner. Please contact your administrator."; return(authenticationModel); } int pinExpirationDays = 0; Int32.TryParse(_configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.PinExpirationDays), out pinExpirationDays); int daysBeforAlert = 0; Int32.TryParse(_configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.AlertBeforePinExpirationInDays), out daysBeforAlert); var pinExpireInDays = _technicianRepository.GetPinExpireInDays(userSession.CurrentOrganizationRole.OrganizationRoleUserId, pinExpirationDays); if (pinExpireInDays <= daysBeforAlert) { pinExpireInDays = pinExpireInDays <= 0 ? 0 : pinExpireInDays; } _sessionContext.UserSession = userSession; var loggedInUser = _userRepository.GetUser(userSession.UserId); _sessionContext.LastLoggedInTime = loggedInUser.UserLogin.LastLogged.ToString(); _userLoginRepository.UpdateLoginStatus(_sessionContext.UserSession.UserId, true); var sessionId = Guid.NewGuid().ToString(); var userLoginLog = SaveLoginInfo(userSession.UserId, sessionId, model.DeviceKey); _sessionContext.UserSession.UserLoginLogId = userLoginLog.Id; var technicianProfile = new Technician(); if (_sessionContext.UserSession.AvailableOrganizationRoles.Any(x => x.RoleId == (long)Roles.Technician)) { var technicianOrgRoleUserId = _sessionContext.UserSession.AvailableOrganizationRoles.First(x => x.RoleId == (long)Roles.Technician).OrganizationRoleUserId; technicianProfile = _technicianRepository.GetTechnician(technicianOrgRoleUserId); } authenticationModel = new MobileResponseModel { IsSuccess = true, Message = "Successfully Logged In", StatusCode = 200, Data = new AuthenticationModel { UserId = userSession.UserId,//Todo: need to check if OrgRoleUserID Can be Sent Token = (sessionId + "_" + userLoginLog.UserId).Encrypt(), Name = userSession.FullName, Role = userSession.CurrentOrganizationRole.RoleDisplayName, Pin = !string.IsNullOrWhiteSpace(technicianProfile.Pin) ? technicianProfile.Pin.Encrypt() : string.Empty, ShowAlertBeforePinExpirationInDays = daysBeforAlert, RemainingDays = pinExpireInDays, } }; } catch (Exception exception) { _logger.Error("while loging user" + exception.StackTrace); authenticationModel.Message = "UserName or Password is not valid"; return(authenticationModel); } } else { _logger.Warn("Tried to access with invalid cridential"); authenticationModel.Message = "UserName or Password is not valid"; return(authenticationModel); } return(authenticationModel); }
public void Create(Technician technician) { DAOFactory.GetTechnicianDAO().Create(technician); }
//计算工资并添加到数据库 public JsonResult CountSalaryAjax() { int year = Convert.ToInt32(Request["year"].Trim()); int month = Convert.ToInt32(Request["month"].Trim()); List <GeneralStaff> generalStaffs = new List <GeneralStaff>(); List <Salary> salaries = new List <Salary>(); string conn = ConfigurationManager.AppSettings["DBConn"]; MySqlConnection con = new MySqlConnection(conn); con.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "select id,department,position,duty,type,name,month_day,grade,sale,target,reach_bonus,commission,fixed,alltsutomu from staff"; cmd.Connection = con; MySqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { GeneralStaff general = null; if (dr["position"].ToString().Trim() == "3") { Technician technician = new Technician(); technician.Grade = Convert.ToInt32(dr["grade"].ToString()); general = technician; } else if (dr["position"].ToString().Trim() == "2") { Salesman salesman = new Salesman(); salesman.Sale = Convert.ToInt32(dr["sale"].ToString()); salesman.Target = Convert.ToInt32(dr["target"].ToString()); salesman.ReachBonus = Convert.ToInt32(dr["reach_bonus"].ToString()); salesman.Commission = Convert.ToInt32(dr["commission"].ToString()); general = salesman; } else { GeneralStaff generalStaff = new GeneralStaff(); general = generalStaff; } general.Id = Convert.ToInt32(dr["id"].ToString()); general.Department = Convert.ToInt32(dr["department"].ToString()); general.Position = Convert.ToInt32(dr["position"].ToString()); general.Duty = Convert.ToInt32(dr["duty"].ToString()); general.Type = Convert.ToInt32(dr["type"].ToString()); general.Name = dr["name"].ToString(); general.MonthTotalDays = Convert.ToInt32(dr["month_day"].ToString()); general.Fixed = Convert.ToInt32(dr["Fixed"].ToString()); general.AllTsutomu = Convert.ToInt32(dr["alltsutomu"].ToString()); general.Absence = 0; general.SickLeave = 0; general.Lates = 0; general.OvertimeDay = 2; generalStaffs.Add(general); } dr.Close(); foreach (GeneralStaff g in generalStaffs) { Salary salary = g.GetSalary(year, month); salaries.Add(salary); } foreach (Salary salary in salaries) { cmd.CommandText = "insert into salary (staff_id,year,month,total,overtime,leavemoney,late,extra,reachbonus,alltsutomued,technical,fixed) " + "values(@staff_id,@year,@month,@total,@overtime,@leavemoney,@late,@extra,@reachbonus,@alltsutomued,@technical,@fixed)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@staff_id", salary.Staff_id); cmd.Parameters.AddWithValue("@year", salary.Year); cmd.Parameters.AddWithValue("@month", salary.Month); //cmd.Parameters.AddWithValue("@total", 123456); cmd.Parameters.AddWithValue("@total", salary.Total); cmd.Parameters.AddWithValue("@overtime", salary.Overtime); cmd.Parameters.AddWithValue("@leavemoney", salary.Leave); cmd.Parameters.AddWithValue("@late", salary.Late); cmd.Parameters.AddWithValue("@extra", salary.Extra); cmd.Parameters.AddWithValue("@reachbonus", salary.ReachBonus); cmd.Parameters.AddWithValue("@alltsutomued", salary.AllTsutomu); cmd.Parameters.AddWithValue("@technical", salary.TechnicalAllowance); cmd.Parameters.AddWithValue("@fixed", salary.Fixed); //cmd.Connection = con; cmd.ExecuteNonQuery(); } con.Close(); //string jsonStr = JsonConvert.SerializeObject(salaries); //return jsonStr; return(Json(salaries, JsonRequestBehavior.AllowGet)); }
public TechnicianViewModel(ICollection <ReportDocumentViewModel> documents, IEnumerable <DateTime> last12Months, Technician technician) { Technician = technician; JobsDoneInLast12Months = documents.Count(c => c.Technician == technician.Name); JobsMonthByMonth = new Dictionary <DateTime, int>(); DateOfLastCheck = technician.DateOfLastCheck; DateOfLast3YearCheck = technician.DateOfLast3YearCheck; foreach (var last12Month in last12Months) { JobsMonthByMonth.Add(last12Month, 0); } var technicianDocuments = documents.Where(c => string.Equals(c.Technician, technician.Name, StringComparison.CurrentCultureIgnoreCase)).ToList(); foreach (var viewModel in technicianDocuments) { var dt = new DateTime(viewModel.Created.Year, viewModel.Created.Month, 1); JobsMonthByMonth[dt] += 1; } }
public ActionResult Edit(ProfileEditModel profileEditModel) { try { if (ModelState.IsValid) { _userProfileService.SaveProfile(profileEditModel); if (profileEditModel.IsOtpByAppEnabled || profileEditModel.IsOtpByEmailEnabled || profileEditModel.IsOtpBySmsEnabled || profileEditModel.IsPinRequiredForRole) { var loginSettings = _loginSettingRepository.Get(profileEditModel.Id); loginSettings = loginSettings ?? new LoginSettings { UserLoginId = profileEditModel.Id }; loginSettings.DownloadFilePin = profileEditModel.IsPinRequiredForRole ? (string.IsNullOrEmpty(profileEditModel.DownloadFilePin) ? loginSettings.DownloadFilePin : profileEditModel.DownloadFilePin) : null; if (profileEditModel.UseAuthenticator) { loginSettings.AuthenticationModeId = (long)AuthenticationMode.AuthenticatorApp; loginSettings.GoogleAuthenticatorSecretKey = (string)TempData["EncodedSecret"]; } else { loginSettings.GoogleAuthenticatorSecretKey = null; loginSettings.AuthenticationModeId = profileEditModel.UseSms && profileEditModel.UseEmail ? (long)AuthenticationMode.BothSmsEmail : (profileEditModel.UseSms ? (long)AuthenticationMode.Sms : (long)AuthenticationMode.Email); } _loginSettingRepository.Save(loginSettings); } if (_sessionContext.UserSession.CurrentOrganizationRole.RoleId == (long)Roles.Technician) { var technicianProfile = _technicianRepository.GetTechnician(_sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); if (technicianProfile != null) { technicianProfile.Pin = profileEditModel.TechnicianPin; } else { technicianProfile = new Technician { TechnicianId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, CanDoPreAudit = false, IsTeamLead = false, Pin = profileEditModel.TechnicianPin }; } var repository = ((IRepository <Technician>)_technicianRepository); repository.Save(technicianProfile); } profileEditModel = _userProfileService.GetProfileEditModel(profileEditModel.Id); profileEditModel.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Profile Updated Successfully."); return(View(profileEditModel)); } var secret = (string)TempData["EncodedSecret"]; profileEditModel.EncodedSecret = TimeBasedOneTimePassword.EncodeSecret(secret); TempData.Keep("EncodedSecret"); return(View(profileEditModel)); } catch (Exception ex) { profileEditModel.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(ex.Message); return(View(profileEditModel)); } }
public IActionResult Delete(Technician technician) { context.Technicians.Remove(technician); context.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public async Task <ActionResult> Edit([Bind(Include = "Email,Id,UserName,FirstName,LastName")] EditUserViewModel editUser, params string[] selectedRole) { if (ModelState.IsValid) { var user = await UserManager.FindByIdAsync(editUser.Id); if (user == null) { return(HttpNotFound()); } if (user.Email != editUser.Email) { user.EmailConfirmed = false; Customer c = vtc1.Customers.Where(x => x.CustomerEmail == user.Email).FirstOrDefault(); c.CustomerEmail = editUser.Email; vtc.SaveChanges(); } user.UserName = editUser.UserName; user.FirstName = editUser.FirstName; user.LastName = editUser.LastName; user.Email = editUser.Email; var userRoles = await UserManager.GetRolesAsync(user.Id); selectedRole = selectedRole ?? new string[] { }; var result = await UserManager.AddToRolesAsync(user.Id, selectedRole.Except(userRoles).ToArray <string>()); if (!result.Succeeded) { ModelState.AddModelError("", result.Errors.First()); return(View()); } result = await UserManager.RemoveFromRolesAsync(user.Id, userRoles.Except(selectedRole).ToArray <string>()); if (!result.Succeeded) { ModelState.AddModelError("", result.Errors.First()); return(View()); } // bool ro = UserManager.IsInRoleAsync(user.Id, "Technician"); if (await UserManager.IsInRoleAsync(user.Id, "Technician")) { List <Technician> tcc = new List <Technician>(); tcc = vtc1.Technicians.ToList(); // if (tcc.Count > 0) //{ Technician tt = tcc.Where(x => x.TechnicianEmail == user.Email).FirstOrDefault(); if (tt == null) { Technician tc = new Technician { TechnicianEmail = user.Email, Username = user.UserName, FirstName = user.FirstName, LastName = user.LastName, TechnicianPhone = user.PhoneNumber, Active = true, NumberOfOperations = 0, }; vtc1.Technicians.Add(tc); vtc1.SaveChanges(); } //} } //else //{ // List<Technician> tcc = new List<Technician>(); // tcc = vtc1.Technicians.ToList(); // Technician tt = tcc.Where(x => x.TechnicianEmail == user.Email).FirstOrDefault(); // if (tt != null) // { // vtc1.Technicians.Remove(tt); // } //} return(RedirectToAction("Index")); } ModelState.AddModelError("", "Something failed."); return(View()); }
public static TechnicianModel ToModel(this Technician entity) { return(entity.MapTo <Technician, TechnicianModel>()); }
//Metoda koja se poziva kada tehničar odjavljuje posao public ActionResult CheckOut(int id) { Technician user = Session["user"] as Technician; using (var db = new SrceAppDatabase1Entities()) { Job job = db.Job.Find((short)id); if (job == null) { new EntryPointNotFoundException(); } if (ModelState.IsValid) { db.Technician.Find(user.TechnicianID).Job.Remove(job); int numTech = db.Job.Find(id).Technician.Count(); if (numTech != 0) { if (numTech == 1) //Ako ostane jedan tehničar event oboja u boju tehničara i prikazano je ime tehničara { var tech = db.Job.Find(id).Technician.First(); job.Color = tech.Color; job.Title = tech.Name + " " + tech.LastName; } else { //Ukoliko ostane više tehničara miče se iz stringa title user-a koji se trenutno odjavio List <string> title = job.Title.Split(new string[] { ", " }, StringSplitOptions.None).ToList(); int indexSubstring = title.IndexOf(user.Name + " " + user.LastName); if (indexSubstring == 0) { job.Title = job.Title.Replace(user.Name + " " + user.LastName + ", ", ""); } else { job.Title = job.Title.Replace(", " + user.Name + " " + user.LastName, ""); } } } else { job.Color = null; //Ako nema prijavljenih tehničara onda se vraća defaultni event job.Title = null; job.JobNotes = null; if (job.JobState == 1 || job.JobState == 4) { job.Color = Colors.Red.Value; if (job.JobState == 1) { job.JobState = (byte)JobStates.SwapRequest; } } } db.SaveChanges(); } } return(RedirectToAction("Index")); }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 51, Configuration.FieldSeparator), Id, SetIdObr.HasValue ? SetIdObr.Value.ToString(culture) : null, PlacerOrderNumber?.ToDelimitedString(), FillerOrderNumber?.ToDelimitedString(), UniversalServiceIdentifier?.ToDelimitedString(), Priority, RequestedDateTime.HasValue ? RequestedDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ObservationDateTime.HasValue ? ObservationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ObservationEndDateTime.HasValue ? ObservationEndDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, CollectionVolume?.ToDelimitedString(), CollectorIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, CollectorIdentifier.Select(x => x.ToDelimitedString())) : null, SpecimenActionCode, DangerCode?.ToDelimitedString(), RelevantClinicalInformation, SpecimenReceivedDateTime.HasValue ? SpecimenReceivedDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, SpecimenSource?.ToDelimitedString(), OrderingProvider != null ? string.Join(Configuration.FieldRepeatSeparator, OrderingProvider.Select(x => x.ToDelimitedString())) : null, OrderCallbackPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, OrderCallbackPhoneNumber.Select(x => x.ToDelimitedString())) : null, PlacerField1, PlacerField2, FillerField1, FillerField2, ResultsRptStatusChngDateTime.HasValue ? ResultsRptStatusChngDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ChargeToPractice?.ToDelimitedString(), DiagnosticServSectId, ResultStatus, ParentResult?.ToDelimitedString(), QuantityTiming != null ? string.Join(Configuration.FieldRepeatSeparator, QuantityTiming.Select(x => x.ToDelimitedString())) : null, ResultCopiesTo != null ? string.Join(Configuration.FieldRepeatSeparator, ResultCopiesTo.Select(x => x.ToDelimitedString())) : null, ParentResultsObservationIdentifier?.ToDelimitedString(), TransportationMode, ReasonForStudy != null ? string.Join(Configuration.FieldRepeatSeparator, ReasonForStudy.Select(x => x.ToDelimitedString())) : null, PrincipalResultInterpreter?.ToDelimitedString(), AssistantResultInterpreter != null ? string.Join(Configuration.FieldRepeatSeparator, AssistantResultInterpreter.Select(x => x.ToDelimitedString())) : null, Technician != null ? string.Join(Configuration.FieldRepeatSeparator, Technician.Select(x => x.ToDelimitedString())) : null, Transcriptionist != null ? string.Join(Configuration.FieldRepeatSeparator, Transcriptionist.Select(x => x.ToDelimitedString())) : null, ScheduledDateTime.HasValue ? ScheduledDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, NumberOfSampleContainers.HasValue ? NumberOfSampleContainers.Value.ToString(Consts.NumericFormat, culture) : null, TransportLogisticsOfCollectedSample != null ? string.Join(Configuration.FieldRepeatSeparator, TransportLogisticsOfCollectedSample.Select(x => x.ToDelimitedString())) : null, CollectorsComment != null ? string.Join(Configuration.FieldRepeatSeparator, CollectorsComment.Select(x => x.ToDelimitedString())) : null, TransportArrangementResponsibility?.ToDelimitedString(), TransportArranged, EscortRequired, PlannedPatientTransportComment != null ? string.Join(Configuration.FieldRepeatSeparator, PlannedPatientTransportComment.Select(x => x.ToDelimitedString())) : null, ProcedureCode?.ToDelimitedString(), ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null, PlacerSupplementalServiceInformation != null ? string.Join(Configuration.FieldRepeatSeparator, PlacerSupplementalServiceInformation.Select(x => x.ToDelimitedString())) : null, FillerSupplementalServiceInformation != null ? string.Join(Configuration.FieldRepeatSeparator, FillerSupplementalServiceInformation.Select(x => x.ToDelimitedString())) : null, MedicallyNecessaryDuplicateProcedureReason?.ToDelimitedString(), ResultHandling, ParentUniversalServiceIdentifier?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public void CollectionPathIncludesOrganizationId() { Technician tech = new Technician(_context.Listen360, 1000); Assert.AreEqual("organizations/1000/technicians", tech.CollectionPath); }
partial void UpdateTechnician(Technician instance);
public void OrganizationIdAttributeNeverSerialized() { Technician tech = new Technician(_context.Listen360, 1000); Assert.IsFalse(tech.Changes.ContainsKey("organization-id")); }
private void BtnRun_Click(object sender, EventArgs e) { //Qué entidad vamos a afectar MessageBox.Show("Crear en: " + cboSheet.SelectedItem.ToString()); string entity = cboSheet.SelectedItem.ToString(); if (entity.Equals("ARTICULOS")) { //creamos la lista de Articulos List <Article> articles = new List <Article>(); //recorremos el DataGridView y agregamos cada fila a la lista int rows = DgvVisor.RowCount; MessageBox.Show("Cantidad de filas: " + rows); for (int i = 0; i < rows; i++) { Article a = new Article { Article_code = DgvVisor.Rows[i].Cells[0].Value.ToString(), Article_description = DgvVisor.Rows[i].Cells[1].Value.ToString(), //Article_model = DgvVisor.Rows[i].Cells[2].Value.ToString(), //Article_serial = DgvVisor.Rows[i].Cells[3].Value.ToString(), Article_warranty = int.Parse(DgvVisor.Rows[i].Cells[4].Value.ToString()), Create_by = "Bulkload", Create_date = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) }; articles.Add(a); } //Enviamos a la logica para que haga cada uno de los insert txtResult.Text = bulkLoadLog.BulkLoadArticle(articles); } else if (entity.Equals("CLIENTES")) { //creamos la lista de Clientes List <Client> clients = new List <Client>(); //recorremos el DataGridView y agregamos cada fila a la lista int rows = DgvVisor.RowCount; MessageBox.Show("Cantidad de filas: " + rows); for (int i = 0; i < rows; i++) { Client c = new Client { Client_id = DgvVisor.Rows[i].Cells[0].Value.ToString(), Client_name = DgvVisor.Rows[i].Cells[1].Value.ToString(), Client_address = DgvVisor.Rows[i].Cells[2].Value.ToString(), Client_location = DgvVisor.Rows[i].Cells[3].Value.ToString(), Client_city = DgvVisor.Rows[i].Cells[4].Value.ToString(), Client_department = DgvVisor.Rows[i].Cells[5].Value.ToString(), Client_tel1 = DgvVisor.Rows[i].Cells[6].Value.ToString(), Client_tel2 = DgvVisor.Rows[i].Cells[7].Value.ToString(), Client_email = DgvVisor.Rows[i].Cells[8].Value.ToString(), }; clients.Add(c); } //Enviamos a la logica para que haga cada uno de los insert txtResult.Text = bulkLoadLog.BulkLoadClient(clients); } else if (entity.Equals("REFACCIONES")) { //creamos la lista de Refactions List <Refaction> refactions = new List <Refaction>(); //recorremos el DataGridView y agregamos cada fila a la lista int rows = DgvVisor.RowCount; MessageBox.Show("Cantidad de filas: " + rows); for (int i = 0; i < rows; i++) { Refaction r = new Refaction { Refaction_code = DgvVisor.Rows[i].Cells[0].Value.ToString(), Refaction_description = DgvVisor.Rows[i].Cells[1].Value.ToString(), Refaction_unit_price = DgvVisor.Rows[i].Cells[2].Value.ToString() }; refactions.Add(r); } //Enviamos a la logica para que haga cada uno de los insert txtResult.Text = bulkLoadLog.BulkLoadRefaction(refactions); } else if (entity.Equals("SERVICIOS")) { //creamos la lista de Services List <Service> services = new List <Service>(); //recorremos el DataGridView y agregamos cada fila a la lista int rows = DgvVisor.RowCount; MessageBox.Show("Cantidad de filas: " + rows); for (int i = 0; i < rows; i++) { Service s = new Service { Service_code = DgvVisor.Rows[i].Cells[0].Value.ToString(), Service_activity = DgvVisor.Rows[i].Cells[1].Value.ToString(), Service_duration = DgvVisor.Rows[i].Cells[2].Value.ToString(), Service_cost = decimal.Round(decimal.Parse(DgvVisor.Rows[i].Cells[3].Value.ToString()), 2).ToString().Replace(',', '.'), Service_type = char.Parse(DgvVisor.Rows[i].Cells[4].Value.ToString()) }; services.Add(s); Console.WriteLine( //"Codigo: " + "(" + s.Service_code.Length + ")" + s.Service_code + //" | Activity: " + "(" + s.Service_activity.Length + ")" + s.Service_activity + //" | Duration: " + s.Service_duration + "(" + s.Service_duration.Length + ")" + " | Cost: " + "(" + s.Service_cost.Length + ")" + s.Service_cost + " | Type: " + "(" + s.Service_type.ToString().Length + ")" + s.Service_type); } //Enviamos a la logica para que haga cada uno de los insert txtResult.Text = bulkLoadLog.BulkLoadService(services); } else if (entity.Equals("TECNICOS")) { //creamos la lista de Technicians List <Technician> technicians = new List <Technician>(); //recorremos el DataGridView y agregamos cada fila a la lista int rows = DgvVisor.RowCount; MessageBox.Show("Cantidad de filas: " + rows); for (int i = 0; i < rows; i++) { Technician t = new Technician { Technician_id = DgvVisor.Rows[i].Cells[0].Value.ToString(), Technician_name = DgvVisor.Rows[i].Cells[1].Value.ToString(), Technician_contact = DgvVisor.Rows[i].Cells[2].Value.ToString(), Technician_alias = DgvVisor.Rows[i].Cells[3].Value.ToString(), Technician_telephone = DgvVisor.Rows[i].Cells[4].Value.ToString(), Technician_position = DgvVisor.Rows[i].Cells[5].Value.ToString(), Create_by = "Bulkload", Create_date = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) }; technicians.Add(t); } //Enviamos a la logica para que haga cada uno de los insert txtResult.Text = bulkLoadLog.BulkLoadTechnician(technicians); } }
public void ReadCustomAttribute() { Technician tech = new Technician(_context.Listen360, 1000); string attr = tech[1]; }
public IActionResult Delete(Technician technician) { data.Delete(technician); data.Save(); return(RedirectToAction("List", "Technician")); }
public void WriteCustomAttribute() { Technician tech = new Technician(_context.Listen360, 1000); tech[1] = "foo"; }
public async Task <IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); if (ModelState.IsValid) { //excepciones para que el correo sea de la universidad y un rango de la edad try { string[] emailInput = Input.Email.Split("@"); string EmailVerificate = emailInput[1]; Check.Precondition(EmailVerificate == EmailUCU, "El correo debe de ser de la Universidad"); } catch (Check.PreconditionException ex) { return(Redirect("https://localhost:5001/Exception?id=" + ex.Message)); } try { int BirthDateInput = Input.BirthDate.Year; Check.Precondition(BirthDateInput > 1950, "Edad Incorrecta"); Check.Precondition(BirthDateInput < 2010, "Edad incorrecta"); } catch (Check.PreconditionException ex) { return(Redirect("https://localhost:5001/Exception?id=" + ex.Message)); } var user = new Technician { Name = Input.Name, BirthDate = Input.BirthDate, UserName = Input.Email, Email = Input.Email }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); var roleToAdd = await _roleManager.FindByNameAsync(IdentityData.NonAdminRoleNames[this.Role]); _userManager.AddToRoleAsync(user, roleToAdd.Name).Wait(); // Es necesario tener acceso a RoleManager para poder buscar el rol de este usuario; se asigna aquí para poder // buscar por rol después cuando no hay acceso a RoleManager. user.AssignRole(_userManager, roleToAdd.Name); await _userManager.UpdateAsync(user); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.Page( "/Account/ConfirmEmail", pageHandler: null, values: new { userId = user.Id, code = code }, protocol: Request.Scheme); await _emailSender.SendEmailAsync(Input.Email, "Confirm your email", $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>."); await _signInManager.SignInAsync(user, isPersistent : false); return(LocalRedirect(returnUrl)); } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } // If we got this far, something failed, redisplay form return(Page()); }
public ActionResult Create(Technician technician) { _db.Technicians.Add(technician); _db.SaveChanges(); return(RedirectToAction("Index")); }