Ejemplo n.º 1
0
        private void txtItemName_LostFocus(object sender, EventArgs e)
        {
            vItemProduct oItem = Items.Where(lst => lst.ItemName.Equals(txtItemName.Text)).FirstOrDefault();

            txtItemCode.Text     = oItem != null ? oItem.ItemCode : string.Empty;
            txtShortName.Text    = txtItemName.Text;
            lblPreviewLine1.Text = txtItemName.Text;
            lblPreviewLine3.Text = txtItemCode.Text;
        }
Ejemplo n.º 2
0
        private vItemProduct ConvertIntoItemObject(string[] record)
        {
            vItemProduct oItem = new vItemProduct();

            oItem.ItemType      = record[0];
            oItem.ItemID        = Convert.ToInt16(record[1]);
            oItem.ItemCode      = record[2];
            oItem.ItemName      = record[3];
            oItem.ItemGroupID   = Convert.ToInt16(record[4]);
            oItem.ItemGroupCode = record[5];
            oItem.ItemGroupName = record[6];
            oItem.ItemUnit      = record[7];
            oItem.ItemStatus    = record[8];
            return(oItem);
        }
Ejemplo n.º 3
0
        private string ConvertItemDataToString(vItemProduct itemInfo)
        {
            // Read the data and convert it to the appropriate data type.
            string item = string.Format("{0};{1};{2};{3};{4};{5};{6};{7};{8}",
                                        itemInfo.GCItemType,
                                        itemInfo.ItemID,
                                        itemInfo.ItemCode,
                                        itemInfo.ItemName,
                                        itemInfo.ItemGroupID,
                                        itemInfo.ItemGroupCode,
                                        itemInfo.ItemGroupName,
                                        itemInfo.ItemUnit,
                                        itemInfo.ItemStatus
                                        );

            return(item);
        }
Ejemplo n.º 4
0
        private void LoadItemFromLocalDB()
        {
            string   dbName   = ((ComboBoxItem)cboDatabase.SelectedItem).Value.ToString();
            string   fileName = string.Format(@"{0}\data\{1}.dat", Application.StartupPath, dbName);
            FileInfo file     = new FileInfo(fileName);

            if (file.Exists)
            {
                IEnumerable <string> recordList = File.ReadAllLines(file.FullName);
                List <vItemProduct>  lstItem    = new List <vItemProduct>();
                foreach (string itemInfo in recordList)
                {
                    // Read the data and convert it to the appropriate data type.
                    string[]     record = itemInfo.Split(';');
                    vItemProduct oItem  = new vItemProduct();
                    oItem = ConvertIntoItemObject(record);
                    lstItem.Add(oItem);
                }
                ApplicationParameter.ItemList = lstItem;
                Items = lstItem.AsEnumerable();
                RefreshBindingSource();
            }
        }