Esempio n. 1
0
        internal static VoiceMail Load(string number, Context context)
        {
            VoiceMail  ret  = null;
            Connection conn = ConnectionPoolManager.GetConnection(typeof(VoiceMail));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(VoiceMail),
                                                                           new SelectParameter[] { new EqualParameter("Number", number),
                                                                                                   new EqualParameter("Context", context) });

            if (tmp.Count > 0)
            {
                ret = (VoiceMail)tmp[0];
            }
            conn.CloseConnection();
            if ((ret != null) && (!ret.ResetVMPassword))
            {
                List <Dictionary <string, string> > tpass = Utility.SelectFromFreeswitchDB(VM_DB, string.Format(VM_DB_PASS_SELECT, number));
                if (tpass.Count > 0)
                {
                    ret.Password = tpass[0]["password"];
                    ret.Update();
                }
            }
            return(ret);
        }