Beispiel #1
0
        private void btnForward_Click_1(object sender, EventArgs e)
        {
            removeControlsFromForwarderPanel();
            lvApprover = new ListView();
            lvApprover.Clear();
            pnlForwarder.BorderStyle = BorderStyle.FixedSingle;
            pnlForwarder.Bounds      = new Rectangle(new Point(100, 10), new Size(700, 300));
            lvApprover        = DocEmpMappingDB.ApproverLV(docID, Login.empLoggedIn);
            lvApprover.Bounds = new Rectangle(new Point(50, 50), new Size(500, 200));
            pnlForwarder.Controls.Remove(lvApprover);
            pnlForwarder.Controls.Add(lvApprover);
            Button lvForwrdOK = new Button();

            lvForwrdOK.Text     = "OK";
            lvForwrdOK.Size     = new Size(150, 20);
            lvForwrdOK.Location = new Point(50, 270);
            lvForwrdOK.Click   += new System.EventHandler(this.lvForwardOK_Click);
            pnlForwarder.Controls.Add(lvForwrdOK);

            Button lvForwardCancel = new Button();

            lvForwardCancel.Text     = "Cancel";
            lvForwardCancel.Size     = new Size(150, 20);
            lvForwardCancel.Location = new Point(250, 270);
            lvForwardCancel.Click   += new System.EventHandler(this.lvForwardCancel_Click);
            pnlForwarder.Controls.Add(lvForwardCancel);

            pnlForwarder.Visible = true;
            pnlAddEdit.Controls.Add(pnlForwarder);
            pnlAddEdit.BringToFront();
            pnlForwarder.BringToFront();
            pnlForwarder.Focus();
        }
Beispiel #2
0
        private void btnForward_Click_1(object sender, EventArgs e)
        {
            //removeControlsFromForwarderPanel();
            //lvApprover = new ListView();
            ////lvApprover.Enabled = true;
            //lvApprover.Clear();
            //pnlForwarder.BorderStyle = BorderStyle.FixedSingle;
            //pnlForwarder.Bounds = new Rectangle(new Point(100, 10), new Size(500, 300));
            frmPopup = new Form();
            frmPopup.StartPosition = FormStartPosition.CenterScreen;
            frmPopup.BackColor     = Color.CadetBlue;

            frmPopup.MaximizeBox     = false;
            frmPopup.MinimizeBox     = false;
            frmPopup.ControlBox      = false;
            frmPopup.FormBorderStyle = FormBorderStyle.FixedSingle;

            frmPopup.Size = new Size(450, 300);
            string DeptList = "Production" + Main.delimiter1 + "QC" + Main.delimiter1 + "ProductSupport";

            lvApprover        = DocEmpMappingDB.ApproverLV(docID, Login.empLoggedIn);
            lvApprover.Bounds = new Rectangle(new Point(0, 0), new Size(450, 250));
            ///pnlForwarder.Controls.Remove(lvApprover);
            frmPopup.Controls.Add(lvApprover);

            Button lvForwrdOK = new Button();

            lvForwrdOK.BackColor = Color.Tan;
            lvForwrdOK.Text      = "OK";
            lvForwrdOK.Location  = new Point(40, 265);
            lvForwrdOK.Click    += new System.EventHandler(this.lvForwardOK_Click);
            frmPopup.Controls.Add(lvForwrdOK);

            Button lvForwardCancel = new Button();

            lvForwardCancel.BackColor = Color.Tan;
            lvForwardCancel.Text      = "CANCEL";
            lvForwardCancel.Location  = new Point(130, 265);
            lvForwardCancel.Click    += new System.EventHandler(this.lvForwardCancel_Click);
            frmPopup.Controls.Add(lvForwardCancel);
            ////lvForwardCancel.Visible = false;
            frmPopup.ShowDialog();
            //pnlForwarder.Visible = true;
            //pnlOuter.Controls.Add(pnlForwarder);
            //pnlOuter.BringToFront();
            //pnlForwarder.BringToFront();
            //pnlForwarder.Focus();
        }
Beispiel #3
0
        private void ListDocValues(string tablename)
        {
            try
            {
                grdList.Rows.Clear();
                DocumentCancelDB dbrecord  = new DocumentCancelDB();
                List <DocCancel> docValues = dbrecord.getDocumentInfo(tablename, selectedDocID);
                foreach (DocCancel val in docValues)
                {
                    //get the employee code of user approved the document
                    ERPUserDB erpuserdb = new ERPUserDB();
                    string    ecode     = "";
                    if (val.ForwardUser.Length != 0)
                    {
                        ecode = erpuserdb.getEmpCode(val.ForwardUser.Trim());
                    }
                    string edet         = Login.userLoggedInName + Main.delimiter1 + Login.userLoggedIn + Main.delimiter2;
                    string approverList = DocEmpMappingDB.getApproverList(selectedDocID, ecode);
                    string tstr         = Login.userLoggedInName + Main.delimiter1 + Login.userLoggedIn + Main.delimiter1 + Main.delimiter2;
                    ////users who can unlock a document
                    ////user should be found in forwarder list and logged in user is the approver and
                    ////user shall be a member of the approverlist of the document

                    if (!(val.ForwardUser == Login.userLoggedIn || val.forwarderlist.Contains(tstr)) &&
                        approverList.Contains(edet))
                    {
                        grdList.Rows.Add(val.TemporaryNo, val.TemporaryDate, val.ForwardUser, val.TableName, val.forwarderlist, val.RowID);
                    }
                    else if (unlockCommiteelist != null && unlockCommiteelist.Contains(";" + Login.userLoggedIn + ";"))
                    {
                        grdList.Rows.Add(val.TemporaryNo, val.TemporaryDate, val.ForwardUser, val.TableName, val.forwarderlist, val.RowID);
                    }
                    ////if (!val.ApprovedUser.Equals(Login.empLoggedIn) || !val.forwarderlist.Contains(Login.empLoggedIn))
                    ////{
                    ////    grdList.Rows.Add(val.TemporaryNo, val.TemporaryDate, val.ApprovedUser, val.TableName, val.forwarderlist);
                    ////}
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            pnlDocUnlockList.Visible = true;
        }
Beispiel #4
0
        ////private void Form1_Load(object sender, EventArgs e)
        ////{
        ////    try
        ////    {
        ////        ListDocEmpMapping();
        ////    }
        ////    catch (Exception)
        ////    {

        ////    }

        ////}
        private void ListDocEmpMapping()
        {
            try
            {
                grdList.Rows.Clear();
                DocEmpMappingDB      dbrecord       = new DocEmpMappingDB();
                List <docempmapping> DocEmpMappings = dbrecord.getDocEmpMapping();
                foreach (docempmapping doc in DocEmpMappings)
                {
                    grdList.Rows.Add(doc.DocumentID, doc.DocumentName,
                                     doc.EmployeeName + "-" + doc.EmployeeID,
                                     doc.SeniorEmployeeName + "-" + doc.SeniorEmployeeID,
                                     ComboFIll.getStatusString(doc.DocumentStatus));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            enableBottomButtons();
            pnlDocumentList.Visible = true;
        }
Beispiel #5
0
        private void showDocumentDataGridView()
        {
            try
            {
                frmPopup = new Form();
                frmPopup.StartPosition = FormStartPosition.CenterScreen;
                frmPopup.BackColor     = Color.CadetBlue;

                frmPopup.MaximizeBox     = false;
                frmPopup.MinimizeBox     = false;
                frmPopup.ControlBox      = false;
                frmPopup.FormBorderStyle = FormBorderStyle.FixedSingle;

                frmPopup.Size = new Size(520, 370);

                Label lblSearch = new Label();
                lblSearch.Location  = new System.Drawing.Point(120, 5);
                lblSearch.AutoSize  = true;
                lblSearch.Text      = "Search by Name";
                lblSearch.Font      = new System.Drawing.Font("Microsoft Sans Serif", 9, FontStyle.Bold);
                lblSearch.ForeColor = Color.Black;
                frmPopup.Controls.Add(lblSearch);

                txtSearch              = new TextBox();
                txtSearch.Size         = new Size(220, 18);
                txtSearch.Location     = new System.Drawing.Point(250, 3);
                txtSearch.Font         = new System.Drawing.Font("Microsoft Sans Serif", 9, FontStyle.Regular);
                txtSearch.ForeColor    = Color.Black;
                txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChangedInDocGridList);
                txtSearch.TabIndex     = 0;
                txtSearch.Focus();
                frmPopup.Controls.Add(txtSearch);

                DocEmpMappingDB empDB = new DocEmpMappingDB();
                grdEmpList = empDB.getDocumentlistGrid();

                grdEmpList.Bounds = new Rectangle(new Point(0, 27), new Size(520, 300));
                frmPopup.Controls.Add(grdEmpList);
                grdEmpList.Columns["TableName"].Visible      = false;
                grdEmpList.Columns["IsReversible"].Visible   = false;
                grdEmpList.Columns["DocumentStatus"].Visible = false;
                grdEmpList.Columns["userCreateUser"].Visible = false;
                grdEmpList.Columns["userCreateime"].Visible  = false;
                grdEmpList.Columns["DocumentID"].Width       = 200;
                grdEmpList.Columns["DocumentName"].Width     = 250;
                foreach (DataGridViewColumn column in grdEmpList.Columns)
                {
                    column.SortMode = DataGridViewColumnSortMode.Automatic;
                }

                Button lvOK = new Button();
                lvOK.BackColor = Color.Tan;
                lvOK.Text      = "OK";
                lvOK.Location  = new System.Drawing.Point(20, 335);
                lvOK.Click    += new System.EventHandler(this.grddocOK_Click1);
                frmPopup.Controls.Add(lvOK);

                Button lvCancel = new Button();
                lvCancel.Text      = "CANCEL";
                lvCancel.BackColor = Color.Tan;
                lvCancel.Location  = new System.Drawing.Point(110, 335);
                lvCancel.Click    += new System.EventHandler(this.grdCancel_Click1);
                frmPopup.Controls.Add(lvCancel);
                frmPopup.ShowDialog();
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                docempmapping   doc   = new docempmapping();
                DocEmpMappingDB docDB = new DocEmpMappingDB();


                try
                {
                    string[] docmts   = txtDocument.Text.Split('-');
                    string[] emply    = txtEmployee.Text.Split('-');
                    string[] snremply = txtSnrEmployee.Text.Split('-');
                    doc.DocumentID         = docmts[1];
                    doc.DocumentName       = docmts[0];
                    doc.EmployeeID         = emply[1];
                    doc.EmployeeName       = emply[0];
                    doc.SeniorEmployeeID   = snremply[1];
                    doc.SeniorEmployeeName = snremply[0];
                    //doc.DocumentID = ((Structures.ComboBoxItem)cmbDocument.SelectedItem).HiddenValue;
                    //////////doc.DocumentName = cmbDocument.SelectedItem.ToString().Trim().Substring(cmbDocument.SelectedItem.ToString().Trim().IndexOf('-') + 1);
                    //doc.DocumentName = ((Structures.ComboBoxItem)cmbDocument.SelectedItem).ToString();
                    //doc.EmployeeName = cmbEmployee.SelectedItem.ToString().Trim().Substring(0, cmbEmployee.SelectedItem.ToString().Trim().IndexOf('-'));
                    //doc.EmployeeID = cmbEmployee.SelectedItem.ToString().Trim().Substring(cmbEmployee.SelectedItem.ToString().Trim().IndexOf('-') + 1);
                    //doc.SeniorEmployeeName = cmbSeniorEmployee.SelectedItem.ToString().Trim().Substring(0, cmbSeniorEmployee.SelectedItem.ToString().Trim().IndexOf('-'));
                    //doc.SeniorEmployeeID = cmbSeniorEmployee.SelectedItem.ToString().Trim().Substring(cmbSeniorEmployee.SelectedItem.ToString().Trim().IndexOf('-') + 1);
                }
                catch (Exception)
                {
                    doc.DocumentID         = "";
                    doc.DocumentName       = "";
                    doc.EmployeeName       = "";
                    doc.EmployeeID         = "";
                    doc.SeniorEmployeeName = "";
                    doc.SeniorEmployeeID   = "";
                }

                doc.DocumentStatus = ComboFIll.getStatusCode(cmbDocumentStatus.SelectedItem.ToString());
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btn.Text;

                {
                    if (btnText.Equals("Update"))
                    {
                        if (docDB.updateDocEmpMapping(doc, prevdoc))
                        {
                            MessageBox.Show("DocEmpMapping Status updated");
                            closeAllPanels();
                            ListDocEmpMapping();
                        }
                        else
                        {
                            MessageBox.Show("Failed to update DocEmpMapping Status");
                        }
                    }
                    else if (btnText.Equals("Save"))
                    {
                        if (docDB.validateDocument(doc))
                        {
                            if (docDB.insertDocEmpMapping(doc))
                            {
                                MessageBox.Show("DocEmpMapping data Added");
                                closeAllPanels();
                                ListDocEmpMapping();
                            }
                            else
                            {
                                MessageBox.Show("Failed to Insert DocEmpMapping");
                            }
                        }
                        else
                        {
                            MessageBox.Show("DocEmpMapping Data Validation failed");
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Failed Adding / Editing User Data");
            }
        }