Example #1
0
 private void btnApprove_Click(object sender, EventArgs e)
 {
     try
     {
         CurrencyVsINRDB cvinrDB = new CurrencyVsINRDB();
         DialogResult    dialog  = MessageBox.Show("Are you sure to Approve the document ?", "Yes", MessageBoxButtons.YesNo);
         if (dialog == DialogResult.Yes)
         {
             if (cvinrDB.ApproveCVINR(prevcvi))
             {
                 MessageBox.Show("CVINR Approved");
                 if (!updateDashBoard(prevcvi, 2))
                 {
                     MessageBox.Show("DashBoard Fail to update");
                 }
                 closeAllPanels();
                 listOption = 1;
                 ListFilteredCVINR(listOption);
                 setButtonVisibility("btnEditPanel");
             }
         }
     }
     catch (Exception)
     {
     }
 }
Example #2
0
        private void ListFilteredCVINR(int option)
        {
            try
            {
                grdList.Rows.Clear();
                forwarderList = demDB.getForwarders(docID, Login.empLoggedIn);
                approverList  = demDB.getApprovers(docID, Login.empLoggedIn);
                CurrencyVsINRDB dbrecord = new CurrencyVsINRDB();
                List <cvinr>    CVINRs   = dbrecord.getFilteredCVINR(userString, option);
                if (option == 1)
                {
                    lblActionHeader.Text = "List of Action Pending Documents";
                }
                else if (option == 2)
                {
                    lblActionHeader.Text = "List of In-Process Documents";
                }
                else if (option == 3 || option == 6)
                {
                    lblActionHeader.Text = "List of Approved Documents";
                }
                foreach (cvinr cvi in CVINRs)
                {
                    if (option == 1)
                    {
                        if (cvi.documentStatus == 99)
                        {
                            continue;
                        }
                    }
                    else
                    {
                    }

                    grdList.Rows.Add(cvi.ConversionDate,
                                     cvi.CurrencyID + "-" + cvi.CurrencyName,
                                     ComboFIll.getCurrencyConversionTypeString(cvi.type),
                                     cvi.INRValue,
                                     // ComboFIll.getDocumentStatusString(cvi.documentStatus),
                                     cvi.status,
                                     cvi.documentStatus,
                                     cvi.CreateUser,
                                     cvi.ForwardUser,
                                     cvi.ApproveUser, cvi.ForwarderList);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error in CVINR listing");
            }
            setButtonVisibility("init");
            pnlCVINRList.Visible = true;

            grdList.Columns["Creator"].Visible   = true;
            grdList.Columns["Forwarder"].Visible = true;
            grdList.Columns["Approver"].Visible  = true;
        }
Example #3
0
 private void btnReverse_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult dialog = MessageBox.Show("Are you sure to Reverse the document ?", "Yes", MessageBoxButtons.YesNo);
         if (dialog == DialogResult.Yes)
         {
             string reverseStr = getReverseString(prevcvi.ForwarderList);
             //do forward activities
             //prevpopi.CommentStatus = DocCommenterDB.removeUnapprovedCommentStatus(prevpopi.CommentStatus);
             CurrencyVsINRDB cvinrDB = new CurrencyVsINRDB();
             if (reverseStr.Trim().Length > 0)
             {
                 int ind = reverseStr.IndexOf("!@#");
                 prevcvi.ForwarderList  = reverseStr.Substring(0, ind);
                 prevcvi.ForwardUser    = reverseStr.Substring(ind + 3);
                 prevcvi.documentStatus = prevcvi.documentStatus - 1;
             }
             else
             {
                 prevcvi.ForwarderList  = "";
                 prevcvi.ForwardUser    = "";
                 prevcvi.documentStatus = 1;
             }
             if (cvinrDB.reverseCVINR(prevcvi))
             {
                 MessageBox.Show("CVINR Document Reversed");
                 closeAllPanels();
                 listOption = 1;
                 ListFilteredCVINR(listOption);
                 setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Example #4
0
        private void lvForwardOK_Click(object sender, EventArgs e)
        {
            try
            {
                int    kount         = 0;
                string approverUID   = "";
                string approverUName = "";
                foreach (ListViewItem itemRow in lvApprover.Items)
                {
                    if (itemRow.Checked)
                    {
                        approverUID   = itemRow.SubItems[2].Text;
                        approverUName = itemRow.SubItems[1].Text;
                        kount++;
                    }
                }
                if (kount == 0)
                {
                    MessageBox.Show("Select one approver");
                    return;
                }
                if (kount > 1)
                {
                    MessageBox.Show("Select only one approver");
                    return;
                }
                else
                {
                    DialogResult dialog = MessageBox.Show("Are you sure to forward the document ?", "Yes", MessageBoxButtons.YesNo);
                    if (dialog == DialogResult.Yes)
                    {
                        //do forward activities
                        CurrencyVsINRDB cvinrDB = new CurrencyVsINRDB();
                        prevcvi.ForwardUser = approverUID;
                        string s = prevcvi.ForwarderList;
                        prevcvi.ForwarderList = prevcvi.ForwarderList + approverUName + Main.delimiter1 +
                                                approverUID + Main.delimiter1 + Main.delimiter2;

                        if (cvinrDB.forwardCVINR(prevcvi))
                        {
                            frmPopup.Close();
                            frmPopup.Dispose();
                            MessageBox.Show("CVINR Forwarded");
                            if (!updateDashBoard(prevcvi, 1))
                            {
                                MessageBox.Show("DashBoard Fail to update");
                            }
                            closeAllPanels();
                            pnlForwarder.Controls.Remove(lvApprover);
                            pnlForwarder.Visible = false;
                            listOption           = 1;
                            ListFilteredCVINR(listOption);
                            setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Example #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Boolean status = true;

            try
            {
                cvinr           cvi     = new cvinr();
                CurrencyVsINRDB cvinrDB = new CurrencyVsINRDB();
                cvi.ConversionDate = dtDate.Value;

                try
                {
                    cvi.CurrencyID    = cmbCurrency.SelectedItem.ToString().Trim().Substring(0, cmbCurrency.SelectedItem.ToString().Trim().IndexOf('-'));
                    cvi.CurrencyName  = cmbCurrency.SelectedItem.ToString().Trim().Substring(cmbCurrency.SelectedItem.ToString().Trim().IndexOf('-') + 1);
                    cvi.INRValue      = float.Parse(txtINRValue.Text);
                    cvi.ForwarderList = prevcvi.ForwarderList;
                    cvi.type          = ComboFIll.getCurrencyConversionTypeCode(cmbType.SelectedItem.ToString());
                }
                catch (Exception ex)
                {
                    status = false;
                    MessageBox.Show("CVINR Data Validation failed");
                    return;
                }

                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btn.Text;


                if (cvinrDB.validateCVINR(cvi))
                {
                    //cvi.documentStatus = prevcvi.documentStatus;
                    if (btnText.Equals("Update"))
                    {
                        if (cvinrDB.updateCVINR(cvi, prevcvi))
                        {
                            MessageBox.Show("CVINR updated");
                            closeAllPanels();
                            listOption = 1;
                            ListFilteredCVINR(listOption);
                        }
                        else
                        {
                            status = false;
                            MessageBox.Show("Failed to update CVINR");
                        }
                    }
                    else if (btnText.Equals("Save"))
                    {
                        cvi.documentStatus = 1;//created
                        if (cvinrDB.insertCVINR(cvi))
                        {
                            MessageBox.Show("CVINR Added");
                            closeAllPanels();
                            listOption = 1;
                            ListFilteredCVINR(listOption);
                        }
                        else
                        {
                            status = false;
                            MessageBox.Show("Failed to Insert CVINR");
                        }
                    }
                }
                else
                {
                    status = false;
                    MessageBox.Show("CVINR Data Validation failed");
                    return;
                }
            }
            catch (Exception ex)
            {
                status = false;
                MessageBox.Show("Failed Adding / Editing CVINR");
            }
            if (status)
            {
                setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save
            }
        }