public ActionResult ApprovalProcessApproval(int Id, int ApprovalId, int Approver, int Status, string Comment) { string comment = (Comment == "null") ? "" : Comment; // DevExpress sending the 'null' string when textbox is empty LessonLearnedModel lessonLearned = (LessonLearnedModel)Session["LessonLearnedModel"]; IIrmaServiceDataModel serviceSystem = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); ApprovalModel approval = serviceSystem.GetItem(string.Format("Id={0}", ApprovalId), "Id"); approval.ApprovedDate = DateTime.Now; approval.ApproverComments = Comment; approval.Status = Status; lessonLearned.Approvals.FirstOrDefault(a => a.Id == ApprovalId).Status = Status; switch (Status) { case (int)IrmaConstants.ApprovalStatus.Approved: var approvedCount = lessonLearned.GetApprovals().Where(a => a.Status == (int)IrmaConstants.ApprovalStatus.Approved).Count(); var totalCount = lessonLearned.GetApprovals().Count(); if (approvedCount == totalCount) // Proceeds with the workflow / auto close { lessonLearned.Status = "Closed"; } break; case (int)IrmaConstants.ApprovalStatus.Rejected: lessonLearned.Status = "Rejected"; approval.ApproverComments = Comment; break; } dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); dataModel.Update(lessonLearned); serviceSystem.Update(approval); return(RedirectToAction("Edit", new { Id = Id })); }
public string Post() { EmailAPIModel emailAPIModel = new EmailAPIModel(); ApprovalModel approvalModel = new ApprovalModel(); var httpPostedFile = HttpContext.Current.Request.Files; var data = httpPostedFile.Count; var fdata = HttpContext.Current.Request.Form; var model = fdata["mail"]; if (model == null) { model = fdata["approval"]; } //emailAPIModel = JsonConvert.DeserializeObject<EmailAPIModel>(model); approvalModel = JsonConvert.DeserializeObject <ApprovalModel>(model); string str = ""; int count = 0; HttpFileCollection uploads = HttpContext.Current.Request.Files; if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/images"))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/images")); } for (int i = 0; i < uploads.Count; i++) { HttpPostedFile upload = uploads[i]; string targetFolder = HttpContext.Current.Server.MapPath("~/images"); string targetPath = Path.Combine(targetFolder, upload.FileName); upload.SaveAs(targetPath); } string files = count + " Uploaded Files From:" + str; return("Success"); }
public ActionResult Deny(ApprovalModel denial) { using (OracleConnection dbConn = new OracleConnection(HelperModel.cnnVal("OracleDB"))) { if (ModelState.IsValid) { // Mark request as denied string sqlQuery1 = @"UPDATE REQUESTDETAILS SET REQSTATUS_ID = 3 WHERE REQUESTDETAILS_ID = " + denial.REQUESTDETAILS_ID; // Mark approval as denied with reason of denial string sqlQuery2 = @"UPDATE REQUESTAPPROVALS SET ACTIONDATE = SYSDATE, REQSTATUS_ID = 3, REASON_OF_DENIAL = '" + denial.REASON_OF_DENIAL + @"' WHERE REQUESTDETAILS_ID = " + denial.REQUESTDETAILS_ID + @" AND APPROVAL_ROCKETID = '" + testRocketID + "'"; dbConn.Execute(sqlQuery1); dbConn.Execute(sqlQuery2); /*=========Email Code Will Go Here========*/ /* Notify user and supervisor of denial */ /*========================================*/ return(PartialView("Denied")); } else { return(PartialView("Deny")); } } }
protected DataModels.Approval Approve(DataModels.Client Client, DataModels.ResourceOwner Owner, string Scope) { DataModels.Approval approval = ApprovalModel.GetApproval(Client, Owner); if (approval == null || TokenHelper.MissingScopesArray(Scope, approval.scope).Length != 0) { string apprUrl = Request.GetApplicationUrl(); if (!apprUrl.EndsWith("/")) { apprUrl += '/'; } UriBuilder bldr = new UriBuilder(apprUrl); bldr.Path += "approval"; string query = "client_id=" + Client.id + "&redirect=" + Request.AbsoluteUri.UrlEncode(); if (Scope != null) { query += "&scope=" + Scope.UrlEncode(); } bldr.Query = query; Response.AddHeader("Location", bldr.ToString()); Response.StatusCode = (int)System.Net.HttpStatusCode.Redirect; return(null); } return(approval); }
public ActionResult Insert(string customers, string territory) { try { List <string> customerList = customers.Split(',').Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x)).ToList(); customerList = customerList.Distinct().ToList(); foreach (var cust in customerList) { string customer = _customerAppService.GetBy("customer_code", cust); var customerModel = string.IsNullOrEmpty(customer) ? new CustomerModel() : JsonConvert.DeserializeObject <CustomerModel>(customer); var approval = new ApprovalModel(); approval.customer_code = cust; approval.customer_name = customerModel.customer_name; approval.customer_address = customerModel.customer_address; approval.territory_old = customerModel.teritorry; approval.territory_new = territory; approval.timestamp = DateTime.Now; string data = JsonHelper <ApprovalModel> .Serialize(approval); var lalala = _approvalAppService.Add(data); } return(Json(new { Status = "True" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Status = "False" }, JsonRequestBehavior.AllowGet)); } }
public JsonResult ApproveApplication(ApprovalModel model) { var rep = new ApplicationMasterRepository(); var result = rep.ApproveApplication(model); return(Json(result ? "OK" : "Error")); }
private void BindingForm(ApprovalModel model) { ClearBinding(); if (model.ActionTreeId == 0) { model.ActionTrees = _repoAth.GetStartTreeByUser(model.RequestorId).Where(x => x.TeamId.Equals(model.WaitForApproveTeamId)).ToList(); comboBox2.Enabled = true; } else { model.ActionTrees = _repoAth.GetStartTreeByUser(model.RequestorId).ToList(); var resutl = _repoAth.GetTreeByID(model.ActionTreeId); model.ActionTree = resutl.TreeViewName; comboBox2.Enabled = false; } if (model.ActionTrees.Count() != 0) { comboBox2.DataSource = model.ActionTrees; comboBox2.DisplayMember = "TreeViewName"; comboBox2.ValueMember = "TreeViewId"; comboBox2.DataBindings.Add("Text", model, "ActionTree"); } }
/*-----------------------------Approve View--------------------------------*/ public ActionResult Approve(int REQUESTDETAILS_ID) { ApprovalModel approval = new ApprovalModel(); approval.REQUESTDETAILS_ID = REQUESTDETAILS_ID; return(PartialView(approval)); }
/*-----------------------------Deny View--------------------------------*/ public ActionResult Deny(int REQUESTDETAILS_ID) { ApprovalModel denial = new ApprovalModel(); denial.REQUESTDETAILS_ID = REQUESTDETAILS_ID; return(PartialView(denial)); }
public static async Task UploadBlobAsync([ActivityTrigger] ApprovalModel approvalModel, [Queue("ocrinfoqueue")] IAsyncCollector <CloudQueueMessage> cloudQueueMessageCollector, ILogger log) { var approvalModelString = JsonConvert.SerializeObject(approvalModel); var cloudQueueMessage = new CloudQueueMessage(approvalModelString); await cloudQueueMessageCollector.AddAsync(cloudQueueMessage); }
public TestMethods(CustomSession _session) { InitializeComponent(); this._sess = new Session(); this._pr = new Ice.CustomUI.PRList.RequisitionRepo(); this._repoAth = new AuthRepo(); this._repoReq = new RequisitionRepo(); this._repoEst = new Erp.Custom.CostManagement.Repositories(); epiSession = _session; content = new ApprovalModel(); }
public IActionResult GetOneApprovalByCode(string approvalCode) { try { ApprovalModel approvalModel = approvalRepository.GetOneApprovalByCode(approvalCode); return(Ok(approvalModel)); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); return(StatusCode(StatusCodes.Status500InternalServerError, errors)); } }
public async Task <CommentListModel> UnApprove(ApprovalModel model) { await _service.UnApproveAsync(model.Id).ConfigureAwait(false); var result = await List(model.ParentId).ConfigureAwait(false); result.Status = new StatusMessage { Type = StatusMessage.Success, Body = _localizer.Comment["The comment was successfully unapproved"] }; return(result); }
public List <ApprovalDetails> Get(ApprovalRequest Request) { if (!this.Request.Items.ContainsKey("auth:user")) { return(null); } DataModels.Token token = this.Request.Items.GetValue <DataModels.Token>("auth:token"); if (!token.scope.Contains("sjrb.oauth.authorizations")) { throw new TokenRequestError(ErrorCodes.invalid_scope, "sjrb.oauth.authorizations scope is required"); } ResourceOwner user = this.Request.Items.GetValue <ResourceOwner>("auth:user"); string[] memberof = user.GetValues <string>("memberOf"); List <Approval> approvals = null; if (memberof != null && memberof.Contains("CN=NCC - Tool Support - RWS,OU=Security,OU=Mail Enabled,OU=Groups,OU=Corp,DC=SJRB,DC=AD")) { if (!string.IsNullOrWhiteSpace(Request.resource_owner_id)) { approvals = ApprovalModel.GetApprovalByResourceOwner(Request.resource_owner_id); } if (!string.IsNullOrWhiteSpace(Request.client_id)) { approvals = ApprovalModel.GetApprovalByClientID(Request.client_id); } } if (approvals == null) { approvals = ApprovalModel.GetApprovalByResourceOwner(user); } //Dictionary<string, ResourceOwner> owners = ResourceOwnerModel.GetByIDs(approvals.ConvertAll(cur => cur.resource_owner_id).Distinct()).ToDictionary(cur => cur.id); Dictionary <string, Client> clients = ClientModel.GetClients(approvals.ConvertAll(cur => cur.client_id).Distinct()).ToDictionary(cur => cur.id); return(approvals.ConvertAll(toConvert => new ApprovalDetails { client = clients[toConvert.client_id], //resource_owner = owners[toConvert.resource_owner_id], resource_owner_id = toConvert.resource_owner_id, client_id = toConvert.client_id, refresh_token = toConvert.refresh_token, scope = toConvert.scope, type = toConvert.type, }).ToList()); }
public async Task <IActionResult> Approve([FromBody] ApprovalModel model) { try { await _registerService.ProccessAsync(model, User.GetUserId()); return(Ok()); } catch (Exception x) { Log.Error($"ERROR approving auction registration ID = {model.EntityId}", x.Message); return(StatusCode(500, x.Message)); } }
public ActionResult Delete(int Id = 0) { approvalService = new ApprovalService(); if (Id != 0) { approvalService = new ApprovalService(); approvalService.DeleteById(Id); } ApprovalModel approvalModel = new ApprovalModel(); return(PartialView(VIEW_FORM_PARTIAL, approvalModel)); }
public ActionResult LessonsLearnedApprovalAddPartial(ApprovalModel rowModel) { if (ModelState.IsValid) { var lessonModel = (LessonLearnedModel)Session["LessonLearnedModel"]; rowModel.RequestInfo = Url.Action("ApprovalProcessApproval"); OAPServiceSystem.AddApprover(rowModel, lessonModel); } else { ViewData["UpdateError"] = true; } return(LessonsLearnedApprovalPartial()); }
public static void AddApprover(ApprovalModel approvalModel, LessonLearnedModel lessonLearned) { IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); var approver = ServiceSystem.GetUser((int)approvalModel.Approver); approvalModel.Type = (int)ApprovalModel.ApprovalType.LessonsLearnedApproval; approvalModel.RequestItemId = lessonLearned.Id; approvalModel.Name = lessonLearned.Title; approvalModel.Requester = UtilitySystem.CurrentUserId; approvalModel.RequestedDate = DateTime.Now; approvalModel.Position = (int)approver.Position; approvalModel = dataModel.Add(approvalModel); lessonLearned.Approvals.Add(approvalModel); }
public async Task <IActionResult> Deny([FromBody] ApprovalModel input) { var sendEndpoint = await _sendEndpointProvider.GetSendEndpoint(new Uri("queue:approve-work-item")); await sendEndpoint.Send <ApprovalEvent>( new { input.CorrelationId, input.Name, input.Notes, WasApproved = false }); return(Ok()); }
public List <ApprovalModel> Approvals() { var approvals = new List <ApprovalModel>(); if (IpmApprovalEnabled) { var validBusinessRoles = new List <string> { Constants.BusinessRole.Ipm }; if (CostConsultantIpmAllowed) { validBusinessRoles.Add(Constants.BusinessRole.CostConsultant); } approvals.Add(new ApprovalModel { Type = ApprovalType.IPM, Status = ApprovalStatus.New, ValidBusinessRoles = validBusinessRoles.ToArray() }); } if (!BrandApprovalEnabled) { return(approvals); } var approval = new ApprovalModel { Type = ApprovalType.Brand, Status = ApprovalStatus.New, ValidBusinessRoles = new[] { Constants.BusinessRole.BrandManager }, }; if (HasExternalIntegration) { approval.Members.Add(new ApprovalMemberModel { Email = ApprovalMemberModel.BrandApprovalUserEmail, IsExternal = true // This approval member should be hidden from UI because it is 'fake' approval member that represents Coupa system }); } approvals.Add(approval); return(approvals); }
public string ApproveApplication(ApprovalModel model, string userId) { try { if (model == null) { return("Error: model null"); } var result = _db.SP_VISITOR_APPLICATION_MASTER_APPROVE(model.MasterId, model.ApplicationId, model.IsApprove, model.Comment, userId, model.LinkApplication); return("Ok"); } catch (Exception ex) { LogHelper.Error("VisitorApplicationMasterRepository ApproveApplication: " + ex.Message + " Inner exception: " + ex.InnerException.Message); return(ex.InnerException.Message); } }
public string Approve(ApprovalModel model, string userId) { try { if (model == null) { return("Error: model null"); } var result = _db.SP_PASSINGGOODS_APPROVE(model.MasterId, model.ApplicationId, model.IsApprove, model.Comment, userId, model.LinkApplication); return("Ok"); } catch (Exception ex) { LogHelper.Error("PassingGoodsRepository ApproveApplication: " + ex.Message + " Inner exception: " + ex.InnerException.Message); return(ex.InnerException.Message); } }
public override View GetView(int position, View convertView, ViewGroup parent) { View view; if (convertView == null) { view = LayoutInflater.From(_context).Inflate(Resource.Layout.ApprovalListRow, parent, false); } else { view = convertView; } ApprovalModel model = _approvalList[position]; (view.FindViewById <TextView>(Resource.Id.tvApprovalName)).Text = model.ApprovalName; (view.FindViewById <TextView>(Resource.Id.tvApprovalCount)).Text = model.Count.ToString(); return(view); }
public ActionResult CapBookApprovalStatusUpdate(int Id, int ApprovalId, int Approver, int Status) { ManageCapBookModel model = (ManageCapBookModel)Session["ManageCapBookModel"]; IIrmaServiceDataModel statusDataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); ApprovalModel approval = statusDataModel.GetItem(string.Format("Id={0}", ApprovalId), "Id"); if (approval != null) { approval.Status = Status; if (Status != 2) { approval.ApprovedDate = DateTime.Now; } statusDataModel.Update(approval); } return(View("CapBookApproval", model)); }
public async Task ProccessAsync(ApprovalModel model, string userId) { var item = await _context.AuctionRegistration.SingleOrDefaultAsync(x => x.Id == model.EntityId && !x.Deleted); if (item == null) { throw new NullReferenceException("Item not found"); } item.IsApproved = model.Approved; item.ProcessedBy = userId; item.ProcessedOn = DateTime.UtcNow; if (!model.Approved) { item.RejectReason = model.RejectReason; } await _context.SaveChangesAsync(); }
public bool ApproveApplication(ApprovalModel model) { try { if (model == null) { return(false); } using (var db = new PORTALEntities()) { var result = db.SP_APPLICATION_MASTER_APPROVE(model.MasterId, model.ApplicationId, model.IsApprove, model.Comment, model.UserId, model.LinkApplication); return(true); } } catch (Exception ex) { LogHelper.Error("ApplicationMasterRepository ApproveApplication: " + ex.Message + " Inner exception: " + ex.InnerException.Message); return(false); } }
public void Delete(ApprovalRequest Request) { if (!this.Request.Items.ContainsKey("auth:user")) { return; } DataModels.Token token = this.Request.Items.GetValue <DataModels.Token>("auth:token"); if (!token.scope.Contains("sjrb.oauth.authorizations")) { throw new TokenRequestError(ErrorCodes.invalid_scope, "sjrb.oauth.authorizations scope is required"); } ResourceOwner user = this.Request.Items.GetValue <ResourceOwner>("auth:user"); string[] memberof = user.GetValues <string>("memberOf"); if (string.IsNullOrWhiteSpace(Request.client_id)) { throw new ArgumentException("client_id is required", "client_id"); } if (string.IsNullOrWhiteSpace(Request.resource_owner_id)) { Request.resource_owner_id = user.id; } if (memberof != null && !memberof.Contains("CN=NCC - Tool Support - RWS,OU=Security,OU=Mail Enabled,OU=Groups,OU=Corp,DC=SJRB,DC=AD") && Request.resource_owner_id != user.id) { throw new Exception("You do not have access to delete this approval"); } if (!ApprovalModel.DeleteApproval(Request.client_id, Request.resource_owner_id)) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; } }
public ActionResult Approve(ApprovalModel approval) { using (OracleConnection dbConn = new OracleConnection(HelperModel.cnnVal("OracleDB"))) { /* Set approval to approved */ string sqlQuery1 = @"UPDATE REQUESTAPPROVALS SET ACTIONDATE = SYSDATE, REQSTATUS_ID = 2 WHERE REQUESTDETAILS_ID = " + approval.REQUESTDETAILS_ID + @" AND APPROVAL_ROCKETID = '" + testRocketID + "'"; dbConn.Execute(sqlQuery1); /* Retrieve Approval Level, Custodian Rocket ID, and Admin Rocket ID for Request*/ List <int> AL_ID = dbConn.Query <int>("SELECT AL_ID FROM REQUESTAPPROVALS WHERE REQUESTDETAILS_ID = " + approval.REQUESTDETAILS_ID + @" AND APPROVAL_ROCKETID = '" + testRocketID + "'").ToList(); List <string> PRIMARY_CUSTODIAN_ROCKETID = dbConn.Query <string>("SELECT PRIMARY_CUSTODIAN_ROCKETID FROM SECURITYCLASS INNER JOIN REQUESTDETAILS ON SECURITYCLASS.SECURITYCLASS_ID = REQUESTDETAILS.SECURITYCLASS_ID WHERE REQUESTDETAILS.REQUESTDETAILS_ID = " + approval.REQUESTDETAILS_ID).ToList(); List <string> ADMIN_ROCKETID = dbConn.Query <string>("SELECT ADMIN_ROCKETID FROM SECURITYCLASS INNER JOIN REQUESTDETAILS ON SECURITYCLASS.SECURITYCLASS_ID = REQUESTDETAILS.SECURITYCLASS_ID WHERE REQUESTDETAILS.REQUESTDETAILS_ID = " + approval.REQUESTDETAILS_ID).ToList(); string sqlQuery2; if (AL_ID[0] == 2) { //Elevate request to Custodian sqlQuery2 = @"INSERT INTO REQUESTAPPROVALS (APPROVAL_ID, REQUESTDETAILS_ID, APPROVAL_ROCKETID, AL_ID, ACTIONDATE) VALUES (APPROVAL_ID.nextval, " + approval.REQUESTDETAILS_ID + @", '" + PRIMARY_CUSTODIAN_ROCKETID[0] + @"', 3, SYSDATE)"; dbConn.Execute(sqlQuery2); } else if (AL_ID[0] == 3) { //Elevate request to Admin sqlQuery2 = @"INSERT INTO REQUESTAPPROVALS (APPROVAL_ID, REQUESTDETAILS_ID, APPROVAL_ROCKETID, AL_ID, ACTIONDATE) VALUES (APPROVAL_ID.nextval, " + approval.REQUESTDETAILS_ID + @", '" + ADMIN_ROCKETID[0] + @"', 4, SYSDATE)"; dbConn.Execute(sqlQuery2); } else if (AL_ID[0] == 4) { //Mark request as approved sqlQuery2 = @"UPDATE REQUESTDETAILS SET REQSTATUS_ID = 2 WHERE REQUESTDETAILS_ID = " + approval.REQUESTDETAILS_ID; dbConn.Execute(sqlQuery2); } /*=========Email Code Will Go Here========*/ /* Notify user and next approver */ /*========================================*/ return(PartialView("Approved")); } }
public ActionResult CapBookApprovalDetailUpdate(ApprovalModel approval) { ManageCapBookModel model = (ManageCapBookModel)Session["ManageCapBookModel"]; if (ModelState.IsValid) { IIrmaServiceDataModel approvalModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); ApprovalModel entity = approvalModel.GetItem(string.Format("Id={0}", approval.Id), "Id"); if (entity != null) { entity.ApproverComments = approval.ApproverComments; approvalModel.Update(entity); int index = model.Approvals.FindIndex(x => x.Id == approval.Id); if (index >= 0 && index < model.Approvals.Count) { model.Approvals[index].ApproverComments = approval.ApproverComments; } } } return(PartialView("CapBookApprovalDetailPartial", model)); }
public IActionResult AddApproval(ApprovalModel approvalModel) { try { if (approvalModel == null) { return(BadRequest("Data is null.")); } if (!ModelState.IsValid) { Errors errors = ErrorsHelper.GetErrors(ModelState); return(BadRequest(errors)); } ApprovalModel addedApproval = approvalRepository.AddApproval(approvalModel); return(StatusCode(StatusCodes.Status201Created, addedApproval)); } catch (Exception ex) { Errors errors = ErrorsHelper.GetErrors(ex); return(StatusCode(StatusCodes.Status500InternalServerError, errors)); } }