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


C# Country.Commit方法代码示例

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


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

示例1: gvCountry_RowDeleting

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

                // Delete the selected Country
                _currentCountry = new Country();
                _currentCountry.CountryID = countryIDToDelete;
                _currentCountry.ScreenMode = ScreenMode.Delete;
                result = _currentCountry.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, get the country details
                if (result.Status == TransactionStatus.Success)
                {
                    GetCountryDetails();
                    tcntAllCSCTabs.ActiveTab = tpnlCountry;
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrorMessageToDB("Countries.aspx", "", "gvCountry_RowDeleting", ex.Message.ToString(), new ECGroupConnection());
                throw;
            }
        }
开发者ID:samdoss,项目名称:AMSystem,代码行数:33,代码来源:Countries.aspx.cs

示例2: btnCountryAdd_Click

        protected void btnCountryAdd_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                // Create a new Country Object
                _currentCountry = new Country();

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

                // Assign values to the Country Object
                _currentCountry.CountryID = Convert.ToInt32(txtCountryID.Text.ToString());
                _currentCountry.CountryDescription = txtCountry.Text.ToString();

                // Add / Edit the Country
                TransactionResult result;
                _currentCountry.ScreenMode = ScreenMode.Add;
                result = _currentCountry.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 get the country details
                if (result.Status == TransactionStatus.Success)
                {
                    GetCountryDetails();
                    txtCountryID.Text = "0";
                    txtCountry.Text = "";
                    tcntAllCSCTabs.ActiveTab = tpnlCountry;
                }
                else
                {
                    txtCountryID.Text = "0";
                    txtCountry.Text = "";
                    tcntAllCSCTabs.ActiveTab = tpnlCountry;
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrorMessageToDB("Countries.aspx", "", "btnCountryAdd_Click", ex.Message.ToString(), new ECGroupConnection());
                throw;
            }
        }
开发者ID:samdoss,项目名称:AMSystem,代码行数:49,代码来源:Countries.aspx.cs


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