Пример #1
0
 protected void ButtonAddRentType_Click(object sender, EventArgs e)
 {
     string rentTypeName = TextBoxRentTypeName.Text.Trim();
     if (!QuickPM.Property.ValidRentType(rentTypeName))
     {
         Session["PropertyErrorMessage"] = "<font color=\"red\">Only use letters, numbers, and % in the rent name</font>";
         return;
     }
     int chartOfAccount = 0;
     if (TextBoxRentTypeChartOfAccount.Text.Trim() != "")
     {
         if (!Int32.TryParse(TextBoxRentTypeChartOfAccount.Text, out chartOfAccount))
         {
             Session["PropertyErrorMessage"] = "<font color=\"red\">Please enter a number for the chart of account</font>";
             return;
         }
     }
     QuickPM.Property property = new QuickPM.Property(Int32.Parse(Request["PropertyId"]));
     if (property.RentTypes.IndexOf(rentTypeName) != -1)
     {
         Session["PropertyErrorMessage"] = "<font color=\"red\">That rent name already exists!</font>";
         return;
     }
     property.AddRentType(rentTypeName);
     if (TextBoxRentTypeChartOfAccount.Text.Trim() != "")
     {
         property.ChartOfAccounts.Add(property.RentTypes.Count - 1, chartOfAccount);
     }
     property.Save();
 }
Пример #2
0
        protected void PopulateTenantDropDown()
        {
            if (serviceRequest.PropertyId != -1)
            {
                QuickPM.Property prop = new QuickPM.Property(serviceRequest.PropertyId);
                List<string> tenantIds = prop.GetTenantIds();
                foreach (string tenantId in tenantIds)
                {
                    QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId);
                    ListItem item = new ListItem(tenant.GetShortName() + " (#" + tenantId + ")", tenantId);
                    item.Selected = serviceRequest.TenantId == item.Value;
                    DropDownListTenant.Items.Add(item);

                }

                if (serviceRequest.TenantId.Trim() == "")
                {
                    TextBoxContactName.Text = "";
                    TextBoxContactName.Enabled = false;
                    TextBoxContactPhone.Text = "";
                    TextBoxContactPhone.Enabled = false;

                    TextBoxOtherAddress.Enabled = true;
                    TextBoxOtherCity.Enabled = true;
                    TextBoxOtherKeyContact.Enabled = true;
                    TextBoxOtherNumber.Enabled = true;
                    TextBoxOtherState.Enabled = true;

                }
                else
                {

                    TextBoxContactName.Enabled = true;
                    TextBoxContactPhone.Enabled = true;

                    TextBoxOtherAddress.Enabled = false;
                    TextBoxOtherCity.Enabled = false;
                    TextBoxOtherKeyContact.Enabled = false;
                    TextBoxOtherNumber.Enabled = false;
                    TextBoxOtherState.Enabled = false;

                    TextBoxOtherAddress.Text = "";
                    TextBoxOtherCity.Text = "";
                    TextBoxOtherKeyContact.Text = "";
                    TextBoxOtherNumber.Text = "";
                    TextBoxOtherState.Text = "";
                }

            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            QuickPMWebsite.DatabaseSettings.UpdateDatabaseConnectionString(Context.Profile, Request);
            serviceRequest = new ServiceRequest();
            serviceRequest.PropertyId = -1;
            workOrder = new WorkOrderRequest();
            long id = 0;
            if (Request["ServiceRequestId"] != null && long.TryParse(Request["ServiceRequestId"], out id))
            {
                serviceRequest = new QuickPM.ServiceRequest(id);
                List<WorkOrderRequest> workOrders = QuickPM.WorkOrderRequest.Find<QuickPM.WorkOrderRequest>("ServiceRequestId", id);
                if (workOrders.Count > 0)
                {
                    workOrder = workOrders[0];
                }
                else
                {
                    serviceRequest.Save();
                    workOrder.ServiceRequestId = serviceRequest.Id;
                    workOrder.Save();
                }
            }
            if (!IsPostBack)
            {
                PopulateControls();
                ListItem tenantItem = new ListItem("None", "");
                tenantItem.Selected = serviceRequest.TenantId == "";
                DropDownListTenant.Items.Add(tenantItem);
                ListItem it = new ListItem("Other", "-1");
                it.Selected = serviceRequest.PropertyId == long.Parse(it.Value);
                //DropDownListProperty.Items.Add(it);
                foreach (int PropertyId in QuickPM.Util.GetPropertyIds())
                {
                    QuickPM.Property p = new QuickPM.Property(PropertyId);
                    ListItem item = new ListItem(p.Name + " (#" + PropertyId + ")", p.Id.ToString());
                    if (p.Id == serviceRequest.PropertyId)
                    {
                        item.Selected = true;

                    }
                    //DropDownListProperty.Items.Add(item);
                }
                PopulateTenantDropDown();

            }
            //DropDownListProperty.Enabled = Request["PropertyId"] == null;
            //DropDownListProperty.Visible = Request["PropertId"] == null;
            TextBoxContactName.Visible = DropDownListTenant.SelectedValue != "";
            TextBoxContactPhone.Visible = DropDownListTenant.SelectedValue != "";
        }