コード例 #1
0
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                Entities.Brand brand = new Entities.Brand();
                brand.ID         = Convert.ToInt32(hdBrandId.Value);
                brand.Name       = txtName.Text.Trim();
                brand.Order      = Convert.ToInt32(txtOrder.Text.Trim());
                brand.Status     = Convert.ToInt32(ddlStatus.SelectedValue);
                brand.CompanyId  = CPublic.GetCompanyID();
                brand.CreatedBy  = CPublic.GetuserID();
                brand.ModifiedBy = CPublic.GetuserID();

                OutputMessage result = null;
                if (brand.ID == 0)
                {
                    result = brand.Save();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
                else
                {
                    result = brand.Update();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
            }
            catch (FormatException ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('Enter a Valid Order')", true);
            }
        }
コード例 #2
0
 /// <summary>
 /// Create a new Brand object.
 /// </summary>
 /// <param name="name">Initial value of the Name property.</param>
 public static Brand CreateBrand(global::System.String name)
 {
     Brand brand = new Brand();
     brand.Name = name;
     return brand;
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the BrandSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBrandSet(Brand brand)
 {
     base.AddObject("BrandSet", brand);
 }