Save() public method

public Save ( ) : bool
return bool
コード例 #1
0
        private void SaveData()
        {
            CustMan.Customer currentCustomer = new CustMan.Customer();
            currentCustomer.CustomerId = Int32.Parse(hdnCustomerId.Value.Trim() == String.Empty ? "0" : hdnCustomerId.Value.Trim());
            currentCustomer.CompanyId  = Master.CurrentCompany.CompanyId;

            if (hdnCustomerMode.Value.Trim() == "1")
            {
                SaveSingleCustomerData(currentCustomer);
            }
            else
            {
                SaveCustomerGroupData(currentCustomer);
            }

            string errorMSG;

            if ((new CustomerManagement.CustomerManager()).IsValidToSave(currentCustomer, out errorMSG))
            {
                if (string.IsNullOrEmpty(errorMSG) && currentCustomer.Save())
                {
                    hdnCustomerId.Value = currentCustomer.CustomerId.ToString();
                    this.ViewData();
                    dsData = currentCustomer.SelectGroupByGroupId(currentCustomer.CustomerId);
                    gvGroupMembers.DataSource = dsData;
                    gvGroupMembers.DataBind();
                    dsData.Tables[0].PrimaryKey = new DataColumn[] { dsData.Tables[0].Columns["CustomerId"] };
                    Session[Constants.SESSION_GROUPCUSTOMERS] = dsData;

                    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowMessage", "javascript:ShowSuccessMessage('" + Messages.Save_Success + "')", true);
                }
                else
                {
                    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowMessage", "javascript:ShowInfoMessage('" + Messages.Save_Unsuccess + "')", true);
                }
            }
        }
コード例 #2
0
        private void SaveData()
        {
            CustMan.Customer currentCustomer = new CustMan.Customer();
            currentCustomer.CustomerId = Int32.Parse(hdnCustomerId.Value.Trim() == String.Empty ? "0" : hdnCustomerId.Value.Trim());
            currentCustomer.CompanyId = Master.CurrentCompany.CompanyId;

            if (hdnCustomerMode.Value.Trim() == "1")
            {
                SaveSingleCustomerData(currentCustomer);
            }
            else
            {
                SaveCustomerGroupData(currentCustomer);
            }

            string errorMSG;
            if ((new CustomerManagement.CustomerManager()).IsValidToSave(currentCustomer, out errorMSG))
            {
                if (string.IsNullOrEmpty(errorMSG) && currentCustomer.Save())
                {
                    hdnCustomerId.Value = currentCustomer.CustomerId.ToString();
                    this.ViewData();
                    dsData = currentCustomer.SelectGroupByGroupId(currentCustomer.CustomerId);
                    gvGroupMembers.DataSource = dsData;
                    gvGroupMembers.DataBind();
                    dsData.Tables[0].PrimaryKey = new DataColumn[] { dsData.Tables[0].Columns["CustomerId"] };
                    Session[Constants.SESSION_GROUPCUSTOMERS] = dsData;

                    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowMessage", "javascript:ShowSuccessMessage('" + Messages.Save_Success + "')", true);
                }
                else
                {
                    System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowMessage", "javascript:ShowInfoMessage('" + Messages.Save_Unsuccess + "')", true);
                }
            }
        }