LogError() public static méthode

public static LogError ( String msg ) : void
msg String
Résultat void
Exemple #1
0
        private void ReaderLoop()
        {
            while (_Active)
            {
                Thread.Sleep(5);

                if (_Handle != IntPtr.Zero && _Connected)
                {
                    byte[] buff = new byte[REPORT_LENGTH];

                    try
                    {
                        CHIDAPI.ReadTimeout(_Handle, out buff, REPORT_LENGTH, 100);
                    }
                    catch (Exception e)
                    {
                        CLog.LogError("(WiiMoteLib) Error reading from device: " + e.ToString());
                    }

                    if (ParseInputReport(buff))
                    {
                        if (WiiMoteChanged != null)
                        {
                            WiiMoteChanged(this, new WiiMoteChangedEventArgs(_WiiMoteState));
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        ///     Loads the currently selected theme trying all others if current theme failed loading<br />
        ///     Therefore CConfig.Theme/Skin might be changed!<br />
        ///     Closes the program on failure!
        /// </summary>
        public static void Load()
        {
            CTheme theme = _Themes.FirstOrDefault(th => th is CBaseTheme && th.Name == CConfig.Config.Theme.Theme) ?? _Themes.FirstOrDefault(th => th is CBaseTheme);

            while (theme != null)
            {
                if (theme.Load())
                {
                    break;
                }
                theme.Unload();
                CLog.LogError("Failed to load theme " + theme + "! Removing...", true);
                _Themes.Remove(theme);
                theme = _Themes.FirstOrDefault(th => th is CBaseTheme);
            }
            CurrentThemes.Add(-1, theme);
            if (theme == null)
            {
                CLog.LogError("No themes found! Cannot continue!", true, true);
            }
            else
            {
                CConfig.Config.Theme.Theme = theme.Name;
                CConfig.Config.Theme.Skin  = theme.CurrentSkin.Name;
                int[] ids = _Themes.Select(th => th.PartyModeID).Distinct().ToArray();
                foreach (int id in ids.Where(id => id >= 0))
                {
                    LoadPartymodeTheme(id);
                }
            }
        }
        // GET: Group/Edit/5
        public ActionResult Edit(int id)
        {
            try
            {
                GroupModels Group = new GroupModels();
                UserID = Session[CConfig.SESSION_USERID] == null ? 1 : Convert.ToInt32(Session[CConfig.SESSION_USERID]);

                Group = data.GetGroupByID(id);
                ViewData["ListRule"] = data.GetAccessRights(id);
                TempData["MenuList"] = new SelectList(data.GetListMenu(), "ID", "Name");
                TempData.Keep("MenuList");

                ViewData["ListGroupType"] = new SelectList(data.GetGroupTypeList(UserID), "ID", "NameVN", Group.GroupType);
                ViewData["Hotel"]         = new SelectList(dataNam.getListHotels(), "Code", "Name", Group.SysHotelCode);

                TempData["ListGroupMenu"] = data.GetListGroupMenu(id);
                TempData.Keep("ListGroupMenu");
                return(View(Group));
            }
            catch (Exception ex)
            {
                CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex));
                return(View());
            }
        }
Exemple #4
0
        /// <summary>
        /// Thực hiện các thao tác Insert, Update và Delete dữ liệu trong CSDL
        /// với các câu lệnh truy vấn SQL có sử dụng tham số
        /// </summary>
        /// <param name="sqlQuery">Câu lệnh truy vấn SQL</param>
        /// <param name="paramArr">Mảng tham số truyền vào cho câu lệnh SQL</param>
        /// <param name="sqlCT" >Kiểu Store Procedure hay kiểu Text</param>
        public bool ExecuteNonQuery(string sqlQuery, SqlParameter[] paramArr, CommandType sqlCT)
        {
            bool functionReturnValue = false;

            if ((_OpenConnection() == false))           // Open Connection
            {
                return(false);
            }

            //Tạo đối tượng dbCommand với câu lệnh SQL truyền vào và thiết lập tham số
            SqlCommand sqlCmd = CreateDbCommand(sqlQuery, paramArr, sqlCT);

            try
            {
                /*Log before execute*/
                CLog.LogSQL(GetParamInfo(), sqlQuery);

                //Thực thi câu lệnh truy vấn
                sqlCmd.ExecuteNonQuery();
                sqlCmd.Parameters.Clear();
                functionReturnValue = true;
            }
            catch (SqlException ex)
            {
                /*Log error execute*/
                CLog.LogError(GetParamInfo(), ex.Message);

                functionReturnValue = false;
                throw ex;
            }
            finally {
                _CloseConnection();
            }
            return(functionReturnValue);
        }
Exemple #5
0
        protected override bool _LoadSkin()
        {
            CSkin skin = null;

            for (int i = 0; i < 3; i++)
            {
                skin = _GetSkinToLoad(i);
                if (skin == null)
                {
                    continue;
                }
                if (skin.Load())
                {
                    break;
                }
                skin.Unload();
                CLog.LogError("Failed to load skin " + skin + "! Removing...", true);
                _Skins.Remove(skin.Name);
            }
            if (skin == null)
            {
                return(false);
            }
            CurrentSkin = skin;
            return(true);
        }
Exemple #6
0
        private bool _OpenVideoStream()
        {
            int        videoStreamIndex;
            SACDecoder decoder;

            try
            {
                _Videodecoder    = CAcinerella.AcCreateVideoDecoder(_Instance);
                decoder          = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder));
                videoStreamIndex = decoder.StreamIndex;
            }
            catch (Exception)
            {
                CLog.LogError("Error opening video file (can't find decoder): " + _FileName);
                return(false);
            }

            if (videoStreamIndex < 0)
            {
                return(false);
            }

            _Width  = decoder.StreamInfo.VideoInfo.FrameWidth;
            _Height = decoder.StreamInfo.VideoInfo.FrameHeight;

            if (decoder.StreamInfo.VideoInfo.FramesPerSecond > 0)
            {
                _FrameDuration = 1f / (float)decoder.StreamInfo.VideoInfo.FramesPerSecond;
            }

            _Framebuffer.Init(_Width * _Height * 4);
            _FrameAvailable = false;
            return(true);
        }
Exemple #7
0
        private bool _CreateDB()
        {
            if (_Connection == null)
            {
                return(false);
            }

            try
            {
                using (SQLiteCommand command = new SQLiteCommand(_Connection))
                {
                    command.CommandText = "CREATE TABLE IF NOT EXISTS Version (Value INTEGER NOT NULL);";
                    command.ExecuteNonQuery();

                    command.CommandText = "INSERT INTO Version (Value) VALUES(0)";
                    command.ExecuteNonQuery();

                    command.CommandText = "CREATE TABLE IF NOT EXISTS Images ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
                                          "Path TEXT NOT NULL, width INTEGER NOT NULL, height INTEGER NOT NULL);";
                    command.ExecuteNonQuery();

                    command.CommandText = "CREATE TABLE IF NOT EXISTS ImageData ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
                                          "ImageID INTEGER NOT NULL, Data BLOB NOT NULL);";
                    command.ExecuteNonQuery();
                }
            }
            catch (Exception e)
            {
                CLog.LogError("Error creating Ressource DB " + e);
                return(false);
            }
            return(true);
        }
Exemple #8
0
        public bool _Load(string file)
        {
            File = file;
            SPlaylist data;

            try
            {
                var xml = new CXmlDeserializer();
                data = xml.Deserialize <SPlaylist>(File);
            }
            catch (Exception e)
            {
                CLog.LogError("Cannot load playlist from " + file + ": " + e.Message);
                return(false);
            }
            Name  = data.Info.Name;
            Songs = new List <CPlaylistSong>();
            foreach (SPlaylistSong songEntry in data.Songs)
            {
                CSong plSong = CSongs.AllSongs.FirstOrDefault(song => song.Artist == songEntry.Artist && song.Title == songEntry.Title);
                if (plSong == null)
                {
                    CLog.LogError("Can't find song '" + songEntry.Title + "' from '" + songEntry.Artist + "' in playlist file: " + File);
                }
                else
                {
                    var playlistSong = new CPlaylistSong(plSong.ID, songEntry.GameMode);
                    Songs.Add(playlistSong);
                }
            }
            return(true);
        }
Exemple #9
0
        private bool _CreateCoverDB()
        {
            try
            {
                using (var command = new SQLiteCommand(_Connection))
                {
                    command.CommandText = "CREATE TABLE IF NOT EXISTS Version (Value INTEGER NOT NULL);";
                    command.ExecuteNonQuery();

                    command.CommandText = "INSERT INTO Version (Value) VALUES(@Value)";
                    command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.DatabaseCoverVersion;
                    command.ExecuteNonQuery();

                    command.CommandText = "CREATE TABLE IF NOT EXISTS Cover ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
                                          "Path TEXT NOT NULL, width INTEGER NOT NULL, height INTEGER NOT NULL);";
                    command.ExecuteNonQuery();

                    command.CommandText = "CREATE TABLE IF NOT EXISTS CoverData ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
                                          "CoverID INTEGER NOT NULL, Data BLOB NOT NULL);";
                    command.ExecuteNonQuery();
                }
            }
            catch (Exception e)
            {
                CLog.LogError("Error creating Cover DB " + e);
                return(false);
            }
            return(true);
        }
Exemple #10
0
 /// <summary>
 ///     Removes all textures from the screen
 /// </summary>
 protected override void _ClearScreen()
 {
     if (_Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0).IsFailure)
     {
         CLog.LogError("Failed to clear the backbuffer");
     }
 }
Exemple #11
0
        //===================================== Add Brand =====================================//
        static public SportModels.ResponseModel Api_Sport_Brand_Add_BLL(SportModels.BrandModel BM)
        {
            SportModels.ResponseModel RM = new SportModels.ResponseModel();

            try
            {
                //lay du lieu tu DAL, return
                SportModels.DALOutput DALO = new SportModels.DALOutput();

                DALO = CSqlSport.Api_Sport_Brand_Add_DAL(BM);

                // response info (success)
                RM.Code    = DALO.ErrorCode;
                RM.Message = DALO.ErrorMessage;
                RM.Data    = DALO.SqlData;
            }
            catch (Exception ex)
            {
                // log error
                CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex));
                // response info (error)
                RM.Code    = CBase.GetLayerErrorCode(CBase.LAYER.BLL);
                RM.Message = ex.Message;
                RM.Data    = null;
            }

            // return
            return(RM);
        }
Exemple #12
0
 protected override void _OnAfterDraw()
 {
     _RenderVertexBuffer();
     if (_Device.EndScene().IsFailure)
     {
         CLog.LogError("Failed to end scene");
     }
     try
     {
         //Now push the frame to the Viewport
         _Device.Present();
     }
     catch (Direct3D9Exception)
     {
         //In Direct3D devices can get lost.
         //This happens for example when opening the Task Manager in Vista/Windows 7 or if a UAC message is opening
         //We need to reset the device to get it to workable state again
         //After a reset Init() needs to be called because all data in the Direct3D default pool are lost and need to be recreated
         if (_Device.TestCooperativeLevel() == ResultCode.DeviceNotReset)
         {
             _Reset();
             _InitDevice();
         }
     }
     Application.DoEvents();
 }
Exemple #13
0
 protected override void _OnBeforeDraw()
 {
     if (_Device.BeginScene().IsFailure)
     {
         CLog.LogError("Failed to begin scene");
     }
 }
Exemple #14
0
        public static int ReadTimeout(IntPtr device, ref byte[] data, int length, int milliseconds)
        {
            IntPtr dataPtr = Marshal.AllocHGlobal(length);
            int    bytesRead;

            try
            {
                bytesRead = hid_read_timeout(device, dataPtr, length, milliseconds);
            }
            catch (Exception e)
            {
                bytesRead = -1;
                CLog.LogError("Error CHIDAPI.ReadTimeout(): " + e);
            }

            if (bytesRead != -1)
            {
                Marshal.Copy(dataPtr, data, 0, bytesRead);
            }
            else
            {
                data = null;
            }

            Marshal.FreeHGlobal(dataPtr);

            return(bytesRead);
        }
 public void LoadVerionInfo()
 {
     if (this.m_OnLoadingProcess == true)
     {
         return;
     }
     this.m_OnLoadingProcess = true;
     this.m_Request.Get((result) => {
         var json               = result.ToJSONObject();
         var version            = int.Parse(json["version"].ToString());
         var subVersion         = json["subVersion"].ToString();
         var assetBundleUrl     = json["assetBundleUrl"].ToString();
         this.m_CurrentTime     = DateTime.UtcNow.Ticks;                  // long.Parse (json["serverTime"].ToString());
         this.m_ResourceManager = new CDownloadResourceManager(version, subVersion, assetBundleUrl);
         // COMPLETE
         this.DownloadResource();
         // UPDATE REFERENCES
         CTaskUtil.REFERENCES[CTaskUtil.VERSION] = subVersion;
         this.m_OnLoadingProcess = false;
         this.m_UILoading.SetUpUILoading(subVersion);
     }, (error) => {
         CLog.LogError(error);
         // FAIL
         this.OnTaskFail();
         this.m_OnLoadingProcess = false;
     }, null);
 }
Exemple #16
0
        public static int Read(IntPtr Device, out byte[] Data, int length)
        {
            Data = new byte[length];
            IntPtr data = Marshal.AllocHGlobal(length);

            int result = -1;

            try
            {
                result = hid_read(Device, data, length);
            }
            catch (Exception e)
            {
                result = -1;
                CLog.LogError("Error CHIDAPI.Read(): " + e.ToString());
            }

            if (result != -1)
            {
                Marshal.Copy(data, Data, 0, result);
            }
            else
            {
                Data = null;
            }

            Marshal.FreeHGlobal(data);
            return(result);
        }
Exemple #17
0
        private void _ReaderLoop()
        {
            var buff = new byte[_ReportLength];

            while (Connected)
            {
                int bytesRead;
                try
                {
                    bytesRead = CHIDApi.ReadTimeout(_Handle, ref buff, _ReportLength, 400);
                    if (bytesRead == -1)
                    {
                        Connected = false; //Disconnected
                        Connect();
                        break;
                    }
                }
                catch (Exception e)
                {
                    CLog.LogError("(WiiMoteLib) Error reading from device: " + e);
                    Connected = false;
                    break;
                }

                if (bytesRead > 0 && _ParseInputReport(buff))
                {
                    if (WiiMoteChanged != null)
                    {
                        WiiMoteChanged.Invoke(this, new CWiiMoteChangedEventArgs(_WiiMoteState));
                    }
                }
                Thread.Sleep(5);
            }
            CHIDApi.Close(_Handle);
        }
Exemple #18
0
        private bool _OnMessage(Message msg)
        {
            if (msg == null || msg.Handle == IntPtr.Zero)
            {
                return(true);
            }
            switch (msg.Type)
            {
            case MessageType.Eos:
                if (_Loop)
                {
                    Position = 0;
                }
                else
                {
                    _IsFinished = true;
                }
                break;

            case MessageType.Error:
                GException error;
                string     debug;
                msg.ParseError(out error, out debug);
                CLog.LogError("Gstreamer error: message" + error.Message + ", code" + error.Code + " ,debug information" + debug);
                return(false);

            case MessageType.DurationChanged:
                _UpdateDuration();
                break;
            }
            msg.Dispose();
            return(true);
        }
Exemple #19
0
        //Copies a frame to the buffer but does not set it as 'written'
        //Returns true if frame data is now in buffer
        private bool _CopyDecodedFrameToBuffer()
        {
            bool       result;
            SACDecoder decoder;

            try
            {
                decoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder));
            }
            catch (Exception e)
            {
                CLog.LogError("Couldn't copy the frame to the managed environment.", false, false, e);
                return(false);
            }

            if (decoder.Buffer != IntPtr.Zero)
            {
                _LastDecodedTime = (float)decoder.Timecode;
                result           = _Framebuffer.Put(decoder.Buffer, _LastDecodedTime);
            }
            else
            {
                result = false;
            }
            _FrameAvailable = false;
            return(result);
        }
        public bool checkPermission(DataTable dt, string str, string action)
        {
            bool result = false;

            DataRow[] dtSelect = new DataRow[dt.Rows.Count];
            try
            {
                dtSelect = dt.Select("Model = '" + str + "'");
                foreach (DataRow row in dtSelect)
                {
                    if (row[action].ToString() == "1")
                    {
                        if (result == false)
                        {
                            result = true;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                //if (dt.Select("Model = '"+ str +"'")[0][action].ToString() == "True")
            }
            catch (Exception ex)
            {
                result = false;
                CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex));
            }
            return(result);
        }
Exemple #21
0
        /// <summary>
        /// Lấy về DataReader
        /// </summary>
        /// <param name="sqlQuery">Câu truy vấn lấy dữ liệu</param>
        /// <param name="sqlConn">Đối tượng kết nối cần sử dụng</param>
        /// <param name="paramArr">Mảng chứa các tham số truyền cho câu truy vấn </param>
        /// <param name="sqlCT">Kiểu truy vấn: Text hoặc Stored Procedure</param>
        /// <returns>Đối tượng DataReader chứa dữ liệu cần lấy</returns>
        public SqlDataReader ExecuteReader(string sqlQuery, SqlParameter[] paramArr, CommandType sqlCT)
        {
            if ((_OpenConnection() == false))           // Open Connection
            {
                return(null);
            }

            //Tạo đối tượng dbCommand với câu lệnh SQL truyền vào và thiết lập tham số
            SqlCommand sqlCmd = CreateDbCommand(sqlQuery, paramArr, sqlCT);

            try
            {
                /*Log before execute*/
                CLog.LogSQL(GetParamInfo(), sqlQuery);

                m_DataReader = sqlCmd.ExecuteReader();
                sqlCmd.Parameters.Clear();
                sqlCmd.Dispose();
            }
            catch (Exception ex)
            {
                /*Log error execute*/
                CLog.LogError(GetParamInfo(), ex.Message);

                m_DataReader = null;
                throw ex;
            }
            finally
            {
                _CloseConnection();
            }
            return(m_DataReader);
        }
        // GET: Group/Detail/5
        public ActionResult DetailBooking(string BookingCode)
        {
            List <string> json = new List <string>();
            DataSet       ds   = new DataSet();

            try
            {
                UserID    = Session[CConfig.SESSION_USERID] == null ? 1 : Convert.ToInt32(Session[CConfig.SESSION_USERID]);
                HotelCode = Session[CConfig.SESSION_HOTELCODE].ToString();

                //Lấy danh sách giá thời điểm
                ViewData["giathoidiem"] = new SelectList(data.GetList_DefineCategory("GIATHOIDIEM", UserID), "Value", "Name");
                //Lấy danh sách khung giá phòng
                ViewData["khunggiaphong"] = new SelectList(data.GetList_DefineCategory("KHUNGGIAPHONG", UserID), "Value", "Name");

                if (HotelCode == null)
                {
                    Response.Redirect("Receptionist/BookingList");
                }
                json = data.GetReservationRoom_Detail(BookingCode, HotelCode, UserID);
                //ds = data.GetReservationRoom_Detail( BookingCode, HotelCode, UserID);
                //Thông tin đặt phòng
                ViewData["BookingInfo"] = json[0];
                // thong tin phong
                ViewData["SetRoom"] = json[1];
                //Thông tin khách hàng
                ViewData["CustomerInfo"] = json[2];
            }
            catch (Exception ex)
            {
                CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex));
            }
            return(View());
        }
Exemple #23
0
        //Ham nay thuc hien viec ket noi voi database
        //COMMAND => The time in seconds to wait for the command to execute. The default is 30 seconds.
        public bool _OpenConnection()
        {
            bool functionReturnValue = false;

            try
            {
                if (m_Connection == null || m_Connection.State == ConnectionState.Closed) // 2015-07-16 09:33:40 ngocta2 => bug: open 2 connection, close 1
                {
                    // CHUA OPEN roi thi tao new connection
                    m_Connection = new SqlConnection(this.m_ConnectionString);
                    m_Connection.Open();
                    functionReturnValue = true;
                }
                else
                {
                    if (m_Connection.State == ConnectionState.Open)
                    {
                        // OPEN roi thi ko tao connection nua
                        functionReturnValue = true;
                    }
                }
            }
            catch (Exception ex)
            {
                functionReturnValue = false;
                CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex));
            }
            return(functionReturnValue);
        }
        /// <summary>
        /// get set room
        /// </summary>
        /// <param name="BookingCode"></param>
        /// <returns></returns>
        public JsonResult GetRoomForReservationRoom(string BookingCode)
        {
            List <string> json = new List <string>();
            DataSet       ds   = new DataSet();

            try
            {
                UserID    = Session[CConfig.SESSION_USERID] == null ? 1 : Convert.ToInt32(Session[CConfig.SESSION_USERID]);
                HotelCode = Session[CConfig.SESSION_HOTELCODE].ToString();
                if (HotelCode == null)
                {
                    Response.Redirect("Receptionist/BookingList");
                }
                json = data.GetReservationRoom_Detail(BookingCode, HotelCode, UserID);
                ////ds = data.GetReservationRoom_Detail( BookingCode, HotelCode, UserID);
                ////Thông tin đặt phòng
                //ViewData["BookingInfo"] = json[0];
                //// thong tin phong
                //ViewData["SetRoom"] = json[1];
                ////Thông tin khách hàng
                //ViewData["CustomerInfo"] = json[2];
            }
            catch (Exception ex)
            {
                CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex));
            }
            return(Json(new { mess = json }, JsonRequestBehavior.AllowGet));
        }
Exemple #25
0
        public static bool LoadPartymodeTheme(int partyModeID)
        {
            Debug.Assert(partyModeID >= 0);
            CTheme theme = _Themes.FirstOrDefault(th => th.PartyModeID == partyModeID && th.Name == CConfig.Config.Theme.Theme);

            if (theme != null)
            {
                if (theme.Load())
                {
                    CurrentThemes.Add(partyModeID, theme);
                    return(true);
                }
                theme.Unload();
                CLog.LogError("Failed to load theme " + theme + " for partymode! Removing...", true);
                _Themes.Remove(theme);
            }
            theme = _Themes.First(th => th.PartyModeID == partyModeID && th.Name == CSettings.DefaultName);
            if (theme.Load())
            {
                CurrentThemes.Add(partyModeID, theme);
                return(true);
            }
            CLog.LogError("Failed to load default theme for partymode! Unloading partymode!", true);
            foreach (CPartyTheme th in _Themes.Where(th => th.PartyModeID == partyModeID))
            {
                th.Unload();
            }
            _Themes.RemoveAll(th => th.PartyModeID == partyModeID);
            return(false);
        }
Exemple #26
0
        private PortAudioSharp.PortAudio.PaStreamCallbackResult _MyPaStreamCallback(
            IntPtr input,
            IntPtr output,
            uint frameCount,
            ref PortAudioSharp.PortAudio.PaStreamCallbackTimeInfo timeInfo,
            PortAudioSharp.PortAudio.PaStreamCallbackFlags statusFlags,
            IntPtr userData)
        {
            try
            {
                if (frameCount > 0 && input != IntPtr.Zero)
                {
                    CRecordDevice dev = _Devices[userData.ToInt32()];
                    uint          numBytes;
                    numBytes = frameCount * (uint)dev.Channels * 2;

                    byte[] recbuffer = new byte[numBytes];

                    // copy from managed to unmanaged memory
                    Marshal.Copy(input, recbuffer, 0, (int)numBytes);
                    _HandleData(dev, recbuffer);
                }
            }
            catch (Exception e)
            {
                CLog.LogError("Error on Stream Callback (rec): " + e);
            }

            return(PortAudioSharp.PortAudio.PaStreamCallbackResult.paContinue);
        }
        public JsonResult DeleteGroupMenu(string ID)
        {
            string result, resultC;

            try
            {
                DataSet ds     = new DataSet();
                int     iID    = string.IsNullOrEmpty(ID) ? 0 : Int32.Parse(ID.ToString());
                int     UserID = Session[CConfig.SESSION_USERID].ToString() == "" ? 1 : Convert.ToInt32(Session[CConfig.SESSION_USERID]);

                ds = data.DeleteGroupMenuRel(iID, UserID);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    result  = ds.Tables[0].Rows[0][0].ToString();
                    resultC = ds.Tables[0].Rows[0][1].ToString();
                }
                else
                {
                    result  = "Error: Xóa Menu không thành công";
                    resultC = "-1";
                }
            }
            catch (Exception ex)
            {
                result  = "Error: Không thêm được menu vào group";
                resultC = "";
                CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex));
            }

            return(Json(new { mess = result, code = resultC }, JsonRequestBehavior.AllowGet));
        }
Exemple #28
0
        public Transform GetHangPoint(string name, TSVector curPosition, TSVector curForward, out TSVector position, out TSVector forward)
        {
            position = curPosition;
            forward  = curForward;
            Transform transform    = null;
            bool      hasHangPoint = false;

            if (m_cHangPointItem != null)
            {
                var hangPointData = m_cHangPointItem.GetHangPointData(name);
                if (hangPointData != null)
                {
                    hasHangPoint = true;
                    FP nAngle = TSVector.Angle(TSVector.forward, curForward);
                    if (curForward.x < 0)
                    {
                        nAngle = 360 - nAngle;
                    }
                    TSQuaternion sQuat = TSQuaternion.AngleAxis(nAngle, TSVector.up);
                    position = curPosition + sQuat * hangPointData.position;
                    forward  = sQuat * hangPointData.forward;
                    forward.Normalize();
                }
            }
            if (m_cHangPointView != null)
            {
                transform    = m_cHangPointView.GetHangPoint(name);
                hasHangPoint = true;
            }
            if (!hasHangPoint)
            {
                CLog.LogError("对象" + this.name + "找不到挂点名为:" + name + "的挂点信息");
            }
            return(transform);
        }
Exemple #29
0
        private bool _CheckRequiredElements()
        {
            List <string> missingTextures = _Required.Textures.FindAll(name => !_Textures.ContainsKey(name));
            List <string> missingVideos   = _Required.Videos.FindAll(name => !_Videos.ContainsKey(name));
            List <string> missingColors   = _Required.Colors.FindAll(name => !_Data.Colors.ContainsKey(name));

            if (missingTextures.Count + missingVideos.Count + missingColors.Count == 0)
            {
                return(true);
            }
            string msg = "The skin \"" + this + "\" is missing the following elements: ";

            if (missingTextures.Count > 0)
            {
                msg += Environment.NewLine + "Textures: " + String.Join(", ", missingTextures);
            }
            if (missingVideos.Count > 0)
            {
                msg += Environment.NewLine + "Videos: " + String.Join(", ", missingVideos);
            }
            if (missingColors.Count > 0)
            {
                msg += Environment.NewLine + "Colors: " + String.Join(", ", missingColors);
            }
            CLog.LogError(msg);
            return(false);
        }
Exemple #30
0
        //===================================== Delete Category =====================================//
        public static SportModels.DALOutput Api_Sport_Category_Delete_DAL(SportModels.CategoryModel CM)
        {
            DataSet ds = new DataSet();

            try
            {
                SqlParameter[] arrParams = new SqlParameter[1];

                // input params
                arrParams[0]           = new SqlParameter("categoryID", SqlDbType.Int);
                arrParams[0].Direction = ParameterDirection.Input;
                arrParams[0].Value     = CM.CategoryID;

                // exec
                ds = SqlHelper.ExecuteDataset(CConfigDS.CONNECTION_STRING_SQL_SPORT_SHOP, CommandType.StoredProcedure, CConfigDS.SPORT_SHOP_SQL_SP_CATEGORY_DELETE, arrParams);

                // return (neu sp ko tra error code,msg thi tu gan default)
                return(new SportModels.DALOutput()
                {
                    ErrorCode = CConfigDS.RESPONSE_CODE_SUCCESS, ErrorMessage = CConfigDS.RESPONSE_MSG_SUCCESS, SqlData = ds
                });
            }
            catch (Exception ex)
            {
                // log error
                CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex));
                // error => return null
                return(new SportModels.DALOutput()
                {
                    ErrorCode = CBase.GetLayerErrorCode(CBase.LAYER.DAL), ErrorMessage = ex.Message, SqlData = null
                });
            }
        }