public long GetLangId(Controller current, string lang) { long retorno = 1; lang = Session["lang_code"].ToString(); var x = PwdEncript.criptograph.Descriptografar("zEDSC8Lxh/P88a+UO9jQqw=="); dbconnection db = new dbconnection(); db.CFG_APLICATIVO = current.Server.MapPath("~/padv.cfg"); opInt.ERR_LOGERRFILENAME = current.Server.MapPath("~/App_Data/") + Properties.Settings.Default.ErrLogFileName; db.setERRLOGFILENAME = opInt.ERR_LOGERRFILENAME; if (!db.LOADCONFIG) { retorno = 0; throw new Exception(); } ConfigDB.Conexao_Parametros("DOMIT_SERVER", db.getDBNAME, db.getDBPWD, db.getDBTYPE, db.getDBUSER); var ret = ConfigDB.GetInstanciaCon().TestConnection(); current.Session["rcr"] = rcr; try { exist_languages exist_languages = new exist_languages(); // var languages = exist_languages.Consultar(); if (lang == null) { Session["lang_code"] = exist_languages.LangViaId(Convert.ToInt64(Session["lang_id"])); } } catch (Exception ex) { throw ex; } return(retorno); }
public Exist_UsersDto consultarUsuario(long user_id) { Exist_UsersDto usuario = new Exist_UsersDto(); try { Exist_UsersDtoCollection usuarios = new Exist_UsersDtoCollection(); string sql = "SELECT *FROM exist_users"; if (user_id != 0) { sql = sql + " WHERE user_id='" + user_id + "'"; } DataTable tabela = conexao.ExecutarConsulta(CommandType.Text, sql); foreach (DataRow item in tabela.Rows) { usuario.user_email = item["user_email"].ToString(); usuario.user_company = item["user_company"].ToString(); usuario.user_name = item["user_name"].ToString(); usuario.user_phone = item["user_phone"].ToString(); exist_languages exist_languages = new exist_languages(); long lang_id = Convert.ToInt64(item["lang_id"]); var lang_collections = exist_languages.Consultar(lang_id); if (lang_collections.Count > 0) { usuario.lang_id = lang_collections[0]; } if (item["user_date_expire"] != DBNull.Value) { usuario.user_date_expire = Convert.ToDateTime(item["user_date_expire"]); } if (item["user_date_register"] != DBNull.Value) { usuario.user_date_register = Convert.ToDateTime(item["user_date_register"]); } if (item["date_answer"] != DBNull.Value) { usuario.date_answer = Convert.ToDateTime(item["date_answer"]); } if (item["treatment"] != DBNull.Value) { usuario.treatment = item["treatment"].ToString(); } usuario.currency_id = Convert.ToInt64(item["currency_id"]); usuario.base_calc = Convert.ToInt32(item["base_calc"]); usuario.specie_id = Convert.ToInt64(item["specie_id"]); usuario.dose = Convert.ToInt64(item["dose"]); usuario.user_blocked = Convert.ToBoolean(item["user_blocked"]); usuario.user_id = Convert.ToInt64(item["user_id"]); usuario.user_password = item["user_password"].ToString(); usuario.user_country = Convert.ToInt64(item["user_country"]); CountriesDto countries = new CountriesDto() { country_id = Convert.ToInt64(item["user_country"]) }; usuario.user_admin = Convert.ToBoolean(item["user_admin"]); if (item["comments"] != DBNull.Value) { usuario.comments = item["comments"].ToString(); } if (item["user_accesslevel"] != DBNull.Value) { usuario.user_accesslevel = Convert.ToInt32(item["user_accesslevel"]); } if (item["lang_id"] != DBNull.Value) { usuario.lang_id.lang_id = Convert.ToInt64(item["lang_id"]); } if (item["table_id"] != DBNull.Value) { usuario.table_id = Convert.ToInt64(item["table_id"]); } if (item["measure_config_id"] != DBNull.Value) { usuario.measure_config_id = Convert.ToInt64(item["measure_config_id"]); } if (item["system_id"] != DBNull.Value) { usuario.system_id = Convert.ToInt64(item["system_id"]); } if (item["action"] != DBNull.Value) { usuario._action = Convert.ToInt32(item["action"]); } if (item["last_name"] != DBNull.Value) { usuario.last_name = item["last_name"].ToString(); } return(usuario); } return(null); } catch (Exception ex) { throw ex; } }