예제 #1
0
        private static Hashtable stockItemIdTable()
        {
            Hashtable         ht          = new Hashtable();
            stockitem3        st          = new stockitem3();
            StockItemDB3      stockitemdb = new StockItemDB3();
            List <stockitem3> StockItems  = stockitemdb.getStockItems();

            foreach (stockitem3 sitem in StockItems)
            {
                try
                {
                    string id    = sitem.StockItemID;
                    string key   = id.Substring(0, 6);
                    string value = id.Substring(6, 4);
                    if (ht.ContainsKey(key))
                    {
                        ht[key] = value;
                    }
                    else
                    {
                        ht.Add(key, value);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            return(ht);
        }
예제 #2
0
 private void btnApprove_Click_1(object sender, EventArgs e)
 {
     try
     {
         StockItemDB3 stockitemdb = new StockItemDB3();
         if (cmbGroup1Select.SelectedIndex == -1 || cmbGroup2Select.SelectedIndex == -1 || cmbGroup3Select.SelectedIndex == -1 || cmbUnit.SelectedIndex == -1)
         {
             MessageBox.Show("Fill Stockitem detail before approving");
             return;
         }
         DialogResult dialog = MessageBox.Show("Are you sure to Approve the document ?", "Yes", MessageBoxButtons.YesNo);
         if (dialog == DialogResult.Yes)
         {
             if (stockitemdb.ApproveStockItem(prevsitem, id))
             {
                 MessageBox.Show("Stock Item Approved");
                 closeAllPanels();
                 listOption = 1;
                 ListStockItem(listOption);
                 setButtonVisibility("btnEditPanel");
             }
         }
     }
     catch (Exception)
     {
     }
 }
예제 #3
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
                     StockItemDB3 sidb = new StockItemDB3();
                     prevsitem.ForwardUser = approverUID;
                     string s = prevsitem.ForwarderList;
                     prevsitem.ForwarderList = prevsitem.ForwarderList + approverUName + Main.delimiter1 +
                                               approverUID + Main.delimiter1 + Main.delimiter2;
                     if (sidb.forwardStockItem(prevsitem))
                     {
                         pnlCmtr.Visible = false;
                         pnlCmtr.Controls.Remove(lvApprover);
                         MessageBox.Show("Document Forwarded");
                         closeAllPanels();
                         listOption = 1;
                         ListStockItem(listOption);
                         setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse
                     }
                 }
             }
         }
     }
     catch (Exception)
     {
     }
 }
예제 #4
0
 private void btnApprove_Click_1(object sender, EventArgs e)
 {
     try
     {
         StockItemDB3 stockitemdb = new StockItemDB3();
         DialogResult dialog      = MessageBox.Show("Are you sure to Approve the document ?", "Yes", MessageBoxButtons.YesNo);
         if (dialog == DialogResult.Yes)
         {
             if (stockitemdb.ApproveStockItem(prevsitem, id))
             {
                 MessageBox.Show("Stock Item Approved");
                 closeAllPanels();
                 listOption = 1;
                 ListStockItem(listOption);
                 setButtonVisibility("btnEditPanel");
             }
         }
     }
     catch (Exception)
     {
     }
 }
예제 #5
0
 private void btnReverse_Click_1(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(prevsitem.ForwarderList);
             //do forward activities
             //prevpopi.CommentStatus = DocCommenterDB.removeUnapprovedCommentStatus(prevpopi.CommentStatus);
             StockItemDB3 sidb = new StockItemDB3();
             if (reverseStr.Trim().Length > 0)
             {
                 int ind = reverseStr.IndexOf("!@#");
                 prevsitem.ForwarderList  = reverseStr.Substring(0, ind);
                 prevsitem.ForwardUser    = reverseStr.Substring(ind + 3);
                 prevsitem.documentStatus = prevsitem.documentStatus - 1;
             }
             else
             {
                 prevsitem.ForwarderList  = "";
                 prevsitem.ForwardUser    = "";
                 prevsitem.documentStatus = 1;
             }
             if (sidb.reverseStockITem(prevsitem))
             {
                 MessageBox.Show("PO Product Inward Document Reversed");
                 closeAllPanels();
                 listOption = 1;
                 ListStockItem(listOption);
                 setButtonVisibility("btnEditPanel"); //activites are same for cance, forward,approce and reverse
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
예제 #6
0
        private void ListStockItem(int option)
        {
            try
            {
                // pnlActionButtons.Visible = true;
                lblActionHeader.Visible = true;
                grdList.Rows.Clear();
                forwarderList = demDB.getForwarders(docID, Login.empLoggedIn);
                approverList  = demDB.getApprovers(docID, Login.empLoggedIn);
                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";
                }
                StockItemDB3      stockitemdb = new StockItemDB3();
                List <stockitem3> StockItems  = stockitemdb.getFilteredStockItems(userString, option);
                foreach (stockitem3 sitem in StockItems)
                {
                    if (option == 1)
                    {
                        if (sitem.documentStatus == 99)
                        {
                            continue;
                        }
                    }
                    else
                    {
                    }
                    grdList.Rows.Add();
                    grdList.Rows[grdList.RowCount - 1].Cells["StockItemID"].Value    = sitem.StockItemID;
                    grdList.Rows[grdList.RowCount - 1].Cells["Description"].Value    = sitem.Name;
                    grdList.Rows[grdList.RowCount - 1].Cells["ReorderLevel"].Value   = sitem.ReorderLevel;
                    grdList.Rows[grdList.RowCount - 1].Cells["Group1"].Value         = sitem.Group1CodeDescription;
                    grdList.Rows[grdList.RowCount - 1].Cells["Group2"].Value         = sitem.Group2CodeDescription;
                    grdList.Rows[grdList.RowCount - 1].Cells["Group3"].Value         = sitem.Group3CodeDescription;
                    grdList.Rows[grdList.RowCount - 1].Cells["Group1Code"].Value     = sitem.Group1Code;
                    grdList.Rows[grdList.RowCount - 1].Cells["Group2Code"].Value     = sitem.Group2Code;
                    grdList.Rows[grdList.RowCount - 1].Cells["Group3Code"].Value     = sitem.Group3Code;
                    grdList.Rows[grdList.RowCount - 1].Cells["Unit"].Value           = sitem.Unit + "-" + sitem.UnitDescription;
                    grdList.Rows[grdList.RowCount - 1].Cells["Status"].Value         = sitem.status;
                    grdList.Rows[grdList.RowCount - 1].Cells["DocumentStatus"].Value = sitem.documentStatus;
                    grdList.Rows[grdList.RowCount - 1].Cells["CreateUser"].Value     = sitem.CreateUser;
                    grdList.Rows[grdList.RowCount - 1].Cells["Creator"].Value        = sitem.CreateUserName;
                    grdList.Rows[grdList.RowCount - 1].Cells["Forwarder"].Value      = sitem.ForwardUserName;
                    grdList.Rows[grdList.RowCount - 1].Cells["Approver"].Value       = sitem.ApproveUserName;
                    grdList.Rows[grdList.RowCount - 1].Cells["ForwarderLists"].Value = sitem.ForwarderList;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in Stock Item listing");
            }
            setButtonVisibility("init");

            grdList.Columns["Creator"].Visible   = true;
            grdList.Columns["Forwarder"].Visible = true;
            grdList.Columns["Approver"].Visible  = true;
            pnlList.Visible = true;
            grdList.Visible = true;
        }
예제 #7
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            Boolean status = true;

            try
            {
                stockitem3   sitem       = new stockitem3();
                StockItemDB3 stockitemdb = new StockItemDB3();
                //cvi.ConversionDate = dtDate.Value;

                try
                {
                    sitem.Group1Code            = cmbGroup1Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup1Select.SelectedItem.ToString().Trim().IndexOf('-'));
                    sitem.Group1CodeDescription = cmbGroup1Select.SelectedItem.ToString().Trim().Substring(cmbGroup1Select.SelectedItem.ToString().Trim().IndexOf('-') + 1);
                }
                catch (Exception)
                {
                    sitem.Group1Code            = "";
                    sitem.Group1CodeDescription = "";
                }
                try
                {
                    sitem.Group2Code            = cmbGroup2Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup2Select.SelectedItem.ToString().Trim().IndexOf('-'));
                    sitem.Group2CodeDescription = cmbGroup2Select.SelectedItem.ToString().Trim().Substring(cmbGroup2Select.SelectedItem.ToString().Trim().IndexOf('-') + 1);
                }
                catch (Exception)
                {
                    sitem.Group2Code            = "";
                    sitem.Group2CodeDescription = "";
                }
                try
                {
                    sitem.Group3Code            = cmbGroup3Select.SelectedItem.ToString().Trim().Substring(0, cmbGroup3Select.SelectedItem.ToString().Trim().IndexOf('-'));
                    sitem.Group3CodeDescription = cmbGroup3Select.SelectedItem.ToString().Trim().Substring(cmbGroup3Select.SelectedItem.ToString().Trim().IndexOf('-') + 1);
                }
                catch (Exception)
                {
                    sitem.Group3Code            = "";
                    sitem.Group3CodeDescription = "";
                }
                try
                {
                    sitem.Unit            = cmbUnit.SelectedItem.ToString().Trim().Substring(0, cmbUnit.SelectedItem.ToString().Trim().IndexOf('-'));
                    sitem.UnitDescription = cmbUnit.SelectedItem.ToString().Trim().Substring(cmbUnit.SelectedItem.ToString().Trim().IndexOf('-') + 1);
                }
                catch (Exception)
                {
                    sitem.Unit            = "";
                    sitem.UnitDescription = "";
                }
                //sitem.StockItemID = CreateStockItemID(itc);
                sitem.Name          = txtName.Text;
                sitem.ReorderLevel  = Convert.ToInt32(txtReorderLevel.Text);
                sitem.ForwarderList = prevsitem.ForwarderList;
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btn.Text;


                if (stockitemdb.validateStockItem(sitem))
                {
                    if (btnText.Equals("Update"))
                    {
                        if (stockitemdb.updateStockItem(sitem, prevsitem))
                        {
                            MessageBox.Show("Stock Item updated");
                            closeAllPanels();
                            listOption = 1;
                            ListStockItem(listOption);
                        }
                        else
                        {
                            status = false;
                            MessageBox.Show("Failed to Update Stock Item");
                        }
                    }
                    else if (btnText.Equals("Save"))
                    {
                        sitem.documentStatus = 1;//created
                        if (stockitemdb.insertStockItem(sitem))
                        {
                            MessageBox.Show("Stock Item Added");
                            closeAllPanels();
                            listOption = 1;
                            ListStockItem(listOption);
                        }
                        else
                        {
                            status = false;
                            MessageBox.Show("Failed to Insert Stock Item");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Stock Item Data Validation failed");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed Adding / Editing Stock Item");
            }
            if (status)
            {
                setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save
            }
        }