public void InitializeDGVDesign(BunifuDataGridView bdgv, TabPage tp)
 {
     tp.Controls.Add(bdgv);
     bdgv.Theme = BunifuDataGridView.PresetThemes.DarkViolet;
     bdgv.Dock  = DockStyle.Fill;
     bdgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
 }
Exemplo n.º 2
0
        public void insertSoldMedicines(BunifuDataGridView dataGridView, string paymentType)
        {
            DateTime now = DateTime.Now;

            baglanti.Open();
            for (int i = 0; i < dataGridView.Rows.Count; i++)
            {
                try
                {
                    string ilacId   = dataGridView.Rows[i].Cells["İlaç ID"].Value.ToString();
                    string recipeId = dataGridView.Rows[i].Cells["Reçete ID"].Value.ToString();
                    string query    = "Insert Into SatilanIlaclar(IlacId,SatisTarihi,SatisSekli,ReceteId,SatanPersonelId) Values ('" + ilacId + "','" + now.ToString("dd/MM/yyyy") + "','" + paymentType + "','" + recipeId + "','1')";
                    komut.Connection  = baglanti;
                    komut.CommandText = query;
                    komut.ExecuteNonQuery();
                    komut.Dispose();
                }
                catch (Exception e)
                {
                    //Console.WriteLine(e);
                }
            }

            baglanti.Close();
        }
Exemplo n.º 3
0
        public void insertSoldProducts(BunifuDataGridView dataGridView, string paymentType)
        {
            DateTime now = DateTime.Now;

            baglanti.Open();
            for (int i = 0; i < dataGridView.Rows.Count; i++)
            {
                try
                {
                    string productID     = dataGridView.Rows[i].Cells["Ürün ID"].Value.ToString();
                    string productBarkod = dataGridView.Rows[i].Cells["Barkod"].Value.ToString();
                    string productName   = dataGridView.Rows[i].Cells["Ürün Adı"].Value.ToString();
                    string query         = "Insert Into SatilanYanUrunler(Id,UrunAdi,BarkotNo,SatisTarihi,SatisSekli,SatanPersonelId) " +
                                           "Values ('" + productID + "','" + productName + "','" + productBarkod + "','" + now.ToString("dd/MM/yyyy") + "','" + paymentType + "','1')";
                    komut.Connection  = baglanti;
                    komut.CommandText = query;
                    komut.ExecuteNonQuery();
                    komut.Dispose();
                }
                catch (Exception e)
                {
                    //Console.WriteLine(e);
                }
            }

            baglanti.Close();
        }
        public SequenceForm(string _usecase)
        {
            InitializeComponent();
            this.Text  += " " + _usecase;
            useCase     = _usecase;
            cyberRawDgv = new BunifuDataGridView();
            InitializeDGVDesign(cyberRawDgv, fromPcap);
            pySharkDgv = new BunifuDataGridView();
            InitializeDGVDesign(pySharkDgv, fromPyShark);
            packetBeatDgv = new BunifuDataGridView();
            InitializeDGVDesign(packetBeatDgv, fromPacketBeat);
            snortDgv = new BunifuDataGridView();
            InitializeDGVDesign(snortDgv, fromSnort);
            phyRawDgv = new BunifuDataGridView();
            InitializeDGVDesign(phyRawDgv, phyFromPcap);
            mergeDgv = new BunifuDataGridView();
            InitializeDGVDesign(mergeDgv, mergeCyPhy);
            imputationDgv = new BunifuDataGridView();
            InitializeDGVDesign(imputationDgv, imputate);
            encodingDgv = new BunifuDataGridView();
            InitializeDGVDesign(encodingDgv, encoding);

            columnNames = new List <string> {
                "TimeStamp", "Frame Len", "Frame Type", "Source MAC", "Dest MAC", "Src IP", "Dest IP", "IP Length", "IP Flag", "Src Port", "Dest Port", "TCP Length", "TCP Flag", "Next Seq", "Ack Number"
            };
            ProcessTab.SelectedTab = fromPcap;
            populateDGVs(ref cyberRawDgv, this.useCase, "1", columnNames);
        }
Exemplo n.º 5
0
        public static void suspendEmployee(DateTime terminationDate)
        {
            employeDataGridView = My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1;
            int selectedRow = employeDataGridView.CurrentRow.Index;

            employeeID = Conversions.ToInteger(employeDataGridView.Rows[selectedRow].Cells[6].Value);
            db.TerminateEmployee(employeeID, terminationDate);
            MdlEmpManagement.populateEmployeeList(My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1, My.MyProject.Forms.FrmEmployeeManagement.employeeStatus);
        }
Exemplo n.º 6
0
        private void FrmClearance_Load(object sender, EventArgs e)
        {
            employeDataGridView = My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1;
            int    selectedRow = employeDataGridView.CurrentCell.RowIndex;
            string firstName   = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[1].Value);
            string lastName    = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[2].Value);

            Label1.Text = "Check all functionalities you wish to grant to " + firstName + " " + lastName;
        }
Exemplo n.º 7
0
 public static void populateEmployeeList(BunifuDataGridView gridView, string status)
 {
     gridView.Rows.Clear();
     foreach (DataRow employee in db.getTableInfo("Employees", "Alias, First_Name ,LAst_Name , Yard, Phone_Number , Status, ID", status + " order by alias").Rows)
     {
         gridView.Rows.Add(employee["Alias"], employee["First_Name"], employee["Last_Name"], employee["Yard"], employee["Phone_Number"], employee["Status"], employee["ID"]);
     }
     // sqlCon.Close()
     // End Using
 }
Exemplo n.º 8
0
        public double suma_monto_datagrid(BunifuDataGridView datagrid)
        {
            double monto = 0;

            for (int i = 0; i < datagrid.RowCount; i++)
            {
                if (datagrid.Rows [i].Cells [0].Value != null)
                {
                    monto += double.Parse(datagrid.Rows [i].Cells [0].Value.ToString());
                }
            }
            return(monto);
        }
Exemplo n.º 9
0
        private DataGridViewRow getSelectedRow(BunifuDataGridView dataGrid)
        {
            for (int i = 0, loopTo = dataGrid.Rows.Count - 1; i <= loopTo; i++)
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dataGrid.Rows[i].Cells[1].Value, true, false)))
                {
                    return(dataGrid.Rows[i]);

                    break;
                }
            }

            return(default);
Exemplo n.º 10
0
        private void FrmSuspention_Load(object sender, EventArgs e)
        {
            employeDataGridView             = My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1;
            fromDateTimePicker1.Value       = DateAndTime.Now;
            reinstateDateTimePicker3.Value  = DateAndTime.Now;
            terminationDateTimePicker.Value = DateAndTime.Now;
            selectedRow = employeDataGridView.CurrentRow.Index;
            string firstName = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[1].Value);
            string lastName  = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[2].Value);

            suspendLabel.Text   = "Suspend employee: " + firstName + " " + lastName;
            terminateLabel.Text = "Terminate employee: " + firstName + " " + lastName;
            reinstateLabel.Text = "Reinstate employee: " + firstName + " " + lastName;
        }
Exemplo n.º 11
0
        public BunifuDataGridView getAllOtherProducts(BunifuDataGridView dataGridView)
        {
            baglanti.Open();
            string query = "SELECT YanUrunler.Id as [Ürün ID], YanUrunler.Barkod, YanUrunler.UrunAdi as [Ürün Adı], Tedarikci.FirmaAdi as [Ruhsat Sahibi]," +
                           "YanUrunler.Fiyat FROM YanUrunler INNER JOIN Tedarikci ON YanUrunler.RuhsatSahibiId = Tedarikci.Id";

            OleDbDataAdapter adtr = new OleDbDataAdapter(query, baglanti);

            ds.Clear();
            adtr.Fill(ds, "YanUrunler");
            dataGridView.DataSource = ds.Tables["YanUrunler"];
            adtr.Dispose();
            baglanti.Close();

            return(dataGridView);
        }
Exemplo n.º 12
0
        public BunifuDataGridView getAllMedicines(BunifuDataGridView dataGridView)
        {
            baglanti.Open();
            string query = "SELECT Ilaclar.Id as [İlaç ID], Ilaclar.Barkod, Ilaclar.UrunAdi as [Ürün Adı]," +
                           " Ilaclar.EtkinMadde as [Etkin Madde], Ilaclar.ReceteTuru as [Reçete Türü], " +
                           "Ilaclar.KullanimYasi as [Kullanım Yaşı], Ilaclar.Fiyat FROM Ilaclar";
            OleDbDataAdapter adtr = new OleDbDataAdapter(query, baglanti);

            ds.Clear();
            adtr.Fill(ds, "Ilaclar");
            dataGridView.DataSource = ds.Tables["Ilaclar"];
            adtr.Dispose();
            baglanti.Close();

            return(dataGridView);
        }
 public MainForm()
 {
     InitializeComponent();
     bdgvCyber = new BunifuDataGridView();
     InitializeDGVDesign(bdgvCyber, cyberTabPage);
     bdgvPhysical = new BunifuDataGridView();
     InitializeDGVDesign(bdgvPhysical, physicalTabPage);
     bdgvCyberPhysical = new BunifuDataGridView();
     InitializeDGVDesign(bdgvCyberPhysical, cpTabPage);
     bdgvTrained = new BunifuDataGridView();
     InitializeDGVDesign(bdgvTrained, trainedTabPage);
     bdgvPscores = new BunifuDataGridView();
     InitializeDGVDesign(bdgvPscores, probTabPage);
     bdgvCoTrained = new BunifuDataGridView();
     InitializeDGVDesign(bdgvCoTrained, coTrainTabPage);
 }
Exemplo n.º 14
0
        public BunifuDataGridView getAllPatients(BunifuDataGridView dataGridView)
        {
            baglanti.Open();
            string query = "SELECT Hasta.Ad, Hasta.Soyad, Hasta.HastaTc as TC, Hasta.SigortaTuru as Sigorta, Hasta.DogumTarihi as [Doğum Tarihi], " +
                           "Ilceler.Ilce as İlçe, Sehirler.İl as İl FROM (Ilceler INNER JOIN Hasta ON Ilceler.IlceId = Hasta.IlceId) INNER JOIN Sehirler ON " +
                           "Ilceler.İl = Sehirler.[Plaka Kodu]";
            OleDbDataAdapter adtr = new OleDbDataAdapter(query, baglanti);

            ds.Clear();
            adtr.Fill(ds, "Hasta");
            dataGridView.DataSource = ds.Tables["Hasta"];

            adtr.Dispose();
            baglanti.Close();

            return(dataGridView);
        }
Exemplo n.º 15
0
        private void bookingsBunifuDataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            BunifuDataGridView s = (BunifuDataGridView)sender;

            if (firstLoad == false)
            {
                contList = "";
                foreach (var cont in selectedContainers)
                {
                    contList += cont.Key + ", ";
                }
                contList = contList.Substring(0, contList.Length - 2);
                int selectedRow = Conversions.ToInteger(s.CurrentRow.Index);
                selectedBookingNumber = Conversions.ToString(bookingsBunifuDataGridView1.Rows[selectedRow].Cells[0].Value);
                selectedMinibookingId = Conversions.ToInteger(bookingsBunifuDataGridView1.Rows[selectedRow].Cells[3].Value);
                infoLabel.Text        = "Booking #: " + selectedBookingNumber + Microsoft.VisualBasic.Constants.vbNewLine + "will receive containers:" + Microsoft.VisualBasic.Constants.vbNewLine + contList;
            }
        }
Exemplo n.º 16
0
        public Dictionary <int, string> getSelectedContIDs(BunifuDataGridView dataDrid)
        {
            var selectedIDs = new Dictionary <int, string>();

            for (int i = 0, loopTo = dataDrid.Rows.Count - 1; i <= loopTo; i++)
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dataDrid.Rows[i].Cells[1].Value, true, false)))
                {
                    int    rowID;
                    string ssline;
                    rowID  = Conversions.ToInteger(dataDrid.Rows[i].Cells[0].Value);
                    ssline = Conversions.ToString(dataDrid.Rows[i].Cells[7].Value);
                    selectedIDs.Add(rowID, ssline);
                }
            }

            return(selectedIDs);
        }
Exemplo n.º 17
0
        public BunifuDataGridView getRecipeMedicines(BunifuDataGridView dataGridView, string receteIdOrHastaTc)
        {
            baglanti.Open();
            string query = "SELECT IlacRecete.ReceteId as [Reçete ID], IlacRecete.IlacId as [İlaç ID], Ilaclar.Barkod, Ilaclar.UrunAdi as [Ürün Adı], " +
                           "Ilaclar.EtkinMadde as [Etkin Madde], Ilaclar.Fiyat FROM Ilaclar " +
                           "INNER JOIN (Recete INNER JOIN IlacRecete ON Recete.ReceteId = IlacRecete.ReceteId) " +
                           "ON Ilaclar.Id = IlacRecete.IlacId WHERE (((IlacRecete.ReceteId)=" + receteIdOrHastaTc + ") OR ((Recete.HastaTcKimlikNo)='" + receteIdOrHastaTc + "'))";

            OleDbDataAdapter adtr = new OleDbDataAdapter(query, baglanti);

            ds.Clear();
            adtr.Fill(ds, "Ilaclar");
            dataGridView.DataSource = null;
            dataGridView.DataSource = ds.Tables["Ilaclar"];
            adtr.Dispose();
            baglanti.Close();

            return(dataGridView);
        }
Exemplo n.º 18
0
        public void insertRecipeToDatabase(int doctorId, string hastaTc, BunifuDataGridView dataGridView, Bunifu.UI.WinForms.BunifuLabel recipeNoLabel)
        {
            DateTime now   = DateTime.Now;
            string   query = "Insert Into Recete(YazanDoktorId,Tarih,HastaTCKimlikNo) Values ('1','" + now.ToString("dd/MM/yyyy") + "','" + hastaTc + "')";

            komut.Connection  = baglanti;
            komut.CommandText = query;
            baglanti.Open();
            komut.ExecuteNonQuery();
            komut.Dispose();

            string           query1 = "SELECT Recete.ReceteId FROM Recete GROUP BY Recete.ReceteId ORDER BY Recete.ReceteId DESC";
            OleDbDataAdapter adtr   = new OleDbDataAdapter(query1, baglanti);

            ds.Clear();
            adtr.Fill(ds, "Hasta");
            int recipeId = Convert.ToInt32(ds.Tables["Hasta"].Rows[0]["ReceteId"]);

            recipeNoLabel.Text = "Reçete No: " + recipeId;
            Console.WriteLine(recipeId);
            adtr.Dispose();

            for (int i = 0; i < dataGridView.Rows.Count; i++)
            {
                try
                {
                    string query2 = "Insert Into IlacRecete(ReceteId,IlacId) Values ('" + recipeId + "','" + dataGridView.Rows[i].Cells["İlaç ID"].Value.ToString() + "')";
                    komut.Connection  = baglanti;
                    komut.CommandText = query2;
                    komut.ExecuteNonQuery();
                    komut.Dispose();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }

            baglanti.Close();
        }
Exemplo n.º 19
0
        public static void MergeEqualCells(DataGridViewCellPaintingEventArgs e, BunifuDataGridView dataGridView)
        {
            var fontStyle = new Font("Microsoft Sans Serif", 9f);

            // Units  with the same value

            // If e.RowIndex <> -1 Then

            // Using gridBrush As Brush = New SolidBrush(dataGridView.GridColor), backColorBrush As Brush = New SolidBrush(e.CellStyle.BackColor)

            // Using gridLinePen As Pen = New Pen(gridBrush)
            // ' Clear cell
            // e.Graphics.FillRectangle(backColorBrush, e.CellBounds)

            // ' Draw line (bottom border and right border of current cell)
            // 'If next row cell has different content, only draw bottom border line of current cell
            // If (e.RowIndex < dataGridView.Rows.Count - 2 AndAlso dataGridView.Rows(e.RowIndex + 1).Cells(e.ColumnIndex).Value.ToString() <> e.Value.ToString()) Or
            // dataGridView.Rows.Count = e.RowIndex + 1 Then
            // e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1)
            // End If

            // ' Draw right border line of current cell
            // e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1, e.CellBounds.Top, e.CellBounds.Right - 1, e.CellBounds.Bottom)

            // ' draw/fill content in current cell, and fill only one cell of multiple same cells
            // If Not e.Value Is Nothing Then
            // If e.RowIndex > 0 AndAlso dataGridView.Rows(e.RowIndex - 1).Cells(e.ColumnIndex).Value.ToString() = e.Value.ToString() Then
            // Else
            // e.Graphics.DrawString(CType(e.Value, String), fontStyle, Brushes.Black, e.CellBounds.X + 2, e.CellBounds.Y + 5, StringFormat.GenericDefault)
            // End If
            // End If

            // e.Handled = True
            // End Using
            // End Using
            // End If
        }
        private void populateDGVs(ref BunifuDataGridView currentDGV, string usecase, string stage, List <string> columnNames)
        {
            currentDGV.Rows.Clear();
            currentDGV.Columns.Clear();



            // 1) Create Process Info
            var psi = new ProcessStartInfo();

            psi.FileName = @"C:\Users\substationc\AppData\Local\Programs\Python\Python37-32\python.exe";

            // 2) Provide script and arguments
            var script = @"C:\Users\substationc\Desktop\DataFusion\DataFusionApp\DataFusionApp\PythonScripts\GetStepData.py";

            //var usecase = this.useCase;
            //var stage = "8";

            psi.Arguments = $"\"{script}\" \"{usecase}\" \"{stage}\"";

            // 3) Process configuration
            psi.UseShellExecute        = false;
            psi.CreateNoWindow         = true;
            psi.RedirectStandardOutput = true;
            psi.RedirectStandardError  = true;

            // 4) Execute process and get output
            var errors  = "";
            var results = "";

            if (!File.Exists("C:\\Users\\substationc\\Desktop\\DataFusion\\DataFusionApp\\DataFusionApp\\bin\\Debug\\msgpack_" + usecase + "_" + stage + ".mp"))
            {
                using (var process = Process.Start(psi))
                {
                    errors  = process.StandardError.ReadToEnd();
                    results = process.StandardOutput.ReadToEnd();
                }
            }

            var serializer     = SerializationContext.Default.GetSerializer <MessagePackObject[][]>();
            var unpackedObject = serializer.Unpack(File.OpenRead("C:\\Users\\substationc\\Desktop\\DataFusion\\DataFusionApp\\DataFusionApp\\bin\\Debug\\msgpack_" + usecase + "_" + stage + ".mp"));
            int ctr            = 0;

            foreach (var features in unpackedObject)
            {
                var index = Array.IndexOf(unpackedObject, features);

                if (ctr == 0)
                {
                    for (int i = 0; i < columnNames.Count; i++)
                    {
                        currentDGV.Columns.Add(columnNames[i], columnNames[i]);
                    }

                    for (int j = columnNames.Count; j < features.Length; j++)
                    {
                        currentDGV.Columns.Add("Meas " + (j + 1 - columnNames.Count).ToString(), "Meas " + (j + 1 - columnNames.Count).ToString());
                    }
                }
                ctr += 1;
                currentDGV.Rows.Add();
                foreach (var feature in features)
                {
                    var feature_index = Array.IndexOf(features, feature);
                    if (feature_index < 0)
                    {
                        continue;
                    }
                    currentDGV.Rows[index].Cells[feature_index].Value = feature;
                }
            }
        }
Exemplo n.º 21
0
        public void getEDIs(BunifuDataGridView ediDataGrid)
        {
            string   condition = "";
            string   table;
            string   EDIMode;
            decimal  GrossWeight = 0m;
            string   inputSource;
            string   TruckDriverName = "";
            string   gateDate;
            string   gateTime;
            string   TruckNumber = "";
            string   contSize    = "";
            decimal  tareWeight;
            DateTime ediModDateTime;
            DateTime datimeTineInsideFile;
            string   datimeTineInsideFileStr;
            DateTime gateTimeDate;
            var      ediorgTimeDate = default(DateTime);
            DateTime dTRequestSent;
            var      dTRequestSentStr = default(string);
            string   ssLineCode;
            string   bkgnRelNumb;
            DateTime tempDateTime, tempTime;
            string   confHandshakeEdi = "";
            string   location;
            string   carrierCode;
            string   dateAndTimeRequested;

            // Set different queries for in-gate EDI and out-gate EDI
            if (tabinoutGate.SelectedIndex == 0)
            {
                EDIMode = "IN-GATE";
                InGateDataGridView.Rows.Clear();
                condition = "on [In-Out Unique ID] = [Unique ID] ";
                table     = "(select * from [Containers In-Out] where convert(date,[Gate Date In]) >='" + fromInBunifuDatePicker.Value.ToShortDateString() + @"'  AND
		 convert(date,[Gate Date In]) <=  '"         + toInBunifuDatePicker.Value.ToShortDateString() + "' and [Trouble In-Gate] = 0 and [In Gate EDI] = 1 and (" + getEDIssLines() + @")) as c lEFT join
	 (select * from ((select * from[EDI Records] where [Gate Mode] <> 'OUT-GATE') as d  LEFT join
		(select * from [ManualEDILog] ) as m on d.EDIRecID = m.EDIRecordID))as r "        ;
            }
            else
            {
                EDIMode = "OUT-GATE";
                OutGateDataGridView.Rows.Clear();
                string showOutCans = "";
                if (cbShowOutGatedCans.Checked == true)
                {
                    showOutCans = "and [Gate Date Out] is not null";
                }
                VW_CompanyCompanyType c = (VW_CompanyCompanyType)cboSSLine.SelectedItem;
                VW_BookingMinibooking b = (VW_BookingMinibooking)bookingComboBox.SelectedItem;

                var conditionFilter = Operators.AddObject(Operators.AddObject(Operators.AddObject("and ([SS Line Code Out] like '%" + Strings.Trim(Conversions.ToString(c.CompanyCode)) + "%' or [SS Line Code In] like '%" + Strings.Trim(Conversions.ToString(c.CompanyCode)) + "%') and " + " [Booking Number] is not null and [Booking Number] like '%", b.BookingNumber), "%' "), showOutCans);
                table = Conversions.ToString(Operators.AddObject(Operators.AddObject("(select * from [Containers In-Out] where (" + getEDIssLines() + ") ", conditionFilter), @")  as c lEFT join
	 (select * from ((select * from[EDI Records] where [Gate Mode] <> 'IN-GATE') as d  LEFT join
		(select * from [ManualEDILog] ) as m on d.EDIRecID = m.EDIRecordID))as r "        ));

                // toOutBunifuDatePicker.Value.Date + "' and [Trouble In-Gate] = 0 and [In Gate EDI] = 1
                condition = "on [Unique ID] = [In-Out Unique ID]";
            }

            if (isRefresh)
            {
                InOutEDIRecDT = dbCeres.getTableInfo(table, "*", condition);
                searchTable   = InOutEDIRecDT;
            }

            foreach (DataRow row in searchTable.Rows)
            {
                if (tabinoutGate.SelectedIndex == 0)
                {
                    if (row["Yard Code In"] != DBNull.Value)
                    {
                        location = Strings.Trim(Conversions.ToString(row["Yard Code In"]));
                    }
                    else
                    {
                        location = "N/A";
                    }

                    if (row["Carrier Truck In"] == DBNull.Value)
                    {
                        TruckNumber = "";
                    }
                    else
                    {
                        TruckNumber = Strings.Trim(Conversions.ToString(row["Carrier Truck In"]));
                    }

                    if (row["Carrier DriverName In"] == DBNull.Value)
                    {
                        TruckDriverName = Strings.Trim("N/A");
                    }
                    else
                    {
                        TruckDriverName = Strings.Trim(Conversions.ToString(row["Carrier DriverName In"]));
                    }

                    bkgnRelNumb = Strings.Trim(Conversions.ToString(row["Release Number"]));
                    ssLineCode  = Strings.Trim(Conversions.ToString(row["SS Line Code In"]));
                    carrierCode = Strings.Trim(Conversions.ToString(row["Carrier Code In"]));


                    if (row["ConfHandShakeDateTime"] != DBNull.Value)
                    {
                        ediorgTimeDate   = Conversions.ToDate(row["ConfHandShakeDateTime"]);
                        confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm");
                        if (row["EDIModDateTime"] != DBNull.Value)
                        {
                            datimeTineInsideFile    = Conversions.ToDate(row["EDIModDateTime"]);
                            datimeTineInsideFileStr = datimeTineInsideFile.ToString("dd-MMM-yyyy HH:mm");
                            // ediorgTimeDate = row["EDIOriginalDateTime")
                            confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm");
                        }
                        else if (row["In Gate EDI Date Time"] != DBNull.Value)
                        {
                            ediorgTimeDate          = Conversions.ToDate(row["ConfHandShakeDateTime"]);
                            confHandshakeEdi        = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm");
                            datimeTineInsideFile    = Conversions.ToDate(row["Gate Date In"]);
                            datimeTineInsideFileStr = datimeTineInsideFile.ToString("dd-MMM-yyyy HH:mm");
                        }
                        else
                        {
                            datimeTineInsideFileStr = "N/A";
                        }

                        if (row["Date and Time"] != DBNull.Value)
                        {
                            dTRequestSent    = Conversions.ToDate(row["Date and Time"]);
                            dTRequestSentStr = dTRequestSent.ToString("dd-MMM-yyyy HH:mm");
                        }
                        else
                        {
                            dTRequestSent = Conversions.ToDate("N/A");
                        }
                    }
                    else
                    {
                        datimeTineInsideFileStr = "N/A";
                        if (row["In Gate EDI Date Time"] != DBNull.Value)
                        {
                            ediorgTimeDate          = Conversions.ToDate(row["Gate Date In"]);
                            confHandshakeEdi        = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm");
                            datimeTineInsideFileStr = confHandshakeEdi;
                        }
                        else
                        {
                            confHandshakeEdi = "N/A";
                        }

                        if (row["Date and Time"] != DBNull.Value)
                        {
                            dTRequestSent    = Conversions.ToDate(row["Date and Time"]);
                            dTRequestSentStr = dTRequestSent.ToString("dd-MMM-yyyy HH:mm");
                        }
                        else
                        {
                            dTRequestSentStr = "N/A";
                        }
                    }

                    gateTimeDate = Conversions.ToDate(row["Gate Date In"]);
                    gateDate     = gateTimeDate.ToString("dd-MMM-yyyy");
                    gateTime     = gateTimeDate.ToString("HH:mm");
                }
                else
                {
                    if (row["Booking Number"] != DBNull.Value)
                    {
                        bkgnRelNumb = Strings.Trim(Conversions.ToString(row["Booking Number"]));
                    }
                    else
                    {
                        bkgnRelNumb = "N/A";
                    }

                    if (row["SS Line Code Out"] == DBNull.Value)
                    {
                        ssLineCode = "";
                    }
                    else
                    {
                        ssLineCode = Strings.Trim(Conversions.ToString(row["SS Line Code Out"]));
                    }

                    if (row["Carrier Code Out"] != DBNull.Value)
                    {
                        carrierCode = Strings.Trim(Conversions.ToString(row["Carrier Code Out"]));
                    }
                    else
                    {
                        carrierCode = "";
                    }

                    if (row["Yard Code Out"] != DBNull.Value)
                    {
                        location = Strings.Trim(Conversions.ToString(row["Yard Code Out"]));
                    }
                    else
                    {
                        location = "N/A";
                    }

                    if (row["Carrier Truck Out"] == DBNull.Value)
                    {
                        TruckNumber = "N/A";
                    }
                    else
                    {
                        TruckNumber = Strings.Trim(Conversions.ToString(row["Carrier Truck Out"]));
                    }

                    if (row["Carrier DriverName Out"] == DBNull.Value)
                    {
                        TruckDriverName = "N/A";
                    }
                    else
                    {
                        TruckDriverName = Strings.Trim(Conversions.ToString(row["Carrier DriverName Out"]));
                    }

                    if (row["ConfHandShakeDateTime"] != DBNull.Value)
                    {
                        ediorgTimeDate   = Conversions.ToDate(row["ConfHandShakeDateTime"]);
                        confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm");
                        if (row["EDIModDateTime"] != DBNull.Value)
                        {
                            datimeTineInsideFile    = Conversions.ToDate(row["EDIModDateTime"]);
                            datimeTineInsideFileStr = datimeTineInsideFile.ToString("dd-MMM-yyyy HH:mm");
                            // ediorgTimeDate = row["EDIOriginalDateTime")
                            confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm");
                        }
                        else if (row["Out Gate EDI Date Time"] != DBNull.Value)
                        {
                            ediorgTimeDate   = Conversions.ToDate(row["ConfHandShakeDateTime"]);
                            confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm");
                            if (row["Gate Date Out"] != DBNull.Value)
                            {
                                datimeTineInsideFile    = Conversions.ToDate(row["Gate Date Out"]);
                                datimeTineInsideFileStr = datimeTineInsideFile.ToString("dd-MMM-yyyy HH:mm");
                            }
                            else
                            {
                                datimeTineInsideFileStr = "N/A";
                            }
                        }
                        else
                        {
                            datimeTineInsideFileStr = "N/A";
                        }

                        if (row["Date and Time"] != DBNull.Value)
                        {
                            dTRequestSent    = Conversions.ToDate(row["Date and Time"]);
                            dTRequestSentStr = dTRequestSent.ToString("dd-MMM-yyyy HH:mm");
                        }
                        else
                        {
                            dTRequestSent = Conversions.ToDate("N/A");
                        }
                    }
                    else
                    {
                        datimeTineInsideFileStr = "N/A";
                        if (row["Out Gate EDI Date Time"] != DBNull.Value && row["Gate Date Out"] != DBNull.Value)
                        {
                            ediorgTimeDate          = Conversions.ToDate(row["Gate Date Out"]);
                            confHandshakeEdi        = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm");
                            datimeTineInsideFileStr = confHandshakeEdi;
                        }
                        else
                        {
                            confHandshakeEdi = "N/A";
                        }
                    }

                    if (row["Gate Date Out"] != DBNull.Value)
                    {
                        gateTimeDate = Conversions.ToDate(row["Gate Date Out"]);
                        gateDate     = gateTimeDate.ToString("dd-MMM-yyyy");
                        gateTime     = gateTimeDate.ToString("HH:mm");
                    }
                    else
                    {
                        gateDate = "";
                        gateTime = "";
                    }

                    if (row["Date and Time"] != DBNull.Value)
                    {
                        dTRequestSent    = Conversions.ToDate(row["Date and Time"]);
                        dTRequestSentStr = dTRequestSent.ToString("dd-MMM-yyyy HH:mm");
                    }
                    else
                    {
                        dTRequestSentStr = "N/A";
                    }
                }

                try
                {
                    contSize = Conversions.ToString(row["ContainerSize"]);
                }
                catch
                {
                    contSize = "";
                }

                if (row["Input Source"].Equals("SYSTEM"))
                {
                    inputSource = "SYSTEM";
                }
                else if (tabinoutGate.SelectedIndex == 1)
                {
                    if (row["Input Source"] == DBNull.Value)
                    {
                        if (row["Out Gate EDI Date Time"] == DBNull.Value)
                        {
                            inputSource = "";
                        }
                        else
                        {
                            inputSource = "SYSTEM";
                        }
                    }
                    else
                    {
                        inputSource = Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject("PRE-SEND    " + Constants.vbNewLine + "By: ", row["User Name"]), Constants.vbNewLine), "Date/Time: "), ediorgTimeDate.ToString("dd-MMM-yyyy hh:mm tt")));
                    }
                }
                else if (row["Input Source"] == DBNull.Value)
                {
                    if (row["In Gate EDI Date Time"] == DBNull.Value)
                    {
                        inputSource = "";
                    }
                    else
                    {
                        inputSource = "SYSTEM";
                    }
                }
                else
                {
                    inputSource = Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject("RESEND    " + Constants.vbNewLine + "By: ", row["User Name"]), Constants.vbNewLine), "Date/Time: "), ediorgTimeDate.ToString("dd-MMM-yyyy hh:mm tt")));
                }

                if (row["TARE Weight"] != DBNull.Value)
                {
                    tareWeight = (decimal)MdlContainerManagement.DoFunctions.CVS(Conversions.ToString(row["TARE Weight"]));
                }
                else
                {
                    tareWeight = 0m;
                }

                // GrossWeight = DoFunctions.CVS(row["Gross Weight"])

                if (row["Gross Weight"] != DBNull.Value)
                {
                    GrossWeight = (decimal)MdlContainerManagement.DoFunctions.CVS(Conversions.ToString(row["Gross Weight"]));
                }
                else
                {
                    GrossWeight = 0m;
                }

                ediDataGrid.Rows.Add(row["Unique ID"], null, Strings.Trim(Conversions.ToString(row["Container Number"])), location, datimeTineInsideFileStr, confHandshakeEdi, gateDate + " " + gateTime, dTRequestSentStr, inputSource, ssLineCode, bkgnRelNumb, contSize, (object)GrossWeight, (object)tareWeight, carrierCode, TruckNumber, TruckDriverName);
            }
        }
Exemplo n.º 22
0
        public static void saveClearance(BunifuDataGridView employeDataGridView)
        {
            var    clearanceTreeView = My.MyProject.Forms.FrmClearance.TreeView1;
            int    selectedRow       = employeDataGridView.CurrentRow.Index;
            int    selectedEmployee  = Conversions.ToInteger(employeDataGridView.Rows[selectedRow].Cells[6].Value);
            string tableName;
            string columnName;

            // loop through root nodes
            foreach (TreeNode rootNode in clearanceTreeView.Nodes)
            {
                tableName  = "Main_Menu_Clearance";
                columnName = rootNode.Text;
                int childNodeIndex = 0;
                if (rootNode.Checked)
                {
                    db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 1);
                    columnName = rootNode.Text;
                    // loop through child nodle
                    foreach (TreeNode node in rootNode.Nodes)
                    {
                        columnName = Conversions.ToString(node.Text);
                        tableName  = rootNode.Text.Replace(" ", "_") + "_Clearance";
                        var anode = rootNode.Nodes;
                        if (anode[childNodeIndex].Checked)
                        {
                            db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 1);
                        }
                        else
                        {
                            db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 0);
                        }

                        if (node.Nodes is object)
                        {
                            tableName = Conversions.ToString(Operators.AddObject(node.Text.Replace(" ", "_"), "_Clearance"));
                            TreeNodeCollection childNode = (TreeNodeCollection)node.Nodes;
                            for (int i = 0, loopTo = childNode.Count - 1; i <= loopTo; i++)
                            {
                                var chNodes = childNode[i];
                                if (chNodes.Checked)
                                {
                                    columnName = childNode[i].Text;
                                    db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 1);
                                    if (chNodes.Nodes.Count > 0)
                                    {
                                        var lastNodes = chNodes.Nodes;
                                        for (int x = 0, loopTo1 = lastNodes.Count - 1; x <= loopTo1; x++)
                                        {
                                            if (lastNodes[x].Text.Equals("See sensitive information"))
                                            {
                                                columnName = lastNodes[x].Text;
                                                if (lastNodes[x].Checked)
                                                {
                                                    db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 1);
                                                }
                                                else
                                                {
                                                    db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 0);
                                                }
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    columnName = Conversions.ToString(node.Nodes[i].Text);
                                    db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 0);
                                    if (chNodes.Nodes.Count > 0)
                                    {
                                        var lastNodes = chNodes.Nodes;
                                        for (int x = 0, loopTo2 = lastNodes.Count - 1; x <= loopTo2; x++)
                                        {
                                            if (lastNodes[x].Text.Equals("See sensitive information"))
                                            {
                                                columnName = lastNodes[x].Text;
                                                db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 0);
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        childNodeIndex += 1;
                    }
                }
                else
                {
                    childNodeIndex = 0;
                    db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 0);
                    foreach (TreeNode node in rootNode.Nodes)
                    {
                        // columnName = node.Text.Replace(" ", "_") + "_Clearance"
                        columnName = Conversions.ToString(node.Text);
                        tableName  = rootNode.Text.Replace(" ", "_") + "_Clearance";
                        db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 0);
                        if (node.Nodes is object)
                        {
                            for (int i = 0, loopTo3 = Conversions.ToInteger(Operators.SubtractObject(node.Nodes.Count, 1)); i <= loopTo3; i++)
                            {
                                tableName  = Conversions.ToString(Operators.AddObject(node.Text.Replace(" ", "_"), "_Clearance"));
                                columnName = Conversions.ToString(node.Nodes[i].Text);
                                TreeNode chNodes = (TreeNode)node.Nodes[i];
                                db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 1);
                                if (chNodes.Nodes.Count > 0)
                                {
                                    var lastNodes = chNodes.Nodes;
                                    for (int x = 0, loopTo4 = lastNodes.Count - 1; x <= loopTo4; x++)
                                    {
                                        if (lastNodes[x].Text.Equals("See sensitive information"))
                                        {
                                            columnName = lastNodes[x].Text;
                                            db.updateClearance(selectedEmployee, tableName, columnName.Replace(" ", "_"), 0);
                                        }
                                    }
                                }
                            }
                        }

                        childNodeIndex += 1;
                    }
                }
            }
        }
Exemplo n.º 23
0
        public static void reassignCardID(string cardID)
        {
            employeDataGridView = My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1;
            int    selectedRow = employeDataGridView.CurrentRow.Index;
            string firstName   = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[1].Value);
            string lasttName   = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[2].Value);
            string aliaas      = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[0].Value);

            employeeID = Conversions.ToInteger(employeDataGridView.Rows[selectedRow].Cells[6].Value);

            // db._ID = employeeID

            if (Conversions.ToBoolean(db.cardAlreadyAssigned(cardID)))
            {
                string device = "";
                if (My.MyProject.Forms.FrmCardAssignment.isPhoneID)
                {
                    device = "device";
                }
                else
                {
                    device = "card";
                }

                int result = (int)MessageBox.Show("This " + device + " is already assigned to " + My.MyProject.Forms.FrmLoginWindow._employeeName + ". Would you like to reassign it to " + aliaas + " " + lasttName + "?", "Warning", MessageBoxButtons.YesNo);
                if (result == (int)DialogResult.Yes)
                {
                    db.dissociateCardID();
                    db.reassignCard(employeeID.ToString(), cardID);
                    My.MyProject.Forms.FrmCardAssignment.reassignCardTitleLabel.ForeColor = Color.Green;
                    My.MyProject.Forms.FrmCardAssignment.reassignCardTitleLabel.Text      = device.Substring(0, 1).ToUpper() + device.Substring(1, device.Length - 1) + " assigned to " + firstName + " " + lasttName;
                    My.MyProject.Forms.FrmCardAssignment.PictureBox1.Image = My.Resources.Resources.icon_available;
                    My.MyProject.Forms.FrmCardAssignment.BackColor         = Color.White;
                    MdlControllerModifier.pause(2000);
                    My.MyProject.Forms.FrmCardAssignment.Close();
                }
                else
                {
                    My.MyProject.Forms.FrmCardAssignment._cardID = "";
                }
            }
            else
            {
                string device = "";
                if (My.MyProject.Forms.FrmCardAssignment.isPhoneID)
                {
                    device = "device";
                }
                else
                {
                    device = "card";
                }

                int result = (int)MessageBox.Show("This " + device + " is not in use yet " + ". Would you like to assign it to " + aliaas + " " + lasttName + "?", "Warning", MessageBoxButtons.YesNo);
                if (result == (int)DialogResult.Yes)
                {
                    db.reassignCard(employeeID.ToString(), cardID);
                    My.MyProject.Forms.FrmCardAssignment.reassignCardTitleLabel.ForeColor = Color.Green;
                    My.MyProject.Forms.FrmCardAssignment.reassignCardTitleLabel.Text      = device + " assigned to " + firstName + " " + lasttName;
                    My.MyProject.Forms.FrmCardAssignment.PictureBox1.Image = My.Resources.Resources.icon_available;
                    My.MyProject.Forms.FrmCardAssignment.BackColor         = Color.White;
                    MdlControllerModifier.pause(2000);
                    My.MyProject.Forms.FrmCardAssignment.Close();
                }
                else
                {
                    My.MyProject.Forms.FrmCardAssignment._cardID = "";
                }
            }
        }
Exemplo n.º 24
0
        public static void populateTimeSheetList()
        {
            summaryList = My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView;
            string payMethod   = Conversions.ToString(My.MyProject.Forms.FrmTimeSheet.payMethodComboBox.SelectedItem.ToString().Substring(0, 1));
            string selectField = "";

            if (payMethod.Equals("P"))
            {
                payMethod   = "Punch_Type = 'PW' and ";
                selectField = "Punch_Type,";
            }
            else if (payMethod.Equals("A"))
            {
                payMethod = "";
            }
            else
            {
                payMethod   = "Punch_Type = '" + payMethod + "' and ";
                selectField = "Punch_Type,";
            }

            My.MyProject.Forms.FrmTimeSheet.timeSheetDescriptionLabel.Text = Conversions.ToString(Operators.AddObject("Time Sheet for period ending ", My.MyProject.Forms.FrmTimeSheet.endPeriodComboBox.SelectedItem));
            ComboBox endPeriodComboBox = My.MyProject.Forms.FrmTimeSheet.endPeriodComboBox;
            string   endDate           = Conversions.ToString(Convert.ToDateTime(Operators.AddObject(Operators.AddObject(endPeriodComboBox.SelectedItem, " "), My.MyProject.Forms.FrmTimeSheet.yearComboBox.SelectedItem.ToString())));

            endPeriodDate = Convert.ToDateTime(endDate + " 23:59:59");
            if (endPeriodComboBox.SelectedIndex == 0)
            {
                startPeriodDate = Conversions.ToDate(_firstDayOfMonth);
                startPeriodDate = new DateTime(Convert.ToInt32(My.MyProject.Forms.FrmTimeSheet.yearComboBox.SelectedItem), startPeriodDate.Month, startPeriodDate.Day, 0, 0, 0, 0);
            }
            else
            {
                startPeriodDate = Convert.ToDateTime(endPeriodComboBox.Items[0]);
                startPeriodDate = new DateTime(Convert.ToInt32(My.MyProject.Forms.FrmTimeSheet.yearComboBox.SelectedItem), startPeriodDate.Month, 16, 0, 0, 0, 0, 0);
            }

            int    totalHours     = 0;
            int    totalMinutes   = 0;
            string totalTime      = "";
            int    remainder      = 0;
            bool   employeeWorked = false;

            summaryList.Rows.Clear();

            // clearDataGrid(summaryList)

            DataTable showEmployees = (DataTable)db.getHourlyEmpIdOfCurrentPeriod(startPeriodDate, endPeriodDate);
            int       uid;
            string    fname;
            string    lname;
            string    aliasName;
            // Dim firstEntry = True

            string columnsEmployees = "UserID, Alias, First_Name, Last_Name, " + selectField + " sum(totalMinutes) as totalMinutes, Type";
            string tables           = @"(select Alias, First_Name, Last_Name, userID, Type,
Start_Time_Date, End_Time_Date, " + selectField + @"
  DATEDIFF(minute,Start_Time_Date, End_Time_Date) as totalMinutes  from
  Time_Sheet, Employees e";
            string columnsTimeSheet = " Alias,  " + selectField + @" sum(totalMinutes)from
     (select Alias, Last_Name, userID, Start_Time_Date, End_Time_Date, Punch_Type,
  DATEDIFF(minute,Start_Time_Date, End_Time_Date) as totalMinutes  from
  Time_Sheet, Employees e) k";
            string conditions       = "where " + payMethod + " Start_Time_Date >= '" + startPeriodDate.ToString("yyyy-MM-dd 00:00:00") + @"' and
   Start_Time_Date  <= '" + endPeriodDate.ToString("yyyy-MM-dd 23:59:59") + @"' and UserID = e.ID) s
   group by UserID, Alias, First_Name, Last_Name, " + selectField + " Type order by Alias";

            foreach (DataRow row in db.getTableInfo(tables, columnsEmployees, conditions).Rows)
            {
                // empid = row["ID")
                uid       = Conversions.ToInteger(row["userID"]);
                fname     = Conversions.ToString(row["First_Name"]);
                lname     = Conversions.ToString(row["Last_Name"]);
                aliasName = Conversions.ToString(row["Alias"]);
                if (Information.IsDBNull(row["totalMinutes"]))
                {
                    totalMinutes = 0;
                }
                else
                {
                    totalMinutes = Conversions.ToInteger(row["totalMinutes"]);
                }

                remainder = totalMinutes % 60;
                if (totalMinutes >= 60)
                {
                    totalHours += totalMinutes / 60;
                }

                totalTime  = totalHours + ":" + remainder.ToString("D2");
                conditions = "where " + payMethod + " UserID = " + uid.ToString() + " and End_Time_Date is null and Start_Time_Date >= '" + startPeriodDate.ToString("yyyy-MM-dd 00:00:00") + @"' and
   Start_Time_Date  <= '" + endPeriodDate.ToString("yyyy-MM-dd 23:59:59") + "'";
                string punchType = "";
                if (string.IsNullOrEmpty(selectField))
                {
                    punchType = "";
                }
                else
                {
                    punchType = Conversions.ToString(row["Punch_Type"]);
                }

                if (db.getTableInfo("Time_Sheet", "*", conditions).Rows.Count > 0)
                {
                    summaryList.Rows.Add((object)false, aliasName, lname, fname, totalTime, "working", uid.ToString(), punchType, row["Type"]);
                }
                else
                {
                    summaryList.Rows.Add((object)false, aliasName, lname, fname, totalTime, "complete", uid.ToString(), punchType, row["Type"]);
                }

                totalHours     = 0;
                totalMinutes   = 0;
                totalTime      = "";
                employeeWorked = false;
            }
        }
Exemplo n.º 25
0
        private void containersBunifuDataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            BunifuDataGridView s = (BunifuDataGridView)sender;

            totalContainersLabel.Text = s.Rows.Count.ToString() + " of " + totalNumberOfCans.ToString();
        }
Exemplo n.º 26
0
        public void getInOutGates(BunifuDataGridView dataGrid, string gateMode)
        {
            dataGrid.Rows.Clear();
            string   collumns;
            string   condition;
            int      RecordCount = 0;
            decimal  GrossWeight = 0m;
            string   EDICan      = "";
            string   InGateStatus;
            string   TempLine        = "";
            string   ThisLine        = "";
            string   TruckDriverName = "";
            string   TruckNumber     = "";
            DataRow  InGateRow;
            string   contSize = "";
            decimal  tareWeight;
            string   comments;
            string   ediInfo;
            string   gateAction = "";
            DateTime gateTimeDate;
            DateTime ediTimeDate;
            string   ssLineCode;
            string   carrierCode;

            collumns = @"[Unique ID], [Container Number], [In Gate EDI],[Out Gate EDI], [Should Send InGate EDI],[Yard Code In], [Trouble In-Gate],
                    [SS Line Code In], [Release Number], [Gate Date In],[Container Size], [Gross Weight], [TARE Weight],
                    [Carrier Code In], [Carrier Truck In], [Carrier DriverName In], [Comments In], [Gate Date Out],[In Gate EDI Date Time]
                     ,[Out Gate EDI Date Time], [Carrier Truck Out], [SS Line Code Out], [Carrier Code Out], [Carrier Truck out],
                    [Carrier DriverName Out], [Gross Weight Out], [Booking Number], [Hold Out-Gate], [Should Send OutGate EDI], [ContainerSize]";
            if (gateMode.Equals("ingate"))
            {
                condition  = "Where Convert(date,[Gate Date In]) >= '" + fromInBunifuDatePicker.Value.Date + "' And Convert(date,[Gate Date In]) <= '" + toInBunifuDatePicker.Value.Date + "' Order By [Gate Date In]  DESC";
                gateAction = "IN-GATE";
            }
            else
            {
                condition  = " Where Convert(date,[Gate Date Out]) >= '" + fromOutBunifuDatePicker.Value.Date + "' And Convert(date,[Gate Date Out]) <= '" + toOutBunifuDatePicker.Value.Date + "' Order By [Gate Date Out] DESC";
                gateAction = "OUT-GATE";
            }

            if (isRefresh)
            {
                InOutDT     = dbCeres.getTableInfo("[Containers In-Out]", collumns, condition);
                searchTable = InOutDT;
                // EDIRecordsDt = dbCeres.getTableInfo("[EDI Records]", "*", "where [Date and Time] >= '" & fromInBunifuDatePicker.Value.Date & "' And [Date and Time] <= '" &
                // toInBunifuDatePicker.Value.Date & "' Order By [Date and Time] DESC")
            }

            foreach (DataRow row in searchTable.Rows)
            {
                // If row["Container Size") = ChrW(0) Then
                // contSize = "20 FT"
                // ElseIf row["Container Size") = ChrW(1) Then
                // contSize = "40 FT"
                // ElseIf row["Container Size") = ChrW(2) Then
                // contSize = "40 FT HC"
                // ElseIf row["Container Size") = ChrW(3) Then
                // contSize = "53 FT"
                // End If
                // Stop
                if (row["ContainerSize"] != DBNull.Value)
                {
                    contSize = Conversions.ToString(row["ContainerSize"]);
                }
                else
                {
                    contSize = "";
                }

                DateTime tempDate;
                object   tempDateTime;
                DateTime tempTime;
                string   ediTimeDateStr = "";
                if (gateMode.Equals("ingate"))
                {
                    gateTimeDate = Conversions.ToDate(row["Gate Date In"]);
                    if (row["In Gate EDI Date Time"] != DBNull.Value)
                    {
                        ediTimeDate    = Conversions.ToDate(row["In Gate EDI Date Time"]);
                        ediTimeDateStr = ediTimeDate.ToString("dd-MMM-yyyy HH:mm");
                    }
                    else
                    {
                        ediTimeDateStr = "N/A";
                    }

                    if (row["Trouble In-Gate"] == DBNull.Value && row["Trouble In-Gate"] == DBNull.Value)
                    {
                        InGateStatus = "TROUBLE";
                    }
                    else
                    {
                        InGateStatus = "VALID";
                    }

                    if (row["Carrier Truck In"] == DBNull.Value)
                    {
                        TruckNumber = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(' '), 10);
                    }
                    else
                    {
                        TruckNumber = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(row["Carrier Truck In"]), 10);
                    }

                    if (row["Carrier DriverName In"] == DBNull.Value)
                    {
                        TruckDriverName = Strings.Trim("N/A");
                    }
                    else
                    {
                        TruckDriverName = Strings.Trim(Conversions.ToString(row["Carrier DriverName In"]));
                    }

                    GrossWeight = Conversions.ToDecimal(Strings.Trim(MdlContainerManagement.DoFunctions.CVS(Conversions.ToString(row["Gross Weight"])).ToString()));
                    if (row["TARE Weight"] == DBNull.Value)
                    {
                        tareWeight = 0m;
                    }
                    else
                    {
                        tareWeight = (decimal)MdlContainerManagement.DoFunctions.CVS(Conversions.ToString(row["TARE Weight"]));
                    }

                    comments = Strings.Trim(Conversions.ToString(row["Comments In"]));
                    if (row["SS Line Code In"] != DBNull.Value)
                    {
                        ssLineCode = Strings.Trim(Conversions.ToString(row["SS Line Code In"]));
                    }
                    else
                    {
                        ssLineCode = "N/A";
                    }

                    if (row["Carrier Code In"] != DBNull.Value)
                    {
                        carrierCode = Strings.Trim(Conversions.ToString(row["Carrier Code In"]));
                    }
                    else
                    {
                        carrierCode = "N/A";
                    }

                    string relNumb = "";
                    string yardIn  = "";
                    string canNumb = "";
                    if (row["Release Number"] != DBNull.Value)
                    {
                        relNumb = Strings.Trim(Conversions.ToString(row["Release Number"]));
                    }
                    else
                    {
                    }

                    if (row["Yard Code In"] != DBNull.Value)
                    {
                        yardIn = Strings.Trim(Conversions.ToString(row["Yard Code In"]));
                    }

                    if (row["Container Number"] != DBNull.Value)
                    {
                        canNumb = Strings.Trim(Conversions.ToString(row["Container Number"]));
                    }

                    dataGrid.Rows.Add(row["Unique ID"], (object)false, canNumb, gateAction, yardIn, EDICan, ediTimeDateStr, "", InGateStatus, ssLineCode, relNumb, gateTimeDate.ToString("dd-MMM-yyyy"), gateTimeDate.ToString("HH:mm"), contSize, (object)GrossWeight, (object)tareWeight, carrierCode, TruckNumber, TruckDriverName);
                }
                else
                {
                    gateTimeDate = Conversions.ToDate(row["Gate Date Out"]);
                    if (row["Out Gate EDI Date Time"] != DBNull.Value)
                    {
                        ediTimeDate    = Conversions.ToDate(row["Out Gate EDI Date Time"]);
                        ediTimeDateStr = ediTimeDate.ToString("dd-MMM-yyyy HH:mm");
                    }
                    else
                    {
                        ediTimeDateStr = "N/A";
                    }

                    if (row["Hold Out-Gate"] != DBNull.Value && Convert.ToBoolean(row["Hold Out-Gate"]) == true)
                    {
                        InGateStatus = "HOLD";
                    }
                    else
                    {
                        InGateStatus = "VALID";
                    }

                    if (row["Carrier Truck Out"] == DBNull.Value)
                    {
                        TruckNumber = "N/A";
                    }
                    else
                    {
                        TruckNumber = Strings.Trim(Conversions.ToString(row["Carrier Truck Out"]));
                    }

                    if (row["Carrier DriverName Out"] == DBNull.Value)
                    {
                        TruckDriverName = "N/A";
                    }
                    else
                    {
                        TruckDriverName = Strings.Trim(Conversions.ToString(row["Carrier DriverName Out"]));
                    }

                    GrossWeight = Conversions.ToDecimal(Strings.Trim(MdlContainerManagement.DoFunctions.CVS(Conversions.ToString(row["Gross Weight Out"])).ToString()));
                    if (row["TARE Weight"] != DBNull.Value)
                    {
                        tareWeight = (decimal)MdlContainerManagement.DoFunctions.CVS(Conversions.ToString(row["TARE Weight"]));
                    }
                    else
                    {
                        tareWeight = 0m;
                    }

                    string bkgNumb;
                    if (row["Booking Number"] != DBNull.Value)
                    {
                        bkgNumb = Strings.Trim(Conversions.ToString(row["Booking Number"]));
                    }
                    else
                    {
                        bkgNumb = "N/A";
                    }

                    string yardIn;
                    if (row["Yard Code In"] != DBNull.Value)
                    {
                        yardIn = Strings.Trim(Conversions.ToString(row["Yard Code In"]));
                    }
                    else
                    {
                        yardIn = "N/A";
                    }

                    if (row["SS Line Code Out"] != DBNull.Value)
                    {
                        ssLineCode = Strings.Trim(Conversions.ToString(row["SS Line Code Out"]));
                    }
                    else
                    {
                        ssLineCode = "N/A";
                    }

                    if (row["Carrier Code Out"] != DBNull.Value)
                    {
                        carrierCode = Strings.Trim(Conversions.ToString(row["Carrier Code Out"]));
                    }
                    else
                    {
                        carrierCode = "N/A";
                    }

                    dataGrid.Rows.Add(row["Unique ID"], (object)false, Strings.Trim(Conversions.ToString(row["Container Number"])), gateAction, yardIn, EDICan, ediTimeDateStr, "", InGateStatus, ssLineCode, bkgNumb, gateTimeDate.ToString("dd-MMM-yyyy"), gateTimeDate.ToString("HH:mm"), contSize, (object)GrossWeight, (object)tareWeight, carrierCode, TruckNumber, TruckDriverName);
                }
            }
        }
 public ChartForm(BunifuDataGridView dgv)
 {
     InitializeComponent();
     dgvForChart = dgv;
 }
Exemplo n.º 28
0
        public static void populateDetails(int selectedID)
        {
            MdlLoadingSetting.waitForm.Show();
            detailedEntires.Clear();
            detailsDataGridView.Rows.Clear();
            detailedEntires.Columns.Add("date");
            detailedEntires.Columns.Add("clockIn");
            detailedEntires.Columns.Add("clockOut");
            detailedEntires.Columns.Add("hoursWorked");
            detailedEntires.Columns.Add("punchID");
            detailedEntires.Columns.Add("shift");
            summaryList         = My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView;
            detailsDataGridView = My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView;
            DateTime d1;
            var      d2 = default(DateTime);
            string   hours;
            string   payMethod = My.MyProject.Forms.FrmTimeSheet.payMethodComboBox.Text.Substring(0, 1);

            if (payMethod.Equals("P"))
            {
                payMethod = "and Punch_Type = 'PW'";
            }
            else if (payMethod.Equals("A"))
            {
                payMethod = "";
            }
            else
            {
                payMethod = "and Punch_Type = '" + payMethod + "'";
            }

            string fields    = "ID, userID, Start_Time_Date, End_Time_Date, Punch_Type";
            string condition = "where  Start_Time_Date >= '" + Conversions.ToString(startPeriodDate) + "' and " + "Start_Time_Date  <= '" + Conversions.ToString(endPeriodDate) + "' and UserID = " + selectedID.ToString() + "  " + payMethod + " order by Start_Time_Date";

            foreach (DataRow entry in db.getTableInfo("Time_Sheet", fields, condition).Rows)
            {
                string punchType;
                if (entry["Punch_Type"].Equals("H"))
                {
                    punchType = "Hourly";
                }
                else if (entry["Punch_Type"].Equals("S"))
                {
                    punchType = "Salary";
                }
                else
                {
                    punchType = "Piece Work";
                }

                if (db.isStatPunch(Conversions.ToString(entry["ID"])))
                {
                    punchType = "Statutory";
                }

                d1 = Convert.ToDateTime(entry["Start_Time_Date"]);
                if (!Information.IsDBNull(entry["End_Time_Date"]))
                {
                    d2    = Convert.ToDateTime(entry["End_Time_Date"]);
                    hours = Conversions.ToString(MdlControllerModifier.hoursWorked(Conversions.ToString(entry["Start_Time_Date"]), Conversions.ToString(entry["End_Time_Date"])));
                    detailedEntires.Items.Add(new ListViewItem(new[] { Strings.Format(d1, "MM/dd/yyyy"), Strings.Format(d1, "HH:mm "), Strings.Format(d2, "HH:mm "), Conversions.ToString(MdlControllerModifier.hoursWorked(Conversions.ToString(entry["Start_Time_Date"]), Conversions.ToString(entry["End_Time_Date"]))), Conversions.ToString(entry["ID"]), Conversions.ToString(entry["Punch_Type"]) }));
                    detailsDataGridView.Rows.Add(Strings.Format((object)d1, "MM/dd/yyyy"), Strings.Format((object)d1, "HH:mm "), Strings.Format((object)d2, "HH:mm "), MdlControllerModifier.hoursWorked(Conversions.ToString(entry["Start_Time_Date"]), Conversions.ToString(entry["End_Time_Date"])), punchType, "", entry["ID"], entry["Punch_Type"]);
                }
                else
                {
                    detailsDataGridView.Rows.Add(Strings.Format((object)d1, "MM/dd/yyyy"), Strings.Format((object)d1, "HH:mm "), "", "", punchType, "", entry["ID"], entry["Punch_Type"]);
                    detailedEntires.Items.Add(new ListViewItem(new[] { Strings.Format(d1, "MM/dd/yyyy"), Strings.Format(d1, "HH:mm "), Strings.Format(d2, "HH:mm "), "", Conversions.ToString(entry["ID"]), Conversions.ToString(entry["Punch_Type"]) }));
                }
            }

            showModifiedPunches();
            MdlLoadingSetting.waitForm.Close();
        }