Beispiel #1
0
 private void bt_submit_Click(object sender, EventArgs e)
 {
     int day = DateTime.Now.Day;
     int month = DateTime.Now.Month;
     int year = DateTime.Now.Year;
     dtkho = new datakho();
     string s = "";
     for (int i = 0; i < dtkho.count; i++)
     {
         s = s + dtkho.buffer[i] + "\n";
     }
     for (int i = 0; i < (this.num_item + 1); i++)
     {
         int ID = import.findIDThucPham(cb_name_thucpham[i].SelectedItem.ToString());
         int Price = Int32.Parse(tb_price_thucpham[i].Text);
         int Quanlity = Int32.Parse(tb_num_thucpham[i].Text);
         for (int j = 0; j < import.count_TP; j++)
         {
             if (ID == import.ID_TP[j])
             {
                 import.dongia_TP_kho_new[j] = Price;
                 import.luong_TP_kho_new[j] = Quanlity;
             }
         }
         s = dtkho.reload(s, ID, Price, Quanlity);
     }
     if (s != "")dtkho.updateData(s);
     string update_tp = "";
     for (int i = 0; i < import.count_TP; i++)
     {
         update_tp = update_tp + "" + import.ID_TP[i] + "/" + import.name_TP[i] + "/" + import.type_TP[i] + "/" + import.unit_TP[i]  + "/" + import.luong_TP_kho_new[i] + "/" + import.dongia_TP_kho_new[i] + "/" + import.luong_TP_kho_old[i] + "/" + import.dongia_TP_kho_old[i] + "\n";
     }
     if (update_tp != "") dtkho.updateDataTP(update_tp);
     this.Close();
     Program.count_info_kho++;
     Program.th_infor_kho[Program.count_info_kho].Start();
 }
Beispiel #2
0
        public void xuathopdong()
        {
            FileInfo hopdong = new FileInfo("data/database/hopdong.dat");
            if (hopdong.Exists == true)
            {
                string newfilename = "data/database/hopdong-"
                    + DateTime.Now.Day + "-"
                    + DateTime.Now.Month + "-"
                    + DateTime.Now.Year + ".dat";
                hopdong.CopyTo(newfilename, true);
            }
            string str_hopdong = null;
            datakho dkt1 = new datakho();
            modun_quanli_thucdon_dinhduong md1 = new modun_quanli_thucdon_dinhduong();
            md1.query_thucpham();
            for (int i = 0; i < quanli_HDTP.count_TP_hn; i++)
            {
                for (int j = 0; j < md1.count_TP; j++)
                {
                    if (quanli_HDTP.ID_TP_hn[i] == Convert.ToInt32(md1.ID_TP[j]))
                    {
                        md1.dongia_TP_kho_new[j] = Convert.ToInt32(quanli_HDTP.dongia_TP_kho_new_hn[i]);
                    }
                }

                // Dung
                str_hopdong += quanli_HDTP.ID_TP_hn[i] + "/";
                str_hopdong += quanli_HDTP.name_TP_hn[i] + "/";
                str_hopdong += quanli_HDTP.dongia_TP_kho_new_hn[i] + "/";
                str_hopdong += quanli_HDTP.nhaphanphoi_hn[i] + "/";
                quanli_HDTP.ngaybatdau_hn[i] = DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
                str_hopdong += quanli_HDTP.ngaybatdau_hn[i] + "/";
                str_hopdong += quanli_HDTP.ngayketthuc_hn[i];
                str_hopdong += "\n";
            }
            File.WriteAllText("data/database/hopdong.dat", str_hopdong);

            string result_tp = "";
            for (int i = 0; i < md1.count_TP; i++)
            {
                result_tp = result_tp + md1.ID_TP[i] + "/" + md1.name_TP[i] + "/" + md1.type_TP[i] + "/" + md1.unit_TP[i] +
                    "/" + md1.luong_TP_kho_new[i] + "/" + md1.dongia_TP_kho_new[i] +
                    "/" + md1.luong_TP_kho_old[i] + "/" + md1.dongia_TP_kho_old[i] + "\n";
            }
            dkt1.updateDataTP(result_tp);
        }