Beispiel #1
0
 public Object ViewRecord(Int64 loggerID)
 {
     DataLoggerlist vwDataLogger = new DataLoggerlist();
     try
     {
         vwDataLogger = DAL.DALDataLogger.ViewDataLoggerRecord(Convert.ToInt32(loggerID));
     }
     catch (Exception ex)
     {
         throw;
     }
     return vwDataLogger;
 }
Beispiel #2
0
        public static DataLoggerlist ViewDataLoggerRecord(Int32 loggerid)
        {
            DataLoggerlist objlogger = new DataLoggerlist();
            using (var context = new SycousCon())
            {
                try
                {
                    objlogger = (from p in context.DataLoggers

                                 join N in context.NotificationMasters
                                 on p.RetrievalID equals N.NotificationID
                                 where (p.IsDeleted == 0  && N.DeleteStatus == 0 && p.ID == loggerid)
                                 orderby p.CreateDate descending
                                 select new DataLoggerlist()
                                 {
                                     ID = SqlFunctions.StringConvert((Double)p.ID),
                                     DataCollectorMake = p.DataCollectorMake,
                                     DataCollectorModel = p.DataCollectorModel,
                                     SerialNumber = p.SerialNumber,
                                     SimNumber = p.SerialNumber,
                                     Telephone = p.Telephone,
                                     Location = p.Location,
                                     Retrieval = N.NotificationName,
                                     IPAddress = p.IPAddress
                                 }).FirstOrDefault();
                    if (objlogger != null)
                    { return objlogger; }
                    else
                    {
                        objlogger = null;
                        return objlogger;
                    }
                }
                catch (Exception ex)
                {
                    context.Dispose();
                    throw;
                }
            }
        }
        public ActionResult PropertyMap(String mloggerID, String Type, String MapID)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
                ViewBag.RoleName = loginsession.RoleName;
                IEnumerable<DAL.MeterDetails> MeterList = null;
                try
                {

                    if (loginsession.ClientID != null)
                    {
                        ViewBag.ClientList = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text");
                    }
                    else
                    { ViewBag.ClientList = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text"); }

                    if( (mloggerID != null)&&(Type != null))
                    {
                        String _LoggerID = BAL.Security.URLDecrypt(mloggerID);
                        String _Type = BAL.Security.URLDecrypt(Type);
                        String _MapID = BAL.Security.URLDecrypt(MapID);
                        ViewBag.LoggerID = _LoggerID;

                        DAL.DataLoggerlist Logger = new DataLoggerlist();
                        Logger = BAL.DataLoggerModel.ViewDataLogger(_LoggerID);
                        ViewBag.LoggerID = Logger.ID;
                        ViewBag.LoogerSerial = Logger.SerialNumber;
                        ViewBag.TYPE = _Type;
                        ViewBag.MapID = _MapID;
                        DAL.DataLoggerMapping logger = new DataLoggerMapping();
                        if (_Type == "Assign")
                        {

                            logger = DAL.DALDataLogger.ViewDataLoggerMappingRecord(_MapID);

                        }

                        if (_Type == "Assign")
                        {
                            ViewBag.ClientList = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text", logger.ClientID);
                            ViewBag.ClientName = logger.Client;
                            ViewBag.SiteList = new SelectList(BAL.SiteModel.SiteDropDownList(loginsession.UserID.ToString(), Convert.ToInt64(logger.ClientID), loginsession.UserType.ToString(), loginsession.RoleName), "Value", "Text", logger.SiteID);
                            ViewBag.siteName = logger.Site;

                            ViewBag.Communication = new SelectList(BAL.CommunicationModel.CommunicationDropDownList(), "Value", "Text", logger.CommunicationID);
                            ViewBag.CommunicationName = logger.Communication;
                            ViewBag.StartDatevalue = logger.StartDate;

                            MeterList = BAL.DataLoggerModel.GetMeterDeatailsRecordList(logger.DataloggerID, logger.ClientID, logger.SiteID);

                            return View(MeterList);
                        }
                        else
                        {
                            ViewBag.ClientName = "";
                            ViewBag.siteName = "";
                            ViewBag.CommunicationName = "";
                            ViewBag.StartDatevalue = "";
                            ViewBag.SiteList = new SelectList(BAL.Common.Default_DDR(), "Value", "Text");
                            ViewBag.Communication = new SelectList(BAL.CommunicationModel.CommunicationDropDownList(), "Value", "Text");

                            if (loginsession.ClientID != null)
                            {
                                ViewBag.ClientList = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text");
                            }
                            else
                            { ViewBag.ClientList = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text"); }
                            return View();
                        }

                        //DataLoggerMapClass logger = new DataLoggerMapClass();
                        //DataLoggerMaster loggermaster = new DataLoggerMaster();
                        //loggermaster = BAL.DataLoggerModel.EditDataLogger(Dec_LoggerID);
                        //logger.LoggerId = Convert.ToInt32(Dec_LoggerID);
                        //logger.LoggerSerial = loggermaster.SerialNumber;

                    }
                    else
                    {
                        return View();
                    }

                }
                catch (Exception ex)
                {
                    return Content("ErrorMessage" + ":" + ex.StackTrace.ToString());
                }

            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
        public ActionResult PropertyMap()
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
                ViewBag.RoleName = loginsession.RoleName;
                IEnumerable<DAL.MeterDetails> MeterList = null;
                try
                {

                    String LoggerID = Request.Form["hdLoggerID"];
                    String Client = Request.Form["Client"];
                    String Site = Request.Form["Site"];
                    String Type = Request.Form["hdType"];
                    String MapID = Request.Form["hdMapID"];

                    if ((loginsession.ClientID != null)&&(Client !=null))
                    {
                        ViewBag.ClientList = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text", Client);

                        ViewBag.SiteList = new SelectList(BAL.SiteModel.SiteDropDownList(loginsession.UserID.ToString(), Convert.ToInt64(Client), loginsession.UserType.ToString(), loginsession.RoleName), "Value", "Text", Site);
                    }
                    else
                    { ViewBag.ClientList = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text"); }
                    ViewBag.Communication = new SelectList(BAL.CommunicationModel.CommunicationDropDownList(), "Value", "Text");

                    if (LoggerID != null)
                    {
                        ViewBag.LoggerID = LoggerID;
                        DAL.DataLoggerlist Logger = new DataLoggerlist();
                        Logger = BAL.DataLoggerModel.ViewDataLogger(LoggerID);
                        ViewBag.LoggerID = Logger.ID;
                        ViewBag.LoogerSerial = Logger.SerialNumber;
                    }

                    ViewBag.TYPE = Type;
                    ViewBag.MapID = MapID;
                    DAL.DataLoggerMapping logger = new DataLoggerMapping();
                    if (Type == "Assign")
                    {

                        logger = DAL.DALDataLogger.ViewDataLoggerMappingRecord(MapID);
                        MeterList = BAL.DataLoggerModel.GetMeterDeatailsRecordList(logger.DataloggerID, logger.ClientID, logger.SiteID);
                    }
                    else
                    {
                        if ((LoggerID != null) && (Client != null) && (Site != null))
                        {
                            MeterList = BAL.DataLoggerModel.GetMeterDeatailsRecordList(LoggerID, Client, Site);
                        }
                    }
                    return View(MeterList);
                }
                catch (Exception ex)
                {
                    return Content("ErrorMessage" + ":" + ex.StackTrace.ToString());
                }

            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
 public ActionResult DView(String LoggerID)
 {
     if (Session["Login"] != null)
     {
         LoginSession loginsession = (LoginSession)Session["Login"];
         ViewBag.CompanyLogo = loginsession.CompanyLogo;
         ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
         String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
         String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
         ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
         ViewBag.RoleName = loginsession.RoleName;
         if (LoggerID != null)
         {
             String Dec_LoggerID = BAL.Security.URLDecrypt(LoggerID);
             DataLoggerlist logger = new DataLoggerlist();
             if ((Dec_LoggerID != "0") && (Dec_LoggerID != null))
             {
                 logger = BAL.DataLoggerModel.ViewDataLogger(Dec_LoggerID);
             }
             return View(logger);
         }
         else
         { return RedirectToAction("Index", "DataLogger"); }
     }
     else
     { return RedirectToAction("Index", "Home"); }
 }