コード例 #1
0
ファイル: Admin.asmx.cs プロジェクト: alex765022/IBN
        public void UpdateTrial(
            string companyId,
            string companyName,
            bool isActive,
            int maxUsers,
            int maxExternalUsers,
            int maxDiskSpace,

            string contactName,
            string contactPhone,
            string contactEmail,

            DateTime trialStartDate,
            DateTime trialEndDate
            )
        {
            IConfigurator config  = Configurator.Create();
            ICompanyInfo  company = config.GetCompanyInfo(companyId);

            int     tariffId    = -1;
            decimal balance     = 0m;
            int     discount    = 0;
            decimal creditLimit = 0m;
            bool    sendSpam    = true;

            using (IDataReader reader = CManage.GetCompany(new Guid(companyId)))
            {
                if (reader.Read())
                {
                    if (reader["tariffId"] != DBNull.Value)
                    {
                        tariffId = (int)reader["tariffId"];
                    }
                    balance     = (decimal)reader["balance"];
                    discount    = (int)reader["discount"];
                    creditLimit = (decimal)reader["creditLimit"];
                    sendSpam    = (bool)reader["send_spam"];
                }
            }

            CManage.UpdateTrialCompany(new Guid(companyId), companyName, company.Host, company.Scheme, company.Port, 1,
                                       trialStartDate, trialEndDate, isActive, contactName, contactPhone, contactEmail,
                                       maxUsers, maxExternalUsers, maxDiskSpace, sendSpam, false);
        }
コード例 #2
0
ファイル: SiteEdit.ascx.cs プロジェクト: alex765022/IBN
        protected void OnSaveCommand(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            byte companyType = (byte)CompanyType.Billable;

            if (TypeList.SelectedValue == ((byte)CompanyType.Trial).ToString())
            {
                companyType = (byte)CompanyType.Trial;
            }

            string scheme = SchemeList.SelectedValue;
            string port   = PortValue.Text;

            try
            {
                if (companyType == (byte)CompanyType.Billable)
                {
                    CManage.UpdateCompany(
                        CompanyUid,
                        txtCompanyName.Text,
                        txtDomain.Text,
                        scheme,
                        port,
                        companyType,
                        IsActive.Checked,
                        txtContactName.Text,
                        txtContactPhone.Text,
                        txtContactEmail.Text,
                        int.Parse(MaxUsersValue.Text),
                        int.Parse(MaxExternalUsersValue.Text),
                        int.Parse(MaxDiskSpaceValue.Text),
                        true,
                        int.Parse(TariffList.SelectedValue),
                        decimal.Parse(BalanceValue.Text),
                        int.Parse(DiscountValue.Text),
                        decimal.Parse(CreditLimitValue.Text),
                        decimal.Parse(AlertThresholdValue.Text),
                        SendSpamCheckBox.Checked);
                }
                else
                {
                    DateTime datas = DateTime.Parse(txtDateFrom.Text);
                    DateTime data  = DateTime.Parse(txtDateTo.Text);

                    CManage.UpdateTrialCompany(
                        CompanyUid,
                        txtCompanyName.Text,
                        txtDomain.Text,
                        scheme,
                        port,
                        companyType,
                        datas,
                        data,
                        IsActive.Checked,
                        txtContactName.Text,
                        txtContactPhone.Text,
                        txtContactEmail.Text,
                        int.Parse(MaxUsersValue.Text),
                        int.Parse(MaxExternalUsersValue.Text),
                        int.Parse(MaxDiskSpaceValue.Text),
                        SendSpamCheckBox.Checked,
                        true);
                }
            }
            catch (ConfigurationException ex)
            {
                cvError.IsValid      = false;
                cvError.ErrorMessage = ex.Message;
                return;
            }
            Response.Redirect("../Pages/SiteView.aspx?id=" + CompanyUid.ToString());
        }