Ejemplo n.º 1
0
        // Конструктор при открытии уже существующего списка
        public TableOfList(string login, Autorization autorization, string ID, string creator, string name)
        {
            InitializeComponent();
            startForm    = autorization;
            username     = login;
            this.ID      = ID;
            this.name    = name;
            this.creator = creator;



            List <List> temp = new List <List>();

            files.ReadFromFile(ID, ref temp);

            int countRows = 0;

            foreach (List product in temp)
            {
                productsTable.Rows.Add();

                productsTable.Rows[countRows].Cells[0].Value = product.checkedProduct;
                productsTable.Rows[countRows].Cells[1].Value = product.productName;
                productsTable.Rows[countRows].Cells[2].Value = product.productCount;
                productsTable.Rows[countRows].Cells[3].Value = product.cost;
                productsTable.Rows[countRows].Cells[4].Value = product.shopName;

                countRows++;
            }
        }
Ejemplo n.º 2
0
        // Конструктор при создании нового списка
        public TableOfList(string login, Autorization autorization)
        {
            InitializeComponent();
            startForm = autorization;
            username  = login;
            creator   = login;

            string path = "lastnumber.txt";

            try
            {
                using (StreamReader sr = new StreamReader(path, Encoding.UTF8))
                {
                    string line;
                    line = sr.ReadLine();
                    ID   = line;
                }
            }
            catch
            {
                MessageBox.Show("Простите, в работе с базой списков что-то пошло не так");
            }

            try
            {
                using (StreamWriter sw = new StreamWriter(path))
                {
                    sw.WriteLine(Int32.Parse(ID) + 1);
                }
            }
            catch
            {
                MessageBox.Show("Простите, в работе с базой списков что-то пошло не так");
            }

            files.WriteInFile(username, ID);
            files.WriteInFile(ID, new List <List>(), false, username, "Неизвестно");
        }
Ejemplo n.º 3
0
 public MainForm(string login, Autorization autorization)
 {
     InitializeComponent();
     username  = login;
     startForm = autorization;
 }
Ejemplo n.º 4
0
 public Registration(Autorization autorizationForm)
 {
     InitializeComponent();
     startForm = autorizationForm;
 }