예제 #1
0
        public string InsertData(string ParameterName, string ParameterDesc, int IsAxis, int IsSensor, decimal LSL, decimal USL, int LogFrequency, int axisid, int logfreqid, int unit, string element, string subelement, string Deterioration, int IsCycle)
        {
            string res = "";
            var    doesThisPlantExist = db.configurationtblsensordatalinks.Where(m => m.IsDeleted == 0 && m.ParameterName == ParameterName && m.AxisID != axisid).ToList();

            if (doesThisPlantExist.Count == 0)
            {
                configurationtblsensordatalink tblpc = new configurationtblsensordatalink();
                tblpc.CreatedBy     = 1;
                tblpc.CreatedOn     = DateTime.Now;
                tblpc.IsDeleted     = 0;
                tblpc.ParameterName = ParameterName;
                tblpc.ParameterDesc = ParameterDesc;
                tblpc.IsCycle       = IsCycle;
                tblpc.IsAxis        = IsAxis;
                tblpc.IsSensor      = IsSensor;
                tblpc.Element       = element;
                tblpc.Unit          = unit;
                tblpc.SubElement    = subelement;
                tblpc.Deterioration = Deterioration;
                tblpc.LSL           = LSL;
                tblpc.LogFreqUnitID = logfreqid;
                tblpc.USL           = USL;
                tblpc.LogFrequency  = LogFrequency;
                tblpc.AxisID        = axisid;
                db.configurationtblsensordatalinks.Add(tblpc);
                db.SaveChanges();
                res = "success";
            }
            return(res);
        }
예제 #2
0
        //Get Method
        public ActionResult EditSensorDataLink(int id)
        {
            if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty))
            {
                return(RedirectToAction("Login", "Login", null));
            }
            ViewBag.Logout = Session["Username"].ToString().ToUpper();
            ViewBag.roleid = Session["RoleID"];
            String Username = Session["Username"].ToString();

            using (i_facility_unimechEntities db = new i_facility_unimechEntities())
            {
                configurationtblsensordatalink tblmc = db.configurationtblsensordatalinks.Find(id);
                if (tblmc == null)
                {
                    return(HttpNotFound());
                }
                ViewBag.FrequencyUnit = new SelectList(db.tblunits.Where(m => m.IsDeleted == 0), "U_id", "Unit", tblmc.LogFreqUnitID).ToList();
                ViewBag.Unit          = new SelectList(db.tblunits.Where(m => m.IsDeleted == 0), "U_id", "Unit", tblmc.LogFreqUnitID).ToList();
                ViewBag.Axis          = new SelectList(db.tbl_axisdet.Where(m => m.IsDeleted == 0), "AxisDetID", "AxisID", tblmc.AxisID).ToList();
                SensorDataLink sd = new SensorDataLink();
                sd.sensordatalink = tblmc;
                return(View(sd));
            }
        }
예제 #3
0
        // GET: SensorDataLink
        public ActionResult Index()
        {
            if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty))
            {
                return(RedirectToAction("Login", "Login", null));
            }
            ViewBag.Logout = Session["Username"].ToString().ToUpper();
            ViewBag.roleid = Session["RoleID"];
            String Username = Session["Username"].ToString();

            using (i_facility_unimechEntities db = new i_facility_unimechEntities())
            {
                SensorDataLink pa = new SensorDataLink();
                configurationtblsensordatalink mp = new configurationtblsensordatalink();
                pa.sensordatalink = mp;
                pa.sensordataList = db.configurationtblsensordatalinks.Where(m => m.IsDeleted == 0).ToList();
                return(View(pa));
            }
        }