Ejemplo n.º 1
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("请问确认要删除这些记录吗?一旦删除数据将不可恢复!", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         int i;
         Prument.ORM.Products _p = new Prument.ORM.Products();
         for (i = 0; i < dataGridView1.SelectedRows.Count; i++)
         {
             _p.ID = Int32.Parse(dataGridView1.SelectedRows[i].Cells["pID"].Value.ToString());
             _p.DataBind(Prument.ORM.BindOperator.Delete);
         }
         DataGridRefresh();
     }
 }
Ejemplo n.º 2
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("����ȷ��Ҫɾ����Щ��¼��һ��ɾ�����ݽ����ɻָ���", "��ʾ", MessageBoxButtons.YesNo) ==DialogResult.Yes)
     {
         int i;
         Prument.ORM.Products _p = new Prument.ORM.Products();
         for (i = 0; i < dataGridView1.SelectedRows.Count; i++)
         {
             _p.ID = Int32.Parse(dataGridView1.SelectedRows[i].Cells["pID"].Value.ToString());
             _p.DataBind(Prument.ORM.BindOperator.Delete);
         }
         DataGridRefresh();
     }
 }
Ejemplo n.º 3
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            int    i     = 0;
            string _mess = "´¢´æ³É¹¦£¡";

            Prument.ORM.BindOperator _bo;
            try
            {
                _p.Name        = this.txbName.Text;
                _p.Description = this.txbDescription.Text;
                _p.Images.clear();
                while (i < ImageMax)
                {
                    _p.Images.add(ImagePaths[i]);
                    i++;
                }
                if (this.Status == EditStatus.Changed)
                {
                    _bo = Prument.ORM.BindOperator.Update;
                }
                else
                {
                    _bo = Prument.ORM.BindOperator.Insert;
                }
                FileInfo _file;
                i = 0;
                while (_p.Images.Path[i] != "" && _p.Images.Path[i] != null)
                {
                    _file = new FileInfo(_p.Images.Path[i]);
                    string target = Application.StartupPath + "\\Pictures\\" + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString() + "_" + DateTime.Now.Hour.ToString().ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + (new System.Random()).Next(0, 100).ToString() + _p.Images.Path[i].Substring(_p.Images.Path[i].LastIndexOf("\\") + 1, _p.Images.Path[i].Length - _p.Images.Path[i].LastIndexOf("\\") - 1);
                    _file.CopyTo(target, true);
                    _p.Images.Path[i] = target;
                    ((mainForm)this.MdiParent).tspbMain.Value = (int)Math.Floor((decimal)i * (decimal)100 / (decimal)_p.Images.Count);
                    i++;
                }
                _p.DataBind(_bo);
                ((mainForm)this.MdiParent).tspbMain.Value = 0;
            }
            catch (Exception ex) {
                _mess = "´æ´¢Ê§°Ü" + ex.Message;
            }

            MessageBox.Show(_mess);
            this.Status = EditStatus.Saved;
            changeSaveStatus();
        }