public ActionResult DeleteAppliance(long AppKey) { DigitalApplianceAPIController _api = new DigitalApplianceAPIController(); ApplianceMaster _Appliance = _api.GetAppliance(strEmail, AppKey); return(View(_Appliance)); }
public async Task <ActionResult> CreateAppliance(ApplianceMaster Model) { DigitalApplianceAPIController _api = new DigitalApplianceAPIController(); _api.CreateAppliance(strEmail, Model.ApplianceName, Model.ApplianceDesc); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteAppliance(ApplianceMaster Model) { DigitalApplianceAPIController _api = new DigitalApplianceAPIController(); _api.UpdateAppliance(strEmail, Model.ApplianceKey, "", "", "N"); return(RedirectToAction("Index")); }
public IEnumerable <ApplianceMaster> GetAllAppliances(string ConnString, string Email, long ApplianceKey, out string ReturnMessage) { try { string SQLQuery = "select appliance_key, appliance_name, appliance_desc,user_email, status_on_off, last_status_change , active_yn " + " from digital_appliance " + " where upper(user_email) = '" + Email.ToUpper() + "' "; if (ApplianceKey > 0) { SQLQuery = SQLQuery + " and appliance_key = " + ApplianceKey; } DataTable _result = DataAccess.GetData(ConnString, SQLQuery); List <ApplianceMaster> lstAppMaster = new List <ApplianceMaster>(); ApplianceMaster lappMaster; foreach (DataRow dtr in _result.Rows) { lappMaster = new ApplianceMaster(); lappMaster.ApplianceKey = dtr.Field <long>("appliance_key"); lappMaster.ApplianceName = dtr.Field <string>("appliance_name"); lappMaster.ApplianceDesc = dtr.Field <string>("appliance_desc"); lappMaster.UserEmail = dtr.Field <string>("user_email"); lappMaster.StatusOnOff = dtr.Field <string>("status_on_off"); lappMaster.LastStatusChanged = dtr.Field <DateTime?>("last_status_change").ToString(); lappMaster.ActiveYN = dtr.Field <string>("active_yn"); lstAppMaster.Add(lappMaster); } ReturnMessage = "SUCCESS"; return(lstAppMaster); } catch (Exception ex) { ReturnMessage = ex.Message; throw; } }
public ApplianceMaster GetAppliance(string Email, long ApplianceKey) { string _outMessage = ""; try { ApplianceMaster _app = new ApplianceMaster(); BusinessLogic objBusinessLogic = new BusinessLogic(); ApplianceMaster lstResult = objBusinessLogic.GetAppliances(ApplianceKey, _connStr, Email, out _outMessage); if (_outMessage == "SUCCESS") { return(lstResult); } else { return(null); } } catch { return(null); } }