public void DoWork(int hours, WorkType type) { for (int i = 0; i < hours; i++) { OnWorkPerformed(i, type); } }
public Work Save(int id, string Title, string Description, string Url, WorkType WorkType, int UserId, DateTime DateSubmitted, bool PartcipateInPoll, bool ApprovedForPoll, bool Live, bool Featured, int PollId) { var work = id > 0 ? GetById(id) : new Work(); if(!string.IsNullOrEmpty(Url)) { Url = Assets.HasHttpOrHttps(Url) ? Url : string.Format("http://{0}", Url); } work.Title = Title; work.Description = Description; work.Url = Url; work.WorkType = (int)WorkType; work.UserId = UserId; work.DateSubmitted = id > 0 ? work.DateSubmitted : DateSubmitted; work.PartcipateInPoll = PartcipateInPoll; work.ApprovedForPoll = ApprovedForPoll; work.Live = Live; work.Featured = Featured; work.PollId = PollId; work.Views = id > 0 ? work.Views : 0; var workDa = new WorkDa(databasecontext); //if new if (id < 1) work = workDa.Add(work); //update else work = workDa.Update(work); return work; }
private void button1_Click(object sender, EventArgs e) { t = WorkType.NotWorking; if (comboBox1.SelectedItem.ToString().Equals("근무")) { t = WorkType.Working; } else if(comboBox1.SelectedItem.ToString().Equals("미 근무")) { t = WorkType.NotWorking; } else if(comboBox1.SelectedItem.ToString().Equals("부분 근무")) { t = WorkType.incompleteWorking; } if (textBox1.Text != "") { workTime = int.Parse(textBox1.Text); } note = textBox5.Text; //System.Diagnostics.Debug.WriteLine(workTime.ToString()); //System.Diagnostics.Debug.WriteLine(note); textBox1.Clear(); textBox5.Clear(); this.Hide(); }
public string GetCurrentTheme(WorkType type) { switch (type) { case WorkType.Mobile: { if (!mobileThemeName.IsNull()) return mobileThemeName; var themeName = storeStateSettings.DefaultStoredThemeForMobile; if (!themeProvider.ThemeConfigExists(themeName)) // if theme configuration doesn't exist, search all the desktop themes and select one among them themeName = themeProvider.GetThemeConfigurations() .Where(x => x.IsForMobile).FirstOrDefault().ThemeName; // only get the first theme matched, if there is no theme, should throw exception because shouldn't allow site without theme mobileThemeName = themeName; return themeName; } case WorkType.Desktop: default: { if (!desktopThemeName.IsNull()) return desktopThemeName; var themeName = workContext.CurrentUser.GetWorkingDesktopThemeName(UserCharacteristicResource.DesktopThemeName); if (!themeProvider.ThemeConfigExists(themeName)) // if theme configuration doesn't exist, search all the desktop themes and select one among them themeName = themeProvider.GetThemeConfigurations() .Where(x => !x.IsForMobile).FirstOrDefault().ThemeName; // only get the first theme matched, if there is no theme, should throw exception because shouldn't allow site without theme desktopThemeName = themeName; return themeName; } } }
protected virtual void OnWorkedPerformed(int hours, WorkType workType) { var del = WorkPerformed as EventHandler<WorkPerformedEventArgs>; if (del != null) { del(this, new WorkPerformedEventArgs(hours, workType)); } }
public override void Construct(Vector3 point, int currentPointValue,WorkType wType) { base.Construct(point, currentPointValue, wType); if (!tryPlaceSurveyPoint(point, currentPointValue)) { GameManager.actionManager.CancelPendingWork(); } }
private void init(uint id, string text, WorkType work, WorkStatusType workStatus, WorkResultType workResult) { ID = id; Text = text; Work = work; WorkStatus = workStatus; WorkResult = workResult; }
public Work(WorkType type, IWork parent, IArtist artist, string name, short year, uint number) { this.type = type; this.parent = parent; this.artist = artist; this.name = name ?? string.Empty; this.year = year; this.number = number; }
private void OnWorkPerformed(int hours, WorkType type) { WorkPerformedHandler localHandler = WorkPerformed; if (localHandler != null) { localHandler(hours, type); } //WorkPerformed?.Invoke(hours, type); }
public void DoWork(int hours, WorkType workType) { for (int i = 0; i < hours; i++) { System.Threading.Thread.Sleep(1000); OnWorkPerformed(i+1,workType); } OnWorkCompleted(); }
public void OnWorkTypeChange(WorkType wType) { if (wType != null) { activeText = wType.Description; activeColor = wType.getColor(); gameObject.SetActive(true); activeColor.a = 1.7f; } }
/// <summary> /// Event /// </summary> /// <param name="hours"></param> /// <param name="workType"></param> protected virtual void OnWorkPerformed(int hours, WorkType workType) { // init delegate, if not null, use it with EventArgs class var del = WorkPerformed; if (del != null) { del(this, new WorkPerformedEventArgs(hours, workType)); } }
public void OnChangedWorkType(WorkType wtype) { if (wtype.Description == "Build") { EnableSubMenu(wtype.subMenu); } else { CloseMenu(); } }
public void simpleConstruct(Vector3 point, WorkType wType,SurveyProject project) { surveyProject = project; cubePoint = point; //surveyProject.AddProbeToQueue(this); workType = wType; if (GameManager.actionManager.ApplyWork(this)) { Color col = wType.getColor(); col.a = 0.4f; cube = new GLCube(point, Vector3.one, col, this); } }
// GET: WorkTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkType workType = _workTypeService.Find(id); if (workType == null) { return(HttpNotFound()); } return(View(workType)); }
public IActionResult AddWorkType([FromBody] WorkTypeBindingModel model) { WorkType type = new WorkType { Id = model.Id, Name = model.Name }; _repository.AddWorkType(type); return(CreatedAtRoute("GetWorkType", new { id = type.Id, }, type)); }
protected virtual void OnWorkPerformed(int hours, WorkType workType) { //if(WorkPerformed != null) //{ // WorkPerformed(hours, workType); //} var del = WorkPerformed as EventHandler <WorkPerformedEventArgs>; // cast the event as the delegate if (del != null) // check if there are any listeners attached { del(this, new WorkPerformedEventArgs(hours, workType)); } }
protected virtual void OnWorkPerformed(int hours, WorkType workType) { //if (WorkPerformed != null) //{ // WorkPerformed(hours, workType); //} var del = WorkPerformed as WorkPerformedHandler; if (del != null) { del(hours, workType); } }
public void ShouldBeAbleToScheduleWorkToRepeatAtAFixedInterval(WorkType workType, ActorScheduleOptions actorScheduleOptions) { var barrier = new TaskCompletionSource <bool>(); var expectedInterval = TimeSpan.FromMilliseconds(100); var times = new List <DateTime>(); var sampleSize = 5; void Adder() { if (times.Count < sampleSize) { times.Add(DateTime.UtcNow); } if (times.Count == sampleSize) { // Block here so that we can assess something that's not moving barrier.Task.Wait(); } } switch (workType) { case WorkType.Sync: _scheduler.Schedule((Action)Adder, expectedInterval, actorScheduleOptions); break; case WorkType.Async: _scheduler.Schedule(async() => { await Task.Yield(); Adder(); }, expectedInterval, actorScheduleOptions); break; default: throw new Exception($"Unhandled test case {workType}."); } Within.FiveSeconds(() => times.Count.Should().Be(sampleSize)); var actualIntervals = times.Take(sampleSize - 1).Zip(times.Skip(1), (x, y) => y - x).ToList(); // Use 75ms instead of 100ms to give it a bit of latitude: mainly we just want to make sure there is some delaying going on. actualIntervals.Should().OnlyContain(x => x >= TimeSpan.FromMilliseconds(75)); barrier.SetResult(true); }
public virtual void DoWork(int hours, WorkType workType) { //.....Do Work Here //Notify the consumer that workType has performed. //Good practice: instead of calling event here we are calling it via another method OnWorkPerformed(hours, workType); //WorkPerformed2(this, new WorkPerformedEventArgs //{ // WorkType = WorkType.GenerateReports, // Hours = 10 //}); }
// Run 모든요청은 이함수로 받는다. public async Task Run(WorkType workType) { var tasks = CreateTaskTasks(workType); if (tasks == null) { return; } foreach (var task in tasks) { await task; } }
// GET: WorkTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkType workType = _warehouseUow.WorkTypes.GetById(id); if (workType == null) { return(HttpNotFound()); } return(View(workType)); }
private void label1_DragDrop(object sender, DragEventArgs e) { // pass the filename to the worker _currentWorkType = WorkType.Read; _currentFilePath = ((string[])e.Data.GetData("FileName"))[0]; worker.RunWorkerAsync(); Warnings.Clear(); label.Text = "Se prelucrează fișierul..."; label.BackColor = SystemColors.Control; rtb.SelectionColor = Color.Green; rtb.AppendText("Se parcurge și citește fișierul\n"); rtb.SelectionColor = Color.Black; rtb.ResetText(); }
public void DoWork(int hours, WorkType workType) { myDelHandler del = WorkPerformed as myDelHandler; if (del != null) { del("Raised from DoWork, via casted delegate"); } if (WorkPerformed != null) { WorkPerformed("test raised from DoWork(int housr WorkType workType) method"); } }
public virtual void OnWorkPerformed(int hours, WorkType workType) { //if (WorkPerformed!=null) //{ // WorkPerformed(hours, workType); //} EventHandler <WorkPerformedEventAgrs> del = WorkPerformed as EventHandler <WorkPerformedEventAgrs>; if (del != null) { del(this, new WorkPerformedEventAgrs(hours, workType)); } }
public async Task <IActionResult> Edit(WorkType workType, Guid?id) { if (id == null) { return(NotFound()); } var partForWork = await _repo.GetPartForWork(id); ViewBag.WorkType = workType; partForWork = SetImageUrls(partForWork); return(View(partForWork)); }
public void DoWork(int hours, WorkType type) { for (int i = 0; i < hours; i++) { if (WorkPerformed != null) { WorkPerformed.Invoke(i + 1, type); } } if (WorkCompleted != null) { WorkCompleted.Invoke(this, new WorkCompletedEventArgs(hours, type)); } }
public IList <Project> getProjectsByWorkType(Boolean isActiveOnly, WorkType workType) { if (isActiveOnly) { return(getMySession().QueryOver <Project>() .Where(x => x.activeFlag == isActiveOnly && x.workType.id == workType.id) .OrderBy(x => x.name).Asc .List()); } return(getMySession().QueryOver <Project>() .Where(x => x.workType.id == workType.id) .OrderBy(x => x.name).Asc .List()); }
/// <summary> /// Начислить зарплату /// </summary> public void SetSalary(Client player, WorkType type, int salary) { var workInfo = GetWorkInfo(player, type); if (ServerState.Players[player].IsPremium()) { salary += (int)(salary * 0.5); } workInfo.Salary += salary; SetWorkInfo(player, workInfo); var message = salary >= 0 ? $"~g~Зачислена зарплата: {salary}$" : $"~r~Получен штраф: {salary}$"; API.sendNotificationToPlayer(player, message); }
// GET: WorkTypes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkType workType = db.WorkTypes.Find(id); if (workType == null) { return(HttpNotFound()); } return(View(workType)); }
public async Task <IActionResult> Initialize(WorkType workType, Guid?id) { if (id == null) { return(NotFound()); } var vm = await CreateWorkItemViewModel(id); ViewData["StaticPartInfoId"] = new SelectList(await _repo.GetAllStaticPartInfos(), "StaticPartInfoId", "PartDescription"); ViewBag.WorkType = workType; return(View(vm)); }
/// <summary> /// 分配特定种类资源的采集任务 /// </summary> /// <param name="workType">资源种类</param> private void ArrangeWork(WorkType workType) { var size = int.Parse(df.partWorldMapDate[df.mianPartId][98]); // size of map var part = df.mianPartId; var maxPlace = -1; var maxRes = 0; var manNeed = 0x7fffffff; var manPool = UIDate.instance.GetUseManPower(); for (int place = 0; place < size * size; place++) { if (Explored(part, place) && !df.PlaceIsBad(part, place) && !df.HaveWork(part, place)) { var res = UIDate.instance.GetWorkPower((int)workType, part, place); var man = int.Parse(df.GetNewMapDate(part, place, 12)); if (res > maxRes && manPool >= man) { if (man <= 1 || !Main.Setting.skipTown) { maxRes = res; maxPlace = place; manNeed = man; } } } } if (maxRes > 0 && maxPlace >= 0) { if (manPool >= manNeed) { var choosePartId = wms.choosePartId; var choosePlaceId = wms.choosePlaceId; var chooseWorkTyp = wms.chooseWorkTyp; wms.choosePartId = part; wms.choosePlaceId = maxPlace; wms.chooseWorkTyp = (int)workType; wms.DoManpowerWork(); wms.choosePartId = choosePartId; wms.choosePlaceId = choosePlaceId; wms.chooseWorkTyp = chooseWorkTyp; } } else { TipsWindow.instance.SetTips(0, new string[] { "<color=#AF3737FF>无资源可采集或人力不足</color>" }, 180); } }
/// <summary> /// Simulate some work done/processing /// </summary> /// <param name="hours"></param> /// <param name="workType"></param> public void DoWork(int hours, WorkType workType) { for (int i = 0; i < hours; i++) { // Simulate a wait/processing System.Threading.Thread.Sleep(500); // Raise event OnWorkPerformed(i + 1, workType); } // Raise event OnWorkCompleted(); }
public static string ReadLocalJsonFile(WorkType workType) { switch (workType) { case WorkType.SelfWork: return(ReadSelfWorkLocalJsonFile()); case WorkType.MineWork: return(ReadMineWorkLocalJsonFile()); default: return(string.Empty); } }
private void OnEditing(object sender, RoutedEventArgs e) { if (data.SelectedItem == null) { return; } WorkType workType = list[data.SelectedIndex]; Windows.Adds.WindowAddWorkType window = new Adds.WindowAddWorkType(workType); if (window.ShowDialog() == true) { workType.Update(); } }
protected virtual void OnWorkPerformed(int hours, WorkType workType) { //if(WorkPerformed != null) //{ // WorkPerformed(hours, worktype); //} var del = WorkPerformed as EventHandler <WorkPerformedEventArgs>; if (del != null) { del(this, new WorkPerformedEventArgs(hours, workType)); } }
public List <WorkDone> GetWorkDones() { List <WorkDone> workDones = new List <WorkDone>(); using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); string sql = @" SELECT WorkDone.Id, WorkDone.ClientId, WorkDone.WorkTypeId, WorkDone.StartedOn, WorkDone.EndedOn, Client.ClientName, Client.IsActivated, WorkType.WorkTypeName, WorkType.Rate FROM WorkDone JOIN Client ON Client.Id = WorkDone.ClientId JOIN WorkType ON WorkType.Id = WorkDone.WorkTypeId ORDER BY WorkDone.Id; "; SqlCommand command = new SqlCommand(sql, connection); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int Id = reader.GetInt32(0); int ClientId = reader.GetInt32(1); int WorkTypeId = reader.GetInt32(2); DateTimeOffset StartedOn = reader.GetDateTimeOffset(3); DateTimeOffset?EndedOn = null; if (!reader.IsDBNull(4)) { EndedOn = reader.GetDateTimeOffset(4); } string ClientName = reader.GetString(5); bool IsActivated = reader.GetBoolean(6); string WorkTypeName = reader.GetString(7); decimal Rate = reader.GetDecimal(8); Client client = new Client(ClientId, ClientName, IsActivated); WorkType workType = new WorkType(WorkTypeId, WorkTypeName, Rate); if (EndedOn.HasValue) { WorkDone workDone = new WorkDone(Id, client, workType, StartedOn, EndedOn.Value); workDones.Add(workDone); } else { WorkDone workDone = new WorkDone(Id, client, workType, StartedOn); workDones.Add(workDone); } } } return(workDones); }
public void DoWork(int hours, WorkType workType) { if (WorkCompleted == null || WorkPerformed == null) { return; } for (int i = 0; i < hours; i++) { Thread.Sleep(1000); WorkPerformed(this, new WorkPerformedEventArgs(i + 1, workType)); } WorkCompleted(this, null); }
public async Task <IActionResult> Uninitialize(WorkType workType, Guid id) { var workItem = await _repo.GetWorkItem(id); workItem.IsInitialized = false; await _repo.DeletePartBatch(workItem.PartsForWork.ToList()); await _repo.DeleteWorkItem(id); SetUIDs(); await _repo.AddWorkItem(workItem); return(RedirectToAction("Index", "WorkItems", new { workType = workType, workId = workItem.WorkId })); }
public WorkContext(Work Work) { this.Work = Work; TeamContexts = new ObservableCollection <TeamContext>(); MaterailContexts = new ObservableCollection <MaterialContext>(); PriborContexts = new ObservableCollection <PriborContext>(); WorkSections = new ObservableCollection <WorkSection>(); using (var db = new DbContexts.SmetaDbAppContext()) { db.WorkTeams.Where(x => x.WorkDemId == Work.Id).ToList().ForEach(x => { TeamContexts.Add(new TeamContext(x)); }); List <Material> materials = db.Materials; // WOrk types WorkTypes = db.WorkTypes; selectedWorkType = WorkTypes.Where(x => x.Id == (db.WorkSections.Where(y => y.Id == Work.WorkSectionId)).FirstOrDefault().WorkTypeId).FirstOrDefault(); //Work sections db.WorkSections.Where(x => x.WorkTypeId == selectedWorkType.Id).ToList().ForEach(x => { WorkSections.Add(x); }); selectedSection = WorkSections.Where(x => x.Id == Work.WorkSectionId).FirstOrDefault(); // Fill Materials db.MaterialGroups.Where(x => x.WorkId == Work.Id).ToList().ForEach(x => { var item = new MaterialContext(x); item.Material = materials.Where(y => y.Id == x.MaterialId).FirstOrDefault(); MaterailContexts.Add(item); }); List <Pribor> pribors = db.Pribors; //Fill Pribors db.PriborGroups.Where(x => x.WorkId == Work.Id).ToList().ForEach(x => { var item = new PriborContext(x); item.Pribor = pribors.Where(y => y.Id == x.PriborId).FirstOrDefault(); PriborContexts.Add(item); }); } }
/// <summary> /// Добавляет игроку работу, если до этого ее еще не было /// </summary> public void CreateInfoIfNeed(Client player, WorkType type) { ServerState.Players.TryGetValue(player, out var playerInfo); if (!playerInfo.Works.TryGetValue(type, out WorkInfo info)) { info = new WorkInfo { Type = type, Level = 1, Active = false, Experience = 0, Salary = 0 }; SetWorkInfo(player, info); } }
private void RunDownloadPool(WorkType work) { //Setup downloadPool downloadPool = SetupSmartThreadPool(settings.DownloadPoolThreads); //Select the items to add to the queue addDownloadTasksToQueue(work); downloadPool.Start(); bool success = SmartThreadPool.WaitAll(results.ToArray()); downloadPool.Shutdown(); WriteStatus("Download Pool Completed, succeeded = " + success.ToString()); }
public async Task <IResponseOutput> GetById([FromRoute] int id) { WorkType workType = await _fsql.Select <WorkType>() .Where(w => w.Id == id) .IncludeMany(w => w.Childs) .Include(w => w.Parent) //.AsTreeCte() .FirstAsync(); if (workType == null) { return(ResponseOutput.NotOk($"未找到ID为{id}的工作类型")); } return(ResponseOutput.Ok(_mapper.Map <WorkTypeResponseDto>(workType))); }
public void Delete(WorkType workType) { using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); string sql = @" DELETE FROM WorkType WHERE Id = @Id "; SqlCommand command = new SqlCommand(sql, connection); command.Parameters.AddWithValue("@Id", workType.Id); command.ExecuteNonQuery(); } }
// GET: WorkTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkType workType = db.WorkTypes.Find(id); if (workType == null) { return(HttpNotFound()); } ViewBag.ParentId = new SelectList(db.WorkTypes, "Id", "Description", workType.ParentId); return(View(workType)); }
public override void Construct(Vector3 point, int currentPointValue,WorkType wType) { base.Construct(point, currentPointValue, wType); if (ValidateWorkForQueue(currentPointValue)) { if (GameManager.actionManager.ApplyWork(this)) { Color col = wType.getColor(); col.a = 0.4f; cube = new GLCube(point, Vector3.one, col, this); } } else { GameManager.actionManager.CancelPendingWork(); } }
public bool SetTheme(string themeName, WorkType type = WorkType.Desktop) { switch (type) { case WorkType.Mobile: { return false; // Cannot support set mobile theme by user so far. } case WorkType.Desktop: default: { if (!storeStateSettings.SelectThemeByUsersIsAllowed) return false; if (workContext.CurrentUser.IsNull()) return false; bool succeed = genericCharacteristicService.SaveCharacteristic(workContext.CurrentUser, UserCharacteristicResource.DesktopThemeName, themeName); if(succeed) desktopThemeName = null; // clear return succeed; } } }
protected void btnSubmitRecuitmentInfo_OnClick(object sender, EventArgs e) { try { Recruitor1 = (Recruitor)Session["Recruitor"]; var jobTitle = txtJobTitle.Text; var numsApplicant = txtNumsApplicant.Text; var recruitor = new Recruitor(Recruitor1.Email, Recruitor1.RecruitorId); var certificate = new Certificate(ddlDegrees.SelectedValue, ddlDegrees.SelectedItem.Text); var salary = new JobSalaryLevel(ddlSalary.SelectedValue, ddlSalary.SelectedItem.Text); var location = new Province(ddlRegions.SelectedValue, ddlRegions.SelectedItem.Text); var category = new JobIndustries(ddlCategories.SelectedValue, ddlCategories.SelectedItem.Text); var jobPostion = new JobPosition(ddlJobPosition.SelectedValue, ddlJobPosition.SelectedItem.Text); var jobExperienceLevel = new ExperienceLevel(ddlJobExperienceLevel.SelectedValue, ddlJobExperienceLevel.SelectedItem.Text); var worktype = new WorkType(ddlWorkType.SelectedValue, ddlWorkType.SelectedItem.Text); var jobDatail = txtJobDetail.Value; var jobDescription = txtDescription.Value; var deadLine = Convert.ToDateTime(tbDeadline.Value); Jobs1 = new Jobs(); var jobid = Request.QueryString["jobid"]; if (jobid != null) { var returnValue = Jobs1.SetFullJobInfo(jobTitle, certificate, salary, location, category, jobDatail, jobDescription, deadLine, jobPostion, jobExperienceLevel, worktype, recruitor, numsApplicant, jobid); if (returnValue) { Session["Job"] = Jobs1; var emailContent = BuidRecommendResume(jobid); SendEmailMember(emailContent, Recruitor1.EmailToSendResume); JavaScriptAleart("Thực hiện thành công"); } else { JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại"); } } else { var returnValue1 = Jobs1.SetFullJobInfo(jobTitle, certificate, salary, location, category, jobDatail, jobDescription, deadLine, jobPostion, jobExperienceLevel, worktype, recruitor, numsApplicant); if (returnValue1>0) { Session["Job"] = Jobs1; var emailContent = BuidRecommendResume(returnValue1.ToString()); JavaScriptAleart(emailContent); SendEmailMember(emailContent, Recruitor1.EmailToSendResume); JavaScriptAleart("Thực hiện thành công"); } else { JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại"); } } } catch (Exception exception) { JavaScriptAleart(exception.Message); } }
public mhWorkEventArgs(WorkType aWorkType) { this.work = aWorkType; }
public void simpleConstruct(Vector3 point, WorkType wType) { cubePoint = point; workType = wType; if (GameManager.actionManager.ApplyWork(this)) { Color col = wType.getColor(); col.a = 0.4f; cube = new GLCube(point, Vector3.one, col, this); } }
public WorkPerformedEventArgs(int hours, WorkType workType) { this.Hours = hours; this.WorkType = workType; }
// Example from page - http://help.k2.com/onlinehelp/k2blackpearl/DevRef/4.6.9/default.htm#How_to_set_a_users_Out_of_Office_Status.html%3FTocPath%3DRuntime%2520APIs%2520and%2520Services%7CWorkflow%7CWorkflow%2520Client%2520API%7CWorkflow%2520Client%2520API%2520Samples%7C_____10 /// <summary> /// Add OOF share for current user /// </summary> private void AddOutOfOffice() { string destinationUser = base.GetStringProperty(Constants.SOProperties.OutOfOffice.DestinationUser); ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0]; serviceObject.Properties.InitResultTable(); DataTable results = base.ServiceBroker.ServicePackage.ResultTable; using (Connection k2Con = new Connection()) { k2Con.Open(base.K2ClientConnectionSetup); WorklistShares wsColl = k2Con.GetCurrentSharingSettings(ShareType.OOF); // Throw error if multiple configurations (WorklistShare objects) detected, as this method cannot support that if (wsColl.Count > 1) { throw new ApplicationException(Constants.ErrorMessages.MultipleOOFConfigurations); } // If configuration exist already, add to it else if (wsColl.Count == 1) { WorklistShare worklistshare = wsColl[0]; int capacity = worklistshare.WorkTypes[0].Destinations.Count; string[] existingDestinations = new string[capacity]; for (int i = 0; i < capacity; i++) { existingDestinations[i] = worklistshare.WorkTypes[0].Destinations[i].Name.ToUpper().Trim(); } if (Array.IndexOf(existingDestinations, destinationUser.ToUpper().Trim()) == -1) { worklistshare.WorkTypes[0].Destinations.Add(new Destination(destinationUser, DestinationType.User)); } bool result = k2Con.ShareWorkList(worklistshare); DataRow dr = results.NewRow(); dr[Constants.SOProperties.OutOfOffice.DestinationUser] = destinationUser; results.Rows.Add(dr); ; } // New user, create configuration for OOF else { // ALL Work that remains which does not form part of any "WorkTypeException" Filter WorklistCriteria worklistcriteria = new WorklistCriteria(); worklistcriteria.Platform = "ASP"; // Send ALL Work based on the above Filter to the following User Destinations worktypedestinations = new Destinations(); worktypedestinations.Add(new Destination(destinationUser, DestinationType.User)); // Link the filters and destinations to the Work WorkType worktype = new WorkType("MyWork_" + k2Con.User.FQN, worklistcriteria, worktypedestinations); WorklistShare worklistshare = new WorklistShare(); worklistshare.ShareType = ShareType.OOF; worklistshare.WorkTypes.Add(worktype); bool result = k2Con.ShareWorkList(worklistshare); k2Con.SetUserStatus(UserStatuses.Available); DataRow dr = results.NewRow(); dr[Constants.SOProperties.OutOfOffice.DestinationUser] = destinationUser; results.Rows.Add(dr); } k2Con.Close(); } }
public static List<Work> GetList(WorkType WorkType) { List<Work> List = new List<Work>(); foreach (var work in WorkDa.GetList((int)WorkType)) { //work.Photos = PhotoBl.GetList(work.Id, PhotoType.Work); work.UrlPath = String.Format("/{0}/{1}/{2}", Enum.GetName(typeof(WorkType), work.WorkType).ToLower(), Assets.SanitiseForUrlPath(work.Title), work.Id); work.User = UserBl.GetUserById(work.UserId); List.Add(work); } return List; }
void start() { filepath = txtFilePath.Text; currentWork = (WorkType)notebook.CurrentPage; worker = new Thread (work); worker.Start (); btnCommand.Label = "Stop"; working = true; }
protected void RaiseProgressEvent(uint id, string text, WorkType work, WorkStatusType workStatus, WorkResultType workResult) { OnProgress(id, text, work, workStatus, workResult); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { DataTable data = GetAllMyResumes(Convert.ToInt32(User1.UserId)); if (data.Rows.Count >= 3) { JavaScriptAleart("Bạn đã tạo tối đa 3 hồ sơ. Vui lòng kiểm tra lại"); return; } var resumeTitle = txtResumeName.Text; var user = new User(User1.Email, User1.UserId); var certificate = new Certificate(ddlDegrees.SelectedValue, ddlDegrees.SelectedItem.Text); var salary = new JobSalaryLevel(ddlExpectedSalary.SelectedValue, ddlExpectedSalary.SelectedItem.Text); var langSkill = new LangSkill(ddlLangSkill.SelectedValue, ddlLangSkill.SelectedItem.Text, txtDescription.Text); var location = new Province(ddlRegions.SelectedValue, ddlRegions.SelectedItem.Text); var category = new JobIndustries(ddlCategories.SelectedValue, ddlCategories.SelectedItem.Text); //var curentPostion = new JobPosition(ddlCurrentPosition.SelectedValue, ddlCurrentPosition.SelectedItem.Text); var expectedPosition = new JobPosition(ddlExpectedPosition.SelectedValue, ddlExpectedPosition.SelectedItem.Text); var jobExperienceLevel = new ExperienceLevel(ddlExp.SelectedValue, ddlExp.SelectedItem.Text); var worktype = new WorkType(ddlworktype.SelectedValue, ddlworktype.SelectedItem.Text); var jobAchievement = ta1.Value; var careerGoal = ta2.Value; var experience = ta3.Value; var literacy = ta6.Value; var skill = ta5.Value; var reference = ta4.Value; var contactmail = txtContactMail.Text; var attachmentPath = ""; if (this.fuResume.HasFile) { string imgThumb = "E:\\DOCUMENTS\\School\\ASP.NETWorkSpaces\\WebFindingJobsMVCmodel\\FileSticky\\" + this.fuResume.FileName; this.fuResume.SaveAs(imgThumb); attachmentPath = "/FileSticky/" + this.fuResume.FileName; } Resume1 = new Resume(); var returnValue = false; var query = Request.QueryString["resumeId"]; if (query != null) { returnValue = Resume1.SetFullResumeInfoUpdate(resumeTitle, certificate, salary, langSkill, location, category, expectedPosition, jobExperienceLevel, worktype, jobAchievement, careerGoal, experience, literacy, skill, reference, user, contactmail, query, attachmentPath); } else { returnValue = Resume1.SetFullResumeInfo(resumeTitle, certificate, salary, langSkill, location, category, expectedPosition, jobExperienceLevel, worktype, jobAchievement, careerGoal, experience, literacy, skill, reference, user, contactmail, attachmentPath); } if (returnValue) { JavaScriptAleart("Thực hiện thành công"); } else { JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại"); } } catch (Exception exception) { JavaScriptAleart(exception.Message); } }
protected virtual void OnProgress(uint id, string text, WorkType work, WorkStatusType workStatus, WorkResultType workResult) { if (_rootModel != null) _rootModel.RaiseProgressEvent(id, text, work, workStatus, workResult); }
// Example from page - http://help.k2.com/onlinehelp/k2blackpearl/DevRef/4.6.9/default.htm#How_to_set_a_users_Out_of_Office_Status.html%3FTocPath%3DRuntime%2520APIs%2520and%2520Services%7CWorkflow%7CWorkflow%2520Client%2520API%7CWorkflow%2520Client%2520API%2520Samples%7C_____10 private void AddOutOfOffice() { string userFQN = base.GetStringProperty(Constants.Properties.OutOfOffice.UserFQN); string destinationUser = base.GetStringProperty(Constants.Properties.OutOfOffice.DestinationUser); ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0]; serviceObject.Properties.InitResultTable(); DataTable results = base.ServiceBroker.ServicePackage.ResultTable; WorkflowManagementServer mngServer = new WorkflowManagementServer(); using (mngServer.CreateConnection()) { mngServer.Open(BaseAPIConnectionString); WorklistShares wsColl = mngServer.GetCurrentSharingSettings(userFQN, ShareType.OOF); // Throw error if multiple configurations (WorklistShare objects) detected, as this method cannot support that if (wsColl.Count > 1) { throw new ApplicationException(Constants.ErrorMessages.MultipleOOFConfigurations); } // If configuration exist already, add to it if (wsColl.Count == 1) { WorklistShare worklistshare = wsColl[0]; worklistshare.WorkTypes[0].Destinations.Add(new Destination(destinationUser, DestinationType.User)); bool result = mngServer.ShareWorkList(userFQN, worklistshare); DataRow dr = results.NewRow(); dr[Constants.Properties.OutOfOffice.UserFQN] = userFQN; dr[Constants.Properties.OutOfOffice.DestinationUser] = destinationUser; dr[Constants.Properties.OutOfOffice.CallSuccess] = result; results.Rows.Add(dr); ; } // New user, create configuration for OOF else { // ALL Work that remains which does not form part of any "WorkTypeException" Filter WorklistCriteria worklistcriteria = new WorklistCriteria(); worklistcriteria.Platform = "ASP"; // Send ALL Work based on the above Filter to the following User Destinations worktypedestinations = new Destinations(); worktypedestinations.Add(new Destination(destinationUser, DestinationType.User)); // Link the filters and destinations to the Work WorkType worktype = new WorkType("MyWork", worklistcriteria, worktypedestinations); WorklistShare worklistshare = new WorklistShare(); worklistshare.ShareType = ShareType.OOF; worklistshare.WorkTypes.Add(worktype); bool result = mngServer.ShareWorkList(userFQN, worklistshare); mngServer.SetUserStatus(userFQN, UserStatuses.Available); DataRow dr = results.NewRow(); dr[Constants.Properties.OutOfOffice.UserFQN] = userFQN; dr[Constants.Properties.OutOfOffice.DestinationUser] = destinationUser; dr[Constants.Properties.OutOfOffice.CallSuccess] = result; results.Rows.Add(dr); } } }
protected uint RaiseProgressEvent(string text, WorkType work, WorkStatusType workStatus, WorkResultType workResult) { uint newID = ProgressEventArgs.NewID(); OnProgress(newID, text, work, workStatus, workResult); return newID; }
/// <summary> /// Does the work, after checking that the entity type is indeed indexed. /// </summary> /// <param name="entity"></param> /// <param name="id"></param> /// <param name="workType"></param> /// <param name="e"></param> protected void ProcessWork(Object entity, object id, WorkType workType, AbstractEvent e) { if (EntityIsIndexed(entity)) { Work work = new Work(entity, id, workType); searchFactory.Worker.PerformWork(work, e.Session); } }