Ejemplo n.º 1
0
        private void DocumentUnlock_Load(object sender, EventArgs e)
        {
            //////this.FormBorderStyle = FormBorderStyle.None;
            Region = System.Drawing.Region.FromHrgn(Utilities.CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
            initVariables();
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Width      -= 100;
            this.Height     -= 100;
            dict             = new Dictionary <string, string>();
            String a = this.Size.ToString();

            grdList.ColumnHeadersDefaultCellStyle.BackColor = Color.LightBlue;
            grdList.EnableHeadersVisualStyles = false;
            unlockCommiteelist = DocumentCancelDB.getCancelCommiteeListString();
            CreateButtons();
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        private void CreateButtons()
        {
            try
            {
                DocumentCancelDB dbrecord = new DocumentCancelDB();
                List <DocCancel> docs     = dbrecord.getDocCancelValues();
                int intex = 0;

                foreach (DocCancel val in docs)
                {
                    dict.Add(val.DocumentID, val.TableName);
                    addButton(val.DocumentID, val.DocumentName, intex);
                    intex++;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in request processing");
            }
        }
Ejemplo n.º 4
0
        private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                DocumentCancelDB dudb = new DocumentCancelDB();

                string columnName = grdList.Columns[e.ColumnIndex].Name;
                if (columnName.Equals("Cancel"))
                {
                    prevdc.RowID         = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["RowID"].Value);
                    prevdc.TemporaryNo   = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["TempNo"].Value);
                    prevdc.TemporaryDate = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["TempDate"].Value);
                    prevdc.TableName     = grdList.Rows[e.RowIndex].Cells["TableName"].Value.ToString();
                    string frwdList = grdList.Rows[e.RowIndex].Cells["ForwarderList"].Value.ToString();
                    if (frwdList == null)
                    {
                        MessageBox.Show("Failed to retrive Forwardlist");
                        return;
                    }
                    DialogResult dialog = MessageBox.Show("Are you sure to Cancel the document ?\n\nDocument Type\t:  " +
                                                          selectedDocName + "\nTemporary No\t:  " + prevdc.TemporaryNo + "\nTemprary Date\t:  " + prevdc.TemporaryDate.ToString("yyyy-MM-dd") + "\n"
                                                          , "Confirmation", MessageBoxButtons.YesNo);
                    if (dialog == DialogResult.No)
                    {
                        return;
                    }

                    string   Forwader = "";
                    string[] strArr   = frwdList.Split(Main.delimiter2);
                    strArr = strArr.Take(strArr.Count() - 1).ToArray();
                    strArr = strArr.Take(strArr.Count() - 1).ToArray();
                    int DocStat = strArr.Count();
                    if (DocStat > 0)
                    {
                        string[] str = strArr[DocStat - 1].Split(Main.delimiter1);
                        Forwader = str[1];
                    }
                    string FWDList = "";
                    foreach (var itm in strArr)
                    {
                        FWDList += itm + Main.delimiter2;
                    }
                    prevdc.ForwardUser   = Forwader;
                    prevdc.forwarderlist = FWDList;
                    if (dudb.updateDocForCancel(prevdc))
                    {
                        MessageBox.Show("Document canceled sucessfully.");
                        grdList.Rows.RemoveAt(e.RowIndex);
                        return;
                    }
                    else
                    {
                        MessageBox.Show("Document Failed to  canceling");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception : Failed to Reverse Document");
            }
        }