示例#1
0
        private void bwSearchBarcode_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                var index = barcodeEntityList2.Count - 1;
                if (barcodeEntityList2[index].Comment == null)
                {
                    barcodeEntityList2[index].Comment = "";

                }

                string[] val = barcodeEntityList2[0].Comment.Split('(');
                string[] change = barcodeEntityList2[0].Comment.Split('[');
                //if (barcodeEntityList2.Count == 0 || (barcodeEntityList2[0].SellDate.ToString() == "1/1/0001 12:00:00 AM" && Change[0].ToString() == ""))
                if (barcodeEntityList2.Count == 0)
                {
                    lblStatus.Text = "ไม่มีข้อมูลสินค้านี้ในระบบค่ะ";
                    lblStatus.ForeColor = Color.Red;
                    lblStatus.Visible = true;
                    txtBarcode.Enabled = true;
                }
                else if (barcodeEntityList2[0].SellDate.ToString() == "1/1/0001 12:00:00 AM")
                {
                }
                else if (val[0].ToString() == "เคลมสินค้า")
                {
                    lblStatus.Text = "สินค้านี้ทำการเคลมแล้ว";
                    lblStatus.ForeColor = Color.Red;
                    lblStatus.Visible = true;
                    txtBarcode.Enabled = true;
                    btnClaim.Visible = false;

                    table1.BeginUpdate();
                    shopList2 = new List<string>();
                    customerList2 = new List<string>();

                    for (int i = 0; i < barcodeEntityList2.Count; i++)
                    {
                        tableModel1.Rows.Add(new Row(
                            new Cell[] {
                        new Cell("" + (tableModel1.Rows.Count+1)),
                        new Cell(barcodeEntityList2[i].SellDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                        new Cell(Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey) ? Param.ShopNameHashtable[barcodeEntityList2[i].PartitionKey].ToString() : barcodeEntityList2[i].PartitionKey),
                        new Cell(barcodeEntityList2[i].ReceivedDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                        new Cell(Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer) ? Param.CustomerNameHashtable[barcodeEntityList2[i].Customer].ToString() : barcodeEntityList2[i].Customer)
                            })
                        );
                        if (!Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey))
                            shopList.Add(barcodeEntityList2[i].PartitionKey);
                        if (!Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer))
                            customerList.Add(barcodeEntityList2[i].Customer);
                    }
                    table1.EndUpdate();

                    FmClaimHistory fm = new FmClaimHistory();
                    fm.Show();
                }
                else if (change[0].ToString() == "เปลี่ยนสินค้า")
                {
                    string[] bar = change[1].ToString().Split(']');
                    lblStatus.Text = "สินค้านี้เปลี่ยนให้บาร์โค้ด " + bar[0].ToString() + "";
                    lblStatus.ForeColor = Color.Red;
                    lblStatus.Visible = true;
                    txtBarcode.Enabled = true;

                    table1.BeginUpdate();
                    shopList2 = new List<string>();
                    customerList2 = new List<string>();

                    for (int i = 0; i < barcodeEntityList2.Count; i++)
                    {
                        tableModel1.Rows.Add(new Row(
                            new Cell[] {
                        new Cell("" + (tableModel1.Rows.Count+1)),
                        new Cell(barcodeEntityList2[i].SellDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                        new Cell(Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey) ? Param.ShopNameHashtable[barcodeEntityList2[i].PartitionKey].ToString() : barcodeEntityList2[i].PartitionKey),
                        new Cell(barcodeEntityList2[i].ReceivedDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                        new Cell(Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer) ? Param.CustomerNameHashtable[barcodeEntityList2[i].Customer].ToString() : barcodeEntityList2[i].Customer)
                            })
                        );
                        if (!Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey))
                            shopList.Add(barcodeEntityList2[i].PartitionKey);
                        if (!Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer))
                            customerList.Add(barcodeEntityList2[i].Customer);
                    }
                    table1.EndUpdate();

                    FmClaimHistory fm = new FmClaimHistory();
                    fm.Show();

                }
                else
                {
                    lblStatus.Visible = false;
                    txtBarcode.Enabled = true;
                    txtBarcode.Text = "";

                    table1.BeginUpdate();
                    shopList2 = new List<string>();
                    customerList2 = new List<string>();

                    for (int i = 0; i < barcodeEntityList2.Count; i++)
                    {
                        tableModel1.Rows.Add(new Row(
                            new Cell[] {
                        new Cell("" + (tableModel1.Rows.Count+1)),
                        new Cell(barcodeEntityList2[i].SellDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                        new Cell(Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey) ? Param.ShopNameHashtable[barcodeEntityList2[i].PartitionKey].ToString() : barcodeEntityList2[i].PartitionKey),
                        new Cell(barcodeEntityList2[i].ReceivedDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                        new Cell(Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer) ? Param.CustomerNameHashtable[barcodeEntityList2[i].Customer].ToString() : barcodeEntityList2[i].Customer)
                            })
                        );
                        if (!Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey))
                            shopList.Add(barcodeEntityList2[i].PartitionKey);
                        if (!Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer))
                            customerList.Add(barcodeEntityList2[i].Customer);
                    }
                    table1.EndUpdate();
                }
            }
            catch (Exception ex){ Console.WriteLine(ex); }
            bwGetProduct.RunWorkerAsync();
        }
示例#2
0
        private void bwSearchBarcode_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                var index = barcodeEntityList2.Count - 1;
                if (barcodeEntityList2[index].Comment == null)
                {
                    barcodeEntityList2[index].Comment = "";
                }

                string[] val    = barcodeEntityList2[0].Comment.Split('(');
                string[] change = barcodeEntityList2[0].Comment.Split('[');
                //if (barcodeEntityList2.Count == 0 || (barcodeEntityList2[0].SellDate.ToString() == "1/1/0001 12:00:00 AM" && Change[0].ToString() == ""))
                if (barcodeEntityList2.Count == 0)
                {
                    lblStatus.Text      = "ไม่มีข้อมูลสินค้านี้ในระบบค่ะ";
                    lblStatus.ForeColor = Color.Red;
                    lblStatus.Visible   = true;
                    txtBarcode.Enabled  = true;
                }
                else if (barcodeEntityList2[0].SellDate.ToString() == "1/1/0001 12:00:00 AM")
                {
                }
                else if (val[0].ToString() == "เคลมสินค้า")
                {
                    lblStatus.Text      = "สินค้านี้ทำการเคลมแล้ว";
                    lblStatus.ForeColor = Color.Red;
                    lblStatus.Visible   = true;
                    txtBarcode.Enabled  = true;
                    btnClaim.Visible    = false;

                    table1.BeginUpdate();
                    shopList2     = new List <string>();
                    customerList2 = new List <string>();

                    for (int i = 0; i < barcodeEntityList2.Count; i++)
                    {
                        tableModel1.Rows.Add(new Row(
                                                 new Cell[] {
                            new Cell("" + (tableModel1.Rows.Count + 1)),
                            new Cell(barcodeEntityList2[i].SellDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                            new Cell(Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey) ? Param.ShopNameHashtable[barcodeEntityList2[i].PartitionKey].ToString() : barcodeEntityList2[i].PartitionKey),
                            new Cell(barcodeEntityList2[i].ReceivedDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                            new Cell(Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer) ? Param.CustomerNameHashtable[barcodeEntityList2[i].Customer].ToString() : barcodeEntityList2[i].Customer)
                        })
                                             );
                        if (!Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey))
                        {
                            shopList.Add(barcodeEntityList2[i].PartitionKey);
                        }
                        if (!Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer))
                        {
                            customerList.Add(barcodeEntityList2[i].Customer);
                        }
                    }
                    table1.EndUpdate();

                    FmClaimHistory fm = new FmClaimHistory();
                    fm.Show();
                }
                else if (change[0].ToString() == "เปลี่ยนสินค้า")
                {
                    string[] bar = change[1].ToString().Split(']');
                    lblStatus.Text      = "สินค้านี้เปลี่ยนให้บาร์โค้ด " + bar[0].ToString() + "";
                    lblStatus.ForeColor = Color.Red;
                    lblStatus.Visible   = true;
                    txtBarcode.Enabled  = true;

                    table1.BeginUpdate();
                    shopList2     = new List <string>();
                    customerList2 = new List <string>();

                    for (int i = 0; i < barcodeEntityList2.Count; i++)
                    {
                        tableModel1.Rows.Add(new Row(
                                                 new Cell[] {
                            new Cell("" + (tableModel1.Rows.Count + 1)),
                            new Cell(barcodeEntityList2[i].SellDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                            new Cell(Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey) ? Param.ShopNameHashtable[barcodeEntityList2[i].PartitionKey].ToString() : barcodeEntityList2[i].PartitionKey),
                            new Cell(barcodeEntityList2[i].ReceivedDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                            new Cell(Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer) ? Param.CustomerNameHashtable[barcodeEntityList2[i].Customer].ToString() : barcodeEntityList2[i].Customer)
                        })
                                             );
                        if (!Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey))
                        {
                            shopList.Add(barcodeEntityList2[i].PartitionKey);
                        }
                        if (!Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer))
                        {
                            customerList.Add(barcodeEntityList2[i].Customer);
                        }
                    }
                    table1.EndUpdate();

                    FmClaimHistory fm = new FmClaimHistory();
                    fm.Show();
                }
                else
                {
                    lblStatus.Visible  = false;
                    txtBarcode.Enabled = true;
                    txtBarcode.Text    = "";

                    table1.BeginUpdate();
                    shopList2     = new List <string>();
                    customerList2 = new List <string>();

                    for (int i = 0; i < barcodeEntityList2.Count; i++)
                    {
                        tableModel1.Rows.Add(new Row(
                                                 new Cell[] {
                            new Cell("" + (tableModel1.Rows.Count + 1)),
                            new Cell(barcodeEntityList2[i].SellDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                            new Cell(Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey) ? Param.ShopNameHashtable[barcodeEntityList2[i].PartitionKey].ToString() : barcodeEntityList2[i].PartitionKey),
                            new Cell(barcodeEntityList2[i].ReceivedDate.ToLocalTime().ToString("dd MMMM yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("th-TH"))),
                            new Cell(Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer) ? Param.CustomerNameHashtable[barcodeEntityList2[i].Customer].ToString() : barcodeEntityList2[i].Customer)
                        })
                                             );
                        if (!Param.ShopNameHashtable.Contains(barcodeEntityList2[i].PartitionKey))
                        {
                            shopList.Add(barcodeEntityList2[i].PartitionKey);
                        }
                        if (!Param.CustomerNameHashtable.Contains(barcodeEntityList2[i].Customer))
                        {
                            customerList.Add(barcodeEntityList2[i].Customer);
                        }
                    }
                    table1.EndUpdate();
                }
            }
            catch (Exception ex) { Console.WriteLine(ex); }
            bwGetProduct.RunWorkerAsync();
        }