public ProxyResponse <InsertActivityResult> InsertActivity(ActivityDetail activityDetail) { OperationMethod = HttpMethod.Post; var uri = base.GetRequestUri(null); return(base.GetResponse <ActivityDetail, InsertActivityResult>(uri, activityDetail)); }
public ProxyResponse <UpdateActivityResult> UpdateActivity(int activityId, ActivityDetail activityDetail) { OperationMethod = HttpMethod.Put; var uri = base.GetRequestUri(activityId.ToString()); return(base.GetResponse <ActivityDetail, UpdateActivityResult>(uri, activityDetail)); }
// GET: Procurement/ActivityDetails/Create public IActionResult Create(short id) { ActivityDetail activityDetail = new ActivityDetail(); activityDetail.ActivityID = id; short stepNo = (short)_context.ActivityDetail.Count(a => a.ActivityID == id); Activity activity = _context.Activity.Find(id); if (stepNo == 0) { if (activity.ReviewType == "Post Review") { stepNo++; } //PProcurementPlan plan = db.PProcurementPlans.Find(activity.ProcurementPlanID); Step step = _context.Step.Where(a => a.ProcurementPlanID == activity.ProcurementPlanID).FirstOrDefault(); activityDetail.StepID = step.StepID; } else { activityDetail.StepID = nextStepID(stepNo, activity.ProcurementPlanID); if (activity.ReviewType == "Post Review" && stepNo == 6) { stepNo++; } } activityDetail.Activity = _context.Activity.Find(id); activityDetail.Step = _context.Step.Find(activityDetail.StepID); ViewBag.PPName = _context.ProcurementPlan.Find(activityDetail.Step.ProcurementPlanID).Name; activityDetail.PlannedDate = DateTime.Now; activityDetail.CreatedDate = DateTime.Now; activityDetail.CreatedBy = User.Identity.Name; return(View(activityDetail)); }
private void LoadData() { ActivityInfo ai = ActivityInfo.Provider.Get(ActivityID); if (ai == null) { return; } string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType); ActivityDetail ucDetails = null; try { ucDetails = Page.LoadUserControl(pathToControl) as ActivityDetail; } catch (HttpException exception) { // Ignore not existing control. // File.Exists cannot be used because user control is not available on filesystem for precompiled web application. if (exception.GetHttpCode() != (int)HttpStatusCode.NotFound) { throw; } } if (ucDetails != null && ucDetails.LoadData(ai)) { pnlDetails.Controls.Add(ucDetails); return; } // Control doesn't exist or couldn't load data. It's ok for custom activities or activities without details. Visible = false; }
private void LoadData() { ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(this.ActivityID); if (ai == null) { return; } string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType); try { ucDetails = this.Page.LoadControl(pathToControl) as ActivityDetail; bool dataLoaded = ucDetails.LoadData(ai); pnlDetails.GroupingText = GetString("om.activity.details.groupdetails"); pnlDetails.Controls.Add(ucDetails); ucDetails.Visible = dataLoaded; pnlDetails.Visible = dataLoaded; } catch (HttpException) { // Failed to load the control } }
private void VerifyDetailsAreSame(ActivityDetail details1, ActivityDetail details2) { Assert.Equal(details2.Title, details1.Title); Assert.Equal(details2.Details, details1.Details); Assert.Equal(details2.OwnerEmail, details1.OwnerEmail); Assert.Equal(details2.Done, details1.Done); Assert.Equal(details2.Due.Date, details1.Due.Date); }
public ActionResult DeleteConfirmed(Guid id) { ActivityDetail activityDetail = db.ActivityDetails.Find(id); db.ActivityDetails.Remove(activityDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
//歷史活動Partial public ActionResult Activity_DetailPartial(int id = 0) { ActivityDetail AD = new ActivityDetail(); var act = AD.GetActivity(id); ViewBag.photoids = AD.GetActivityPhoto(id); return(PartialView(act)); }
//Populate the script lists here. Follow the example on how to add to a list #region Populate Lists /// <summary> /// Use this method to populate the lists. They are already set to be selected from the /// CycleScripts method and no other work is required. /// </summary> public override void PopulateLists() { SignIn.Clear(); AccountCreation.Clear(); Activities.Clear(); ActivityDetail.Clear(); Workouts.Clear(); Courses.Clear(); Dashboard.Clear(); Navigation.Clear(); Explore.Clear(); Reports.Clear(); Health.Clear(); Goals.Clear(); Upload.Clear(); Settings.Clear(); CheckFirmware.Clear(); ManualActivity.Clear(); Troubleshoot.Clear(); base.PopulateLists(); //MyCategory.Add(new TestCase(base.baseURL, base.webdriver, base.verificationErrors)); SignIn.Add(new Connect_SignIn(base.baseURL, base.webdriver, base.verificationErrors)); SignIn.Add(new Connect_SignInValidation(base.baseURL, base.webdriver, base.verificationErrors)); Settings.Add(new Connect_MeasurementSettings(base.baseURL, base.webdriver, base.verificationErrors)); Navigation.Add(new Connect_GeneralNavigation(base.baseURL, base.webdriver, base.verificationErrors)); Navigation.Add(new Connect_Navigation_Unauthenticated(base.baseURL, base.webdriver, base.verificationErrors)); Upload.Add(new Connect_UploadFile(base.baseURL, base.webdriver, base.verificationErrors)); Activities.Add(new Connect_ActivitiesSort(base.baseURL, base.webdriver, base.verificationErrors)); ActivityDetail.Add(new Connect_ActivityDetail_Validation(base.baseURL, base.webdriver, base.verificationErrors)); //CheckFirmware.Add(new Connect_CheckFirmware_Edge800(base.baseURL, base.webdriver, base.verificationErrors)); // Jira opened CheckFirmware.Add(new Connect_CheckFirmware_Edge705(base.baseURL, base.webdriver, base.verificationErrors)); CheckFirmware.Add(new Connect_CheckFirmware_Edge605(base.baseURL, base.webdriver, base.verificationErrors)); CheckFirmware.Add(new Connect_CheckFirmware_FR60(base.baseURL, base.webdriver, base.verificationErrors)); CheckFirmware.Add(new Connect_CheckFirmware_FR405CX(base.baseURL, base.webdriver, base.verificationErrors)); CheckFirmware.Add(new Connect_CheckFirmware_Edge305(base.baseURL, base.webdriver, base.verificationErrors)); CheckFirmware.Add(new Connect_CheckFirmware_FR201(base.baseURL, base.webdriver, base.verificationErrors)); //CheckFirmware.Add(new Connect_CheckFirmware_FR210(base.baseURL, base.webdriver, base.verificationErrors)); //Test Failing CheckFirmware.Add(new Connect_CheckFirmware_Edge500(base.baseURL, base.webdriver, base.verificationErrors)); //CheckFirmware.Add(new Connect_CheckFirmware_FR110(base.baseURL, base.webdriver, base.verificationErrors)); //Test Failing //CheckFirmware.Add(new Connect_CheckFirmware_FR910(base.baseURL, base.webdriver, base.verificationErrors)); CheckFirmware.Add(new Connect_CheckFirmware_FR610(base.baseURL, base.webdriver, base.verificationErrors)); Dashboard.Add(new Connect_Dashboard_CreateGoal(base.baseURL, base.webdriver, base.verificationErrors)); Dashboard.Add(new Connect_Dashboard_NoGoal(base.baseURL, base.webdriver, base.verificationErrors)); Dashboard.Add(new Connect_Dashboard_PercentComplete(base.baseURL, base.webdriver, base.verificationErrors)); Dashboard.Add(new Connect_Dashboard_NoUploads(base.baseURL, base.webdriver, base.verificationErrors)); Dashboard.Add(new Connect_Dashboard_FiveItems(base.baseURL, base.webdriver, base.verificationErrors)); Dashboard.Add(new Connect_Dashboard_ActivityNameTabs(base.baseURL, base.webdriver, base.verificationErrors)); Dashboard.Add(new Connect_Dashboard_ActivityType(base.baseURL, base.webdriver, base.verificationErrors)); //Dashboard.Add(new Connect_Dashboard_FiveItems(base.baseURL, base.webdriver, base.verificationErrors)); //jira 10209 ManualActivity.Add(new Connect_ManualActivity_NameCharLimit(base.baseURL, base.webdriver, base.verificationErrors)); ManualActivity.Add(new Connect_ManualActivity_NoName(base.baseURL, base.webdriver, base.verificationErrors)); ManualActivity.Add(new Connect_ManualActivity_ActivityType(base.baseURL, base.webdriver, base.verificationErrors)); ManualActivity.Add(new Connect_ManualActivity_DescriptionLimit(base.baseURL, base.webdriver, base.verificationErrors)); //Related to Jira 10309 ManualActivity.Add(new Connect_ManualActivity_PaceCalc(base.baseURL, base.webdriver, base.verificationErrors)); }
public ActionResult Edit([Bind(Include = "activityId,locationId,driveHrsFromHome,activityType,activityOtherDesc,activityName,activityNotes,activityWinter,activitySpring,activitySummer,activityFall,activitySiteName,activitySiteURL")] ActivityDetail activityDetail) { if (ModelState.IsValid) { db.Entry(activityDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(activityDetail)); }
private void dtgListActivities_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } ActivityDetail formDetail = new ActivityDetail(dtgListActivities.Rows[e.RowIndex].Cells["id"].Value.ToString()); formDetail.ShowDialog(); listActivity(); }
public ActionResult Create([Bind(Include = "activityId,locationId,driveHrsFromHome,activityType,activityOtherDesc,activityName,activityNotes,activityWinter,activitySpring,activitySummer,activityFall,activitySiteName,activitySiteURL")] ActivityDetail activityDetail) { if (ModelState.IsValid) { activityDetail.activityId = Guid.NewGuid(); db.ActivityDetails.Add(activityDetail); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(activityDetail)); }
public async Task <IActionResult> Create([Bind("StepID,ActivityID,NotApplicable,PlannedDate,ActualDate,Attachment,CreatedDate,UpdatedBy")] ActivityDetail activityDetail) { if (ModelState.IsValid) { _context.Add(activityDetail); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ActivityID"] = new SelectList(_context.Activity, "ActivityID", "Description", activityDetail.ActivityID); ViewData["StepID"] = new SelectList(_context.Step, "StepID", "StepID", activityDetail.StepID); return(View(activityDetail)); }
public async Task <IActionResult> Create(string PPName, [Bind("StepID,ActivityID,NotApplicable,PlannedDate,ActualDate,Attachment,CreatedBy,CreatedDate,UpdatedBy,UpdatedDate")] ActivityDetail activityDetail, IFormFile Attachment) { if (ModelState.IsValid) { if (activityDetail.NotApplicable == true) { activityDetail.Attachment = null; activityDetail.ActualDate = null; activityDetail.PlannedDate = null; } else { if (Attachment != null) { var rootPath = Path.Combine( Directory.GetCurrentDirectory(), "wwwroot\\Documents\\Procurement\\"); string fileName = Path.GetFileName(Attachment.FileName); fileName = fileName.Replace("&", "n"); string AName = _context.Activity.Find(activityDetail.ActivityID).Name; AName = AName.Replace("&", "n"); //var PPName = _context.ProcurementPlan.Find(activityDetail.Step.ProcurementPlanID).Name; activityDetail.Attachment = Path.Combine("/Documents/Procurement/", PPName + "/" + "//" + AName + "//" + activityDetail.StepID + "//" + fileName);//Server Path //_context.ActivityDetail.Add(activityDetail); string sPath = Path.Combine(rootPath + PPName + "/" + AName + "/", activityDetail.StepID.ToString()); if (!System.IO.Directory.Exists(sPath)) { System.IO.Directory.CreateDirectory(sPath); } string FullPathWithFileName = Path.Combine(sPath, fileName); using (var stream = new FileStream(FullPathWithFileName, FileMode.Create)) { await Attachment.CopyToAsync(stream); } } } activityDetail.CreatedDate = DateTime.Now.Date; //Activity activityObj = _context.Activity.Find(activityDetail.ActivityID); //_context.Update(activityObj); _context.Add(activityDetail); await _context.SaveChangesAsync(); if (activityDetail.StepID == 1) { Activity Obj = _context.Activity.Find(activityDetail.ActivityID); Obj.Status = 2; _context.Update(Obj); } return(RedirectToAction(nameof(Edit), "Activities", new { id = activityDetail.ActivityID })); } return(View(activityDetail)); }
public ActivityDetail GetActivityById(int id) { Activity getActivity = _db.Activities.Single(a => a.ActivityId == id); ActivityDetail detail = new ActivityDetail() { ActivityId = getActivity.ActivityId, Title = getActivity.Title, Description = getActivity.Description, Equipment = getActivity.Equipment, CategoryId = getActivity.CategoryId }; return(detail); }
// GET: ActivityDetails/Delete/5 public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ActivityDetail activityDetail = db.ActivityDetails.Find(id); if (activityDetail == null) { return(HttpNotFound()); } return(View(activityDetail)); }
public IActionResult NewActivity(Happening newHappening) { int?logged_id = HttpContext.Session.GetInt32("LoggedUser"); if (logged_id == null) { return(RedirectToAction("Index")); } if (ModelState.IsValid) { newHappening.CreatedById = (int)logged_id; newHappening.HappeningDate = newHappening.HappeningDate.Date + newHappening.StartTime.TimeOfDay; if (newHappening.DurationMetric == "Days") { TimeSpan ts = new TimeSpan(newHappening.Duration, 0, 0, 0); newHappening.EndTime = newHappening.HappeningDate + ts; } else if (newHappening.DurationMetric == "Hours") { TimeSpan ts = new TimeSpan(newHappening.Duration, 0, 0); newHappening.EndTime = newHappening.HappeningDate + ts; } else if (newHappening.DurationMetric == "Mins") { TimeSpan ts = new TimeSpan(0, newHappening.Duration, 0); newHappening.EndTime = newHappening.HappeningDate + ts; } dbContext.Happenings.Add(newHappening); dbContext.SaveChanges(); ActivityDetail ad = new ActivityDetail(); ad.Happening = dbContext.Happenings .Include(h => h.CreatedBy) .Include(h => h.ParticipantsList) .ThenInclude(p => p.Participant) .FirstOrDefault(h => h.HappeningId == newHappening.HappeningId); if (ad.Happening != null) { ad.loggedUser = dbContext.Users.Include(u => u.createdPlan).Include(u => u.ActivitiesToAttend).ThenInclude(p => p.JoiningActivity).FirstOrDefault(u => u.UserId == (int)logged_id); return(View("activityDetail", ad)); } return(RedirectToAction("home")); // return RedirectToAction("Home"); //return RedirectToAction("ActivityDetail",newHappening.HappeningId); } return(View("newHappening", newHappening)); }
public void UpdateActivity() { var proxy = new ActivityProxy(); var activity = proxy.GetActivity(_testActivityToBeUpdated); var uniqueId = Guid.NewGuid().ToString().Substring(0, 5); var title = "Test activity " + uniqueId; var details = "Details of test activity " + uniqueId; var done = !activity.DataObject.Done; var due = activity.DataObject.Due.AddDays(1); var ownerEmail = string.IsNullOrWhiteSpace(activity.DataObject.OwnerEmail) ? TestConfig.TestUser : null; var attachedToType = string.IsNullOrWhiteSpace(activity.DataObject.AttachedToType) ? null : "Sale"; int?attachedToId = null; if (activity.DataObject.AttachedToId != null && activity.DataObject.AttachedToId > 0) { attachedToId = _saleInvoiceTranId; } var updateActivty = new ActivityDetail { Title = title, Details = details, Done = done, Due = due, OwnerEmail = ownerEmail, AttachedToType = attachedToType, AttachedToId = attachedToId, LastUpdatedId = activity.DataObject.LastUpdatedId }; var updateResponse = proxy.UpdateActivity(_testActivityToBeUpdated, updateActivty); Assert.True(updateResponse.IsSuccessfull, "Call to UpdateActivity was not successful"); Assert.True(updateResponse.DataObject != null, "Call to InsertActivity returned no data"); Assert.Equal(_testActivityToBeUpdated, updateResponse.DataObject.UpdatedActivityId); var activityGet = proxy.GetActivity(_testActivityToBeUpdated); Assert.True(activityGet.DataObject != null, "No row returned from Get after update."); VerifyDetailsAreSame(updateActivty, activityGet.DataObject); }
//[Authorize(Roles = "Procurement")] // GET: Procurement/ActivityDetails/Create public IActionResult Create(short id) { ActivityDetail activityDetail = new ActivityDetail(); activityDetail.ActivityID = id; short stepNo = (short)_context.ActivityDetail.Count(a => a.ActivityID == id); Activity activity = _context.Activity.Find(id); if (stepNo == 0) { if (activity.ReviewType == "Post Review") { stepNo++; } //PProcurementPlan plan = db.PProcurementPlans.Find(activity.ProcurementPlanID); Step step = _context.Step.Where(a => a.ProcurementPlanID == activity.ProcurementPlanID).FirstOrDefault(); activityDetail.StepID = step.StepID; } else { activityDetail.StepID = nextStepID(stepNo, activity.ProcurementPlanID); if (activity.ReviewType == "Post Review" && stepNo == 6) { stepNo++; } } activityDetail.Activity = _context.Activity.Find(id); activityDetail.Step = _context.Step.Find(activityDetail.StepID); ViewBag.PPName = _context.ProcurementPlan.Find(activityDetail.Step.ProcurementPlanID).Name; activityDetail.PlannedDate = DateTime.Now; activityDetail.CreatedDate = DateTime.Now; activityDetail.CreatedBy = User.Identity.Name; ViewBag.Status = "0"; if ((stepNo + 1) == 9) { var val = _context.Lot.Where(a => a.ActivityID == activity.ActivityID && a.IsMatched == false).Count(); ViewBag.Status = (val > 0 ? "0" : "1"); } ViewData["ContractorID"] = new SelectList(_context.Contractor.Where(a => a.ContractorTypeID == 1).ToList(), "ContractorID", "CompanyName"); return(View(activityDetail)); }
private ActivityDetail GetActivityDetail(string title = null, string details = null, string attachedToType = null, int?attachedToId = null, bool done = false, DateTime?due = null, string ownerEmail = null, string type = null, string tags = null) { var uniqueId = Guid.NewGuid().ToString().Substring(0, 5); var activity = new ActivityDetail { Title = title ?? "Test activity " + uniqueId, Details = details ?? "Details of test activity " + uniqueId, AttachedToId = attachedToId ?? _saleInvoiceTranId, AttachedToType = attachedToType ?? "Sale", Done = done, Due = due ?? DateTime.Now.AddDays(5), OwnerEmail = ownerEmail, ActivityType = type ?? _testTag, Tags = new List <string> { tags } }; return(activity); }
public ActivityDetail GetActivityById(int activitytId) { ActivityDetail detail = null; using (var SqlConn = ConnectionProvider.GetConnection()) { var SqlCmd = new SqlCommand(); SqlCmd.Connection = SqlConn; SqlCmd.CommandText = @" SELECT Adress, StartTime, EndTime, Title, ContentText, ImageUrl, Link CreatedTime, LastUpdatedTime FROM dbo.Activity where Id=@ActivitytId"; SqlCmd.Parameters.AddWithValue(@"ActivitytId", activitytId); var reader = SqlCmd.ExecuteReader(); if (reader.Read()) { detail = new ActivityDetail(); detail.Address = reader["Adress"] == DBNull.Value ? null : reader["Adress"].ToString(); detail.ContentText = reader["ContentText"] == DBNull.Value ? null : reader["ContentText"].ToString(); detail.EndTime = reader["EndTime"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(reader["EndTime"]); detail.ImageUrl = reader["ImageUrl"] == DBNull.Value ? null : reader["ImageUrl"].ToString(); detail.Link = reader["ImageUrl"] == DBNull.Value ? null : reader["ImageUrl"].ToString(); detail.StartTime = reader["EndTime"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(reader["EndTime"]); detail.Title = reader["Title"] == DBNull.Value ? null : reader["Title"].ToString(); } } return(detail); }
public bool CreateUpdateActivity(ActivityDetail requestData) { bool result = default(bool); bool res = default(bool); try { if (requestData.ActivityId == default(int)) { return(new RepositoryCreator().ActivityRepository.CreateActivity(requestData)); } else { return(new RepositoryCreator().ActivityRepository.UpdateActivity(requestData)); } } catch (Exception ex) { AggieGlobalLogManager.Fatal("ActivityManager :: CreateUpdateActivity failed :: " + ex.Message); } return(result); }
public IActionResult ActivityDetail(int hapId) { int?logged_id = HttpContext.Session.GetInt32("LoggedUser"); if (logged_id == null) { return(RedirectToAction("Index")); } ActivityDetail ad = new ActivityDetail(); ad.Happening = dbContext.Happenings .Include(h => h.CreatedBy) .Include(h => h.ParticipantsList) .ThenInclude(p => p.Participant) .FirstOrDefault(h => h.HappeningId == hapId); if (ad.Happening != null) { ad.loggedUser = dbContext.Users.Include(u => u.createdPlan).Include(u => u.ActivitiesToAttend).ThenInclude(p => p.JoiningActivity).FirstOrDefault(u => u.UserId == (int)logged_id); return(View("activityDetail", ad)); } return(RedirectToAction("Home")); }
private void LoadData() { ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(this.ActivityID); if (ai == null) { return; } string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType); try { ucDetails = this.Page.LoadControl(pathToControl) as ActivityDetail; bool dataLoaded = ucDetails.LoadData(ai); pnlDetails.GroupingText = GetString("om.activity.details.groupdetails"); pnlDetails.Controls.Add(ucDetails); ucDetails.Visible = dataLoaded; pnlDetails.Visible = dataLoaded; } catch(HttpException) { // Failed to load the control } }
public ActivityDetail GetActivityDetailById(int id) { ActivityDetail detail = null; ActivityDal activityDal = new ActivityDal(); var entity = activityDal.GetActivityById(id); if (entity != null) { detail = new ActivityDetail(); detail.Address = entity.Address; detail.StartTime = entity.StartTime; detail.ContentText = entity.ContentText; detail.EndTime = entity.EndTime; detail.ImageUrl = entity.ImageUrl; detail.Link = entity.Link; detail.Title = entity.Title; } return(detail); }
private void LoadData() { ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(ActivityID); if (ai == null) { return; } string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType); if (FileHelper.FileExists(pathToControl)) { ActivityDetail ucDetails = Page.LoadUserControl(pathToControl) as ActivityDetail; if (ucDetails.LoadData(ai)) { pnlDetails.Controls.Add(ucDetails); return; } } // Control doesn't exist or couldn't load data. It's ok for custom activities or activities without details. Visible = false; }
public ActivityDetail GetActivityById(int activitytId) { ActivityDetail detail = null; using (var SqlConn = ConnectionProvider.GetConnection()) { var SqlCmd = new SqlCommand(); SqlCmd.Connection = SqlConn; SqlCmd.CommandText = @" SELECT Adress, StartTime, EndTime, Title, ContentText, ImageUrl, Link CreatedTime, LastUpdatedTime FROM dbo.Activity where Id=@ActivitytId"; SqlCmd.Parameters.AddWithValue(@"ActivitytId", activitytId); var reader = SqlCmd.ExecuteReader(); if (reader.Read()) { detail = new ActivityDetail(); detail.Address = reader["Adress"] == DBNull.Value ? null : reader["Adress"].ToString(); detail.ContentText = reader["ContentText"] == DBNull.Value ? null : reader["ContentText"].ToString(); detail.EndTime = reader["EndTime"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(reader["EndTime"]); detail.ImageUrl = reader["ImageUrl"] == DBNull.Value ? null : reader["ImageUrl"].ToString(); detail.Link = reader["ImageUrl"] == DBNull.Value ? null : reader["ImageUrl"].ToString(); detail.StartTime = reader["EndTime"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(reader["EndTime"]); detail.Title = reader["Title"] == DBNull.Value ? null : reader["Title"].ToString(); } } return detail; }
public async Task <IActionResult> Edit(short ActivityID, string PPName, int ActualCost, [Bind("StepID,ActivityID,NotApplicable,PlannedDate,ActualDate,Attachment,CreatedDate,UpdatedBy")] ActivityDetail activityDetail, IFormFile Attachment) { //if (id != activityDetail.ActivityID) //{ // return NotFound(); //} if (ModelState.IsValid) { try { if (activityDetail.NotApplicable == true) { activityDetail.Attachment = null; activityDetail.ActualDate = null; activityDetail.PlannedDate = null; } else { if (Attachment != null) { var rootPath = Path.Combine( Directory.GetCurrentDirectory(), "wwwroot\\Documents\\Procurement\\"); string fileName = Path.GetFileName(Attachment.FileName); fileName = fileName.Replace("&", "n"); string AName = _context.Activity.Find(activityDetail.ActivityID).Name; AName = AName.Replace("&", "n"); //var PPName = _context.ProcurementPlan.Find(activityDetail.Step.ProcurementPlanID).Name; activityDetail.Attachment = Path.Combine(rootPath + PPName + "/" + "//" + AName + "//" + activityDetail.StepID + "//" + fileName);//Server Path //_context.ActivityDetail.Add(activityDetail); string sPath = Path.Combine(rootPath + PPName + "/" + AName + "/", activityDetail.StepID.ToString()); if (!System.IO.Directory.Exists(sPath)) { System.IO.Directory.CreateDirectory(sPath); } string FullPathWithFileName = Path.Combine(sPath, fileName); using (var stream = new FileStream(FullPathWithFileName, FileMode.Create)) { await Attachment.CopyToAsync(stream); } } } Activity activityObj = _context.Activity.Find(activityDetail.ActivityID); activityObj.ActualCost = ActualCost; //_context.Update(activityObj); _context.Update(activityDetail); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActivityDetailExists(activityDetail.ActivityID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Edit), "Activities", new { id = activityDetail.ActivityID })); } ViewData["ActivityID"] = new SelectList(_context.Activity, "ActivityID", "Description", activityDetail.ActivityID); ViewData["StepID"] = new SelectList(_context.Step, "StepID", "StepID", activityDetail.StepID); return(View(activityDetail)); }
public Boolean AddTime(int actId) { bool flag = false; try { short delNormal = (short)Model.Enum.DelFlagEnum.Normal; short delDoneAuditing = (short)Model.Enum.DelFlagEnum.DoneAuditing; Activity activity = DbSession.ActivityDal.GetEntities(u => u.ActivityID == actId && u.Status == delDoneAuditing).FirstOrDefault(); var EnrollList = DbSession.UserEnrollDal.GetEntities(u => u.ActivityID == actId && u.Status == delNormal).AsQueryable(); foreach (var Enroll in EnrollList) { //添加活动详情 ActivityDetail activityDetail = new ActivityDetail(); activityDetail.Status = (short)Model.Enum.DelFlagEnum.Normal; activityDetail.UserInfoId = Enroll.UserInfoID; activityDetail.ActivityID = Enroll.ActivityID; activityDetail.CreateTime = DateTime.Now; activityDetail.ModfiedOn = activityDetail.CreateTime; activityDetail.ActivityDetailTime = (decimal)Enroll.ActivityTime; DbSession.ActivityDetailDal.Add(activityDetail); //用户总时长累积 UserDuration userDuration = DbSession.UserDurationDal.GetEntities(u => u.UserDurationID == Enroll.UserInfoID).FirstOrDefault(); //政治面貌 int pId = DbSession.UserInfoDal.GetEntities(u => u.UserInfoID == userDuration.UserDurationID).FirstOrDefault().PoliticalID; //总时长 userDuration.UserDurationTotal = userDuration.UserDurationTotal + (decimal)Enroll.ActivityTime; //用户为党员 if (pId == polParty) { userDuration.UserDurationPartyTotal = userDuration.UserDurationPartyTotal + (decimal)Enroll.ActivityTime; } //用户为预备党员 else if (pId == polPreparatory) { userDuration.UserDurationPropartyTotal = userDuration.UserDurationPropartyTotal + (decimal)Enroll.ActivityTime; //50小时志愿者徽章 if (userDuration.UserDurationPropartyTotal >= 50 && DbSession.UserBadgeDal.GetEntities(u => u.BadgeID == 1 && u.UserInfoID == userDuration.UserDurationID).FirstOrDefault() == null) { UserBadge userBadge = new UserBadge { //徽章ID BadgeID = 1, UserInfoID = userDuration.UserDurationID, CreateTime = DateTime.Now }; userDuration.Status = delNormal; DbSession.UserBadgeDal.Add(userBadge); } } else { userDuration.UserDurationNormalTotal = userDuration.UserDurationNormalTotal + (decimal)Enroll.ActivityTime; } DbSession.UserDurationDal.Update(userDuration); } activity.Status = delNormal; activity.ModfiedOn = DateTime.Now; DbSession.ActivityDal.Update(activity); DbSession.SaveChanges(); flag = true; } catch (Exception e) { flag = false; } return(flag); }
/// <summary> /// Open pane based on pane name /// </summary> /// <typeparam name="TMessage">Message</typeparam> /// <param name="paneName">Pane name</param> /// <param name="msg">Message</param> protected override void AddPane <TMessage>(string paneName, TMessage msg) { string header = ""; object content; switch (paneName) { case addPivotItemName: content = new ActivityAdd(); if (msg.GetType() == typeof(ItemAddNewMsg)) { header = "Add Activity"; } else { header = "Edit Activity"; } break; case detailPivotItemName: content = new ActivityDetail(); header = "Activity Detail"; break; default: throw new NotImplementedException(); } try { if (PivotPanes.FirstOrDefault(x => x.Name == paneName) == null) { PivotPanes.Insert(0, new PivotItem() { Name = paneName, Header = header, Margin = new Thickness(0), Content = content }); } else { PivotPanes.FirstOrDefault(x => x.Name == paneName).Header = header; PivotPanes.FirstOrDefault(x => x.Name == paneName).Content = content; } } catch (Exception) { PivotPanes.Clear(); PivotPanes.Insert(0, new PivotItem() { Name = paneName, Header = header, Content = content }); } finally { if (PivotPanes.FirstOrDefault(x => x.Name == paneName) != null) { //pivotPanes = PivotPanes; RaisePropertyChanged(nameof(PivotPanes)); PaneVisibility = true; double MinNormalWidth = (double)Application.Current.Resources["NormalMinWidth"]; if (MinNormalWidth > ApplicationView.GetForCurrentView().VisibleBounds.Width) { MasterFrame = new GridLength(0); } Messenger.Send(msg); } } }
public async Task <IActionResult> UpdatingActivityDetail([FromBody] JsonElement id) { string DownloadDirectory = _configuration["Configuration:DownloadPath"].Replace("/", "\\"); int Status = 0; string JournalName = string.Empty; string filename = string.Empty; var responsedetail = new Response(); string sCaptureError = ""; var fileDetail = new FileDetail(); // client.BaseAddress = new Uri(_configuration["Configuration:Uri"]); // client.DefaultRequestHeaders.Accept.Clear(); // client.DefaultRequestHeaders.Accept.Add( // new MediaTypeWithQualityHeaderValue("application/json")); // client.DefaultRequestHeaders.Add("clientid", _configuration["Configuration:ClientId"]); // client.DefaultRequestHeaders.Add("apikey", _configuration["Configuration:apiKey"]); var data = id.ToString(); JObject jObject = JObject.Parse(data); string value = (string)jObject.SelectToken("id"); var ids = "{\n\t\"ids\":[" + value + "]\n}".ToString(); // var response = client.PostAsync(_configuration["Configuration:GetActivityFiles"], new StringContent(data, Encoding.UTF8, "application/json")).Result; var client = new RestClient(_configuration["Configuration:LiveUri"] + _configuration["Configuration:GetActivityFiles"]); var request = new RestRequest(Method.POST); request.AddHeader("content-type", "application/json"); request.AddHeader("clientid", _configuration["Configuration:ClientId"]); request.AddHeader("apikey", _configuration["Configuration:apiKey"]); request.AddParameter("application/json", data, ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { responsedetail = JsonConvert.DeserializeObject <Response>(response.Content.ToString()); } if (responsedetail.is_success) { //updating Status to Trn File Property Details Status = responsedetail.data.Status; JournalName = responsedetail.data.JournalName; filename = responsedetail.data.ArticleName; var bookdetails = _context.BookDetails.FirstOrDefault(x => x.bookName == JournalName); fileDetail = _context.FileDetails.FirstOrDefault(x => x.fileName == filename); try { // var fileDetail = await _context.FileDetails.FirstOrDefaultAsync(x => x.fileName == filename); if (fileDetail == null) { return(StatusCode(200, new { is_success = false, data = "", message = string.Format("File Details Not exist for given Articlname {0} ", filename) })); } else if (fileDetail != null) { var FileProplold = await _context.trnFilePropertyDetails.FirstOrDefaultAsync(x => x.fileId == fileDetail.fileID && x.bookId == bookdetails.bookId && x.id == 195); if (FileProplold != null) { try { FileProplold.value = Status.ToString(); // _context.Recorddetails.Attach(recordetailold); // _context.Entry(recordetailold).Property(x=>x.status & x.bookid &x.fileID).IsModified=true; // _context.SaveChanges(); _context.trnFilePropertyDetails.Update(FileProplold); await _context.SaveChangesAsync(); } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = "Error in Updating FilePropertDetails Error Desc: " + ex.Message.ToString() })); } } else { var recordetail = new trnFilePropertyDetail { // id = 195, //Customer Category file Property fileId = fileDetail.fileID, bookId = bookdetails.bookId, value = Status.ToString() }; try { await _context.AddAsync(recordetail); await _context.SaveChangesAsync(); } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = "Error in Inserting FilePropertDetails Error Desc: " + ex.Message.ToString() })); } } } //For CustomerID IOPP from Iatuhor if (responsedetail.data.CustomerId == Customers.IOPPCustomer) { if (responsedetail.data.WorkflowId == (int)WorkFlowIds.authorProofing2 && Status == 3) { //adding Activity and Stage Detail for abovedotne Workflow ID's Enabling HTML Download Acitivity in Copy Editing Stage stageid = (int)IOPPStages.fromAuthor; activityid = (int)activities.HTMLDownload; } else { //adding Activity and Stage Detail for abovedotne Workflow ID's Enabling Pdf Creation Acitivity in Copy Editing Stage stageid = (int)IOPPStages.Copyediting; activityid = (int)activities.IOPPHtmlToPDF; } try { if (fileDetail != null) { var recordetailold = await _context.Recorddetails37.FirstOrDefaultAsync(x => x.fileID == fileDetail.fileID && x.activityid == activityid); if (recordetailold != null) { try { if (recordetailold.status == 0) { recordetailold.status = 1; _context.Recorddetails37.Update(recordetailold); await _context.SaveChangesAsync(); } else { } } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = "Error in Updating Activity Details Error Desc: " + ex.Message.ToString() })); } } else { var recordetail = new Recorddetail37 { fileID = fileDetail.fileID, activityid = (Int16)activityid, stageId = (Int16)stageid, bookid = (Int16)fileDetail.bookid, }; try { await _context.AddAsync(recordetail); await _context.SaveChangesAsync(); } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = "Error in Inserting Activity Details Error Desc: " + ex.Message.ToString() })); } } } } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = ex.Message.ToString() })); } } //For CustomerID BMJ from Iatuhor else if (responsedetail.data.CustomerId == Customers.BMJCustomer) { try { ActivityDetail activityDetail = new ActivityDetail(); StageDetail StageDetail = new StageDetail(); string FileName = Path.GetFileName(responsedetail.data.path.ToString()); DownloadDirectory = DownloadDirectory.Replace(";bookname;", responsedetail.data.JournalName.ToString()); String DownloadPath = DownloadDirectory + filename + "\\" + FileName; int WorkflowId = responsedetail.data.WfdId; string ArticleName = responsedetail.data.ArticleName; Status = responsedetail.data.Status; string UriPath = responsedetail.data.path.ToString(); bool IsitrackStageAdded = false; // string pdfName = Path.GetFileName(jobinputs.pdfPath); // string xmlFName = Path.GetFileName(jobinputs.xmlPath); // string appFName = Path.GetFileName(jobinputs.ApplicationPath); // if (jobinputs.Wfdid == "23" || jobinputs.Wfdid == "24") if (bmjworkflowids.Contains(WorkflowId)) { if (bmjworkflowids.Contains(WorkflowId) && Status == 17) { //adding Activity and Stage Detail for abovedotne Workflow ID's stageid = (int)BMJStages.Revises1; // activityid = (int)activities.BMJXMLCorrection; //dynamically Create folder structure based on activityDetail = _context.ActivityDetails.FirstOrDefault(x => x.activityid == activityid); StageDetail = _context.StageDetails.FirstOrDefault(x => x.stageid == stageid); DownloadPath = DownloadPath.Replace(";stageDetail;", StageDetail.sfoldername); DownloadPath = DownloadPath.Replace(";ActivityDetail;", activityDetail.folderName); IsitrackStageAdded = AddtoItrackStage(ArticleName, "", 128, 513, 3, 1, ref sCaptureError); } else if (bmjworkflowids.Contains(WorkflowId) && Status == 3) { stageid = (int)BMJStages.Preview; activityid = (int)activities.BMJOnlinePDFCreation; activityDetail = await _context.ActivityDetails.FirstAsync(x => x.activityid == activityid); StageDetail = _context.StageDetails.FirstOrDefault(x => x.stageid == stageid); DownloadPath = DownloadPath.Replace(";stageDetail;", StageDetail.sfoldername); DownloadPath = DownloadPath.Replace(";ActivityDetail;", activityDetail.folderName); IsitrackStageAdded = AddtoItrackStage(ArticleName, "", 128, 513, 63, 1, ref sCaptureError); } else { stageid = (int)BMJStages.XMLValidation; activityid = (int)activities.BMJXMLValidation; activityDetail = _context.ActivityDetails.FirstOrDefault(x => x.activityid == activityid); StageDetail = _context.StageDetails.FirstOrDefault(x => x.stageid == stageid); DownloadPath = DownloadPath.Replace(";stageDetail;", StageDetail.sfoldername); DownloadPath = DownloadPath.Replace(";ActivityDetail;", activityDetail.folderName); } if (!string.IsNullOrEmpty(UriPath)) { if ((bmjworkflowids.Contains(WorkflowId))) { try { fileDetail = await _context.FileDetails.FirstOrDefaultAsync(x => x.fileName == filename); if (Decompress(DownloadPath, Path.GetDirectoryName(DownloadPath), UriPath, ref sCaptureError)) { if (fileDetail != null) { var recordetailold = await _context.Recorddetails.FirstOrDefaultAsync(x => x.fileID == fileDetail.fileID && x.activityid == activityid); if (recordetailold != null) { try { if (recordetailold.status == 0) { recordetailold.status = 1; // _context.Recorddetails.Attach(recordetailold); // _context.Entry(recordetailold).Property(x=>x.status & x.bookid &x.fileID).IsModified=true; // _context.SaveChanges(); _context.Recorddetails.Update(recordetailold); await _context.SaveChangesAsync(); } else { } } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = "Error in Updating Activity Details Error Desc: " + ex.Message.ToString() })); } } else { var recordetail = new Recorddetail { fileID = fileDetail.fileID, activityid = (Int16)activityid, stageId = (Int16)stageid, bookid = (Int16)fileDetail.bookid }; try { await _context.AddAsync(recordetail); await _context.SaveChangesAsync(); } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = "Error in Inserting Activity Details Error Desc: " + ex.Message.ToString() })); } } } } else { return(StatusCode(200, new { is_success = false, data = "", message = sCaptureError })); } } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = ex.Message.ToString() })); } } else { return(StatusCode(200, new { is_success = false, data = "", message = "" })); } } else { return(StatusCode(200, new { is_success = false, data = "", message = "File Path Should not be empty" })); } } else { return(StatusCode(200, new { is_success = false, data = "", message = " workflow id is not configured for id: " + WorkflowId })); } } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = ex.Message.ToString() })); } } } catch (Exception ex) { return(StatusCode(200, new { is_success = false, data = "", message = ex.Message.ToString() })); } var clientupdate = new RestClient(_configuration["Configuration:Uri"] + _configuration["Configuration:GetActivityFiles"]); var requestupdate = new RestRequest(Method.POST); requestupdate.AddHeader("content-type", "application/json"); requestupdate.AddHeader("clientid", _configuration["Configuration:ClientId"]); requestupdate.AddHeader("apikey", _configuration["Configuration:apiKey"]); requestupdate.AddParameter("application/json", ids, ParameterType.RequestBody); IRestResponse responsenew = client.Execute(request); if (responsenew.IsSuccessful) { responsedetail = JsonConvert.DeserializeObject <Response>(response.Content.ToString()); if (responsedetail.is_success) { return(StatusCode(200, new { is_success = true, data = "", message = "Success" })); } else { return(StatusCode(200, new { is_success = true, data = "", message = "Success" })); } } else { return(StatusCode(200, new { is_success = false, data = "", message = "Error in Updating Status" })); } } else { return(StatusCode(200, new { is_success = false, data = "", message = "No Respond from IAuthor URL " })); } }