Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            tapal       tap   = new tapal();
            TapalPickDB tapdb = new TapalPickDB();

            tap.ReceivedFrom       = txtReceivedFrom.Text.Trim();
            tap.Description        = txtDescription.Text.Trim();
            tap.InwardDocumentType = cmbInwardDocType.SelectedItem.ToString();
            if (cmbInwardDocType.SelectedIndex == -1 || string.IsNullOrWhiteSpace(tap.ReceivedFrom))
            {
                MessageBox.Show("Please check the Data Entered!!!");
                return;
            }
            if (tapdb.updateTapalDetails(tap, refr))
            {
                MessageBox.Show("Tapal Summary updated");
                grdDetailList.Rows.Clear();
                detaillist();
                pnlUpdate.Visible     = false;
                grdDetailList.Enabled = true;
                grdMainList.Enabled   = true;
                btnCancel.Enabled     = true;
            }
            else
            {
                MessageBox.Show("Failed to Update Tapal Summary");
            }
        }
Beispiel #2
0
 public void clearData()
 {
     try
     {
         grdDetailList.Rows.Clear();
         dt     = DateTime.Now;
         prevag = new tapal();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #3
0
 public void clearData()
 {
     try
     {
         txtFileName.Text = "";
         cmbInwardDocType.SelectedIndex = -1;
         txtReceivedFrom.Text           = "";
         txtEmployees.Text   = "";
         txtDescription.Text = "";
         prevtapal           = new tapal();
         removeControlsFromPnlLvPanel();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #4
0
        public void detaillist()
        {
            prevag = new tapal();
            TapalPickDB TapDB             = new TapalPickDB();
            List <tapalDistribution> list = TapDB.getTapalListSummaryForADate(dt);
            int i = 1;

            foreach (tapalDistribution ts in list)
            {
                grdDetailList.Rows.Add();
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["LineNo"].Value             = i;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["RowID"].Value              = ts.RowID;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Date"].Value               = ts.Date;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["FileName"].Value           = ts.FileName;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["InwardDocumentType"].Value = ts.InwardDocumentType;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["ReceivedFrom"].Value       = ts.ReceivedFrom;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Description"].Value        = ts.Description;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Status"].Value             = showStatusString(ts.ActionReferenceID, ts.RowID, ts.Status, ts.ActionStatus);
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CreateUser"].Value         = ts.CreateUser;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Creator"].Value            = ts.Creator;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DistributeUser"].Value     = ts.DistributeUser;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Distributor"].Value        = ts.Distributor;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["ReceiveUser"].Value        = ts.UserID;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Receiver"].Value           = ts.UserName;
                grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CreateTime"].Value         = ts.CreateTime;
                if (grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Status"].Value.ToString() == "Delivered")
                {
                    //orange
                    grdDetailList.Rows[grdDetailList.RowCount - 1].DefaultCellStyle.BackColor = Color.Orange;
                }
                else if (grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Status"].Value.ToString() == "Deleted Before Viewing")
                {
                    grdDetailList.Rows[grdDetailList.RowCount - 1].DefaultCellStyle.BackColor = Color.Red;
                }
                else if (grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Status"].Value.ToString().Contains("Moved to"))
                {
                    grdDetailList.Rows[grdDetailList.RowCount - 1].DefaultCellStyle.BackColor = Color.Yellow;
                }
                i++;
            }
            grdDetailList.ClearSelection();
        }
Beispiel #5
0
 private void grdList_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex < 0)
         {
             return;
         }
         string columnName = grdList.Columns[e.ColumnIndex].Name;
         clearData();
         try
         {
             if (columnName.Equals("Distribute") || columnName.Equals("View") || columnName.Equals("Delete"))
             {
                 prevtapal                    = new tapal();
                 prevtapal.RowID              = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["RowID"].Value.ToString());
                 prevtapal.DocumentID         = grdList.Rows[e.RowIndex].Cells["gDocID"].Value.ToString();
                 prevtapal.Date               = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["Date"].Value.ToString());
                 prevtapal.FileName           = grdList.Rows[e.RowIndex].Cells["FileName"].Value.ToString();
                 prevtapal.ReceivedFrom       = grdList.Rows[e.RowIndex].Cells["ReceivedFrom"].Value.ToString();
                 prevtapal.InwardDocumentType = grdList.Rows[e.RowIndex].Cells["InwardDocumentType"].Value.ToString();
                 prevtapal.FileType           = grdList.Rows[e.RowIndex].Cells["FileType"].Value.ToString();
                 prevtapal.Status             = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["Status"].Value.ToString());
                 prevtapal.ProtectionLevel    = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["ProtectionLevel"].Value.ToString());
                 prevtapal.CreateUser         = grdList.Rows[e.RowIndex].Cells["Creator"].Value.ToString();
                 prevtapal.CreateTime         = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["CreateTime"].Value.ToString());
                 prevtapal.Description        = grdList.Rows[e.RowIndex].Cells["Description"].Value.ToString();
                 if (columnName.Equals("View"))
                 {
                     grdList.Enabled = false;
                     string fileName = TapalPickDB.getFileFromDB(prevtapal.RowID, prevtapal.FileName);
                     fileDir = fileName;
                     System.Diagnostics.Process process = System.Diagnostics.Process.Start(fileName);
                     grdList.Enabled             = true;
                     process.EnableRaisingEvents = true;
                     process.Exited += new EventHandler(myProcess_Exited);
                     process.WaitForExit();
                 }
                 if (columnName.Equals("Delete"))
                 {
                     DialogResult dialog = MessageBox.Show("Are you sure to delete the document ?", "Yes", MessageBoxButtons.YesNo);
                     if (dialog == DialogResult.Yes)
                     {
                         if (TapalPickDB.deleteTapal(prevtapal.RowID))
                         {
                             MessageBox.Show("Deleted");
                             listtapal();
                         }
                     }
                     else
                     {
                         return;
                     }
                 }
                 if (columnName.Equals("Distribute"))
                 {
                     showEmployeeDataGridView("NVP");
                     //showEmployeeListView();
                     //grdList.Enabled = false;
                     //btnPickFile.Enabled = false;
                 }
                 //txtFileName.Text = prevag.GroupCode;
                 //txtFileDesc.Text = prevag.GroupInwardDocumentType;
                 //pnlAddNew.Visible = true;
                 //txtFileName.ReadOnly = true;
             }
         }
         catch (Exception ex)
         {
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Boolean status = true;

            try
            {
                TapalPickDB agdb = new TapalPickDB();
                tapal       tap  = new tapal();
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btnSave.Text;

                try
                {
                    //if (!System.Text.RegularExpressions.Regex.IsMatch(txtFileName.Text, @"^[0-9]+$"))
                    //{
                    //    MessageBox.Show("Group Code accepts only numeric characters");
                    //    return;
                    //}
                    //else
                    tap.DocumentID         = docID;
                    tap.Date               = UpdateTable.getSQLDateTime();
                    tap.ReceivedFrom       = txtReceivedFrom.Text.Trim();
                    tap.Description        = txtDescription.Text.Trim();
                    tap.FileName           = Path.GetFileName(txtFileName.Text);
                    tap.InwardDocumentType = cmbInwardDocType.SelectedItem.ToString();
                    if (cmbInwardDocType.SelectedIndex == -1)
                    {
                        MessageBox.Show("Enter InwardDocumentType.");
                        return;
                    }
                    string nm = Path.GetFileName(txtFileName.Text);
                    //if (!System.Text.RegularExpressions.Regex.IsMatch(txtFileDesc.Text, @"^[\sa-zA-Z0-9]+$"))
                    //{
                    //    MessageBox.Show("GroupInwardDocumentType accepts only alphanumeric characters");
                    //    return;
                    //}
                    //else
                    byte[]       byteArray = null;
                    FileStream   fs        = new FileStream(txtFileName.Text, FileMode.Open, FileAccess.Read);
                    BinaryReader br        = new BinaryReader(fs);
                    tap.DocumentContent = Convert.ToBase64String(br.ReadBytes((int)fs.Length));
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Validation failed");
                    return;
                }

                if (btnText.Equals("Save"))
                {
                    if (agdb.validateTapal(tap))
                    {
                        if (agdb.inserttapal(tap))
                        {
                            MessageBox.Show("Tapal Added");
                            closeAllPanels();
                            listtapal();
                            pnlAddNew.Visible        = false;
                            grdList.Visible          = true;
                            pnlBottomButtons.Visible = true;
                        }
                        else
                        {
                            status = false;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Validation failed");
                    }
                    if (!status)
                    {
                        MessageBox.Show("Failed to save Tapal Document");
                    }
                }
                else
                {
                    MessageBox.Show("btnSave error.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
        }