Esempio n. 1
0
        private void button_update_Click(object sender, EventArgs e)
        {
            Items_From_Receipt currob;

            if (bFiltered == true)
            {
                int rowindex = filtered[dataGridView_products.CurrentRow.Index].rowIndex;
                currob = global_list[rowindex];
            }
            else
            {
                currob = global_list[dataGridView_products.CurrentRow.Index];
            }


            currob.Product_Name        = textBox_Product_name.Text;
            currob.Company_Name        = textBox_Company_details.Text;
            currob.Install_Date        = textBox_install_date.Text;
            currob.Warranty_Expiration = textBox_warrrenty.Text;
            currob.Serial_Number       = textBox_serial_number.Text;
            currob.Reference_Name      = textBox_reference_name.Text;

            dataGridView_products.DataSource = null;////nblIAM RESET DATASOUCE!!!!!!!
            var source = global_list;

            dataGridView_products.DataSource = source;
            Logwriter.writelog("#UPDATE:Time,>>>>>Item Updated:Config ID,Product,Company,Install Date,Warranty,Serial No,Ref Name <<<<<");
            Logwriter.writelog("UPDATE:" + current_timestamp + "," + ">>>>>" + currob.Config_item_ID + "," +
                               currob.Product_Name + "," + currob.Company_Name + "," + currob.Install_Date + "," + currob.Warranty_Expiration
                               + "," + currob.Serial_Number + "," + currob.Reference_Name + "<<<<<");
        }
        private void button_export_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter           = "csv files (*.csv)|*.csv";
            dlg.Title            = "Export in CSV format";
            dlg.CheckPathExists  = true;
            dlg.InitialDirectory = Application.StartupPath;
            dlg.ShowDialog();
            var watch = System.Diagnostics.Stopwatch.StartNew();

            if (dlg.FileName != "")
            {
                using (StreamWriter sw = new StreamWriter(dlg.FileName))
                {
                    foreach (Mapped item in List_of_what_is_Mapped)
                    {
                        sw.WriteLine(item.Receipt_Name +
                                     "," + item.AutoTask_Name
                                     );
                    }
                    watch.Stop();
                    var elapsedMs = watch.ElapsedMilliseconds;

                    int count = List_of_what_is_Mapped.Count();

                    Logwriter.writelog("#FILE EXPORTED:Time,Filename,Item Count,Time Elapsed");
                    Logwriter.writelog("FILE EXPORTED:" + current_timestamp + "," + dlg.FileName + "," + count + "," + elapsedMs);
                }
            }
        }
Esempio n. 3
0
        private void Search_by_Product_name(BindingList <Items_From_Receipt> filtered, bool s1, bool s2, bool s3)
        {
            if (s1 == false && s2 == true && s3 == true)
            {
                var watch = System.Diagnostics.Stopwatch.StartNew();
                int index = 0;
                foreach (Items_From_Receipt currOb in global_list)
                {
                    if (currOb.Product_Name.Contains(textBox_Product_name.Text))
                    {
                        currOb.rowIndex = index;
                        filtered.Add(currOb);
                    }

                    index++;
                }
                watch.Stop();

                var elapsedMs = watch.ElapsedMilliseconds;
                dataGridView_products.DataSource = null;
                var source = filtered;
                dataGridView_products.DataSource = source;

                string searchType = "Product Name";
                string searchTerm = textBox_Product_name.Text;
                int    count      = filtered.Count();
                Logwriter.writelog("#SEARCH:Time,Search by type, Search Term, Time Search Took, No of Items Returned");
                Logwriter.writelog("SEARCH:" + current_timestamp + "," + searchType + "," + searchTerm + "," + elapsedMs + "," + count);
            }
        }
Esempio n. 4
0
        private void button_search_Click(object sender, EventArgs e)
        {
            filtered = new BindingList <Items_From_Receipt>();

            if (string.IsNullOrEmpty(textBox_Product_name.Text.Trim()) &&
                string.IsNullOrEmpty(textBox_serial_number.Text.Trim()) &&
                string.IsNullOrEmpty(textBox_reference_name.Text.Trim()))
            {
                MessageBox.Show("You need a value in the either the" +
                                "  Product Name, " +
                                "Serial Number, " +
                                "Reference Name " +
                                " textboxes above");
                Logwriter.writelog("#SEARCH:Status, Reason");
                Logwriter.writelog("SEARCH:Failed, as Values not Entered in either" +
                                   "\n Product Name," +
                                   "\n Serial Number" +
                                   "\n or Reference Name textboxes");
                return;
            }

            bool s1 = string.IsNullOrEmpty(textBox_Product_name.Text.Trim());
            bool s2 = string.IsNullOrEmpty(textBox_serial_number.Text.Trim());
            bool s3 = string.IsNullOrEmpty(textBox_reference_name.Text.Trim());

            Search_by_Product_name(filtered, s1, s2, s3);
            Search_By_serial_Number(filtered, s1, s2, s3);
            Search_By_refernce_Name(filtered, s1, s2, s3);

            bFiltered = true;
        }
Esempio n. 5
0
        private void button_new_Click(object sender, EventArgs e)
        {
            global_list.Add(new Items_From_Receipt
            {
                Config_item_ID      = "",
                Product_Name        = textBox_Product_name.Text,
                Company_Name        = textBox_Company_details.Text,
                Install_Date        = textBox_install_date.Text,
                Warranty_Expiration = textBox_warrrenty.Text,
                Serial_Number       = textBox_serial_number.Text,
                Reference_Name      = textBox_reference_name.Text,
                status = ""
            });
            dataGridView_products.DataSource = null;////nblIAM RESET DATASOUCE!!!!!!!
            var source = global_list;

            dataGridView_products.DataSource = source;

            dataGridView_products.FirstDisplayedScrollingRowIndex = dataGridView_products.RowCount - 1;
            dataGridView_products.Rows[dataGridView_products.RowCount - 1].Selected = true;
            Logwriter.writelog("#NEW:Time,>>>>>VALUE:Item Updated:Product,Company,Install Date,Warranty,Serial No,Ref Name<<<<<<");
            Logwriter.writelog("#NEW:" + current_timestamp + ">>>>>" + textBox_Product_name.Text + "," +
                               textBox_Company_details.Text + "," +
                               textBox_install_date.Text + "," +
                               textBox_warrrenty.Text + "," +
                               textBox_serial_number.Text + "," +
                               textBox_reference_name.Text + "<<<<<<");
        }
Esempio n. 6
0
 public static void Main(string[] args)
 {
     Logwriter.Initialize();
     settings = new TcpMirrorSetting();
     SocketServer.StartListening(settings.LocalEndpoint, cb, Path.Combine(Generics._AssemblyDir, "log.txt"));
     if (settings.DestinationEndpoint.Port == 8081)
     {
         Console.ReadKey();
     }
 }
Esempio n. 7
0
        public FileSystemPolicyExecutor(ResourceMonitor monitor, PathBuilder builder, Logwriter log)
        {
            _monitor = monitor;
            _builder = builder;
            _log     = log;

            _monitor.OnChanged += ResourceChanged;

            _monitor.Begin();
        }
Esempio n. 8
0
        //
        private void ATUtility_Load(object sender, EventArgs e)
        {
            this.CenterToScreen();
            Logwriter.writelog("#LOGIN:, User,Time");
            Logwriter.writelog("LOGIN:"******"," + current_timestamp);

            dataGridView_products.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            dataGridView_products.Refresh();
            System.Threading.Thread.Sleep(1000);
            button_re_load.PerformClick();
        }
Esempio n. 9
0
        private void button_clear_fields_Click(object sender, EventArgs e)
        {
            textBox_Product_name.Clear();
            textBox_Company_details.Clear();
            textBox_install_date.Clear();
            textBox_warrrenty.Clear();
            textBox_serial_number.Clear();
            textBox_reference_name.Clear();
            Logwriter.writelog("#CLEAR FIELDS:Time");
            Logwriter.writelog("CLEAR FIELDS:" + current_timestamp);

            return;
        }
        private void button_ok_Click(object sender, EventArgs e)
        {
            var watch1 = System.Diagnostics.Stopwatch.StartNew();

            using (StreamWriter sw = new StreamWriter(contents_of_textbox))
            {
                sw.WriteLine(textBox_pasted_items.Text);
            }
            watch1.Stop();
            var elapsedMs = watch1.ElapsedMilliseconds;

            Logwriter.writelog("#TIME LASPE PASTED ITEMS:Time in Ms");
            Logwriter.writelog("TIME LASPE PASTED ITEMS:" + elapsedMs.ToString());


            List <string> Line_with_company_name_in_it = new List <string>(File.ReadAllLines(contents_of_textbox));

            //get company name
            for (int i = 0; i < Line_with_company_name_in_it.Count; i++)
            {
                if (Line_with_company_name_in_it[i].ToString().Contains("Name:"))
                {
                    Company_name = Line_with_company_name_in_it[i].Substring(8).Trim();
                }
            }

            handle_pastbox_contents_skip_unwanted_text();

            /// get rid of line with    LAYAWAY RECALL in it
            var oldlines  = File.ReadAllLines(pattern_output);
            var omit_line = oldlines.Where(line => !line.Contains("LAYAWAY RECALL"));

            File.WriteAllLines(pattern_output, omit_line);


            List <string> Lines = new List <string>(File.ReadAllLines(pattern_output));

            List <string> new_list = new List <string>();

            Handle_finding_Patterns_in_the_text(Lines, new_list);

            using (StreamWriter sr = new StreamWriter(resulting_file, false))//Example_2_Final.txt
            {
                new_list.ForEach(i => sr.Write("{0}\n", i));
            }



            MessageBox.Show("Successfully Imported", " Receipt Import Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
        ///////////////////////////importbutton/////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////
        private void button_Import_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            List_of_what_is_Mapped   = new BindingList <Mapped>();

            var FD = new System.Windows.Forms.OpenFileDialog();

            if (FD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string fileToOpen = FD.FileName;
                var    watch      = System.Diagnostics.Stopwatch.StartNew();
                using (StreamReader sr = new StreamReader(fileToOpen))
                {
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        string[] wholeLine = line.Split(',');
                        if (wholeLine.Length > 1)
                        {
                            List_of_what_is_Mapped.Add(new Mapped()
                            {
                                Receipt_Name  = wholeLine[0],
                                AutoTask_Name = wholeLine[1]
                            });
                        }
                    }
                    watch.Stop();
                    var elapsedMs = watch.ElapsedMilliseconds;
                    int count     = List_of_what_is_Mapped.Count();
                    Logwriter.writelog("#MAPPING IMPORT CSV:Time,Filename,Time lapsed,Count");
                    Logwriter.writelog("MAPPING IMPORT CSV:" + current_timestamp + "," + FD.FileName + "," + elapsedMs.ToString() + "," + count.ToString());
                }
                var source1 = List_of_what_is_Mapped;
                dataGridView1.DataSource = source1;
                DataGridViewColumn column = dataGridView1.Columns[0];
                column.Width = 430;
                DataGridViewColumn columns = dataGridView1.Columns[1];
                columns.Width = 430;
            }
            using (StreamWriter sw = new StreamWriter(@"Mapping_dgv_Entries.txt"))
            {
                foreach (Mapped item in List_of_what_is_Mapped)
                {
                    sw.WriteLine(item.Receipt_Name +
                                 "," + item.AutoTask_Name
                                 );
                }
            }
        }
Esempio n. 12
0
        private void button_set_all_install_date_Click(object sender, EventArgs e)
        {
            foreach (Items_From_Receipt currrob in global_list)
            {
                currrob.Install_Date = textBox_install_date.Text;
            }

            dataGridView_products.DataSource = null;    ////nblIAM RESET DATASOUCE!!!!!!!
            var source = global_list;

            dataGridView_products.DataSource = source;
            Logwriter.writelog("#SET ALL INSTALL DATE:Value ");
            Logwriter.writelog("SET ALL INSTALL DATE:" + textBox_install_date.Text);
        }
Esempio n. 13
0
        private void button_setall_reference_Click(object sender, EventArgs e)
        {
            foreach (Items_From_Receipt currrob in global_list)
            {
                currrob.Reference_Name = textBox_reference_name.Text;
            }

            dataGridView_products.DataSource = null;////nblIAM RESET DATASOUCE!!!!!!!
            var source = global_list;

            dataGridView_products.DataSource = source;

            Logwriter.writelog("#SET ALL REFERENCE NAME DATE:Date,Value ");
            Logwriter.writelog("SET ALL REFERENCE NAME DATE:" + current_timestamp + "," + textBox_reference_name.Text);
        }
Esempio n. 14
0
        private void button_setall_warrenty_Click(object sender, EventArgs e)
        {
            foreach (Items_From_Receipt currrob in global_list)
            {
                currrob.Warranty_Expiration = textBox_warrrenty.Text;
            }

            dataGridView_products.DataSource = null;////nblIAM RESET DATASOUCE!!!!!!!
            var source = global_list;

            dataGridView_products.DataSource = source;

            Logwriter.writelog("#SET ALL WARRANTY EXPIRATION DATE:Value ");
            Logwriter.writelog("SET ALL WARRANTY EXPIRATION DATE:" + textBox_warrrenty.Text);
        }
Esempio n. 15
0
        private void button_set_all_company_Click(object sender, EventArgs e)

        {
            foreach (Items_From_Receipt currrob in global_list)
            {
                currrob.Company_Name = textBox_Company_details.Text;
            }

            dataGridView_products.DataSource = null;////nblIAM RESET DATASOUCE!!!!!!!
            var source = global_list;

            dataGridView_products.DataSource = source;

            Logwriter.writelog("#SET ALL COMPANY NAME:Value ");
            Logwriter.writelog("SET ALL COMPANY NAME:" + textBox_Company_details.Text);
        }
Esempio n. 16
0
        private void button_import_Click(object sender, EventArgs e)
        {
            var FD = new System.Windows.Forms.OpenFileDialog();

            if (FD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string fileToOpen = FD.FileName;
                label_current_file.Text = "File in Use: " + fileToOpen.ToString();

                var watch = System.Diagnostics.Stopwatch.StartNew();

                using (StreamReader sr = new StreamReader(fileToOpen))
                {
                    string line;
                    line = sr.ReadLine();//headertext which needs to be skipped, doing nothing with header

                    while ((line = sr.ReadLine()) != null)
                    {
                        line = line.Replace("\"", "");
                        string[] wholeLine = line.Split(',');
                        if (wholeLine.Length > 9)
                        {
                            global_list.Add(new Items_From_Receipt()
                            {
                                Config_item_ID      = wholeLine[0],
                                Product_Name        = wholeLine[1],
                                Company_Name        = wholeLine[2],
                                Install_Date        = wholeLine[5],
                                Warranty_Expiration = wholeLine[6],
                                Serial_Number       = wholeLine[7],
                                Reference_Name      = wholeLine[9],
                                status = ""
                            });
                        }
                    }
                    watch.Stop();
                    var elapsedMs = watch.ElapsedMilliseconds;
                    int count     = global_list.Count();
                    Logwriter.writelog("#IMPORT CSV:Time,Filename,Time lapsed,Count");
                    Logwriter.writelog("IMPORT CSV:" + current_timestamp + "," + FD.FileName + "," + elapsedMs.ToString() + "," + count.ToString());
                }
                dataGridView_products.DataSource = null;
                var source = global_list;
                dataGridView_products.DataSource = source;
                //Process.Start(@"current_working_file.csv");
            }
        }
Esempio n. 17
0
        private void button_re_set_Click(object sender, EventArgs e)
        {
            bFiltered = false;
            MessageBox.Show("Warning!!! Reset will clear all work done");
            textBox_Product_name.Clear();
            textBox_Company_details.Clear();
            textBox_install_date.Clear();
            textBox_warrrenty.Clear();
            textBox_serial_number.Clear();
            textBox_reference_name.Clear();

            dataGridView_products.DataSource = null;
            global_list = new BindingList <Items_From_Receipt>();
            //global_list = null;
            Logwriter.writelog("#RESET:Time");
            Logwriter.writelog("RESET:" + current_timestamp);
        }
Esempio n. 18
0
        private void button_delete_Click(object sender, EventArgs e)
        {
            global_list.RemoveAt(dataGridView_products.CurrentRow.Index);
            dataGridView_products.DataSource = null;////nblIAM RESET DATASOUCE!!!!!!!
            var source = global_list;

            dataGridView_products.DataSource = source;
            Logwriter.writelog("#DELETE:Time,>>>>>VALUE:Item Updated:Product,Company,Install Date,Warranty,Serial No,Ref Name<<<<<<");
            Logwriter.writelog("DELETE:" + current_timestamp + "," + ">>>>>" +
                               dataGridView_products.CurrentRow.Cells[1].Value.ToString() + ","
                               + dataGridView_products.CurrentRow.Cells[2].Value.ToString() + ","
                               + dataGridView_products.CurrentRow.Cells[3].Value.ToString() + ","
                               + dataGridView_products.CurrentRow.Cells[4].Value.ToString() + ","
                               + dataGridView_products.CurrentRow.Cells[5].Value.ToString() + ","
                               + dataGridView_products.CurrentRow.Cells[6].Value.ToString() + ","
                               + dataGridView_products.CurrentRow.Cells[7].Value.ToString() + "<<<<<");
        }
        private void button_del_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Are You Sure You Wish To Delete This Record?", "Warning",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);

            string for_del_receipt_name = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            string for_del_AT_name      = dataGridView1.CurrentRow.Cells[1].Value.ToString();

            List_of_what_is_Mapped.RemoveAt(dataGridView1.CurrentRow.Index);
            dataGridView1.DataSource = null;
            var source = List_of_what_is_Mapped;

            dataGridView1.DataSource = source;

            using (StreamWriter sw = new StreamWriter(@"Mapping_dgv_Entries.txt"))
            {
                foreach (Mapped item in List_of_what_is_Mapped)
                {
                    sw.WriteLine(item.Receipt_Name +
                                 "," + item.AutoTask_Name
                                 );
                }
            }
            dataGridView1.DataSource = null;////nblIAM RESET DATASOUCE!!!!!!!
            var source2 = List_of_what_is_Mapped;

            dataGridView1.DataSource = source2;
            DataGridViewColumn column = dataGridView1.Columns[0];

            column.Width = 430;
            DataGridViewColumn columns = dataGridView1.Columns[1];

            columns.Width = 430;

            dataGridView1.FirstDisplayedScrollingRowIndex           = dataGridView1.RowCount - 1;
            dataGridView1.Rows[dataGridView1.RowCount - 1].Selected = true;
            textBox_Receipt_name.Text = null;
            textBox_AT_name.Text      = null;

            Logwriter.writelog("#DELETE  MAPPING:Time,>>>>>Item DELETED:Receipt Name, AT Name<<<<<");
            Logwriter.writelog("DELETE MAPPING:" + current_timestamp + "," + ">>>>>" + for_del_receipt_name + "," + for_del_AT_name + "<<<<<");

            //dataGridView1.DataSource = null;
            //var source1 = List_of_what_is_Mapped;
            //dataGridView1.DataSource = source1;
        }
Esempio n. 20
0
        private void button_reset_Click(object sender, EventArgs e)
        {
            bFiltered = false;
            //MessageBox.Show("Warning!!! Reset will clear all work done");
            textBox_Product_name.Clear();
            textBox_Company_details.Clear();
            textBox_install_date.Clear();
            textBox_warrrenty.Clear();
            textBox_serial_number.Clear();
            textBox_reference_name.Clear();

            dataGridView_products.DataSource = null;
            var    source  = global_list;
            string fsource = source.ToString();

            dataGridView_products.DataSource = source;

            Logwriter.writelog("#RE-LOAD:Time,Source Reset To:, Count");
            Logwriter.writelog("RE-LOAD:" + current_timestamp + "," + "Global List" + "," + global_list.Count());
        }
        private void button_New_Click(object sender, EventArgs e)
        {
            List_of_what_is_Mapped.Add(new Mapped
            {
                Receipt_Name  = textBox_Receipt_name.Text,
                AutoTask_Name = textBox_AT_name.Text
            });
            dataGridView1.DataSource = null;////nblIAM RESET DATASOUCE!!!!!!!
            var  source   = List_of_what_is_Mapped;
            bool isUnique = List_of_what_is_Mapped.Distinct().Count() == List_of_what_is_Mapped.Count();

            if (isUnique == false)
            {
                MessageBox.Show("Error Duplictes");
            }
            dataGridView1.DataSource = source;
            DataGridViewColumn column = dataGridView1.Columns[0];

            column.Width = 430;
            DataGridViewColumn columns = dataGridView1.Columns[1];

            columns.Width = 430;

            dataGridView1.FirstDisplayedScrollingRowIndex           = dataGridView1.RowCount - 1;
            dataGridView1.Rows[dataGridView1.RowCount - 1].Selected = true;


            using (StreamWriter sw = new StreamWriter(@"Mapping_dgv_Entries.txt"))
            {
                foreach (Mapped item in List_of_what_is_Mapped)
                {
                    sw.WriteLine(item.Receipt_Name +
                                 "," + item.AutoTask_Name
                                 );
                }
            }
            Logwriter.writelog("#NEW MAPPING:Time,>>>>>Item Updated:Receipt Name, AT Name<<<<<");
            Logwriter.writelog("NEW MAPPING:" + current_timestamp + "," + ">>>>>" + textBox_Receipt_name.Text + "," + textBox_AT_name.Text);
        }
Esempio n. 22
0
 public static void Start()
 {
     Logwriter.Initialize();
     settings = new TcpMirrorSetting();
     SocketServer.StartListening(settings.LocalEndpoint, cb, Path.Combine(Generics._AssemblyDir, "log.txt"));
 }
        private void Handle_finding_Patterns_in_the_text(List <string> Lines, List <string> new_list)
        {
            bool bRefunded = false;

            Lines = removeblanks(Lines);
            for (int i = 0; i < Lines.Count; i++)
            {
                if (Lines[i].Contains("REFUND ITEM"))
                {
                    i++;
                    bRefunded = true;
                }



                ///handle void/////////
                else if (Lines[i].ToString().Contains("VOID ITEM "))
                {
                    i++;
                    Item_list_123[Item_list_123.Count - 1].status = "VOIDED";

                    Logwriter.writelog("#VOIDED:TIME, PRODUCT DETAILS");
                    Logwriter.writelog(Timestamp() + "," + Lines[i].ToString());

                    //new_list.Remove(Lines[i]);
                }
                else if (Lines[i].ToString().Contains("Serial No:"))
                {
                    new_list.Add(Lines[i - 2] + "," + (Lines[i - 1] + "," + (Lines[i])));
                    Item_list_123.Add(new Items_From_Receipt
                    {
                        Config_item_ID = "",
                        Product_Name   = Lines[i - 2].Substring(0, 30),
                        Company_Name   = Company_name,
                        Install_Date   = "",
                        Serial_Number  = Lines[i].Substring(11).Trim(),
                        Reference_Name = "",
                        status         = ((bRefunded) ? "REFUNDED" : "")
                    });
                    bRefunded = false;
                }

                else if (Lines[i].ToString().Contains("@"))
                {
                    new_list.Add(Lines[i - 1] + "," + (Lines[i]) + "," + (Lines[i + 1]));

                    string   line   = Lines[i].ToString();  //2  @    195.00      390.00
                    string[] aprts  = line.Split('@');      //2  @
                    var      range  = aprts[0];             //2
                    int      Frange = Convert.ToInt32(range);
                    for (int qty = 1; qty <= Frange; qty++) ///increment by frange
                    {
                        Item_list_123.Add(new Items_From_Receipt
                        {
                            Config_item_ID = "",
                            Product_Name   = Lines[i - 1],
                            Company_Name   = Company_name,
                            Install_Date   = "",
                            Serial_Number  = "",
                            Reference_Name = "",
                            status         = ((bRefunded) ? "REFUNDED" : "")
                        });
                    }
                    bRefunded = false;
                }
                else if (Lines[i].Contains("--------------"))
                {
                    break;
                }

                else if (Lines[i].Trim().Split(' ').Length == 1 &&
                         Lines[i].Trim().Split(' ')[0].Length > 0 &&
                         !Lines[i - 1].Contains("@") &&
                         !Lines[i + 1].Contains("Serial No"))
                {
                    //USB KEYBOARDS                       1.00
                    //  0000000000256
                    //USB MOUSE                           1.50
                    //  0000000000257////
                    //24" SCREEN                          3.00
                    //  0000000000300
                    //Serial No:       ZZQ1H4LNC02097
                    //WIN 10 64 - BIT                       6.00
                    //  0000000000594
                    //Serial No:          QTC20201246
                    //2 KVA UPS                           8.00
                    //  0000000000187
                    //Serial No:             20040004
                    //1MTR PATCH
                    //              6  @      1.00        6.00
                    //  0000000000334
                    // most likely a PLU Line
                    // check if line above has an @ sign or
                    // if the line below has Serial No:
                    // if it doesn't have one of these then it is a
                    // single item to be added
                    // taking the description from the line above
                    // see USB KEYBOARDS / USB MOUSE sample above
                    Item_list_123.Add(new Items_From_Receipt
                    {
                        Config_item_ID = "",
                        Product_Name   = Lines[i - 1].Substring(0, 20).Trim(),
                        Company_Name   = Company_name,
                        Install_Date   = "",
                        Serial_Number  = "",
                        Reference_Name = "",
                        status         = ((bRefunded) ? "REFUNDED" : "")
                    });
                    bRefunded = false;
                }
            }
        }
Esempio n. 24
0
        private void button_export_Click(object sender, EventArgs e)
        {
            foreach (Items_From_Receipt currOb in global_list)
            {
                bool empty_company_name = !currOb.Company_Name.Any();
                bool empty_Inatall_date = !currOb.Install_Date.Any();

                if (empty_company_name)
                {
                    MessageBox.Show("Error With A Company Name Entry\n Are One or More Entries Blank?");
                    return;
                }

                if (empty_Inatall_date)
                {
                    MessageBox.Show("Error With An Install Date Entry\n" +
                                    "You Can Not Proceed Without an Install Date\n" +
                                    "Are One or More Entries Blank?");
                    return;
                }
            }

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter = "|*.csv";
            saveFileDialog1.Title  = "Save CSV File";
            saveFileDialog1.ShowDialog();
            //Configuration Item ID[updates only],[required] Product Name,[required] Company,Configuration Item Category,Configuration Item Type,[required] Install Date, Warranty Expiration,Serial Number, Reference Number,Reference Name, Number of Users, Contact, Location, Area, Contract, Service, Service Bundle,Billing Product, Billing Product Effective Date,Billing Product Expiration Date, Vendor, Service Level Agreement, Parent Configuration Item Serial Number, Description, Hourly Cost,Monthly Cost, Daily Cost,Per - Use Cost,Setup Fee, Company Link,Material Code(required if creating product),Active / Inactive,Subscription Name, Reviewed for Contract, Subscription Description, Subscription Period Type[required if creating subscription],Subscription Effective Date[required if creating subscription],Subscription Expiration Date[required if creating subscription],Subscription Period Price[required if creating subscription],Subscription Material Code[required if creating subscription],Subscription Purchase Order Number, Subscription Period Cost, Subscription Active,Subscription Vendor, Domain (Required if Category = Domain),SSL Source(Required if Category = SSL Certificate),UDF: 29682852 Username,UDF: 29682853 Password,UDF: 29682854 IP Address, UDF:29682861 OS,UDF: 29682862 Name,UDF: 29682864 Roles,UDF: 29682865 WAN IP:,UDF: 29682866 LAN IP:,UDF: 29682867 Brand,UDF: 29682868 SSID,UDF: 29682869 Security,UDF: 29682870 Location,UDF: 29682871 Make & Model,UDF: 29682872 Battery Life, UDF:29682873 Version,UDF: 29682874 URL,UDF: 29682875 Registrar,UDF: 29682913 AEM_DeviceID,UDF: 29682914 AEM_DeviceUID,UDF: 29682915 AEM_Description,UDF: 29682916 AEM_Manufacturer,UDF: 29682917 AEM_Model,UDF: 29682918 AEM_OperatingSystem,UDF: 29682919 AEM_IPAddress,UDF: 29682920 User - defined field 3,UDF: 29682921 User - defined field 2,UDF: 29682922 User - defined field 1,UDF: 29682923 User - defined field 10,UDF: 29682924 User - defined field 7,UDF: 29682925 User - defined field 6,UDF: 29682926 User - defined field 5,UDF: 29682927 User - defined field 4,UDF: 29682928 User - defined field 9,UDF: 29682929 User - defined field 8,UDF: 29682981 User - defined field 19,UDF: 29682982 User - defined field 17,UDF: 29682983 User - defined field 18,UDF: 29682984 User - defined field 15,UDF: 29682985 User - defined field 16,UDF: 29682986 User - defined field 13,UDF: 29682987 User - defined field 14,UDF: 29682988 User - defined field 11,UDF: 29682989 User - defined field 12,UDF: 29682990 User - defined field 21,UDF: 29682991 User - defined field 20,UDF: 29682992 User - defined field 22,UDF: 29682993 User - defined field 23,UDF: 29682994 User - defined field 24,UDF: 29682995 User - defined field 25,UDF: 29682996 User - defined field 26,UDF: 29682997 User - defined field 27,UDF: 29682998 User - defined field 28,UDF: 29682999 User - defined field 29,UDF: 29683000 Server Type -PixelPOS,UDF: 29683001 User - defined field 30,UDF: 29683002 Bit - Locker,UDF: 29683003 PixelPoint - Backup,UDF: 29683004 Wholesaler,UDF: 29683005 Store ID, UDF:29683006 Symbol Group
            //                                                                                                                                            , WIN10 IOT ENT 2019 LTSC MULTILANG, Centra Roscommon 2054,,,15 / 03 / 2021,,04248000841821,,Till 1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
            //,WIN10 IOT ENT 2019 LTSC MULTILANG, Centra Roscommon 2054,,,15 / 03 / 2021,,04248000841830,,Till 2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
            //,WIN10 IOT ENT 2019 LTSC MULTILANG, Centra Roscommon 2054,,,15 / 03 / 2021,,04248000841831,,Till 3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
            var    watch = System.Diagnostics.Stopwatch.StartNew();
            string path  = saveFileDialog1.FileName;

            if (saveFileDialog1.FileName != "")
            {
                Dictionary <string, string> Mappings = new Dictionary <string, string>();

                Mappings = load_mappings();

                using (var file = File.CreateText(path))
                {   // next line creates AT header/////
                    file.WriteLine("\"Configuration Item ID [updates only]\",\"[required] Product Name\",\"[required] Company\",\"Configuration Item Category\",\"Configuration Item Type\",\"[required] Install Date\",\"Warranty Expiration\",\"Serial Number\",\"Reference Number\",\"Reference Name\",\"Number of Users\",\"Contact\",\"Location\",\"Area\",\"Contract\",\"Service\",\"Service Bundle\",\"Billing Product\",\"Billing Product Effective Date\",\"Billing Product Expiration Date\",\"Vendor\",\"Service Level Agreement\",\"Parent Configuration Item Serial Number\",\"Description\",\"Hourly Cost\",\"Monthly Cost\",\"Daily Cost\",\"Per-Use Cost\",\"Setup Fee\",\"Company Link\",\"Material Code (required if creating product)\",\"Active/Inactive\",\"Subscription Name\",\"Reviewed for Contract\",\"Subscription Description\",\"Subscription Period Type [required if creating subscription]\",\"Subscription Effective Date [required if creating subscription]\",\"Subscription Expiration Date [required if creating subscription]\",\"Subscription Period Price [required if creating subscription]\",\"Subscription Material Code [required if creating subscription]\",\"Subscription Purchase Order Number\",\"Subscription Period Cost\",\"Subscription Active\",\"Subscription Vendor\",\"Domain (Required if Category = Domain)\",\"SSL Source (Required if Category = SSL Certificate)\",\"UDF:29682852 Username\",\"UDF:29682853 Password\",\"UDF:29682854 IP Address\",\"UDF:29682861 OS\",\"UDF:29682862 Name\",\"UDF:29682864 Roles\",\"UDF:29682865 WAN IP:\",\"UDF:29682866 LAN IP:\",\"UDF:29682867 Brand\",\"UDF:29682868 SSID\",\"UDF:29682869 Security\",\"UDF:29682870 Location\",\"UDF:29682871 Make & Model\",\"UDF:29682872 Battery Life\",\"UDF:29682873 Version\",\"UDF:29682874 URL\",\"UDF:29682875 Registrar\",\"UDF:29682913 AEM_DeviceID\",\"UDF:29682914 AEM_DeviceUID\",\"UDF:29682915 AEM_Description\",\"UDF:29682916 AEM_Manufacturer\",\"UDF:29682917 AEM_Model\",\"UDF:29682918 AEM_OperatingSystem\",\"UDF:29682919 AEM_IPAddress\",\"UDF:29682920 User-defined field 3\",\"UDF:29682921 User-defined field 2\",\"UDF:29682922 User-defined field 1\",\"UDF:29682923 User-defined field 10\",\"UDF:29682924 User-defined field 7\",\"UDF:29682925 User-defined field 6\",\"UDF:29682926 User-defined field 5\",\"UDF:29682927 User-defined field 4\",\"UDF:29682928 User-defined field 9\",\"UDF:29682929 User-defined field 8\",\"UDF:29682981 User-defined field 19\",\"UDF:29682982 User-defined field 17\",\"UDF:29682983 User-defined field 18\",\"UDF:29682984 User-defined field 15\",\"UDF:29682985 User-defined field 16\",\"UDF:29682986 User-defined field 13\",\"UDF:29682987 User-defined field 14\",\"UDF:29682988 User-defined field 11\",\"UDF:29682989 User-defined field 12\",\"UDF:29682990 User-defined field 21\",\"UDF:29682991 User-defined field 20\",\"UDF:29682992 User-defined field 22\",\"UDF:29682993 User-defined field 23\",\"UDF:29682994 User-defined field 24\",\"UDF:29682995 User-defined field 25\",\"UDF:29682996 User-defined field 26\",\"UDF:29682997 User-defined field 27\",\"UDF:29682998 User-defined field 28\",\"UDF:29682999 User-defined field 29\",\"UDF:29683000 Server Type - PixelPOS\",\"UDF:29683001 User-defined field 30\",\"UDF:29683002 Bit-Locker\",\"UDF:29683003 PixelPoint - Backup\",\"UDF:29683004 Wholesaler\",\"UDF:29683005 Store ID\",\"UDF:29683006 Symbol Group\"");

                    //file.WriteLine("Configuration Item ID[updates only],[required] Product Name,[required] Company,Configuration Item Category,Configuration Item Type,[required] Install Date, Warranty Expiration,Serial Number, Reference Number,Reference Name, Number of Users, Contact, Location, Area, Contract, Service, Service Bundle,Billing Product, Billing Product Effective Date,Billing Product Expiration Date, Vendor, Service Level Agreement, Parent Configuration Item Serial Number, Description, Hourly Cost,Monthly Cost, Daily Cost,Per - Use Cost,Setup Fee, Company Link,Material Code(required if creating product),Active / Inactive,Subscription Name, Reviewed for Contract, Subscription Description, Subscription Period Type[required if creating subscription],Subscription Effective Date[required if creating subscription],Subscription Expiration Date[required if creating subscription],Subscription Period Price[required if creating subscription],Subscription Material Code[required if creating subscription],Subscription Purchase Order Number, Subscription Period Cost, Subscription Active,Subscription Vendor, Domain (Required if Category = Domain),SSL Source(Required if Category = SSL Certificate),UDF: 29682852 Username,UDF: 29682853 Password,UDF: 29682854 IP Address, UDF:29682861 OS,UDF: 29682862 Name,UDF: 29682864 Roles,UDF: 29682865 WAN IP:,UDF: 29682866 LAN IP:,UDF: 29682867 Brand,UDF: 29682868 SSID,UDF: 29682869 Security,UDF: 29682870 Location,UDF: 29682871 Make & Model,UDF: 29682872 Battery Life, UDF:29682873 Version,UDF: 29682874 URL,UDF: 29682875 Registrar,UDF: 29682913 AEM_DeviceID,UDF: 29682914 AEM_DeviceUID,UDF: 29682915 AEM_Description,UDF: 29682916 AEM_Manufacturer,UDF: 29682917 AEM_Model,UDF: 29682918 AEM_OperatingSystem,UDF: 29682919 AEM_IPAddress,UDF: 29682920 User - defined field 3,UDF: 29682921 User - defined field 2,UDF: 29682922 User - defined field 1,UDF: 29682923 User - defined field 10,UDF: 29682924 User - defined field 7,UDF: 29682925 User - defined field 6,UDF: 29682926 User - defined field 5,UDF: 29682927 User - defined field 4,UDF: 29682928 User - defined field 9,UDF: 29682929 User - defined field 8,UDF: 29682981 User - defined field 19,UDF: 29682982 User - defined field 17,UDF: 29682983 User - defined field 18,UDF: 29682984 User - defined field 15,UDF: 29682985 User - defined field 16,UDF: 29682986 User - defined field 13,UDF: 29682987 User - defined field 14,UDF: 29682988 User - defined field 11,UDF: 29682989 User - defined field 12,UDF: 29682990 User - defined field 21,UDF: 29682991 User - defined field 20,UDF: 29682992 User - defined field 22,UDF: 29682993 User - defined field 23,UDF: 29682994 User - defined field 24,UDF: 29682995 User - defined field 25,UDF: 29682996 User - defined field 26,UDF: 29682997 User - defined field 27,UDF: 29682998 User - defined field 28,UDF: 29682999 User - defined field 29,UDF: 29683000 Server Type -PixelPOS,UDF: 29683001 User - defined field 30,UDF: 29683002 Bit - Locker,UDF: 29683003 PixelPoint - Backup,UDF: 29683004 Wholesaler,UDF: 29683005 Store ID, UDF:29683006 Symbol Group");
                    foreach (Items_From_Receipt item in global_list)
                    {
                        if (item.status == "")
                        {
                            string mapped_product_name = item.Product_Name.Trim();
                            if (Mappings.ContainsKey(mapped_product_name))
                            {
                                mapped_product_name = Mappings[mapped_product_name];
                            }

                            file.WriteLine(item.Config_item_ID + ","
                                           + "\"" + mapped_product_name + "\"" + ","
                                           + "\"" + item.Company_Name + "\"" + ","
                                           + ","        //Configuration Item Category BLANK
                                           + ","        //Configuration Item Type  BLANK

                                           + "\"" + item.Install_Date + "\"" + ","
                                           + "\"" + item.Warranty_Expiration + "\"" + ","

                                           + "\"" + item.Serial_Number + "\"" + ","
                                           + ","         //Reference Number BALNK

                                           + "\"" + item.Reference_Name + "\"" + ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
                                           );
                        }
                    }
                    watch.Stop();
                    var elapsedMs = watch.ElapsedMilliseconds;

                    Write_to_current_working_file();
                    int count = global_list.Count();
                    Logwriter.writelog("#FILE EXPORTED:Time,Filename,Item Count,Time Elapsed");
                    Logwriter.writelog("FILE EXPORTED:" + current_timestamp + "," + path + "," + count + "," + elapsedMs);
                }
            }
        }
Esempio n. 25
0
 private void button1_Click(object sender, EventArgs e)
 {
     this.Close();
     Logwriter.writelog("#LOGOUT:User,Time");
     Logwriter.writelog("LOGOUT:" + Name_of_user + "," + current_timestamp);
 }
Esempio n. 26
0
        private void button_Paste_in_receipt_Click(object sender, EventArgs e)
        {
            bFiltered = false;
            PasteBox pasteForm = new PasteBox();

            pasteForm.ShowDialog(this);
            List <Items_From_Receipt>   pasted_in = pasteForm.Item_list_123;
            Dictionary <string, string> mappings  = new Dictionary <string, string>();

            mappings = load_mappings();
            foreach (Items_From_Receipt ifr in pasted_in)
            {
                if (ifr.status == "REFUNDED")
                {
                    //find the item in global list that is not already refunded
                    //and mark it now as refunded, do not add this item to global list

                    bool bFound = false;
                    foreach (Items_From_Receipt gi in global_list)

                    {
                        if (gi.status != "REFUNDED" && gi.status != "VOIDED")
                        {
                            string Mapped_product = ifr.Product_Name;// assuming product name is not mapped yet
                            if (mappings.ContainsKey(ifr.Product_Name))
                            {
                                Mapped_product = mappings[ifr.Product_Name];// ah the product is mapped!
                            }
                            if ((gi.Product_Name.Trim() == ifr.Product_Name.Trim() || gi.Product_Name.Trim() == Mapped_product.Trim()) &&
                                ((gi.Serial_Number.Length == 0 && ifr.Serial_Number.Length == 0) ||
                                 (gi.Serial_Number.Length > 0 && gi.Serial_Number.Trim() == ifr.Serial_Number.Trim())))// should this be >0

                            {
                                gi.status = "REFUNDED";
                                bFound    = true;
                                break;
                            }
                        }
                    }
                    if (!bFound)
                    {
                        List <string> not_founds = new List <string>();
                        not_founds.Add(ifr.Product_Name);
                        not_founds.Add(",");
                        not_founds.Add(ifr.Serial_Number);
                        MessageBox.Show("Not Found ; Product;" +
                                        ifr.Product_Name +
                                        "\n Serial Number;" +
                                        ifr.Serial_Number, "Refund Item Not Found");



                        Logwriter.writelog("#REFUND ERRORS:TIME, ERROR DETAILS");
                        Logwriter.writelog((Timestamp() +
                                            "," +
                                            string.Format("REFUND ERROR: ({0}).", string.Join(", ", not_founds))));
                    }
                }
                else
                {
                    global_list.Add(ifr);
                }
            }


            button_re_load.PerformClick();



            var list_count = global_list.Count();

            Logwriter.writelog("#NUMBER OF ITEMS PASTED IN:,Count");
            Logwriter.writelog("NUMBER OF ITEMS PASTED IN:" + list_count.ToString());
        }