コード例 #1
0
        public void BinddingShelfChoose(Shelf send)
        {
            int currentRow = dataGridView1.CurrentRow.Index;

            dataGridView1.Rows[currentRow].Cells[colShelfName].Value = send.Name;
            dataGridView1.Rows[currentRow].Cells[colShelfId].Value   = send.Id;
        }
コード例 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     using (SSLsEntities db = new SSLsEntities())
     {
         if (_Id == 0)
         {
             // add new
             Shelf obj = new Shelf();
             obj.Code        = textBoxCode.Text;
             obj.Name        = textBoxName.Text;
             obj.Description = textBoxDesc.Text;
             obj.CreateDate  = DateTime.Now;
             obj.CreateBy    = Singleton.SingletonAuthen.Instance().Id;
             obj.Enable      = true;
             obj.UpdateBy    = Singleton.SingletonAuthen.Instance().Id;
             obj.UpdateDate  = DateTime.Now;
             db.Shelf.Add(obj);
         }
         else
         {
             // edit
             var obj = db.Shelf.SingleOrDefault(w => w.Id == _Id);
             obj.UpdateDate  = DateTime.Now;
             obj.UpdateBy    = Singleton.SingletonAuthen.Instance().Id;
             obj.Code        = textBoxCode.Text;
             obj.Name        = textBoxName.Text;
             obj.Description = textBoxDesc.Text;
             if (radioButton1.Checked)
             {
                 obj.Enable = true;
             }
             else
             {
                 obj.Enable = false;
             }
             db.Entry(obj).State = EntityState.Modified;
         }
         db.SaveChanges();
         Singleton.SingletonPriority1.SetInstance();
         Singleton.SingletonPriority1.Instance();
         this.Dispose();
         _Id = 0;
     }
 }