AJH.CMS.WEB.UI.Admin.ManageSupplier_UC.btnUpdate_Click C# (CSharp) Method

btnUpdate_Click() private method

private btnUpdate_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ViewState[CMSViewStateManager.SupplierID] != null && ucPortalLanguage.SelectedLanguageID > 0)
            {
                try
                {
                    Supplier Supplier =
                        SupplierManager.GetSupplier(Convert.ToInt32(ViewState[CMSViewStateManager.SupplierID]),CMSContext.PortalID, CMSContext.LanguageID);

                    if (Supplier != null)
                    {
                        Supplier.Name = txtName.Text;
                        Supplier.IsEnabled = cbIsEnabled.Checked;
                        Supplier.LanguageID = ucPortalLanguage.SelectedLanguageID;
                        Supplier.ModuleID = (int)CMSEnums.ECommerceModule.Supplier;

                        List<string> files = ucSWFUpload.GetFilesName();
                        if (files.Count > 0)
                            Supplier.LogoImage = files[0];
                        else
                            Supplier.LogoImage = string.Empty;

                        int parentSupplierId = -1;
                        int.TryParse(ddlParentSupplier.SelectedValue, out parentSupplierId);
                        if (parentSupplierId > 0)
                            Supplier.ParentSupplierID = parentSupplierId;

                        Supplier.Description = txtDescription.Text;
                        Supplier.MetaTitle = txtMetaTitle.Text;
                        Supplier.MetaDescription = txtMetaDescription.Text;
                        Supplier.MetaKeywords = txtMetaKeywords.Text;

                        SupplierManager.Update(Supplier);
                        FillSupplierTree();
                        upnlSupplier.Update();
                    }
                }
                catch (Exception ex)
                {
                    dvProblems.Visible = true;
                    dvProblems.InnerText = ex.ToString();
                    upnlSupplier.Update();
                }

            }
        }