Ejemplo n.º 1
0
        private void btnApprove_Clicked(object sender, EventArgs e)
        {
            string documentName = "ADV_DEL_REQ";

            DateTime reqTime     = DateTime.Now;
            DateTime ApproveTime = DateTime.Now;
            string   userIP      = "";
            bool     digitalSign = true;
            int      InqappReq   = 0;
            int      approvalSet = 0;

            string advStatus    = "Approved";
            string myAppLevel   = "";
            string nextAppLevel = "";
            string reqTo        = "";
            string reqLevel     = "";
            int    insertrslt   = 0;

            approvalSet = ApprovalManager.UpdateApprovalStatus(CompanyName, DocNo, CurrentReqLevel, getUserName, ApproveTime, userIP);

            DataTable appbodydt = InquiryApprovalManager.GetApprovalLevelhierarchy(CompanyName, CurrentReqLevel, documentName);


            if (appbodydt.Rows.Count > 0)
            {
                for (int x = 0; x < appbodydt.Rows.Count; x++)
                {
                    myAppLevel   = appbodydt.Rows[x]["ApprovalLevel"].ToString();
                    nextAppLevel = appbodydt.Rows[x]["NextLevel"].ToString();
                    reqTo        = appbodydt.Rows[x]["reqTo"].ToString();

                    reqLevel = nextAppLevel;


                    if (approvalSet > 0 && CurrentReqLevel != "3")
                    {
                        InqappReq = InquiryApprovalManager.InsertMarketingApprovalLog(CompanyName, documentName, DocNo, reqTo, reqTime, getUserName, reqLevel, userIP, digitalSign);
                    }
                    else if (approvalSet > 0 && CurrentReqLevel == "3")
                    {
                        insertrslt = ADO_Manager.UpdateAdvanceStatus(CompanyName, DocNo, advStatus);
                    }
                }
            }
            if (insertrslt != 0)
            {
                string module = "Sales And Marketing";
                string action = "Advance DO request  has been signed by " + getUserName + ", Advance No: " + DocNo + "";
                Admin_ActionLogManager.SendActionLog(CompanyName, action, module, getUserName, DocNo);
            }

            //for refreshing dashboard
            MessagingCenter.Send <App>((App)Application.Current, "OnApproval");
            //closing Popup
            ApprovalFinalizing(DocNo);
        }
Ejemplo n.º 2
0
        private void btnApprove_Clicked(object sender, EventArgs e)
        {
            indicatorApproveProgress.IsRunning = true;
            this.IsBusy = true;


            string   documentName = "INQUIRY";
            string   currentReqLevel = "";
            string   reqTo = ""; string reqLevel = "";
            string   userIP       = "";
            DateTime reqTime      = DateTime.Now;
            DateTime ApproveTime  = DateTime.Now;
            bool     digitalSign  = true;
            int      approvalSet  = 0;
            int      InqappReq    = 0;
            string   inqAppStatus = "Approved";
            string   actionDocNo  = "";
            string   action       = "";
            string   module       = "Sales & Marketting";


            //GetApprovalLevel();

            DataTable dt = ADM.getDetailByInqCompany(CompanyName, DocNo, getUserName);

            getSellingType  = dt.Rows[0]["SellingType"].ToString();
            currentReqLevel = dt.Rows[0]["ReqLevel"].ToString();

            DataTable ApprovalBody = InquiryApprovalManager.GetApprovalLevelhierarchy(CompanyName, currentReqLevel, documentName);

            if (ApprovalBody.Rows.Count > 0)
            {
                for (int x = 0; x < ApprovalBody.Rows.Count; x++)
                {
                    getMyApprovalLevel   = ApprovalBody.Rows[x]["ApprovalLevel"].ToString();
                    getNextApprovalLevel = ApprovalBody.Rows[x]["NextLevel"].ToString();
                    reqTo = ApprovalBody.Rows[x]["reqTo"].ToString();
                }
            }

            reqLevel = getNextApprovalLevel;

            approvalSet = InquiryApprovalManager.UpdateApprovalStatus(CompanyName, DocNo, currentReqLevel, getUserName, ApproveTime, userIP);
            if (approvalSet > 0 && currentReqLevel != "5")
            {
                InqappReq = InquiryApprovalManager.InsertMarketingApprovalLog(CompanyName, documentName, DocNo, reqTo, reqTime, getUserName, reqLevel, userIP, digitalSign);
                App.Current.MainPage.Navigation.PopPopupAsync(true);
            }
            else if (approvalSet > 0 && currentReqLevel == "5")
            {
                if (getSellingType == "LC")
                {
                    InquiryApprovalManager.UpdateInquiryStatus(DocNo, CompanyName, inqAppStatus);
                }
                else
                {
                    InquiryApprovalManager.UpdateCashInquiryStatus(DocNo, CompanyName, inqAppStatus);
                }
            }

            actionDocNo = DocNo;
            action      = "Inquiry  has been signed by " + getUserName + ", Inquiry No: " + DocNo + "";
            Admin_ActionLogManager.SendActionLog(CompanyName, action, module, getUserName, actionDocNo);

            //for refreshing dashboard
            MessagingCenter.Send <App>((App)Application.Current, "OnApproval");
            //closing Popup
            ApprovalFinalizing(getMyApprovalLevel, actionDocNo);
        }