//public PartialViewResult GetSubmitters(string UserID) //{ // var requestVM = new RequestVM(); // //var loggedInUserId = _commonService.GetUserIdByUserName(User.Identity.Name); // requestVM.SubmittingContact = _userService.GetSubmittingContactByUserId(UserID); // return PartialView("_submitcontact", requestVM.SubmittingContact); //} public ActionResult GetSubmittingContactByUserID(string UserID) { var requestVM = new RequestVM(); requestVM.SubmittingContact = _userService.GetSubmittingContactByUserId(UserID); return(Json(requestVM, JsonRequestBehavior.AllowGet)); }
public ActionResult RequestDetail(RequestVM vM) { var ename = Session["EmployeeName"].ToString(); var vacantdetail = new tblVacancydetail() { CompanyCode = vM.CompanyCode, CityCode = vM.CityCode, DepartmentId = vM.DepartmentId, PositionId = vM.PositionId, SeatAvailablityDate = vM.date, }; db.tblVacancydetails.Add(vacantdetail); db.SaveChanges(); if (vacantdetail != null) { List <object> lst = new List <object>(); lst.Add(ename); lst.Add(DateTime.Now); lst.Add(vM.RequestId); object[] item = lst.ToArray(); int output = db.Database.ExecuteSqlCommand("Update tblRequests set Status='Approved',Respondedby=@p0,ResponseDate=@p1 where RequestId=@p2", item); if (output > 0) { TempData["SuccessMessage1"] = "Resignation Approved"; return(RedirectToAction("RequestList")); } } return(View()); }
public static long?AddReplacementRequest(RequestVM model) { long?Result = 0; model.RequestDate = DateTime.Now; try { using (var db = new SoneriCISEntities()) { tbl_Requests request = new tbl_Requests(); request.RequestType = model.RequestType; request.AccountNo = model.AccountNo; request.CIFNo = model.CustomerId; request.WaiveCharges = model.Waive; request.StatusEligibility = model.StatusEligibility; request.FinancialEligibility = model.FinancialEligibility; request.AuthorizationStatus = model.AuthorizationStatus; request.RequestDate = model.RequestDate; request.CardTitle = model.CardTitle; request.CardTypeID = model.CardTypeId; request.Salutation = model.Salutation; request.IsActive = true; request.IsExported = false; request.CreatorID = StateHelper.UserId; db.tbl_Requests.Add(request); db.SaveChanges(); model.ID = request.ID; } Result = model.ID; } catch (Exception ex) { } return(Result); }
// Adds item from Bookmarks to Cart protected void BtnAdd_Click(object sender, EventArgs e) { var btn = (Button)sender; var item = (ListViewItem)btn.NamingContainer; Label lblItemCode = (Label)item.FindControl("lblItemCode"); Label lblDescription = (Label)item.FindControl("lblDescription"); string itemCode = lblItemCode.Text; int reqQty = 1; string description = lblDescription.Text; int empId = (int)Session["empId"]; bool success = Controllers.RequestDetailCtrl.AddToCart(empId, itemCode, reqQty); Main master = (Main)this.Master; if (success) { RequestVM unsubRequest = Controllers.RequestCtrl.GetReq(empId, "Unsubmitted").FirstOrDefault(); PopulateList(unsubRequest.ReqId); lstShow.DataSource = showList; lstShow.DataBind(); UnsubSettings(); HideHeaders(); master.FillCart(); master.UpdateCartCount(); master.ShowToastr(this, String.Format("{0} Qty:{1} Added to Order", description, reqQty), "Item Added Successfully", "success"); } else { master.ShowToastr(this, String.Format("Item {0} Not Added", description), "Something Went Wrong!", "error"); } }
//add new reqNoti public static bool AddNewReqNotification(int empId, RequestVM currReq) { using (SA46Team08ADProjectContext entities = new SA46Team08ADProjectContext()) { try { Notification noti = new Notification(); noti.FromEmp = currReq.EmpId; noti.ToEmp = (int)currReq.ApproverId; noti.NotificationDateTime = System.DateTime.Now; noti.RouteUri = ""; noti.Type = "Request Submitted"; noti.Content = "Request Submitted"; noti.IsRead = true; entities.Notifications.Add(noti); int rowinserted = entities.SaveChanges(); if (rowinserted > 0) { return(true); } else { return(false); } } catch (Exception ex) { throw ex; } } }
public ActionResult Reject(RequestVM vM) { var ename = Session["EmployeeName"].ToString(); var reqid = db.tblRequests.Where(x => x.RequestId == vM.RequestId).FirstOrDefault(); if (reqid != null) { List <object> lst = new List <object>(); lst.Add(ename); lst.Add(DateTime.Now); lst.Add(vM.RequestId); object[] item = lst.ToArray(); int output = db.Database.ExecuteSqlCommand("Update tblRequests set Status='Rejected',Respondedby=@p0,ResponseDate=@p1 where RequestId=@p2", item); if (output > 0) { TempData["SuccessMessage1"] = "Resignation Rejected"; return(RedirectToAction("RequestList")); } } else { TempData["ErrorMessage1"] = "You have not selected any request from Request List"; } return(View("RequestDetail")); }
public bool SaveAdminResponse(RequestVM model) { if (model.RequestId > 0) { var request = _context.Requests.Single(p => p.RequestId == model.RequestId); request.Status = model.Status; if (model.IsProjectCompleted == true) { request.IsProjectCompleted = model.IsProjectCompleted; request.ProjectCompleteddate = DateTime.Now; } _context.SaveChanges(); //Stop clock if Admin returned the request if (model.Status == Convert.ToInt32(RequestStatus.Returned)) { var clock = _context.Clocks.Single(p => p.RequestId == model.RequestId); var remainingDays = clock.ClockDate.Value.Date.Subtract(DateTime.Now.Date).TotalDays; clock.ClockStatus = Convert.ToInt16(ClockStatus.Stop); clock.RemainingDays = Convert.ToInt32(remainingDays); // Stop internal clock if internal clock is in running state. if (clock.InternalClockStatus != null && clock.InternalClockStatus == Convert.ToInt16(ClockStatus.Start)) { clock.InternalClockStatus = Convert.ToInt16(ClockStatus.Stop); var internalRemainingDays = clock.InternalClockDate.Value.Date.Subtract(DateTime.Now.Date).TotalDays; clock.InternalRemainingDays = Convert.ToInt32(internalRemainingDays); } _context.SaveChanges(); } return(true); } return(false); }
public static async Task <DistanceMatrix> GetDistanceMatrix(RequestVM model) { var encodedPointsString = HttpContext.Current.Server.UrlEncode(string.Join("|", model.TechnicalObjects.Select(o => $"{o.Lat},{o.Lng}")) + "|" + string.Join("|", model.RepairShops.Select(o => $"{o.Lat},{o.Lng}"))); HttpResponseMessage response = null; try { using (var client = new HttpClient()) { response = await client.GetAsync( $@"https://maps.googleapis.com/maps/api/distancematrix/json?origins={ encodedPointsString }&destinations={encodedPointsString}&key={ ConfigurationManager.AppSettings["DistanceMatrixApiKey"] }"); } } catch (Exception e) { } var distanceMatrixResponse = JsonConvert.DeserializeObject <DistanceMatrixResponse>(await response.Content.ReadAsStringAsync()); var matrix = new DistanceMatrix(distanceMatrixResponse, model.TechnicalObjects.Count()); return(matrix); }
public void SendEmailDecline(RequestVM requestVM, string message) { var from = "*****@*****.**"; var to = requestVM.Email; //var name = requestVM.FirstName; MailMessage mm = new MailMessage(from, to); string today = DateTime.Now.ToString(); mm.Subject = message + " (" + today + ")"; mm.Body = string.Format("Hi {0},<br /><br />Sorry, Your Application Has Been Decline", requestVM.FirstName); mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential(); NetworkCred.UserName = "******"; NetworkCred.Password = "******"; smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; smtp.Port = 587; smtp.Send(mm); }
// Adds Item to Bookmarks protected void BtnBookmark_Click(object sender, EventArgs e) { var btn = (LinkButton)sender; var item = (ListViewItem)btn.NamingContainer; Label lblItemCode = (Label)item.FindControl("lblItemCode"); Label lblDescription = (Label)item.FindControl("lblDescription"); string itemCode = lblItemCode.Text; string description = lblDescription.Text; int empId = (int)Session["empId"]; bool success = Controllers.RequestDetailCtrl.AddBookmark(empId, itemCode); Main master = (Main)this.Master; if (success) { RequestVM bookmarks = Controllers.RequestCtrl.GetReq(empId, "Bookmarked").FirstOrDefault(); PopulateSidePanel(); bookmarkList = bookmarkList.OrderByDescending(x => x.ReqLineNo).ToList(); BtnShowBmk_Click(btnShowBmk, EventArgs.Empty); master.ShowToastr(this, String.Format("{0} Added to Bookmarks", description), "Item Added Successfully", "success"); } else { master.ShowToastr(this, String.Format("{0} Not Added to Bookmarks", description), "Something Went Wrong", "error"); } }
public async Task <IActionResult> AddRequest(RequestVM model) { if (ModelState.IsValid) { var request = await _converterHelper.ToRequestAsync(model, true); _context.Requests.Add(request); try { await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.ToString()); return(View(model)); } } model.Parishioners = _combosHelper.GetComboParishioners(); model.RequestTypes = _combosHelper.GetComboRequestTypes(); return(View(model)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.invoice_activity); btnClose = FindViewById <Button>(Resource.Id.btnClose); tvName = FindViewById <TextView>(Resource.Id.tvName); tvService = FindViewById <TextView>(Resource.Id.tvService); tvDurationArrival = FindViewById <TextView>(Resource.Id.tvDurationArrival); tvDurationService = FindViewById <TextView>(Resource.Id.tvDurationService); tvDate = FindViewById <TextView>(Resource.Id.tvDate); tvAmount = FindViewById <TextView>(Resource.Id.tvAmount); RequestVM request = JsonConvert.DeserializeObject <RequestVM>(Intent.GetStringExtra("request")); tvName.Text = request.CustomerName; tvDate.Text = DateTime.Today.ToString("dd MMM, yyyy"); tvService.Text = request.HealthServiceName; tvAmount.Text = request.Price.ToString("#,###"); TimeSpan?arrivalDuration = request.StartedTime - request.AssignedTime; TimeSpan?treatmentDuration = request.CompletedTime - request.StartedTime; tvDurationArrival.Text = $"{arrivalDuration.Value.Hours.ToString("00")}:{arrivalDuration.Value.Minutes.ToString("00")}:{arrivalDuration.Value.Seconds.ToString("00")}"; tvDurationService.Text = $"{treatmentDuration.Value.Hours.ToString("00")}:{treatmentDuration.Value.Minutes.ToString("00")}:{treatmentDuration.Value.Seconds.ToString("00")}"; btnClose.Click += ((sender, e) => { Intent intent = new Intent(this, typeof(MainActivity)); intent.AddFlags(ActivityFlags.ClearTop); StartActivity(intent); }); }
public override void OnReceive(Context context, Intent intent) { long requestId = intent.GetLongExtra("requestId", 0); string customerName = intent.GetStringExtra("customerName"); string customerPhone = intent.GetStringExtra("customerPhone"); string healthServiceName = intent.GetStringExtra("healthServiceName"); string healthServiceSwahiliName = intent.GetStringExtra("healthServiceSwahiliName"); double latitude = intent.GetDoubleExtra("latitude", 0); double longitude = intent.GetDoubleExtra("longitude", 0); DateTime initiatedTime = DateTime.Parse(intent.GetStringExtra("initiatedTime")); RequestVM vm = new RequestVM() { Id = requestId, CustomerName = customerName, CustomerPhone = customerPhone, HealthServiceName = healthServiceName, HealthServiceSwahiliName = healthServiceSwahiliName, Latitude = latitude, Longitude = longitude, InitiatedTime = initiatedTime }; if (Activity != null) { Activity.HandleMessage(vm); } }
// submit request // done public static RequestVM SubmitReq(int reqId, List <RequestDetailVM> reqDetList) { // make requestId in reqDetList is the same as reqId using (SA46Team08ADProjectContext entities = new SA46Team08ADProjectContext()) { try { RequestVM req = GetReq(reqId); for (int i = 0; i < reqDetList.Count; i++) { if (reqDetList[i].ReqId == reqId) { List <RequestDetail> rdlist = entities.RequestDetails.ToList(); for (int j = 0; j < rdlist.Count; j++) { if (reqDetList[i].ReqId == rdlist[j].ReqId && reqDetList[i].ReqLineNo == rdlist[j].ReqLineNo) { rdlist[j].ReqQty = reqDetList[i].ReqQty; rdlist[j].AwaitQty = reqDetList[i].AwaitQty; rdlist[j].FulfilledQty = reqDetList[i].FulfilledQty; entities.SaveChanges(); } } } } req.ReqDateTime = DateTime.Now; req.Status = "Submitted"; req = UpdateReq(req); int empId = req.EmpId; Employee emp = entities.Employees.Where(x => x.EmpId == empId).FirstOrDefault(); string deptCode = emp.DeptCode; Department dept = entities.Departments.Where(x => x.DeptCode == deptCode).FirstOrDefault(); int fromEmpId = req.EmpId; int toEmpId; if (dept.DelegateApproverId != null && DateTime.Compare(DateTime.Now, (DateTime)dept.DelegateFromDate) >= 0 && DateTime.Compare(DateTime.Now, (DateTime)dept.DelegateToDate) >= 0) { toEmpId = (int)dept.DelegateApproverId; } else { toEmpId = (int)dept.DeptHeadId; } string type = "Stationery Request"; string content = "A new stationery request has been submitted"; NotificationBL.AddNewNotification(fromEmpId, toEmpId, type, content); // for email EmailBL.SendNewReqEmail(empId, req); return(req); } catch (Exception ex) { throw ex; } } }
public ActionResult SubmitRequest(RequestVM requestVM) { var data = requestRepository.Request(requestVM); if (data == 1) { return(Ok(new { status = "Request success" })); } else if (data == 2) { return(StatusCode(500, new { status = "Input Total Day Request less than Remaining Quota And Less Than 5 day" })); } else if (data == 3) { return(StatusCode(500, new { status = "Input Total Day Request 90 day" })); } else if (data == 4) { return(StatusCode(500, new { status = "Input Total Day Request 3 day" })); } else if (data == 5) { return(StatusCode(500, new { status = "Input Total Day Request 2 day" })); } else if (data == 6) { return(StatusCode(500, new { status = "Input Total Day Request 1 day" })); } else { return(StatusCode(500, new { status = "Interlan Server Error" })); } }
private void RequestVM_OnIgnoreRequest(Users Friend) { IgnoreRequest(userId, Friend.UserID); //Từ chối yêu cầu kết bạn và cập nhập thông tin lên CSDL RequestVM.RemoveRequest(Friend); //Xóa yêu cầu sau khi từ chối friendRequestZone.UpdateLayout(); }
protected void GridView_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) { RequestVM CloneItem = new RequestVM(); if (HttpContext.Current.Session["isCloneRow_Com"] != null && bool.Parse(HttpContext.Current.Session["isCloneRow_Com"].ToString()) == true && GridView.FocusedRowIndex >= 0) { //List<int> selectedIds = GridView.GetSelectedFieldValues("Id").ConvertAll(id => (int)id); //CloneItem = StandardTypeProvider.GetSingleById(selectedIds.Last()); CloneItem = Mapper.Map <RequestVM>(RequestProvider.GetSingleById(int.Parse(GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString()))); HttpContext.Current.Session["isCloneRow_Com"] = false; PropertyInfo myFieldInfo; foreach (var myProperty in typeof(RequestVM).GetProperties()) { myFieldInfo = typeof(RequestVM).GetProperty(myProperty.Name); if (myFieldInfo == null) { continue; } var ttt = myFieldInfo.GetValue(CloneItem); e.NewValues[myProperty.Name] = myFieldInfo.GetValue(CloneItem); } } e.NewValues["RegistedDate"] = DateTime.Now; e.NewValues["HoldEquipNo"] = 1; e.NewValues["RegisteredNo"] = SysConfigProvider.GetRegisteredNo(DateTime.Now.Year).ValueInt.FomatStringNo(DateTime.Now.Year, "/PĐK"); }
private void RequestVM_OnAcceptRequest(Users Friend) { FriendGroup AvailableGroup = cbRequestGroup.SelectedItem as FriendGroup; //Lấy nhóm có sẵn đã được chọn trên Combobox int NewGroupID = 0; if (RequestNewGroupName != null) { if (!AddNewGroup(userId, RequestNewGroupName, ref NewGroupID)) { MessageBox.Show("Thêm nhóm mới không thành công"); } } else if (AvailableGroup == null && RequestNewGroupName == null) { MessageBox.Show("Không tồn tại nhóm có sẵn cũng như thông tin nhóm mới không hợp lệ nên không thể 'chấp nhận' yêu cầu kết bạn"); return; } FriendGroup newGroup = GetGroup(NewGroupID); //Chấp nhận yêu cầu kết bạn và thêm bạn bè vào nhóm mới nếu thông tin không bỏ trống, ngược lại sẽ thêm vào nhóm sẵn có AcceptRequest(userId, Friend.UserID, NewGroupID != 0 ? newGroup.GroupID : AvailableGroup.GroupID); //Bổ sung bạn bè cây dữ liệu GroupTree.AppendFriend(Friend, NewGroupID != 0 ? newGroup : AvailableGroup); RequestVM.RemoveRequest(Friend); //Xóa yêu cầu sau khi chấp nhận friendRequestZone.UpdateLayout(); treeFriend.UpdateLayout(); }
private void FrmRequest_OnUpdateQuery(RequestVM vm) { var item = _requestList.SingleOrDefault(x => x.CHECKLIST_PK == vm.CHECKLIST_PK && x.IDX == vm.IDX); Common.Helper.CopyProperties(vm, item); gridLaneInfo.Refresh(); }
public async Task <IActionResult> Details(long id, EnvType?env) { _logger.LogDebug($"[{nameof(Details)}] Start for id = '{id}' and env = '{env}'"); RequestVM requestVM = await PrepareRequestVM(id, env); return(View(requestVM)); }
// update request // done public static RequestVM UpdateReq(RequestVM req) { using (SA46Team08ADProjectContext entities = new SA46Team08ADProjectContext()) { int reqId = req.ReqId; Request request = entities.Requests.Where(r => r.ReqId == reqId).FirstOrDefault(); request.ApproverComment = req.ApproverComment; if (req.ReqDateTime != null && DateTime.Compare(req.ReqDateTime, new DateTime(1800, 01, 01)) > 0) { request.ReqDateTime = req.ReqDateTime; } if (req.ApprovedDateTime != null && DateTime.Compare(req.ApprovedDateTime, new DateTime(1800, 01, 01)) > 0) { request.ApprovedDateTime = req.ApprovedDateTime; } if (req.CancelledDateTime != null && DateTime.Compare(req.CancelledDateTime, new DateTime(1800, 01, 01)) > 0) { request.CancelledDateTime = req.CancelledDateTime; } if (req.FulfilledDateTime != null && DateTime.Compare(req.FulfilledDateTime, new DateTime(1800, 01, 01)) > 0) { request.FulfilledDateTime = req.FulfilledDateTime; } request.Status = req.Status; entities.SaveChanges(); } return(req); }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (ValidationManager.Validate(this.ucSOInfo)) { RequestVM vm = this.DataContext as RequestVM; //[BugFix] 寄回方式、快递名称、邮包编号,不再是必填项 //当寄回方式不为上门取件物流时,邮包编号必须填写 //string shipType = CPApplication.Current.CurrentPage.Context.Window.Configuration.GetConfigValue("RMA", "ShipTypePush"); //if (vm.ShipType != shipType && string.IsNullOrEmpty(vm.TrackingNumber)) //{ // Window.Alert(ResCreateRequest.Validation_TrackingNumberRequired); // return; //} if (vm.Registers.Count(p => p.IsChecked) == 0) { Window.Alert(ResCreateRequest.Validation_ChooseSOItem); return; } bool flag = true; foreach (var item in vm.Registers) { if (item.IsChecked && string.IsNullOrEmpty(item.BasicInfo.CustomerDesc)) { flag = false; //var members = new List<string> { "CustomerDesc" }; //item.BasicInfo.ValidationErrors.Add(new ValidationResult(ResCreateRequest.Validation_DescriptionRequired,members)); } } if (!flag) { Window.Alert(ResCreateRequest.Validation_DescriptionRequired); return; } RequestVM clonedVM = Newegg.Oversea.Silverlight.Utilities.UtilityHelper.DeepClone <RequestVM>(vm); var list = clonedVM.Registers.Where(p => p.IsChecked).ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].BasicInfo.SOItemType == BizEntity.SO.SOProductType.ExtendWarranty && list[i].RequestType != BizEntity.RMA.RMARequestType.Return) { Window.Alert(ResCreateRequest.Msg_ExtendInfo); return; } } clonedVM.Registers.Clear(); list.ForEach(p => { clonedVM.Registers.Add(p); }); new RequestFacade(this).Create(clonedVM, (obj, args) => { vm.SysNo = args.Result.SysNo; string url = string.Format(ConstValue.RMA_RequestMaintainUrl, vm.SysNo); Window.Navigate(url); }); } }
public void RequestRide([FromBody] RequestVM request1, [FromQuery] int rideId, [FromQuery] string userId) { RideRequest request = _mapper.Map <RideRequest>(request1); request.RideId = rideId; request.RiderId = userId; _rideService.RequestRide(request); }
public HttpStatusCode SubmitRequest(RequestVM requestVM) { var httpClient = new HttpClient(); StringContent content = new StringContent(JsonConvert.SerializeObject(requestVM), Encoding.UTF8, "application/json"); var result = httpClient.PostAsync("https://localhost:44330/api/request/SubmitRequest/", content).Result; return(result.StatusCode); }
public static void UpdateRegister(RequestVM item) { Request dbItem = GetSingleById(item.Id); dbItem.UpdateRegisterRequest(item); RepositoryBase <Request> .Update(dbItem); RepositoryBase <Request> .SaveChanges(); }
private void RecalculateMeasumentUnits(RequestVM model) { foreach (var technicalObject in model.TechnicalObjects) { technicalObject.Intensity = technicalObject.Intensity / 24; } model.MachineSpeed = model.MachineSpeed * 1000; }
public ResponseVM Logout([FromBody] RequestVM logout) { if (!ModelState.IsValid) { return(new ResponseVM(false)); } return(_authService.Logout(logout)); }
private async Task <RequestVM> PrepareRequestVM(long id, EnvType?env) { var request = await _requestSrv.GetRequestByIdAsync(env.Value, id); RequestVM requestVM = _mapper.Map <RequestVM>(request); requestVM.Env = env; return(requestVM); }
//GET ServReq Action Method public IActionResult ServReq() { requestVM = new RequestVM() { Request = new Models.Request() }; return(View(requestVM)); }
public ActionResult UpdateSeen(RequestVM model) { IStructuredetailRepository obj = new StructuredetailRepository(); obj.updateseen(Convert.ToInt32(model.RequestId)); obj.Save(); return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); }