public async Task <IActionResult> UpdateStory([FromBody] RequestStoryDTO storyDTO)
        {
            string userId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Sid).Value;

            DBStatus status = await storiesService.ReplaceStoryAsync(storyDTO, userId);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.NotFound)
            {
                return(NotFound());
            }
            else if (status == DBStatus.Forbidden)
            {
                return(Forbid());
            }
            else if (status == DBStatus.NotModified)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else if (status == DBStatus.PreconditionFailed)
            {
                return(StatusCode(StatusCodes.Status412PreconditionFailed));
            }
            else
            {
                return(Ok(responseStatusDTO));
            }
        }
        public async Task <IActionResult> Register([FromBody] UserRegistrationDTO userRegistrationDTO)
        {
            DBStatus status = await authService.RegisterAsync(userRegistrationDTO);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.Failed)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else if (status == DBStatus.Taken)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            "User Id already taken"
                        }
                    }
                }));
            }
            return(Ok(responseStatusDTO));
        }
        public async Task TestUpdateStory_Ok()
        {
            //Arrange
            string          expectedTitle = "LoremIpsum";
            string          userId        = "akash";
            DBStatus        status        = DBStatus.Modified;
            RequestStoryDTO storyDTO      = new RequestStoryDTO {
                Title = expectedTitle
            };

            storiesService.Setup(x => x.ReplaceStoryAsync(storyDTO, userId)).ReturnsAsync(status);
            storiesController.ControllerContext = httpContext;

            //Act
            var result = await storiesController.UpdateStory(storyDTO) as OkObjectResult;

            //Assert
            Assert.NotNull(result);

            var response = result.Value as ResponseStatusDTO;


            Assert.Equal(200, result.StatusCode);
            Assert.Equal("Modified", response.Message);
        }
        public async Task TestCreateStory_Created()
        {
            // Arrange
            Guid            expectedStoryId = Guid.NewGuid();
            RequestStoryDTO requestStoryDTO = new RequestStoryDTO
            {
                StoryId       = expectedStoryId,
                Title         = "",
                Body          = "",
                PublishedDate = DateTime.UtcNow
            };

            DBStatus dbStatus = DBStatus.Added;

            storiesService.Setup(x => x.CreateStoryAsync(requestStoryDTO, "akash")).ReturnsAsync(dbStatus);
            storiesController.ControllerContext = httpContext;


            //Act
            var actionResult = await storiesController.CreateStory(requestStoryDTO) as CreatedAtActionResult;

            //Assert
            Assert.NotNull(actionResult);
            Assert.Equal(201, actionResult.StatusCode);
            Assert.Equal(expectedStoryId.ToString(), actionResult.RouteValues.GetValueOrDefault("storyId").ToString());
        }
Example #5
0
 private void createSchema_Click(object sender, EventArgs e)
 {
     DatabaseFunctions.CreateFdpsSchema();
     DBStatus.Text = @"Schema successfully created";
     DBStatus.Update();
     InitializedatatableComboBox();
 }
Example #6
0
 private void dropSchema_Click(object sender, EventArgs e)
 {
     DatabaseFunctions.DropFdpsSchema();
     DBStatus.Text = @"Schema successfully dropped";
     DBStatus.Update();
     ClearComboBoxes();
 }
Example #7
0
 public ConfigForm()
 {
     InitializeComponent();
     Control.CheckForIllegalCrossThreadCalls = false;
     DBStatus.init();
     presenter = new ConfigFormPresenter(this);
 }
Example #8
0
        public DBConnect()
        {
            try
            {
                //Relative to application path
                //Use it only for release
                //Debug will have db overwrite
                //string dbPath = Application.StartupPath.ToString() + "\\database\\autocrb.accdb";

                //Dont ask ._.
                string dbPath = Application.StartupPath.ToString() + "..\\..\\..\\..\\database\\autocrb.accdb";
                con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dbPath + ";Persist Security Info=True");
                con.Open();
                currentStatus = DBStatus.Database_Ready;
            }

            catch (OleDbException)
            {
                String message = "Could not connect to the database!"
                                 + Environment.NewLine
                                 + "Please ensure that the database file 'autocrb.accdb' is present in database folder!";

                MessageBox.Show(message, "Database Error", MessageBoxButtons.OK);
                this.currentStatus = DBStatus.Database_NotFound;
            }

            finally
            {
                //Close it once initialized, open con when required
                con.Close();
            }
        }
        public async Task <IActionResult> RemoveStory([Required] Guid storyId)
        {
            string   userId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Sid).Value;
            DBStatus status = await storiesService.RemoveStoryAsync(storyId, userId);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.NotFound)
            {
                return(NotFound());
            }
            else if (status == DBStatus.Forbidden)
            {
                return(StatusCode(StatusCodes.Status403Forbidden));
            }
            else if (status == DBStatus.NotDeleted)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else
            {
                return(Ok(responseStatusDTO));
            }
        }
        public async Task <IActionResult> UpdateUserPassword([FromBody] UpdateUserPasswordDTO updateUserPasswordDTO)
        {
            string userId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Sid).Value;

            updateUserPasswordDTO.UserId = userId;
            DBStatus status = await userService.UpdateUserPasswordAsync(updateUserPasswordDTO);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.NotFound)
            {
                return(NotFound());
            }
            else if (status == DBStatus.Forbidden)
            {
                return(Forbid());
            }
            else if (status == DBStatus.NotModified)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else
            {
                return(Ok(responseStatusDTO));
            }
        }
Example #11
0
 public void Close()
 {
     if (server != null && server.State == MongoServerState.Connected)
     {
         server.Disconnect();
         _status = DBStatus.Close;
     }
 }
Example #12
0
 public void Close()
 {
     if (client != null)
     {
         client  = null;
         _status = DBStatus.Close;
     }
 }
Example #13
0
 private void truncateDB_Click(object sender, EventArgs e)
 {
     DatabaseFunctions.TruncateFdpsTables();
     DBStatus.Text = @"Database tables successfully truncated";
     DBStatus.Update();
     ClearComboBoxes();
     InitializedatatableComboBox();
 }
Example #14
0
        public void Open(string mongoconn, string dbname)
        {
            Release();

            client   = new MongoClient(mongoconn);
            database = client.GetDatabase(dbname);
            _status  = DBStatus.Open;
        }
Example #15
0
 public void Commit()
 {
     if (this._s == DBStatus.Begin_Trans)
     {
         this.trans.Commit();
         this._s = DBStatus.Commit_Trans;
     }
 }
Example #16
0
 /// <summary>
 /// Close SqlServer
 /// </summary>
 public void Close()
 {
     if (this.sqlconn != null && this.sqlconn.State == ConnectionState.Open)
     {
         this.sqlconn.Close();
     }
     this.sqlconn = null;
     this._s      = DBStatus.Close;
 }
Example #17
0
        public async Task <DBStatus> CreateStoryAsync(RequestStoryDTO storyDTO, string userId)
        {
            Story story = mapper.Map <Story>(storyDTO);

            story.AuthorId = userId;
            DBStatus status = await storiesRepository.AddStoryAsync(story);

            return(status);
        }
Example #18
0
        internal string ValueString()
        {
            string str = (string)this._value;

            if (str != null)
            {
                return(str);
            }
            DBStatus status = this.StatusValue();

            if (status != DBStatus.S_OK)
            {
                if (status != DBStatus.S_TRUNCATED)
                {
                    throw this.CheckTypeValueStatusValue(typeof(string));
                }
            }
            else
            {
                switch (this.DbType)
                {
                case 130:
                    str = this.Value_WSTR();
                    goto Label_00C0;

                case 0x4082:
                    str = this.Value_ByRefWSTR();
                    goto Label_00C0;

                case 8:
                    str = this.Value_BSTR();
                    goto Label_00C0;

                case 12:
                    str = (string)this.ValueVariant();
                    goto Label_00C0;
                }
                throw ODB.ConversionRequired();
            }
            switch (this.DbType)
            {
            case 130:
                str = this.Value_WSTR();
                break;

            case 0x4082:
                str = this.Value_ByRefWSTR();
                break;

            default:
                throw ODB.ConversionRequired();
            }
Label_00C0:
            this._value = str;
            return(str);
        }
Example #19
0
        public void getTableTest()
        {
            DBStatus.init();
            DataTable dt = accountService.getTable("s");
            int       i  = dt.Rows.Count;
            int       j  = 0;

            Assert.AreEqual(i, j);
            // Assert.Fail();
        }
        public void UpdateDBStatusWithoutMonitoring(string connectionString, DBStatus dbStatus)
        {
            DBStatus value;

            m_connectionStrings.TryGetValue(connectionString, out value);
            if (value != dbStatus)
            {
                m_connectionStrings[connectionString] = dbStatus;
            }
        }
Example #21
0
        public async Task <DBStatus> RegisterAsync(UserRegistrationDTO userRegistrationDTO)
        {
            string passwordHash = ConverterSuit.ByteArrayToHex(HashSuit.ComputeSha256(Encoding.UTF8.GetBytes(userRegistrationDTO.Password)));
            User   user         = mapper.Map <User>(userRegistrationDTO);

            user.PasswordHash = passwordHash;
            DBStatus status = await authRepository.RegisterAsync(user);

            return(status);
        }
        public async Task TestAddStory_Added(Story story)
        {
            //Arrange
            DBStatus expectedStatus = DBStatus.Added;

            //Act
            DBStatus actualStatus = await storiesRepository.AddStoryAsync(story);

            //Assert
            Assert.Equal(expectedStatus, actualStatus);
        }
Example #23
0
        public void Cancel()
        {
            if (Status != OrderStatus.ORDERING_STATUS_QUEUE)
            {
                return;
            }

            Status    = OrderStatus.ORDERING_STATUS_CANCELED;
            _dbStatus = DBStatus.ORDER_CHANGED;
            //   SaveToDb(true);
        }
Example #24
0
 public void FetchRemote(OnStringCompletedDelegate clbk)
 {
     if (!webClient.IsBusy)
     {
         Status   = DBStatus.Fetching;
         Callback = clbk;
         Uri link = new Uri(GetFileLink("root.txt"));
         webClient.DownloadStringAsync(link);
         StatusMessage = "";
     }
 }
Example #25
0
 /// <summary>
 /// Open SqlServer
 /// </summary>
 /// <param name="connString"></param>
 public void Open(string connString)
 {
     if (sqlconn == null)
     {
         this.sqlconn = new SqlConnection(connString);
     }
     if (this.sqlconn.State != ConnectionState.Open)
     {
         this.sqlconn.Open();
     }
     this._s = DBStatus.Open;
 }
Example #26
0
        /*async static Task Run()
         * {
         *  using (var dbx = new DropboxClient(AccessToken))
         *  {
         *      var full = await dbx.Users.GetCurrentAccountAsync();
         *      Log("{0} - {1}", full.Name.DisplayName, full.Email);
         *  }
         * }*/

        public void FetchRemoteFile(string file, OnStringCompletedDelegate clbk)
        {
            if (!webClient.IsBusy)
            {
                Status   = DBStatus.Fetching;
                Callback = clbk;
                Uri link = new Uri(GetFileLink(file));
                LastTempFile   = Path.GetTempFileName();
                LastTargetFile = Path.Combine(LastDirectory, file);
                webClient.DownloadFileAsync(link, LastTempFile);
                StatusMessage = "";
            }
        }
        public void UpdateDBStatus(string connectionString, DBStatus dbStatus)
        {
            lock (m_lockObj)
            {
                UpdateDBStatusWithoutMonitoring(connectionString, dbStatus);

                //add to dbstatusmonitor thread.
                if (dbStatus == DBStatus.DB_OFFLINE)
                {
                    m_monitorthread.AddItem(connectionString);
                }
            }
        }
Example #28
0
        public Order(User owner, TaxiType taxiType, Address sAddress, Address eAddress)
        {
            Id       = 0;
            Owner    = owner;
            Driver   = null;
            SAddress = sAddress;
            EAddress = eAddress;
            Type     = taxiType;
            Date     = new DateTime();
            Status   = OrderStatus.ORDERING_STATUS_QUEUE;

            _dbStatus = DBStatus.ORDER_NEW;
        }
Example #29
0
        internal byte[] ValueByteArray()
        {
            byte[] buffer = (byte[])this._value;
            if (buffer != null)
            {
                return(buffer);
            }
            DBStatus status = this.StatusValue();

            if (status != DBStatus.S_OK)
            {
                if (status != DBStatus.S_TRUNCATED)
                {
                    throw this.CheckTypeValueStatusValue(typeof(byte[]));
                }
            }
            else
            {
                switch (this.DbType)
                {
                case 12:
                    buffer = (byte[])this.ValueVariant();
                    goto Label_00AC;

                case 0x80:
                    buffer = this.Value_BYTES();
                    goto Label_00AC;

                case 0x4080:
                    buffer = this.Value_ByRefBYTES();
                    goto Label_00AC;
                }
                throw ODB.ConversionRequired();
            }
            switch (this.DbType)
            {
            case 0x80:
                buffer = this.Value_BYTES();
                break;

            case 0x4080:
                buffer = this.Value_ByRefBYTES();
                break;

            default:
                throw ODB.ConversionRequired();
            }
Label_00AC:
            this._value = buffer;
            return(buffer);
        }
Example #30
0
        private async void deleteProject_Click(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine($"Deleting Project with name: {VM.SelectedProject.Name}");

            DBStatus status = await SQLDbHelper.DeleteProject(VM.SelectedProject);

            if (status == DBStatus.Success)
            {
                VM.Projects.Remove(VM.SelectedProject);
                VM.SelectedProject = null;

                VM.IsDeleteProject = false;
            }
        }
Example #31
0
 /// <summary>
 /// Class used for easier describe error or success
 /// </summary>
 /// <param name="status">Operation status fail or success</param>
 public DBRespons(DBStatus status)
 {
     this.status = status;
     switch (status)
     {
         case DBStatus.InsertSuccessful:
             msg = "Insert successful";
             break;
         case DBStatus.UpdateSuccessful:
             msg = "Update successful";
             break;
         case DBStatus.SelectSuccessful:
             msg = "select successful";
             break;
         case DBStatus.InitDBSuccessful:
             msg = "Init DB successful";
             break;
         case DBStatus.OpenSuccessful:
             msg = "Open DB successful";
             break;
         case DBStatus.InsertError:
             msg = "Insert error";
             break;
         case DBStatus.UpdateError:
             msg = "Update error";
             break;
         case DBStatus.SelectError:
             msg = "Select error";
             break;
         case DBStatus.InitDBError:
             msg = "Init DB error";
             break;
         case DBStatus.OpenError:
             msg = "Open DB error";
             break;
         default:
             break;
     }
 }
 internal void StatusValue(DBStatus value)
 {
     this.RowBinding.WriteInt32(this._offsetStatus, (int) value);
 }
Example #33
0
        private static void gogo()
        {
            Dictionary<int, Location> nowpath = new Dictionary<int, Location>();
            Ticker isJump = new Ticker(500000);
            int level = ObjectManager.MyPlayer.Level;
            int nowlevel = ObjectManager.MyPlayer.Level;
            int exp = ObjectManager.MyPlayer.ExperiencePercentage;
            int nowexp = ObjectManager.MyPlayer.ExperiencePercentage;
            int last_run_exp = ObjectManager.MyPlayer.ExperiencePercentage;
            DateTime intime = DateTime.Now;
            DateTime last_run_time = DateTime.Now;
            while (true)
            {
                switch (FBStatus)
                {
                    case DBStatus.In_EntryChecking:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        while (!SetLeader()) ;
                        if (CanStart())
                        {
                            LastLeaderStep = 0;
                            FBStatus = DBStatus.In_LeaderInScopeCheck;
                            Logging.Write("检查大号是不是在范围内");
                            last_run_exp = ObjectManager.MyPlayer.ExperiencePercentage;
                            exp = ObjectManager.MyPlayer.ExperiencePercentage;
                            level = ObjectManager.MyPlayer.Level;
                        }
                        break;

                    case DBStatus.In_LeaderInScopeCheck:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        if (IsLeaderInScope())
                        {
                            nowpath = GetMemPath();
                            FBStatus = DBStatus.In_Running;
                            int this_turn_exp = ObjectManager.MyPlayer.ExperiencePercentage - last_run_exp;
                            this_turn_exp = this_turn_exp >= 0 ? this_turn_exp : 100 + this_turn_exp;
                            Logging.Write(string.Format("第{0}次跑路。这次共获得经验[{1}],耗时[{2}]。",
                                LastLeaderStep + 1,
                                this_turn_exp,
                                DateTime.Now - last_run_time));
                            last_run_exp = ObjectManager.MyPlayer.ExperiencePercentage;
                            last_run_time = DateTime.Now;
                        }
                        break;

                    case DBStatus.In_Running:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        if (MeGoGo(nowpath))
                        {
                            if (LastLeaderStep == LeaderInFB.Keys.Max())
                            {
                                FBStatus = DBStatus.In_CheckIsOut;
                                Logging.Write(string.Format("等待大号暗语,准备出本"));
                            }
                            else
                            {
                                FBStatus = DBStatus.In_LeaderInScopeCheck;
                            }
                            LastLeaderStep++;
                        }
                        break;
                    case DBStatus.In_CheckIsOut:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        if (_Action == ActionStatus.OutFB || _Action == ActionStatus.DirectOut)
                        {
                            Logging.Write(string.Format("收到暗语,出本!!!"));
                            nowlevel = ObjectManager.MyPlayer.Level;
                            nowexp = ObjectManager.MyPlayer.ExperiencePercentage;
                            if (_Action == ActionStatus.OutFB) MeGoGo(GetMemOutPath());

                            //出副本
                            Thread.Sleep(200);
                            FBExit.Face();
                            KeyHelper.PressKey("Up");
                            while (ObjectManager.InGame) Thread.Sleep(100);
                            KeyHelper.ReleaseKey("Up");
                            Thread.Sleep(2000);
                            while (!ObjectManager.InGame) Thread.Sleep(100);
                            _Action = ActionStatus.Nothing;
                            Logging.Write(string.Format("出来了,等待暗语,准备进本。上次刷本经验获得了{0}%,耗时{1},升了{2}级",
                                nowexp - exp >= 0 ? nowexp - exp : 100 + nowexp - exp,
                                DateTime.Now - intime,
                                nowlevel - level));
                            FBStatus = DBStatus.Out_ExitDone;
                        }
                        break;
                    case DBStatus.Out_ExitDone:
                        if (_Action == ActionStatus.InFB)
                        {
                            FBStatus = DBStatus.Out_following;
                            _Action = ActionStatus.Nothing;
                        }
                        break;
                    case DBStatus.Out_following:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        Logging.Write(string.Format("进本!!!"));
                        FBEntry.Face();
                        KeyHelper.PressKey("Up");
                        while (ObjectManager.InGame) Thread.Sleep(100);
                        KeyHelper.ReleaseKey("Up");
                        Thread.Sleep(2000);
                        while (!ObjectManager.InGame) Thread.Sleep(100);
                        Logging.Write(string.Format("进副本了,现在是{0}级,经验{1}%", ObjectManager.MyPlayer.Level, ObjectManager.MyPlayer.ExperiencePercentage));
                        level = ObjectManager.MyPlayer.Level;
                        exp = ObjectManager.MyPlayer.ExperiencePercentage;
                        last_run_exp = exp;
                        intime = DateTime.Now;
                        last_run_time = intime;
                        FBStatus = DBStatus.In_EntryChecking;
                        break;

                }
                Thread.Sleep(100);
            }
        }
Example #34
0
 public static bool Init(string _leadername, Location _fbin, Location _fbout, Dictionary<int, Location> _lloc, Dictionary<int, Location> _path, Dictionary<int, int> _map)
 {
     LastLeaderStep = 0;
     FBStatus = DBStatus.In_EntryChecking;
     _Action = ActionStatus.Nothing;
     LeaderName = _leadername.ToUpper();
     if (!SetLeader()) return false;
     FBEntry = _fbin;
     FBExit = _fbout;
     LeaderInFB = _lloc;
     memInFB = _path;
     MapOverLeaderAndMem = _map;
     return true;
 }
        internal static void CommandParameterStatus(StringBuilder builder, int index, DBStatus status)
        {
            switch (status)
            {
                case DBStatus.S_OK:
                case DBStatus.S_ISNULL:
                case DBStatus.S_IGNORE:
                    return;

                case DBStatus.E_BADACCESSOR:
                    builder.Append(Res.GetString("OleDb_CommandParameterBadAccessor", new object[] { index.ToString(CultureInfo.InvariantCulture), "" }));
                    builder.Append(Environment.NewLine);
                    return;

                case DBStatus.E_CANTCONVERTVALUE:
                    builder.Append(Res.GetString("OleDb_CommandParameterCantConvertValue", new object[] { index.ToString(CultureInfo.InvariantCulture), "" }));
                    builder.Append(Environment.NewLine);
                    return;

                case DBStatus.E_SIGNMISMATCH:
                    builder.Append(Res.GetString("OleDb_CommandParameterSignMismatch", new object[] { index.ToString(CultureInfo.InvariantCulture), "" }));
                    builder.Append(Environment.NewLine);
                    return;

                case DBStatus.E_DATAOVERFLOW:
                    builder.Append(Res.GetString("OleDb_CommandParameterDataOverflow", new object[] { index.ToString(CultureInfo.InvariantCulture), "" }));
                    builder.Append(Environment.NewLine);
                    return;

                case DBStatus.E_UNAVAILABLE:
                    builder.Append(Res.GetString("OleDb_CommandParameterUnavailable", new object[] { index.ToString(CultureInfo.InvariantCulture), "" }));
                    builder.Append(Environment.NewLine);
                    return;

                case DBStatus.S_DEFAULT:
                    builder.Append(Res.GetString("OleDb_CommandParameterDefault", new object[] { index.ToString(CultureInfo.InvariantCulture), "" }));
                    builder.Append(Environment.NewLine);
                    return;
            }
            builder.Append(Res.GetString("OleDb_CommandParameterError", new object[] { index.ToString(CultureInfo.InvariantCulture), status.ToString() }));
            builder.Append(Environment.NewLine);
        }
Example #36
0
        // OleDbCommand
        static internal void CommandParameterStatus(StringBuilder builder, int index, DBStatus status) {
            switch (status) {
            case DBStatus.S_OK:
            case DBStatus.S_ISNULL:
            case DBStatus.S_IGNORE:
                break;

            case DBStatus.E_BADACCESSOR:
                builder.Append(Res.GetString(Res.OleDb_CommandParameterBadAccessor,index.ToString(CultureInfo.InvariantCulture), ""));
                builder.Append(Environment.NewLine);
                break;

            case DBStatus.E_CANTCONVERTVALUE:
                builder.Append(Res.GetString(Res.OleDb_CommandParameterCantConvertValue,index.ToString(CultureInfo.InvariantCulture), ""));
                builder.Append(Environment.NewLine);
                break;

            case DBStatus.E_SIGNMISMATCH:
                builder.Append(Res.GetString(Res.OleDb_CommandParameterSignMismatch,index.ToString(CultureInfo.InvariantCulture), ""));
                builder.Append(Environment.NewLine);
                break;

            case DBStatus.E_DATAOVERFLOW:
                builder.Append(Res.GetString(Res.OleDb_CommandParameterDataOverflow,index.ToString(CultureInfo.InvariantCulture), ""));
                builder.Append(Environment.NewLine);
                break;

            case DBStatus.E_CANTCREATE:
                Debug.Assert(false, "CommandParameterStatus: unexpected E_CANTCREATE");
                goto default;

            case DBStatus.E_UNAVAILABLE:
                builder.Append(Res.GetString(Res.OleDb_CommandParameterUnavailable,index.ToString(CultureInfo.InvariantCulture), ""));
                builder.Append(Environment.NewLine);
                break;

            case DBStatus.E_PERMISSIONDENIED:
                Debug.Assert(false, "CommandParameterStatus: unexpected E_PERMISSIONDENIED");
                goto default;

            case DBStatus.E_INTEGRITYVIOLATION:
                Debug.Assert(false, "CommandParameterStatus: unexpected E_INTEGRITYVIOLATION");
                goto default;

            case DBStatus.E_SCHEMAVIOLATION:
                Debug.Assert(false, "CommandParameterStatus: unexpected E_SCHEMAVIOLATION");
                goto default;

            case DBStatus.E_BADSTATUS:
                Debug.Assert(false, "CommandParameterStatus: unexpected E_BADSTATUS");
                goto default;

            case DBStatus.S_DEFAULT: // MDAC 66626
                builder.Append(Res.GetString(Res.OleDb_CommandParameterDefault,index.ToString(CultureInfo.InvariantCulture), ""));
                builder.Append(Environment.NewLine);
                break;

            default:
                builder.Append(Res.GetString(Res.OleDb_CommandParameterError, index.ToString(CultureInfo.InvariantCulture), status.ToString()));
                builder.Append(Environment.NewLine);
                break;
            }
        }
Example #37
0
 /// <summary>
 /// Constructor used to report error operation in DB
 /// it containt exception message for easier debugin
 /// </summary>
 /// <param name="status">Operation status</param>
 /// <param name="message">Exception message</param>
 public DBRespons(DBStatus status, string message)
 {
     this.status = status;
     this.msg = message;
 }
Example #38
0
 internal void StatusValue(DBStatus value) {
     #if DEBUG
     switch(value) {
     case DBStatus.S_OK:
     case DBStatus.S_ISNULL:
     case DBStatus.S_DEFAULT:
         break;
     default:
         Debug.Assert(false, "unexpected StatusValue");
         break;
     }
     #endif
     RowBinding.WriteInt32(_offsetStatus, (int)value);
 }
Example #39
0
 static internal InvalidOperationException UnexpectedStatusValue(DBStatus status) {
     return ADP.DataAdapter(Res.GetString(Res.OleDb_UnexpectedStatusValue, status.ToString()));
 }
 internal static InvalidOperationException UnexpectedStatusValue(DBStatus status)
 {
     return ADP.DataAdapter(Res.GetString("OleDb_UnexpectedStatusValue", new object[] { status.ToString() }));
 }