public CheckStatus() { objDashboard = new BAL.DeviceDataBAL(); objSubDevice = new Josheph.Framework.BusinessLayer.SubDeviceMasterBAL(); lstPlant = new BAL.PlantMasterBAL().GetAll(string.Empty); lstSubDevices = objSubDevice.GetAll(string.Empty); objLastStatus = new Josheph.Framework.BusinessLayer.PlantDeviceLastStatus(); }
//Save Entry public JsonResult SaveEntry(ENT.SubDeviceMasterSUB model, string SubDeviceId) { try { List <Guid> dctDuplication = new List <Guid>(); //if (model.DeviceId.ToString() == "00000000-0000-0000-0000-000000000000") { throw new Exception("Please Select Device Type."); } if (model.SubDeviceType.ToString() == "00000000-0000-0000-0000-000000000000") { throw new Exception("Please Select Sub Device Type."); } if (model.EntryMode == COM.MyEnumration.EntryMode.ADD) { model.Status = COM.MyEnumration.MyStatus.Active; List <ENT.SubDeviceMasterSUB> lstResult = new BAL.SubDeviceMasterBAL().CheckDuplicateCombination(dctDuplication, COM.MyEnumration.MasterType.SubDeviceMaster, model.SubDeviceName); if (lstResult.Count > 0) { throw new Exception("Device Name Already Exists."); } List <ENT.SubDeviceMasterSUB> lstResult2 = new BAL.SubDeviceMasterBAL().CheckDuplicateSerialNo(dctDuplication, COM.MyEnumration.MasterType.SubDeviceMaster, model.SerialNo); if (lstResult2.Count > 0) { throw new Exception("Serial No Already Exists.!"); } if (objBAL.Insert(model, "")) { GlobalVarible.AddMessage("Record Save Successfully"); } } else { model.CreatedDateTime = DateTime.Now; model.SubDeviceId = new Guid(SubDeviceId.Replace("/", "")); if (objBAL.Update(model)) { GlobalVarible.AddMessage("Record Update Successfully"); } } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }