コード例 #1
0
        private void btnChooseFile_Click(object sender, EventArgs e)
        {
            frmDatasheet frm = new frmDatasheet();

            frm.ChooseFile = true;
            frm.CustomerID = Material.CustomerID;
            frm.Text      += ": " + Material.Code + " - " + Material.Name;
            bool added = false;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                foreach (int item in frm.ListMaterialFileID)
                {
                    ProcessTransaction pt = new ProcessTransaction();
                    pt.OpenConnection();
                    pt.BeginTransaction();
                    try
                    {
                        MaterialFileLinkModel model = new MaterialFileLinkModel();
                        model.MaterialID     = Material.ID;
                        model.MaterialFileID = item;
                        pt.Insert(model);

                        added = true;

                        if (added)
                        {
                            //MaterialModel material = (MaterialModel)MaterialBO.Instance.FindByPK(Material.ID);
                            Material.FileDatasheet = 1;
                            pt.Update(Material);
                        }
                        pt.CommitTransaction();
                    }
                    catch (Exception)
                    {
                    }
                    finally
                    {
                        pt.CloseConnection();
                    }
                }

                loadDatasheet();
            }
        }
コード例 #2
0
        private void btnDatasheet_Click(object sender, EventArgs e)
        {
            frmDatasheet frm = new frmDatasheet();

            TextUtils.OpenForm(frm);
        }