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


C# State.Commit方法代码示例

本文整理汇总了C#中State.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# State.Commit方法的具体用法?C# State.Commit怎么用?C# State.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在State的用法示例。


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

示例1: gvStates_RowDeleting

        protected void gvStates_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                TransactionResult result;
                // Get the selected row's state id
                int stateIDToDelete = Convert.ToInt32(gvStates.DataKeys[e.RowIndex].Value);

                // Delete the selected state
                _currentState = new State();
                _currentState.StateID = stateIDToDelete;
                _currentState.ScreenMode = ScreenMode.Delete;
                result = _currentState.Commit();

                // Display the status of the delete
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("<script>alert('" + result.Message.ToString() + ".');");
                sb.Append("</script>");
                ScriptManager.RegisterStartupScript(this.Page, typeof(string), "MyScript", sb.ToString(), false);

                // If successfully deleted
                if (result.Status == TransactionStatus.Success)
                {
                    ddlStateCountry_SelectedIndexChanged(sender, e);
                    tcntAllCSCTabs.ActiveTab = tpnlStates;
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrorMessageToDB("Countries.aspx", "", "gvStates_RowDeleting", ex.Message.ToString(), new ECGroupConnection());
                throw;
            }
        }
开发者ID:samdoss,项目名称:AMSystem,代码行数:33,代码来源:Countries.aspx.cs

示例2: btnStateSave_Click

        protected void btnStateSave_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                // Create a new State Object
                _currentState = new State();

                // Set whether Add / Edit
                if (txtStateID.Text.ToString() != "0")
                    _currentState.AddEditOption = 1;
                else
                    _currentState.AddEditOption = 0;

                // Assign values to the State Object
                _currentState.CountryID = Convert.ToInt32(ddlCountry.SelectedValue.ToString());
                _currentState.StateID = Convert.ToInt32(txtStateID.Text.ToString());
                _currentState.StateDescription = txtState.Text.ToString();

                // Add / Edit the State
                TransactionResult result;
                _currentState.ScreenMode = ScreenMode.Add;
                result = _currentState.Commit();

                // Display the Status - Whether successfully saved or not
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("<script>alert('" + result.Message.ToString() + ".');");
                sb.Append("</script>");
                ScriptManager.RegisterStartupScript(this.Page, typeof(string), "MyScript", sb.ToString(), false);

                // If successful
                if (result.Status == TransactionStatus.Success)
                {

                    txtStateID.Text = "0";
                    txtState.Text = "";
                    tcntAllCSCTabs.ActiveTab = tpnlStates;
                }
                else
                {

                    txtStateID.Text = "0";
                    txtState.Text = "";
                    tcntAllCSCTabs.ActiveTab = tpnlStates;
                }
                ddlStateCountry_SelectedIndexChanged(sender, e);
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrorMessageToDB("Countries.aspx", "", "btnStateSave_Click", ex.Message.ToString(), new ECGroupConnection());
                throw;
            }
        }
开发者ID:samdoss,项目名称:AMSystem,代码行数:52,代码来源:Countries.aspx.cs


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