当前位置: 首页>>代码示例>>C#>>正文


C# MySqlDatabase类代码示例

本文整理汇总了C#中MySqlDatabase的典型用法代码示例。如果您正苦于以下问题:C# MySqlDatabase类的具体用法?C# MySqlDatabase怎么用?C# MySqlDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MySqlDatabase类属于命名空间,在下文中一共展示了MySqlDatabase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            IncludePage(HowItWorksInc, Resources.Resource.incHowItWorks);
            IncludePage(ProtectInc, Resources.Resource.incProtect);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement);

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);
                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            if (!IsPostBack)
            {
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:30,代码来源:HowItWorks.aspx.cs

示例2: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["pid"] != null)
            {
                long productId;
                if (!long.TryParse(Request.Params["pid"], out productId))
                    productId = 0;
                Session["quotation.pid"] = productId;
            }

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);
                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:29,代码来源:Quotation.aspx.cs

示例3: Login_Click

        protected void Login_Click(object sender, EventArgs e)
        {
            using (Database db = new MySqlDatabase())
            {
                if (db.AdminLoginAuthentication(Email.Text.Trim(), Password.Text.Trim()))
                {
                    Session["AdminLogin"] = Email.Text.Trim();

                    Response.Redirect("ManagePages.aspx");
                }
                else
                {
                    CustomValidator CustomValidatorCtrl = new CustomValidator();

                    CustomValidatorCtrl.IsValid = false;

                    CustomValidatorCtrl.ValidationGroup = "LoginUserValidationGroup";

                    CustomValidatorCtrl.ErrorMessage = "Login Failed !";

                    this.Page.Form.Controls.Add(CustomValidatorCtrl);

                    Session.Remove("AdminLogin");
                }
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:26,代码来源:AdminHome.aspx.cs

示例4: CreateCommand

        public override DbCommand CreateCommand()
        {
            var db = new MySqlDatabase("");
            var cm = db.CreateCommand();
            cm.CommandType = CommandType.StoredProcedure;
            cm.CommandText = this.GetStoredProcedureName();

            DbParameter p = null;

            p = db.CreateParameter("PK_IntColumn", MySqlDbType.Int32, 10, 0);
            p.SourceColumn = p.ParameterName;
            p.Direction = ParameterDirection.Input;
            p.Value = this.PK_IntColumn;
            cm.Parameters.Add(p);

            p = db.CreateParameter("PK_TimestampColumn", MySqlDbType.Timestamp, null, 0);
            p.SourceColumn = p.ParameterName;
            p.Direction = ParameterDirection.Input;
            p.Value = this.PK_TimestampColumn;
            cm.Parameters.Add(p);

            for (int i = 0; i < cm.Parameters.Count; i++)
            {
                if (cm.Parameters[i].Value == null) cm.Parameters[i].Value = DBNull.Value;
            }
            return cm;
        }
开发者ID:fengweijp,项目名称:higlabo,代码行数:27,代码来源:identitytableDelete.cs

示例5: AcceptUser

        protected void AcceptUser(object sender, CommandEventArgs e)
        {
            if (Session["mgmt.userid"] == null)
                return;

            int mgrVcl = 0, mgrEcl = 0;
            Util.GetUserClearanceLevels(Util.UserId, out mgrVcl, out mgrEcl);

            int vcl = 0, ecl = 0, tmp = 0;
            if (int.TryParse(VclText.Text, out tmp))
                vcl = tmp;
            if (int.TryParse(EclText.Text, out tmp))
                ecl = tmp;

            // Rights entered may not be higher then the rights of the manager
            if (vcl <= mgrVcl && ecl <= mgrEcl)
            {
                long userIdToManage = (long)Session["mgmt.userid"];
                using (Database db = new MySqlDatabase())
                {
                    db.RegisterUserRights(userIdToManage, vcl, ecl);
                    Session.Remove("mgmt.userid");
                    ManagerNameLabel.Text = string.Empty;
                }
                UpdateManagerTable();
            }
            else
            {
                ResultMessage.Text = Resources.Resource.UserRightsTooHigh;
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:31,代码来源:Management.aspx.cs

示例6: AddCoArtist

        protected void AddCoArtist(object sender, CommandEventArgs e)
        {
            bool found = false;
            if (CoArtistDropDown.SelectedIndex < 0)
                return;

            using (Database db = new MySqlDatabase())
            {
                long userId = Convert.ToInt64(CoArtistDropDown.SelectedValue);
                if (userId > 0)
                {
                    UserInfo ui = db.GetUser(userId);
                    ClientInfo ci = db.GetClientInfo(userId);

                    Session["user.userid"] = userId;
                    AddCoArtistRow(CoArtistsTable, ci.GetFullName(), CoArtistRole.Text, ci.ClientId);

                    DataView dataView = new DataView(CoArtistsTable);
                    CoArtistsList.DataSource = dataView;
                    CoArtistsList.DataBind();

                    found = true;
                }
            }
            if (!found)
                ErrorMessage.Text = Resources.Resource.ClientNotFound;
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:27,代码来源:RegisterDocManaged.aspx.cs

示例7: GenerateToken

        public Token GenerateToken(string email, string name, string mobile, int passengers, decimal payableAmount, string refId, string reqId)
        {
            try
            {
                int tokenId;
                var db = new MySqlDatabase(DbConfiguration.TokenDB);
                var createDate = DateTime.Now;
                var expiryDate = createDate.AddHours(48);
                MySqlCommand cmd = CommandBuilder.BuildGenerateTokenCommand(db.Connection, email, name, mobile, passengers, payableAmount, createDate, expiryDate, refId, reqId);
                db.ExecuteNonQuery(cmd, "outTokenId", out tokenId);

                if (tokenId != 0)
                    return new Token
                    {
                        Id = tokenId.ToString(),
                        EmailId = email,
                        Name = name,
                        Mobile = mobile,
                        PassengersCount = passengers,
                        PayableAmount = payableAmount,
                        TokenCreationDate = createDate,
                        TokenExpirationDate = expiryDate,
                        PaymentReferenceId = refId,
                        RequestId = reqId
                    };
            }
            catch (Exception ex)
            {
                DBExceptionLogger.LogException(ex, Source, "GenerateToken", Severity.Critical);
                return null;
            }
            return null;
        }
开发者ID:varunupcurve,项目名称:myrepo,代码行数:33,代码来源:TokenDataProvider.cs

示例8: CreateAccount

        public Account CreateAccount(string email, string firstName, string lastName, string mobile, string hashPwd,
                                     bool isEmailVerified = false)
        {
            try
            {
                int accountId;
                var db = new MySqlDatabase(DbConfiguration.DatabaseWrite);
                MySqlCommand cmd = CommandBuilder.BuildCreateAccountCommand(db.Connection, email, firstName, lastName,
                                                                            mobile ?? "", hashPwd, isEmailVerified);
                db.ExecuteNonQuery(cmd, "outaccountid", out accountId);

                if (accountId != 0)
                    return new Account
                               {
                                   AccountId = accountId.ToString(),
                                   Email = email,
                                   FirstName = firstName,
                                   LastName = lastName,
                                   Mobile = mobile,
                                   IsEmailActivated = false,
                                   IsMobileVerified = false,
                                   IsEnabled = true
                               };
            }
            catch (Exception ex)
            {
                DBExceptionLogger.LogException(ex, Source, "CreateAccount", Severity.Critical);
                return null;
            }
            return null;
        }
开发者ID:varunupcurve,项目名称:myrepo,代码行数:31,代码来源:AccountDataProvider.cs

示例9: HandleConnectionError

        private static void HandleConnectionError(MySqlDatabase db, Exception ex, int? tryCount) {
            if(log.IsErrorEnabled) {
                log.Error("Database Connection 생성 및 Open 수행 시에 예외가 발생했습니다. ConnectionString=[{0}]", db.ConnectionString);
                log.Error(ex);
            }

            var timeout = Math.Min(MaxTimeout, Math.Abs(tryCount.GetValueOrDefault(1)) * 50);
            Thread.Sleep(timeout);
        }
开发者ID:debop,项目名称:NFramework,代码行数:9,代码来源:MySqlTool.cs

示例10: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "relationships";
            IncludePage(ProtectInc, Resources.Resource.incProtect);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            string fullname = string.Empty;
            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                fullname = ci.FirstName; //ci.GetFullName();
                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", fullname);
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            string email = Request.Params["email"] ?? "???";
            string format = Resources.Resource.fmtInviteSuccess;
            if (Request.Params["mode"] != null)
            {
                if (Request.Params["mode"] == "1")
                    format = Resources.Resource.fmtInviteExists;
            }
            InviteSuccessLiteral.Text = string.Format(format, email);

            if (!IsPostBack)
            {
            }

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:53,代码来源:InviteSuccess.aspx.cs

示例11: TpIdSearch

        protected void TpIdSearch(object sender, CommandEventArgs e)
        {
            string email = TpIdText.Text;
            using (Database db = new MySqlDatabase())
            {
                long userId = db.GetUserIdByEmail(email);
                UserInfo ui = db.GetUser(userId);
                ClientInfo ci = db.GetClientInfo(userId);

                Session["mgmt.userid"] = userId;
                ManagerNameLabel.Text = ci.GetFullName();
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:13,代码来源:Management.aspx.cs

示例12: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                IncludePage(AccountOverviewInc, Resources.Resource.incMemberHome);
                IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

                using (Database db = new MySqlDatabase())
                {

                    UserInfo ui = db.GetUser(Util.UserId);
                    ClientInfo ci = db.GetClientInfo(Util.UserId);

                    DataSet ds = db.GetRegister(Util.UserId);
                    int protectedTracks = ds.Tables[0].Rows.Count;

                    LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                    LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); //ci.GetFullName());
                    CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                    ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);

                    string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                    decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
                    Session["percentComplete"] = percentComplete;
                    CompletedLiteral.Text = string.Empty;
                    if (percentComplete < 100)
                        CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                    ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
                }

                FillAccountInformation();

                int couponEntry = 0;
                if (Session["coupon.entry"] != null)
                    couponEntry = (int)Session["coupon.entry"];

                if (!IsPostBack)
                {
                    using (Database db = new MySqlDatabase())
                    {
                        int violationState = db.GetUserWhmcsClientId(Util.UserId);
                        if (violationState == 1)
                            couponEntry = 3;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.Write(LogLevel.Error, ex, "AccountOverView<Exception>");
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:51,代码来源:AccountOverview.aspx.cs

示例13: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "relationships";
            Session["loggedinUserEmail"] = string.Empty;
            Util.GetUserClearanceLevels(Util.UserId, out _vcl, out _ecl);
            if (_vcl < 100 && _ecl < 100)
            {
                divManaccChk.Visible = false;
            }
            else
            {
                divManaccChk.Visible = true;
            }
            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;
                Session["loggedinUserEmail"] = ui.Email;
                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            //------- Highlight the selected lang button ------- !

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);

                ddl_Language.SelectedValue = "nl";
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);

                ddl_Language.SelectedValue = "en";
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:51,代码来源:Invitation.aspx.cs

示例14: Persist

        public void Persist(
            OAuthTokenResponse me,
            string oauth_token,
            string oauth_verifier)
        {
            if (_clientInfo == null)
                GetUser();

            using (Database db = new MySqlDatabase())
            {
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "twitterid", Convert.ToString(me.UserId));
                db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "oauthtoken", oauth_token);
                db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "oauthverifier", oauth_verifier);

                _clientInfo.TwitterId = me.ScreenName;

                db.RegisterClientInfo(
                    _clientInfo.LastName,
                    _clientInfo.FirstName,
                    _clientInfo.AddressLine1,
                    _clientInfo.AddressLine2,
                    _clientInfo.ZipCode,
                    _clientInfo.State,
                    _clientInfo.City,
                    _clientInfo.Country,
                    _clientInfo.Language,
                    _clientInfo.Telephone,
                    _clientInfo.Cellular,
                    _clientInfo.CompanyName,
                    _clientInfo.UserId,
                    _clientInfo.AccountOwner,
                    _clientInfo.BumaCode,
                    _clientInfo.SenaCode,
                    _clientInfo.IsrcCode,
                    _clientInfo.TwitterId,
                    _clientInfo.FacebookId,
                    _clientInfo.SoundCloudId,
                    _clientInfo.SoniallId,
                    _clientInfo.OwnerKind,
                    _clientInfo.CreditCardNr,
                    _clientInfo.CreditCardCvv,
                    _clientInfo.EmailReceipt,
                    _clientInfo.Referer,
                    _clientInfo.Gender,
                    _clientInfo.Birthdate,
                    _clientInfo.stagename);
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:50,代码来源:AuthenticationService.cs

示例15: ArtistsTable_RowCommand

        protected void ArtistsTable_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);
            // Retrieve the row that contains the button
            // from the Rows collection.
            GridViewRow row = ArtistsTable.Rows[rowIndex];
            HiddenField hfd = row.FindControl("HiddenFieldUserId") as HiddenField;

            switch (e.CommandName)
            {
                case "DeleteUser":
                    if (hfd != null)
                    {
                        long targetId = 0;
                        if (!long.TryParse(hfd.Value, out targetId))
                            targetId = 0;
                        if (targetId > 0)
                        {
                            long sourceId = Util.UserId;
                            using (Database db = new MySqlDatabase())
                            {
                                db.DeleteRelation(sourceId, targetId, 1);
                            }
                        }
                    }
                    break;

                case "RelateUser":
                    if (hfd != null)
                    {
                        long targetId = 0;
                        if (!long.TryParse(hfd.Value, out targetId))
                            targetId = 0;
                        if (targetId > 0)
                        {
                            long sourceId = Util.UserId;
                            using (Database db = new MySqlDatabase())
                            {
                                UserInfo targetUi = db.GetUser(targetId);
                                ClientInfo targetCI = db.GetClientInfo(targetId);

                                RequestConfirmation(targetUi.Email, 1, targetCI.FirstName, targetCI.LastName);
                            }
                        }
                    }
                    break;
            }
            FillManagedRelationsTable();
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:49,代码来源:ManageRelations.aspx.cs


注:本文中的MySqlDatabase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。