public string RoleDelete(TRoleModel mdl) { try { string ret = ""; var res = db.PTRoleDelete( mdl.IDRole, mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance) ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.RoleLabelRoleName, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (Exception err) { return("Err|" + err.InnerException.Message); } }
public String ModuleDelete(TModuleModel mdl) { try { db = new Hartama_IOTEntities(); string ret = ""; var res = db.PTModuleDelete( mdl.IDModule, mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance) ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelModule, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; } return(ret); } catch (Exception err) { return("Err|" + err.Message); } }
public String FeatureDuplicate(TFeatureModel mdl) { try { string ret = ""; var res = db.PTFeatureDuplicate( mdl.IDModule, mdl.IDFeatures, mdl.UserEntry, Convert.ToDateTime(mdl.DateEntry), mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance) ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.FeatureLabelFeature, retSplit[1]); //ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (Exception err) { return("Err|" + err.InnerException.Message); } }
/* Add by Irham 24 agustus 2015 for Update Site User*/ public String SiteUserSave(string IDSite, string ValueList, TSiteModel mdl) { try { string ret = ""; var res = db.PTSiteUserSave( IDSite, ValueList, mdl.UserEntry, Convert.ToDateTime(mdl.DateEntry), mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance) ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelSiteUser, retSplit[1]); } else { ret = "Err|" + res.Pesan; } return(ret); } catch (Exception err) { return("Err|" + err.InnerException.Message); } }
public String FeatureUpdateSequence(TFeatureModel mdl, string Dir) { try { string ret = ""; var res = db.PTFeatureUpdateSequence( mdl.IDModule, mdl.IDFeatures, Dir, mdl.FeaturesType ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.FeatureLabelFeature, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (Exception err) { return("Err|" + err.InnerException.Message); } }
public String ModuleUpdateSequence(string IDModule, string direction) { try { db = new Hartama_IOTEntities(); string ret = ""; var res = db.PTModuleUpdateSequence( IDModule, direction ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelModule, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (Exception err) { return("Err|" + err.Message); } }
public String UserDelete(TUserModel mdl) { try { string ret = ""; var res = db.PTUserDelete(mdl.IDUser, mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance)).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelUserName, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (SqlException e) { return("Err|" + e.InnerException.Message); //return "0|" + e.Message; } }
public string DeviceInsert(DeviceModel mdl) { try { db = new Hartama_IOTEntities(); string ret = ""; var res = db.InsertDevice( mdl.Device_Name, mdl.Device_category_ID, mdl.Device_Site_ID, mdl.Device_Description, mdl.UserEntry, DateTime.Now.ToShortDateString(), mdl.UserEntry, DateTime.Now.ToShortDateString(), mdl.UserEntry, mdl.MacAddress1, mdl.MacAddress2, mdl.MacAddress3 ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { //var retSplit = res.Pesan.Split('|'); //ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelSite, retSplit[1]); ret = "1"; } else { ret = res.Pesan; } return(ret); } catch (Exception err) { string ErrMsg = ""; if (err.GetType().Name == "EntityCommandExecutionException") { var SqlErr = err.InnerException as SqlException; if (SqlErr.Number == 52627) { var ErrSplit = SqlErr.Message.Split('|'); ErrMsg = TranslateMessageClass.TranslateMessage(ErrSplit[0], Resources.Resource.LabelSite, ErrSplit[1]); } } else { ErrMsg = err.InnerException.Message; } return(ErrMsg); } }
public String ModuleInsert(TModuleModel mdl) { try { db = new Hartama_IOTEntities(); string ret = ""; var res = db.PTModuleInsert( mdl.ModuleCode, mdl.ModuleName, mdl.ModuleDesc, mdl.UserEntry, Convert.ToDateTime(mdl.DateEntry), mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance), mdl.Sequence, mdl.IsDefault, mdl.IDIcon ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelModule, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (Exception err) { string ErrMsg = ""; if (err.GetType().Name == "EntityCommandExecutionException") { var SqlErr = err.InnerException as SqlException; if (SqlErr.Number == 52627) { var ErrSplit = SqlErr.Message.Split('|'); ErrMsg = TranslateMessageClass.TranslateMessage(ErrSplit[0], Resources.Resource.LabelModule, ErrSplit[1]); } } else { ErrMsg = err.InnerException.Message; } return("Err|" + ErrMsg); } }
public string SiteUpdate(TSiteModel mdl) { try { string ret = ""; var res = db.PTSiteUpdate( mdl.IDSite, mdl.SiteName, mdl.Address, mdl.PostCode, mdl.TelephoneNo, mdl.FaxNo, mdl.Email, mdl.PICSite, mdl.UserLastMaintenance, DateTime.Now, mdl.Discontinue, mdl.SiteLogo, 0 ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { //var retSplit = res.Pesan.Split('|'); //ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelSite, retSplit[1]); ret = "1"; } else { ret = res.Pesan; } return(ret); } catch (Exception err) { string ErrMsg = ""; if (err.GetType().Name == "EntityCommandExecutionException") { var SqlErr = err.InnerException as SqlException; if (SqlErr.Number == 52627) { var ErrSplit = SqlErr.Message.Split('|'); ErrMsg = TranslateMessageClass.TranslateMessage(ErrSplit[0], Resources.Resource.LabelSite, ErrSplit[1]); } } else { ErrMsg = err.InnerException.Message; } return(ErrMsg); } }
public string IconInsert(TIconModel mdl) { try { string ret = ""; var res = db.PTIconInsert( mdl.IconName, mdl.IconDesc, mdl.IconClass, mdl.IconType, mdl.IconPath, mdl.IconCategory, mdl.IsDefault, mdl.UserEntry, Convert.ToDateTime(mdl.DateEntry), mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance) ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.IconLabelIcon, retSplit[1]); } else { ret = "Err|" + res.Pesan; } return(ret); } catch (Exception err) { string ErrMsg = ""; if (err.GetType().Name == "EntityCommandExecutionException") { var SqlErr = err.InnerException as SqlException; if (SqlErr.Number == 52627) { var ErrSplit = SqlErr.Message.Split('|'); ErrMsg = TranslateMessageClass.TranslateMessage(ErrSplit[0], Resources.Resource.LabelIcon, ErrSplit[1]); } } else { ErrMsg = err.InnerException.Message; } return("Err|" + ErrMsg); } }
public string RoleInsert(TRoleModel mdl) { try { string ret = ""; var res = db.PTRoleInsert( mdl.Rolename, mdl.RoleDesc, mdl.Discontinue, mdl.UserEntry, Convert.ToDateTime(mdl.DateEntry), mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance) ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.RoleLabelRoleName, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (Exception err) { string ErrMsg = ""; if (err.GetType().Name == "EntityCommandExecutionException") { var SqlErr = err.InnerException as SqlException; if (SqlErr.Number == 52627) { var ErrSplit = SqlErr.Message.Split('|'); ErrMsg = TranslateMessageClass.TranslateMessage(ErrSplit[0], Resources.Resource.LabelRole, ErrSplit[1]); } } else { ErrMsg = err.InnerException.Message; } return("0"); } }
public string CategoryInsertorupdate(CategoryModel mdl) { try { db = new Hartama_IOTEntities(); string ret = ""; var res = db.InsertCategory( mdl.CategoryID, mdl.CategoryName, mdl.CategoryDescription, mdl.UserEntry ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { //var retSplit = res.Pesan.Split('|'); //ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelSite, retSplit[1]); ret = res.Pesan; } else { ret = res.Pesan; } return(ret); } catch (Exception err) { string ErrMsg = ""; if (err.GetType().Name == "EntityCommandExecutionException") { var SqlErr = err.InnerException as SqlException; if (SqlErr.Number == 52627) { var ErrSplit = SqlErr.Message.Split('|'); ErrMsg = TranslateMessageClass.TranslateMessage(ErrSplit[0], Resources.Resource.LabelSite, ErrSplit[1]); } } else { ErrMsg = err.InnerException.Message; } return(ErrMsg); } }
public string createoreditsensorparamdetail(string idsensor, string idcategory, decimal lower, decimal upper, string user) { try { db = new Hartama_IOTEntities(); string ret = ""; var res = db.CreateorEditSensor( idsensor, idcategory, lower, upper, user ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { //var retSplit = res.Pesan.Split('|'); //ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelSite, retSplit[1]); ret = "1"; } else { ret = res.Pesan; } return(ret); } catch (Exception err) { string ErrMsg = ""; if (err.GetType().Name == "EntityCommandExecutionException") { var SqlErr = err.InnerException as SqlException; if (SqlErr.Number == 52627) { var ErrSplit = SqlErr.Message.Split('|'); ErrMsg = TranslateMessageClass.TranslateMessage(ErrSplit[0], Resources.Resource.LabelSite, ErrSplit[1]); } } else { ErrMsg = err.InnerException.Message; } return(ErrMsg); } }
public string DeviceDelete(DeviceModel id) { try { db = new Hartama_IOTEntities(); string ret = ""; var res = db.DeleteDevice(id.Device_ID).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { //var retSplit = res.Pesan.Split('|'); //ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelSite, retSplit[1]); ret = "1"; } else { ret = res.Pesan; } return(ret); } catch (Exception err) { string ErrMsg = ""; if (err.GetType().Name == "EntityCommandExecutionException") { var SqlErr = err.InnerException as SqlException; if (SqlErr.Number == 52627) { var ErrSplit = SqlErr.Message.Split('|'); ErrMsg = TranslateMessageClass.TranslateMessage(ErrSplit[0], Resources.Resource.LabelSite, ErrSplit[1]); } } else { ErrMsg = err.InnerException.Message; } return(ErrMsg); } }
public String FeatureUpdate(TFeatureModel mdl) { try { string ret = ""; var res = db.PTFeatureUpdate( mdl.IDFeatures, mdl.FeaturesCode, mdl.FeaturesName, mdl.FeaturesDesc, mdl.FeaturesType, mdl.FeaturesAction, mdl.IsExternal, mdl.PathApp, mdl.UserLastMaintenance, Convert.ToDateTime(mdl.DateLastMaintenance), mdl.IDIcon ).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.FeatureLabelFeature, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (Exception err) { return("Err|" + err.InnerException.Message); } }
public String UserLocked(TUserInsertModel mdl) { try { string ret = ""; var res = db.PTUserUpdateLocked(mdl.IDUser, mdl.Locked, mdl.UserLastMaintenance, mdl.DateLastMaintenance).FirstOrDefault(); if (res.Error == 0 || res.Error == null) { var retSplit = res.Pesan.Split('|'); ret = TranslateMessageClass.TranslateMessage(retSplit[0], Resources.Resource.LabelUserName, retSplit[1]); ret = "1"; } else { ret = "Err|" + res.Pesan; ret = "0"; } return(ret); } catch (SqlException e) { return("Err|" + e.Message.ToString()); } }