示例#1
0
        public ActionResult AddPlant(string Sys_Plant_name)
        {
            try
            {
                using (var db = new SAEntities())
                {
                    TM_SysPlant plant = new TM_SysPlant();
                    plant.Sys_Plant_name = Sys_Plant_name;
                    plant.del_flag       = false;
                    plant.update_dt      = DateTime.Now;
                    plant.update_by      = Session["SA_Auth"].ToString();
                    db.TM_SysPlant.Add(plant);
                    db.SaveChanges();
                }

                //var db = new PCREntities();
                //PCR_Impact plant = new PCR_Impact();
                //plant.imp_name = Sys_Plant_name;
                //db.PCR_Impact.Add(plant);

                return(Json(true));
            }
            catch (Exception)
            {
                // Do some error logging stuff, handle exception, etc.
                return(Json(false));
            }
        }
示例#2
0
        private KeyValuePair <string, string> GetSAData(string sa_no)
        {
            SAEntities sa     = new SAEntities();
            var        get_sa = (from a in sa.v_tems
                                 where a.control_no == sa_no
                                 select new { a.status_name, a.expect_date }).First();
            string status    = "";
            string expect_dt = "";

            if (get_sa != null)
            {
                status    = get_sa.status_name;
                expect_dt = get_sa.expect_date.ToString("dd/MM/yyyy");
            }

            return(new KeyValuePair <string, string>(status, expect_dt));
        }