示例#1
0
        public ActionResult Action(tblManufacturer objSubmit)
        {
            if (objSubmit.ID == 0)
            {
                objSubmit.DateCreated = DateTime.Now;
                objSubmit.DateUpdated = DateTime.Now;
                objSubmit.IsDeleted   = false;
                objSubmit.IsShow      = true;
                manufacturerRepository.Add(objSubmit);
            }
            else
            {
                var obj = manufacturerRepository.GetById <tblManufacturer>(objSubmit.ID);

                UpdateModel(obj);

                objSubmit.DateUpdated = DateTime.Now;

                manufacturerRepository.Update(obj);
            }

            return(Json(new
            {
                Error = false
            }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     if (txtName.Text == "")
     {
         MessageBox.Show("Fill textboxes to process.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     else
     {
         try
         {
             AddManufacturerBLL bll     = new AddManufacturerBLL();
             tblManufacturer    manufac = new tblManufacturer();
             manufac.MName = txtName.Text;
             generateID();
             manufac.ID = txtID.Text;
             bool ret = bll.InsertManufac(manufac);
             if (ret == true)
             {
                 MessageBox.Show("Inserted successfully");
             }
             else
             {
                 MessageBox.Show("Insert failure");
             }
         }
         catch (SqlException ex)
         {
             MessageBox.Show("Re-input again. Your Company may already be added to database!");
             MessageBox.Show(ex.Message);
         }
     }
 }
示例#3
0
        public bool InsertManufac(tblManufacturer manufac)
        {
            string       sql   = "insert into tblManufacturer values(@id,@name)";
            SqlParameter parid = new SqlParameter("@id", SqlDbType.VarChar);

            parid.Value = manufac.ID;
            SqlParameter parname = new SqlParameter("@name", SqlDbType.VarChar);

            parname.Value = manufac.MName;
            bool ret = WriteData(sql, new[] { parid, parname });

            return(ret);
        }
示例#4
0
        public List <tblManufacturer> GetManuValue()
        {
            List <tblManufacturer> manu = new List <tblManufacturer>();
            var manuresult = uok.manufacturer.GetAll();

            foreach (var item in manuresult)
            {
                tblManufacturer m = new tblManufacturer();
                m.ManufacturerID   = item.ManufacturerID;
                m.ManufacturerName = item.ManufacturerName;
                manu.Add(m);
            }
            return(manu);
        }
示例#5
0
        public bool Delete(tblManufacturer OldManufacturer)
        {
            ServiceDirectDBEntities objDB = new ServiceDirectDBEntities();

            objDB.tblManufacturer.DeleteObject(OldManufacturer);

            try
            {
                objDB.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#6
0
        public bool Insert(tblManufacturer NewManufacturer)
        {
            ServiceDirectDBEntities objDB = new ServiceDirectDBEntities();

            try
            {
                objDB.tblManufacturer.AddObject(NewManufacturer);

                objDB.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#7
0
        public bool Delete(tblManufacturer OldManufacturer)
        {
            ServiceDirectDBEntities objDB = new ServiceDirectDBEntities();

            objDB.tblManufacturer.DeleteObject(OldManufacturer);

            try
            {
                objDB.SaveChanges();

                return true;
            }
            catch
            {
                return false;
            }
        }
示例#8
0
        public bool Insert(tblManufacturer NewManufacturer)
        {
            ServiceDirectDBEntities objDB = new ServiceDirectDBEntities();

            try
            {
                objDB.tblManufacturer.AddObject(NewManufacturer);

                objDB.SaveChanges();

                return true;
            }
            catch
            {

                return false;
            }
        }
示例#9
0
        public bool Update(tblManufacturer NewManufacturer)
        {
            ServiceDirectDBEntities objDB = new ServiceDirectDBEntities();

            tblManufacturer OldManufacturer = objDB.tblManufacturer.First(c => c.MfrID == NewManufacturer.MfrID);

            try
            {
                OldManufacturer.MfrName = NewManufacturer.MfrName;
                OldManufacturer.MfrType = NewManufacturer.MfrType;

                objDB.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#10
0
        public bool Update(tblManufacturer NewManufacturer)
        {
            ServiceDirectDBEntities objDB = new ServiceDirectDBEntities();

            tblManufacturer OldManufacturer= objDB.tblManufacturer.First(c=>c.MfrID==NewManufacturer.MfrID);

            try
            {
                OldManufacturer.MfrName = NewManufacturer.MfrName;
                OldManufacturer.MfrType = NewManufacturer.MfrType;

                objDB.SaveChanges();

                return true;
            }
            catch
            {
                return false;
            }
        }
示例#11
0
 public void remove(tblManufacturer entity)
 {
     throw new NotImplementedException();
 }
示例#12
0
 public IEnumerable <tblManufacturer> find(tblManufacturer v)
 {
     throw new NotImplementedException();
 }
示例#13
0
        public bool InsertManufac(tblManufacturer manufac)
        {
            AddManufacDAL dal = new AddManufacDAL();

            return(dal.InsertManufac(manufac));
        }