Beispiel #1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteId = ((LeadForceBasePage)Page).SiteId;

            ((Site)Page.Master).HideInaccessibleTabs(ref RadTabStrip1, ref RadMultiPage1);

            access = Access.Check();
            if (!access.Write)
            {
                lbtnSave.Visible = false;
            }

            var companyId = Page.RouteData.Values["id"] as string;

            hlCancel.NavigateUrl = UrlsData.AP_Companies();

            if (!string.IsNullOrEmpty(companyId))
            {
                CompanyId = Guid.Parse(companyId);
            }

            ucTaskList.CompanyId = CompanyId;
            ucTaskList.SiteId    = SiteId;

            ucContactList.CompanyId = CompanyId;
            ucContactList.SiteId    = SiteId;

            tagsCompany.ObjectID = CompanyId;

            if (!Page.IsPostBack)
            {
                BindData();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Handles the OnClick event of the lbtnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void lbtnSave_OnClick(object sender, EventArgs e)
        {
            if (!access.Write)
            {
                return;
            }

            var company = dataManager.Company.SelectById(SiteId, CompanyId) ?? new tbl_Company();

            company.Name            = txtName.Text;
            company.ParentID        = ucParentCompany.SelectedValue;
            company.CompanyTypeID   = ddlCompanyType.SelectedValue != string.Empty ? (Guid?)Guid.Parse(ddlCompanyType.SelectedValue) : null;
            company.OwnerID         = ucOwner.SelectedValue;
            company.CompanySizeID   = ddlCompanySize.SelectedValue != string.Empty ? (Guid?)Guid.Parse(ddlCompanySize.SelectedValue) : null;
            company.CompanySectorID = ddlCompanySector.SelectedValue != string.Empty ? (Guid?)Guid.Parse(ddlCompanySector.SelectedValue) : null;

            company.StatusID          = Guid.Parse(ddlStatus.SelectedValue);
            company.Phone1            = txtPhone1.Text;
            company.Phone2            = txtPhone2.Text;
            company.Fax               = txtFax.Text;
            company.Web               = txtWeb.Text;
            company.Email             = txtEmail.Text;
            company.EmailStatusID     = int.Parse(ddlEmailStatus.SelectedValue);
            company.LocationAddressID = ucLocationAddress.Save();
            company.PostalAddressID   = ucPostalAddress.Save();

            if (company.ID == Guid.Empty)
            {
                company.SiteID  = SiteId;
                company.OwnerID = CurrentUser.Instance.ContactID;
                dataManager.Company.Add(company);
            }
            else
            {
                dataManager.Company.Update(company);
            }

            dataManager.CompanyLegalAccount.Update(ucCompanyLegalAccount.CompanyLegalAccountList, company.ID);

            // Save tags
            tagsCompany.SaveTags(company.ID);

            Response.Redirect(UrlsData.AP_Companies());
        }