Example #1
0
        public IActionResult RegisterApprovalType([FromBody] ApprovalType approvalType)
        {
            if (approvalType == null)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Request cannot be null"
                }));
            }
            try
            {
                ApprovalType result = ApprovalHelper.RegisterApprovalType(approvalType);
                if (result != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = result
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Registration Failed."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Example #2
0
        private void DeleteDirectory(ApprovalType approvalType, bool reject)
        {
            string filepath;

            if (approvalType == ApprovalType.checking)
            {
                filepath = ApplicationSettings.GetConnectParameterValue("ReqChecking");
                filepath = filepath + @"\JOB#" + rlog.Job.ToString() + @"\SA#" + rlog.SubAssy + @"\REL#" + rlog.RelNo.ToString();
            }
            else if (approvalType == ApprovalType.approval)
            {
                filepath = ApplicationSettings.GetConnectParameterValue("ReqApproval");
                filepath = filepath + @"\JOB#" + rlog.Job.ToString() + @"\SA#" + rlog.SubAssy + @"\REL#" + rlog.RelNo.ToString();
            }
            else
            {
                return;
            }
            if (!Directory.Exists(filepath))
            {
                return;
            }

            bool isEmpty = !Directory.EnumerateFiles(filepath).Any();

            if (isEmpty && Directory.Exists(filepath))
            {
                Directory.Delete(filepath, true);
            }
            else if (reject && Directory.Exists(filepath))
            {
                Directory.Delete(filepath, true);
            }
        }
Example #3
0
        public IActionResult UpdateApprovalType([FromBody] ApprovalType approvalType)
        {
            try
            {
                if (approvalType == null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.FAIL.ToString(), response = $"{nameof(approvalType)} cannot be null"
                    }));
                }

                ApprovalType result = ApprovalHelper.UpdateApprovalType(approvalType);
                if (result != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = result
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Updation Failed."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Example #4
0
        public async Task <bool> SendApprovalAsync(PtoApproval pto, ApprovalType type)
        {
            var executionToken = await GetExecutionTokenAsync();

            var scriptId       = type == ApprovalType.Approved ? _approvalScriptId : _rejectionScriptId;
            var approveRequest = new RestRequest($"scripts/{scriptId}/run");

            approveRequest.AddHeader("Authorization", $"Bearer {_bearerToken}");
            approveRequest.AddHeader("Content-Type", "application/json");
            approveRequest.AddJsonBody(new
            {
                id = _approvalScriptId,
                scriptExecutionToken = executionToken,
                data = new
                {
                    employeeUserId = pto.EmployeeUserId,
                    employeeName   = pto.EmployeeName,
                    managerUserId  = pto.ManagerUserId,
                    managerName    = pto.ManagerName,
                    startDate      = pto.StartDate,
                    endDate        = pto.EndDate,
                    comments       = pto.Comments,
                    ptoType        = pto.PtoType
                }
            });
            var approveResponse = await _restClient.ExecuteAsync(approveRequest, Method.POST);

            return(approveResponse.StatusCode == System.Net.HttpStatusCode.OK);
        }
        private bool CheckIfNeedLevelTwoApproval()
        {
            var isNeedLevelTwoApproval = ApprovalType.Equals("BetweenFiveAndTenPercent") ||
                                         ApprovalType.Equals("MoreThanPercent");

            return(isNeedLevelTwoApproval);
        }
Example #6
0
        public IActionResult DeleteApprovalType(int approvalId)
        {
            try
            {
                ApprovalType result = ApprovalHelper.DeleteApprovalType(approvalId);
                if (result != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = result
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Deletion Failed."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Example #7
0
 /// <summary>
 /// 根据业务类型获取可选择的审批流程
 /// </summary>
 /// <param name="approveType"></param>
 /// <returns></returns>
 public IEnumerable <ApprovalFlowType> GetApprovalFlowTypeByBusiness(ApprovalType approveType)
 {
     try
     {
         List <ApprovalFlowType> listApprovalFlowType = new List <ApprovalFlowType>();
         int approveTypeIndex = (int)approveType;
         listApprovalFlowType = this.Fetch(p => p.ApprovalTypeValue == approveTypeIndex).ToList();
         return(listApprovalFlowType);
     }
     catch (Exception ex)
     {
         return(this.HandleException <IEnumerable <ApprovalFlowType> >("根据业务类型获取可选择的审批流程失败", ex));
     }
 }
            public async Task SetStatusToApprove()
            {
                // Arrange
                const ApprovalType approvalType = ApprovalType.IPM;
                var approverRoleId = Guid.NewGuid();

                var cost = MockCost();

                var approval = new Approval
                {
                    CostStageRevisionId = cost.LatestCostStageRevision.Id,
                    Type            = approvalType,
                    ApprovalMembers = new List <ApprovalMember>
                    {
                        new ApprovalMember
                        {
                            MemberId = User.Id
                        }
                    }
                };

                foreach (var member in approval.ApprovalMembers)
                {
                    member.Approval = approval;
                }
                cost.LatestCostStageRevision.Approvals = new List <Approval> {
                    approval
                };

                EFContext.Approval.Add(approval);
                EFContext.UserUserGroup.Add(new UserUserGroup {
                    UserId = User.Id
                });
                EFContext.Role.Add(new Role
                {
                    Id   = approverRoleId,
                    Name = Roles.CostApprover
                });
                EFContext.SaveChanges();

                cost.Status = CostStageRevisionStatus.Approved;

                // Act
                var response = await ApprovalService.Approve(cost.Id, User, BuType.Pg);

                // Assert
                response.Should().NotBeNull();
                response.Success.Should().BeTrue();
            }
Example #9
0
        public static ApprovalType UpdateApprovalType(ApprovalType approvalType)
        {
            try
            {
                using Repository <ApprovalType> repo = new Repository <ApprovalType>();
                repo.ApprovalType.Update(approvalType);
                if (repo.SaveChanges() > 0)
                {
                    return(approvalType);
                }

                return(null);
            }
            catch { throw; }
        }
Example #10
0
 private ApprovalTask CreateApprovalTask(CreditApplication creditApplication, ApprovalType type, string name)
 {
     return(new ApprovalTask
     {
         CreditApplicationId = creditApplication.Id,
         ApprovalType = type,
         DispalyText = name,
         CreateDate = DateTime.Now,
         Status = TaskStatus.New,
         CompleteDate = null,
         Outcome = null,
         RejectionReason = null,
         UserId = null,
     });
 }
Example #11
0
        public static ApprovalType RegisterApprovalType(ApprovalType approvalType)
        {
            try
            {
                using Repository <ApprovalType> repo = new Repository <ApprovalType>();
                approvalType.Active = "Y";
                repo.ApprovalType.Add(approvalType);
                if (repo.SaveChanges() > 0)
                {
                    return(approvalType);
                }

                return(null);
            }
            catch { throw; }
        }
        public async Task <int> ReceiveNotification(string userId, string deviceId, ApprovalType approvalType, string ApprovalName, string requisitioId)
        {
            userId = Cipher.Encrypt(userId);
            string approval = (approvalType == ApprovalType.PurchaseOrderApproval) ? "PO" :
                              (approvalType == ApprovalType.CashRequisition) ? "Cash Requisition" :
                              (approvalType == ApprovalType.LeaveApplication) ? "Leave Application" :
                              (approvalType == ApprovalType.ChequeRequisitionInformation) ? "ChequeRequisition" : "";
            string url = RepositorySettings.BaseURl + "Notification?userId=" + userId + "&deviceId=" + deviceId
                         + "&approval=" + ApprovalName + "&requisitioId="
                         + requisitioId;

            HttpClient client = new HttpClient();

            HttpResponseMessage result = await client.GetAsync(url);

            return(JsonConvert.DeserializeObject <int>(result.Content.ReadAsStringAsync().Result));
        }
        /// <summary>
        /// Adds the sms approval.
        /// </summary>
        /// <param name="familyId">The admin member identifier.</param>
        /// <param name="approvalType">The sms approval</param>
        /// <param name="message">The message to send</param>
        /// <param name="purchaseTransactionId">The purchase transaction or payday transaction identifier</param>
        /// <returns>The sms approval</returns>
        public SMSApproval Add(int adminMemberId, ApprovalType approvalType, string message, int?purchaseTransactionId = null)
        {
            var smsApproval = new SMSApproval
            {
                ApprovalType           = approvalType,
                IsActive               = true,
                Message                = message,
                StockPurchaseRequestID = (approvalType == ApprovalType.StockPurchase) ? purchaseTransactionId : null,
                CashOutID              = (approvalType == ApprovalType.CashOut) ? purchaseTransactionId : null,
                DonationID             = (approvalType == ApprovalType.CharityDonation) ? purchaseTransactionId : null,
                PurchasedGiftCardID    = (approvalType == ApprovalType.GiftPurchase) ? purchaseTransactionId : null,
                FamilyMemberID         = adminMemberId,
                LastSentOn             = DateTime.UtcNow
            };

            Repository.Insert(smsApproval);

            return(smsApproval);
        }
        public async Task <List <ApprovalDetailsModel> > GetPOApprovalDetails(string userid, ApprovalRoleType roleType, ApprovalType approvalType)
        {
            userid = Cipher.Encrypt(userid);
            string url = RepositorySettings.BaseURl + "Approval?userid=" + userid + "&roleType=" + roleType + "&approvalType=" + approvalType;

            HttpClient          client = new HttpClient();
            HttpResponseMessage result = await client.GetAsync(url);

            return(JsonConvert.DeserializeObject <List <ApprovalDetailsModel> >(result.Content.ReadAsStringAsync().Result));
        }
Example #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            builder = new Android.App.AlertDialog.Builder(this);
            builder.SetMessage("Hello, World!");

            builder.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ });


            base.OnCreate(savedInstanceState);
            _approvalList     = new ApprovalDetailList(this);
            _approvalType     = (ApprovalType)(Convert.ToInt16(Intent.GetStringExtra("ApprovalType")));
            _approvalRoleType = (ApprovalRoleType)(Convert.ToInt16(Intent.GetStringExtra("ApprovalRoleType")));

            SupportRequestWindowFeature(WindowCompat.FeatureActionBar);
            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.SetCustomView(Resource.Layout.custom_actionbar);
            rltitle = FindViewById <RelativeLayout>(Resource.Id.rltitle);


            SetContentView(Resource.Layout.ApprovalDetailList);

            lvApprovalDetailList = FindViewById <AnimatedExpandableListView>(Resource.Id.lvApprovalsDetails);
            _chkApproveAll       = FindViewById <CheckBox>(Resource.Id.chkSelectAll);
            rlMsg            = FindViewById <RelativeLayout>(Resource.Id.rlMsg);
            rlapprovalDetail = FindViewById <RelativeLayout>(Resource.Id.rlapprovalDetail);

            if (bitopiApplication.ApprovalRoleType == ApprovalRoleType.Recommend)
            {
                (FindViewById <Button>(Resource.Id.btnApproveAll)).Text    = "RECOMMEND SELECTED";
                (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Text = "NOT RECOMMEND SELECTED";
            }
            else
            {
                (FindViewById <Button>(Resource.Id.btnApproveAll)).Text    = "APPROVE SELECTED";
                (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Text = "NOT APPROVE SELECTED";
            }
            (FindViewById <Button>(Resource.Id.btnApproveAll)).Click += (s, e) =>
            {
                builder.SetMessage("Do you want to " + (bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve ? "Approve" : "Recommend ") + _approvalList.Where(t => t.isApproved == true).Count() + " Approval");

                builder.SetPositiveButton("OK", (sender, evnt) =>
                {
                    var progressDialog = ProgressDialog.Show(this, null, "", true);
                    _approvalList.SaveSelected((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve ? "Approved" : "Recommended"), (numberOfSuccessFullOperation) =>
                    {
                        progressDialog.Dismiss();
                        var tempApprovalList = _approvalList.Where(t => t.isDeleted == false).ToList();
                        _approvalList        = new ApprovalDetailList(this);
                        tempApprovalList.ForEach(st => _approvalList.Add(st));
                        _approvalListAdapter.SetData(_approvalList);
                        _approvalListAdapter.NotifyDataSetChanged();
                        Toast.MakeText(this, "Total " + numberOfSuccessFullOperation + " Approval has been " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Approved" : "Recommended"), ToastLength.Long).Show();
                        if (numberOfSuccessFullOperation > 0 && _approvalList.Count == 0)
                        {
                            rlMsg.Visibility            = ViewStates.Visible;
                            rlapprovalDetail.Visibility = ViewStates.Gone;
                        }
                    });

                    /* do something on OK click */
                });
                builder.Create().Show();
            };
            (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Click += (s, e) =>
            {
                builder.SetMessage("Do you want to " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Reject" : "Not Recommend ") + _approvalList.Where(t => t.isApproved == true).Count() + " Approval");

                builder.SetPositiveButton("OK", (sender, evnt) =>
                {
                    var progressDialog = ProgressDialog.Show(this, null, "", true);
                    _approvalList.SaveSelected((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Rejected" : "NotRecommend", (numberOfSuccessFullOperation) =>
                    {
                        progressDialog.Dismiss();
                        var tempApprovalList = _approvalList.Where(t => t.isDeleted == false).ToList();
                        _approvalList        = new ApprovalDetailList(this);
                        tempApprovalList.ForEach(st => _approvalList.Add(st));
                        _approvalListAdapter.SetData(_approvalList);
                        _approvalListAdapter.NotifyDataSetChanged();
                        Toast.MakeText(this, "Total " + numberOfSuccessFullOperation + " Approval has been " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Rejected" : "Not Recommended"), ToastLength.Long).Show();
                        if (numberOfSuccessFullOperation > 0 && _approvalList.Count == 0)
                        {
                            rlMsg.Visibility            = ViewStates.Visible;
                            rlapprovalDetail.Visibility = ViewStates.Gone;
                        }
                    });
                });
                builder.Create().Show();
            };
            RLleft_drawer = FindViewById <RelativeLayout>(Resource.Id.RLleft_drawer);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Visibility = ViewStates.Visible;
            FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Click     += (s, e) =>
            {
                if (mDrawerLayout.IsDrawerOpen(RLleft_drawer))
                {
                    mDrawerLayout.CloseDrawer(RLleft_drawer);
                }
                else
                {
                    mDrawerLayout.OpenDrawer(RLleft_drawer);
                }
            };

            //base.LoadDrawerView();
        }
        private bool CheckIfNeedLevelThreeApproval()
        {
            var isNeedLevelThreeApproval = ApprovalType.Equals("MoreThanPercent");

            return(isNeedLevelThreeApproval);
        }
Example #17
0
        public async Task <GenericCollectionResponse <ReleaseApproval> > GetApprovalsAsync(string projectName, IEnumerable <int> releaseIds, ApprovalStatus status = ApprovalStatus.Undefined, ApprovalType approvalType = ApprovalType.Undefined)
        {
            var parameters = new Dictionary <string, object>();

            FluentDictionary.For(parameters)
            .Add("api-version", "5.0")
            .Add("releaseIdsFilter", string.Join(',', releaseIds), () => releaseIds?.Count() > 0)
            .Add("statusFilter", status, () => status != ApprovalStatus.Undefined)
            .Add("typeFilter", approvalType, () => approvalType != ApprovalType.Undefined);

            var endPointUrl = new Uri($"{projectName}/_apis/release/approvals", UriKind.Relative);

            var response = await this.Connection.Get <GenericCollectionResponse <ReleaseApproval> >(endPointUrl, parameters, null)
                           .ConfigureAwait(false);

            return(response.Body);
        }
Example #18
0
        public MailQueryType parse(Email message, IList <IMonitor> monitors, IDictionary <string, ApprovalType> authorization_dictionary)
        {
            MailQueryType query_type = MailQueryType.Authorizing;

            string user = message.from_address.to_lower();
            bool   user_is_authorized = false;

            if (authorization_dictionary.ContainsKey(user))
            {
                ApprovalType user_is_approved = authorization_dictionary[user];
                if (user_is_approved == ApprovalType.Approved)
                {
                    user_is_authorized = true;
                }
            }

            if (user_is_authorized)
            {
                query_type = MailQueryType.Help;
                string subject_and_body = message.subject + " | " + message.message_body;

                string[] message_words = subject_and_body.Split(' ');
                foreach (string message_word in message_words)
                {
                    if (message_contains_status(message_word))
                    {
                        query_type = MailQueryType.Status; break;
                    }
                    if (message_contains_config(message_word))
                    {
                        query_type = MailQueryType.Configuration; break;
                    }
                    if (message_contains_down(message_word))
                    {
                        query_type = MailQueryType.CurrentDownItems; break;
                    }
                    if (message_contains_approve(message_word))
                    {
                        query_type = MailQueryType.Authorized; break;
                    }
                    if (message_contains_deny(message_word))
                    {
                        query_type = MailQueryType.Denied; break;
                    }
                    if (message_contains_version(message_word))
                    {
                        query_type = MailQueryType.Version; break;
                    }
                    if (message_contains_subscribe(message_word))
                    {
                        query_type = MailQueryType.Subscribe; break;
                    }
                    if (message_contains_unsubscribe(message_word))
                    {
                        query_type = MailQueryType.Unsubscribe; break;
                    }
                }
            }

            return(query_type);
        }
        public int ProcessApproval(string ApprovalID, string ApproveByID, string ApprovedBy, string ApprovaStatus, ApprovalType approvalType,
                                   ApprovalRoleType approvalRoleType, string Remarks)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@ApprovalID", ApprovalID),
                new SqlParameter("@ApproveByID", ApproveByID),
                new SqlParameter("@ApprovedBy", ApprovedBy),
                new SqlParameter("@ApprovaStatus", ApprovaStatus),
                new SqlParameter("@ApprovalType", (int)approvalType),
                new SqlParameter("@ApprovalRoleType", (int)approvalRoleType),
                new SqlParameter("@Remarks", Remarks)
            };
            int result = ExecuteNoResult("BiMob.dbo.sp_ProcessApproval_mobile", param);

            return(result);
        }
Example #20
0
        private void NotifyUserForChange(ApprovalType approvalType)
        {
            NameEmail creator = releaseModule.GetNameEmailByParaValue(UserFields.id, rlog.CreatedById.ToString())[0];
            string    subject;
            string    body;

            if (!rlog.IsActive)
            {
                subject = "Drawing Package Marked Inactive - " + rlog.Job.ToString() + "(" + rlog.SubAssy + ") - (" + rlog.RelNo.ToString() + ")";
                body    = releaseModule.ConnectUser.Name + " has removed the drawing package from release for build. <br>" +
                          "Job Number : " + rlog.Job.ToString() + "<br>" +
                          "Sub Assy : " + rlog.SubAssy + "<br>" +
                          "Release No : " + rlog.RelNo.ToString();
                NameEmail checkor = releaseModule.GetNameEmailByParaValue(UserFields.Name, rlog.CheckedBy)[0];
                if (approvalType == ApprovalType.release)
                {
                    NameEmail approvor = releaseModule.GetNameEmailByParaValue(UserFields.Name, rlog.ApprovedBy)[0];
                    releaseModule.TriggerEmail(creator.email, subject, creator.name, body, "", checkor.email, approvor.email, "Normal");
                }
                else
                {
                    releaseModule.TriggerEmail(creator.email, subject, creator.name, body, "", checkor.email, "", "Normal");
                }
                return;
            }

            if (approvalType == ApprovalType.checking)
            {
                subject = "Drawings Check Rejected - " + rlog.Job.ToString() + "(" + rlog.SubAssy + ") - (" + rlog.RelNo.ToString() + ")";
                body    = releaseModule.ConnectUser.Name + " has declined the checking of the drawing package. <br>" +
                          "Job Number : " + rlog.Job.ToString() + "<br>" +
                          "Sub Assy : " + rlog.SubAssy + "<br>" +
                          "Release No : " + rlog.RelNo.ToString() + "<br>" +
                          "Please check attached screen shot.";

                releaseModule.TriggerEmail(creator.email, subject, creator.name, body, ApplicationSettings.ScreenshotLocation, "", "", "Normal");
            }
            else if (approvalType == ApprovalType.controls)
            {
                subject = "Drawings Approval Rejected - " + rlog.Job.ToString() + "(" + rlog.SubAssy + ") - (" + rlog.RelNo.ToString() + ")";
                body    = releaseModule.ConnectUser.Name + " has declined the controls approval of the drawing package. <br>" +
                          "Job Number : " + rlog.Job.ToString() + "<br>" +
                          "Sub Assy : " + rlog.SubAssy + "<br>" +
                          "Release No : " + rlog.RelNo.ToString() + "<br>" +
                          "Please check attached screen shot.";

                releaseModule.TriggerEmail(creator.email, subject, creator.name, body, ApplicationSettings.ScreenshotLocation, "", "", "Normal");
            }
            else if (approvalType == ApprovalType.release)
            {
                subject = "Drawing Release Rejected - " + rlog.Job.ToString() + "(" + rlog.SubAssy + ") - (" + rlog.RelNo.ToString() + ")";
                body    = releaseModule.ConnectUser.Name + " has declined releasing the drawing package for release for build. <br>" +
                          "Job Number : " + rlog.Job.ToString() + "<br>" +
                          "Sub Assy : " + rlog.SubAssy + "<br>" +
                          "Release No : " + rlog.RelNo.ToString() + "<br>" +
                          "Please check attached screen shot.";
                NameEmail checkor  = releaseModule.GetNameEmailByParaValue(UserFields.Name, rlog.CheckedBy)[0];
                NameEmail approvor = releaseModule.GetNameEmailByParaValue(UserFields.Name, rlog.ApprovedBy)[0];
                releaseModule.TriggerEmail(creator.email, subject, creator.name, body, ApplicationSettings.ScreenshotLocation, checkor.email, approvor.email, "Normal");
            }
            else if (approvalType == ApprovalType.approval)
            {
                subject = "Drawing Approval Rejected - " + rlog.Job.ToString() + "(" + rlog.SubAssy + ") - (" + rlog.RelNo.ToString() + ")";
                body    = releaseModule.ConnectUser.Name + " has declined approving the drawing package. <br>" +
                          "Job Number : " + rlog.Job.ToString() + "<br>" +
                          "Sub Assy : " + rlog.SubAssy + "<br>" +
                          "Release No : " + rlog.RelNo.ToString() + "<br>" +
                          "Please check attached screen shot.";
                NameEmail checkor = releaseModule.GetNameEmailByParaValue(UserFields.Name, rlog.CheckedBy)[0];
                releaseModule.TriggerEmail(creator.email, subject, creator.name, body, ApplicationSettings.ScreenshotLocation, checkor.email, "", "Normal");
            }
            ApplicationSettings.ScreenshotLocation = "";
        }
Example #21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //bitopiApplication = (BitopiApplication)this.ApplicationContext;
            builder = new Android.App.AlertDialog.Builder(this);
            builder.SetMessage("Hello, World!");

            builder.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ });


            base.OnCreate(savedInstanceState);
            _MyTaskList       = new MyTaskList(this);
            _approvalType     = (ApprovalType)(Convert.ToInt16(Intent.GetStringExtra("ApprovalType")));
            _approvalRoleType = (ApprovalRoleType)(Convert.ToInt16(Intent.GetStringExtra("ApprovalRoleType")));

            SupportRequestWindowFeature(WindowCompat.FeatureActionBar);
            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.SetCustomView(Resource.Layout.custom_actionbar);
            rltitle      = FindViewById <RelativeLayout>(Resource.Id.rltitle);
            tvHeaderName = FindViewById <TextView>(Resource.Id.tvHeaderName);

            SetContentView(Resource.Layout.TNAMyTaskList);

            lvMyTask         = FindViewById <AnimatedExpandableListView>(Resource.Id.lvMyTask);
            tvMsg            = FindViewById <TextView>(Resource.Id.tvMsg);
            tvMsg.Visibility = ViewStates.Gone;
            _chkApproveAll   = FindViewById <CheckBox>(Resource.Id.chkSelectAll);
            rlMsg            = FindViewById <RelativeLayout>(Resource.Id.rlMsg);
            rlapprovalDetail = FindViewById <RelativeLayout>(Resource.Id.rlapprovalDetail);
            switch (bitopiApplication.MyTaskType)
            {
            case MyTaskType.UNSEEN:
                tvMsg.Text        = "You don't have any unseen Task";
                tvHeaderName.Text = "My Unseen Task";


                break;

            case MyTaskType.SEEN:
                tvMsg.Text        = "You don't have any seen Task";
                tvHeaderName.Text = "My Seen Task";
                break;

            case MyTaskType.COMPLETED:
                tvMsg.Text        = "You don't have any completed Task";
                tvHeaderName.Text = "My Completed Task";
                break;
            }
            RLleft_drawer = FindViewById <RelativeLayout>(Resource.Id.RLleft_drawer);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Visibility = ViewStates.Visible;
            FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Click     += (s, e) =>
            {
                if (mDrawerLayout.IsDrawerOpen(RLleft_drawer))
                {
                    mDrawerLayout.CloseDrawer(RLleft_drawer);
                }
                else
                {
                    mDrawerLayout.OpenDrawer(RLleft_drawer);
                }
            };

            //LoadDrawerView();
        }
Example #22
0
        private void UpdateRejectedReleaseLog(ApprovalType approvalType)
        {
            if (approvalType == ApprovalType.checking)
            {
                rlog.IsSubmitted = false;
                rlog.SubmittedTo = 0;

                rlog.SubmittedOn = "";

                rlog.ReqCntrlsApp      = false;
                rlog.CntrlsSubmittedTo = 0;
                rlog.CntrlsSubmittedOn = "";

                rlog.CntrlsApproved = false;

                rlog.CntrlsApprovedBy = "";
                rlog.CntrlsApprovedOn = "";

                rlog.IsChecked = false;
                rlog.CheckedOn = "";

                rlog.CheckedBy = "";
            }
            else if (approvalType == ApprovalType.controls)

            {
                rlog.IsSubmitted = false;
                rlog.SubmittedTo = 0;
                rlog.SubmittedOn = "";

                rlog.ReqCntrlsApp      = false;
                rlog.CntrlsSubmittedTo = 0;
                rlog.CntrlsSubmittedOn = "";

                rlog.CntrlsApproved   = false;
                rlog.CntrlsApprovedBy = "";
                rlog.CntrlsApprovedOn = "";
            }
            else if (approvalType == ApprovalType.approval)
            {
                rlog.IsSubmitted = false;
                rlog.SubmittedTo = 0;
                rlog.SubmittedOn = "";

                rlog.IsChecked = false;
                rlog.CheckedOn = "";
                rlog.CheckedBy = "";

                rlog.IsApproved = false;
                rlog.ApprovalTo = 0;
                rlog.ApprovedOn = "";
                rlog.ApprovedBy = "";
            }
            else if (approvalType == ApprovalType.release)
            {
                rlog.IsSubmitted = false;
                rlog.SubmittedTo = 0;
                rlog.SubmittedOn = "";

                rlog.IsChecked = false;
                rlog.CheckedOn = "";
                rlog.CheckedBy = "";

                rlog.IsApproved = false;
                rlog.ApprovalTo = 0;
                rlog.ApprovedOn = "";
                rlog.ApprovedBy = "";

                rlog.IsReleased = false;
                rlog.ReleasedOn = "";
                rlog.ReleasedBy = "";
            }
        }
        public List <ApprovalDetailsModel> GetPOApprovalDetails(string userid, ApprovalRoleType roleType, ApprovalType approvalType)
        {
            userid = Cipher.Decrypt(userid);
            List <ApprovalDetailsModel> approvalList = dbApproval.POApprovalDetails(userid, roleType, approvalType);


            return(approvalList);
        }
        public int SavePOApprovalDetails(string ApprovalID, string ApproveByID, string ApprovedBy, string ApprovaStatus, ApprovalType approvalType,
                                         ApprovalRoleType approvalRoleType, string Remarks)
        {
            ApproveByID = Cipher.Decrypt(ApproveByID);
            int result = dbApproval.ProcessApproval(ApprovalID, ApproveByID, ApprovedBy, ApprovaStatus, approvalType,
                                                    approvalRoleType, Remarks);

            //int result = 1;


            return(result);
        }
            public async Task CallRejectOnApprovalServiceForLatestRevision()
            {
                // Arrange
                const ApprovalType approvalType = ApprovalType.IPM;
                var participantId  = Guid.NewGuid();
                var approverRoleId = Guid.NewGuid();

                var cost = MockCost();

                var approval = new Approval
                {
                    CostStageRevisionId = cost.LatestCostStageRevision.Id,
                    Type            = approvalType,
                    ApprovalMembers = new List <ApprovalMember>
                    {
                        new ApprovalMember
                        {
                            MemberId = User.Id
                        }
                    }
                };

                foreach (var member in approval.ApprovalMembers)
                {
                    member.Approval = approval;
                }
                cost.LatestCostStageRevision.Approvals = new List <Approval> {
                    approval
                };

                EFContext.Approval.Add(approval);
                EFContext.UserUserGroup.Add(new UserUserGroup
                {
                    UserId    = participantId,
                    Id        = Guid.NewGuid(),
                    UserGroup = new UserGroup
                    {
                        ObjectId = cost.Id,
                        Id       = Guid.NewGuid(),
                        RoleId   = approverRoleId,
                    }
                });
                EFContext.Role.Add(new Role
                {
                    Id   = approverRoleId,
                    Name = Roles.CostApprover
                });
                EFContext.SaveChanges();

                cost.Status = CostStageRevisionStatus.Approved;

                // Act
                var response = await ApprovalService.Reject(cost.Id, User, BuType.Pg, null);

                // Assert
                response.Should().NotBeNull();
                response.Success.Should().BeTrue();
                PermissionServiceMock.Verify(p =>
                                             p.RevokeApproverAccess(cost.OwnerId, cost.Id, It.IsAny <IEnumerable <CostUser> >()),
                                             Times.Once);

                PermissionServiceMock.Verify(p =>
                                             p.GrantCostPermission(cost.Id, Roles.CostViewer, It.IsAny <IEnumerable <CostUser> >(), BuType.Pg, It.IsAny <Guid?>(), true),
                                             Times.Once);
            }
        public async Task <int> SavePOApprovalDetails(string ApprovalID, string ApproveByID, string ApprovedBy, string ApprovaStatus, ApprovalType approvalType,
                                                      ApprovalRoleType approvalRoleType, string Remarks = "")
        {
            ApproveByID = Cipher.Encrypt(ApproveByID);
            string url = RepositorySettings.BaseURl + "Approval?ApprovalID=" + ApprovalID + "&ApproveByID=" + ApproveByID
                         + "&ApprovedBy=" + ApprovedBy + "&ApprovaStatus="
                         + ApprovaStatus + "&approvalType=" + approvalType + "&approvalRoleType=" + approvalRoleType + "&Remarks=" + Remarks;

            HttpClient client = new HttpClient();

            HttpResponseMessage result = await client.PostAsync(url, null);

            return(JsonConvert.DeserializeObject <int>(result.Content.ReadAsStringAsync().Result));
        }
Example #27
0
        public static void AddFeedback(string contentId, int version, ContentType contentType, ApprovalType approvalType, string reason, Action <ApiFeedback> successCallback, Action <string> errorCallback)
        {
            ApiModelContainer <ApiFeedback> apiModelContainer = new ApiModelContainer <ApiFeedback>();

            apiModelContainer.OnSuccess = delegate(ApiContainer c)
            {
                if (successCallback != null)
                {
                    successCallback(c.Model as ApiFeedback);
                }
            };
            apiModelContainer.OnError = delegate(ApiContainer c)
            {
                if (errorCallback != null)
                {
                    errorCallback(c.Error);
                }
            };
            ApiContainer responseContainer         = apiModelContainer;
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary["contentType"] = contentType.ToString();
            dictionary["type"]        = approvalType.ToString();
            dictionary["reason"]      = reason;
            if (contentType == ContentType.world)
            {
                API.SendPostRequest("/feedback/" + contentId + "/" + version.ToString(), responseContainer, dictionary);
            }
            else
            {
                API.SendPostRequest("/feedback/" + contentId + "/" + contentType.ToString(), responseContainer, dictionary);
            }
        }
        public List <ApprovalDetailsModel> POApprovalDetails(string UserId, ApprovalRoleType roleType, ApprovalType approvalType)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@userid", UserId),
                new SqlParameter("@ApprovalRolType", (int)roleType),
                new SqlParameter("@ApprovalType", (int)approvalType)
            };

            DataTable dt = ExecuteDataTable("BiMob.dbo.sp_POapprovalDetails_mobile", param);

            List <ApprovalDetailsModel> approvalList = new List <ApprovalDetailsModel>();

            ApprovalDetailsModel user = null;

            foreach (DataRow row in dt.Rows)
            {
                string jsonValue = row.Field <string>("JsonValue");
                List <ApprovalDataModel> _approvalDataList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ApprovalDataModel> >(jsonValue);
                user = new ApprovalDetailsModel
                {
                    ApprovalDataList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ApprovalDataModel> >(row.Field <string>("JsonValue")),
                    POID             = row.Field <string>("POID"),
                    isApproved       = false
                };
                approvalList.Add(user);
            }
            return(approvalList);
        }
Example #29
0
 public BaseCompleteTaskProcessor Find(ApprovalType type)
 {
     return(processors[type]);
 }