public ActionResult Assign(String mMapID) { 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 (mMapID != null) { try { String DecMapID = BAL.Security.URLDecrypt(mMapID); DAL.DataLoggerMapping logger = new DataLoggerMapping(); logger = DAL.DALDataLogger.ViewDataLoggerMappingRecord(DecMapID); DataLoggerMapClass lg = new DataLoggerMapClass(); lg.Mapid = Convert.ToInt64(DecMapID); lg.LoggerSerial = logger.LoggerSerial; lg.ClientName = logger.Client; lg.SiteName = logger.Site; lg.CommunicationName = logger.Communication; lg.StartDate = logger.StartDate; ViewBag.MapID = DecMapID; return View(lg); } catch (Exception ex) { Console.Write(ex.Message); } } return View(); } else { return RedirectToAction("Index", "Home"); } }
public static Boolean UpdateDataloggerMapping(DataLoggerMapClass loggerObj) { Boolean flag = false; try { BALDataLogger objlogger = new BALDataLogger(); flag = objlogger.UpdateMapping(loggerObj); } catch (Exception ex) { throw; } return flag; }
public Boolean UpdateMapping(DataLoggerMapClass loggerobj) { Boolean flag = false; try { SiteInLogger _logger = new SiteInLogger(); if (loggerobj.Mapid != null) { _logger.MapID = Convert.ToInt64(loggerobj.Mapid); } if (loggerobj.EndDate != null) { _logger.Enddate = Common.DateGB(loggerobj.EndDate); } _logger.ModifyBy = loggerobj.modifyBy; _logger.ModifyDate = DateTime.Now; if ((_logger.MapID != null) && (_logger.Enddate != null)) { flag = DAL.DALDataLogger.UpdateDataLoggerMapping(_logger); } } catch (Exception ex) { throw; } return flag; }
public Boolean CreateMapping(DataLoggerMapClass loggerobj) { Boolean flag = false; try { SiteInLogger _logger = new SiteInLogger(); if (loggerobj.ClientId != null) { _logger.ClientID = loggerobj.ClientId; } if (loggerobj.SiteId != null) { _logger.SiteID = loggerobj.SiteId; } if (loggerobj.LoggerId != null) { _logger.LoggerID = loggerobj.LoggerId; } if (loggerobj.CommunicationId != null) { _logger.CommunicationID = loggerobj.CommunicationId; } if (loggerobj.StartDate != null) { _logger.StartDate = Common.DateGB(loggerobj.StartDate); } _logger.CreateBy = loggerobj.CreateBy; _logger.CreateDate = DateTime.Now; if ((_logger.LoggerID != null) && (_logger.ClientID != null) && (_logger.SiteID != null) && (_logger.CommunicationID != null)) { flag = DAL.DALDataLogger.CreateDataLoggerMapping(_logger); } } catch (Exception ex) { throw; } return flag; }
public ActionResult UnAssign(String mloggerID) { 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; try { if (loginsession.ClientID != null) { ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text"); } else { ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text"); } ViewBag.Communication = new SelectList(BAL.CommunicationModel.CommunicationDropDownList(), "Value", "Text"); if (mloggerID != null) { String Dec_LoggerID = BAL.Security.URLDecrypt(mloggerID); ViewBag.LoggerID = Dec_LoggerID; DataLoggerMapClass logger = new DataLoggerMapClass(); DataLoggerMaster loggermaster = new DataLoggerMaster(); loggermaster = BAL.DataLoggerModel.EditDataLogger(Dec_LoggerID); logger.LoggerId = Convert.ToInt32(Dec_LoggerID); logger.LoggerSerial = loggermaster.SerialNumber; return View(logger); } else { return View(); } } catch (Exception ex) { return Content("ErrorMessage" + ":" + ex.StackTrace.ToString()); } } else { return RedirectToAction("Index", "Home"); } }
public ActionResult SaveUnAssign(DataLoggerMapClass model) { if (Session["Login"] != null) { if (ModelState.IsValid) { try { LoginSession loginsession = (LoginSession)Session["Login"]; model.CreateBy = Convert.ToInt64(loginsession.UserID); if (BAL.DataLoggerModel.CreateDataloggerMapping(model)) { return Json(new { result = 1, message = "Record was successfully Saved!" }); } else { return Json(new { result = 0, message = "Duplicate Record " }); } } catch (Exception ex) { return Json(new { result = 0, message = "ErrorMessage" + ":" + ex.StackTrace.ToString() }); } } else { String errorMessage = String.Empty; String exception = String.Empty; foreach (var modelStateVal in ViewData.ModelState.Values) { foreach (var error in modelStateVal.Errors) { errorMessage = error.ErrorMessage; exception = error.Exception.ToString(); } } return Json(new { result = 0, message = "ErrorMessage" + ":" + exception }); } } else { return RedirectToAction("Index", "Home"); } }