Exemplo n.º 1
0
        public string UTypeSelectList()
        {
            QISEntities dbQIS = new QISEntities();

            string result = "<select>";

            foreach (var item in dbQIS.Master_UType)
            {
                result = result + "<option value = '" + item.utype_id + "'>" + item.utype_name + "</option>";
            }

            result = result + "</select>";
            return(result);
        }
Exemplo n.º 2
0
 public ActionResult DeleteUser(string id)
 {
     try
     {
         var db   = new QISEntities();
         var user = db.AuthUser.Find(id);
         db.AuthUser.Remove(user);
         db.SaveChanges();
         return(Json(true));
     }
     catch (Exception)
     {
         return(Json(false));
     }
 }
Exemplo n.º 3
0
 public ActionResult DeleteProduct(int id = 0)
 {
     try
     {
         var db      = new QISEntities();
         var product = db.Master_Product.Find(id);
         //db.Master_Product.Remove(product);
         product.product_del_flag = true;
         db.SaveChanges();
         return(Json(true));
     }
     catch (Exception)
     {
         return(Json(false));
     }
 }
Exemplo n.º 4
0
        public ActionResult AddPlant(string plant_name)
        {
            try
            {
                var          db = new QISEntities();
                Master_Plant mp = new Master_Plant();
                mp.plant_name     = plant_name;
                mp.plant_del_flag = false;
                db.Master_Plant.Add(mp);
                db.SaveChanges();

                return(Json(true));
            }
            catch (Exception)
            {
                // Do some error logging stuff, handle exception, etc.
                return(Json(false));
            }
        }
Exemplo n.º 5
0
 public ActionResult EditUser(string user_code, byte utype_id, int plant_id)
 {
     try
     {
         var db    = new QISEntities();
         var query = from u in db.AuthUser
                     where u.user_code.Equals(user_code)
                     select u;
         var user = query.First();
         user.utype_id = utype_id;
         user.plant_id = plant_id;
         db.SaveChanges();
         return(Json(true));
     }
     catch (Exception)
     {
         return(Json(false));
     }
 }
Exemplo n.º 6
0
 public ActionResult EditProduct(int product_id, string product_name, int plant_id, int group_id)
 {
     try
     {
         var db    = new QISEntities();
         var query = from p in db.Master_Product
                     where p.product_id.Equals(product_id)
                     select p;
         var product = query.First();
         product.product_name = product_name;
         product.plant_id     = plant_id;
         product.group_id     = group_id;
         db.SaveChanges();
         return(Json(true));
     }
     catch (Exception)
     {
         return(Json(false));
     }
 }
Exemplo n.º 7
0
        public ActionResult AddUser(string user_code, byte utype_id, int plant_id)
        {
            try
            {
                var db = new QISEntities();

                var user = new AuthUser();
                user.user_code = user_code;
                user.utype_id  = utype_id;
                user.plant_id  = plant_id;

                db.AuthUser.Add(user);
                db.SaveChanges();
                return(Json(true));
            }
            catch (Exception)
            {
                return(Json(false));
            }
        }
Exemplo n.º 8
0
        public ActionResult EditPlant(int plant_id, string plant_name)
        {
            try
            {
                var db = new QISEntities();

                var query = from u in db.Master_Plant
                            where u.plant_id.Equals(plant_id)
                            select u;

                var plant = query.First();
                plant.plant_name = plant_name;
                db.SaveChanges();

                return(Json(true));
            }
            catch (Exception)
            {
                return(Json(false));
            }
        }
Exemplo n.º 9
0
        public ActionResult AddProduct(string product_name, int plant_id, int group_id)
        {
            try
            {
                var db = new QISEntities();

                var product = new Master_Product();
                product.product_name     = product_name;
                product.plant_id         = plant_id;
                product.group_id         = group_id;
                product.product_del_flag = false;

                db.Master_Product.Add(product);
                db.SaveChanges();
                return(Json(true));
            }
            catch (Exception)
            {
                return(Json(false));
            }
        }
Exemplo n.º 10
0
        public ActionResult DeletePlant(int id = 0)
        {
            try
            {
                var db = new QISEntities();

                var plant = db.Master_Plant.Find(id);

                /*from u in db.Master_Plant
                 *      where u.plant_id.Equals(plant_id)
                 *      select u;
                 * var plant = query.FirstOrDefault();*/
                //db.Master_Plant.Remove(plant);
                plant.plant_del_flag = true;
                db.SaveChanges();
                return(Json(true));
            }
            catch (Exception)
            {
                return(Json(false));
            }
        }