Exemplo n.º 1
0
    }//end ResetWarning

    private void PolulateInstallation(bool isAspNetDet = false, bool isPersDet = false, bool isBusDet = false, bool isBusHrs = false, bool isEmployee = false, bool isService = false, bool isComplete = false) {
        try {
            //get isntallation from session
            Installation i = WebUtils.GetInstallationObjectFromSession();

            //udpate Company details
            if (isBusDet) {
                var _with2 = i.Company;
                _with2.domain = this.businessDetails[0];
                _with2.industry = this.businessDetails[1];
                _with2.natureOfBusiness = (int)Utils.GetNumberInt(this.businessDetails[2]);
                _with2.businessAddress.landline = this.businessDetails[3];
            }

            //update client details (main company contact CLIENT)
            if (isPersDet) {
                var _with1 = i.Company.mainClientContact;
                _with1.title = this.personalDetails[0];
                _with1.firstName = this.personalDetails[1];
                _with1.lastName = this.personalDetails[2];
                _with1.role = (byte)RolesEnum.CLIENT;
            }

            //client ASP.NET USER ID
            if (isAspNetDet) {
                var _with21 = i.Company.mainClientContact;
                _with21.aspnetUserID = this.aspUserID;
                //client Contact Details
                var _with11 = _with21.contactDetail;
                _with11.email = this.email;
                _with11.dateCreated = i.Timestamp;
                _with11.dateUpdated = i.Timestamp;
            }

            if (isBusHrs) {
                var _with22 = i.Company;
                _with22.OpeningTime = this.openHrs;
                _with22.ClosingTime = this.closeHrs;
                _with22.OpeningDays = this.openDays;
            }

            if (isEmployee) {
                //Employees
                Guid tempStaffASPUserID = new Guid();
                var _with3 = i.Employees;
                //loop through all employees added 
                for (int j = 0; j < this.staff1stName.Count; j++) {
                    //add ASP.NET USER and get ASP.NET USER ID
                    tempStaffASPUserID = WebUtils.AddEmployeeASPNETUser(this.staffLastName[j], this.staff1stName[j], this.staffEmail[j]);
                    //add to installation Employee
                    _with3.Add(new EmployeeBLL(this.staffTitles[j], this.staff1stName[j], this.staffLastName[j], this.staffEmail[j], tempStaffASPUserID));
                }
                //add Staff email to Installation ProviderBLL
                i.ServicesProvidedByStaff.staffEmails = this.staffEmail;
            }//endif isEmployees

            if (isService) {
                //services 
                var _with4 = i.Services;
                //loop through all employees added 
                for (int k = 0; k < this.serviceName.Count; k++) {
                    //create new service
                    ServicesBLL serv = new ServicesBLL();
                    serv.name = this.serviceName[k];
                    serv.duration = (byte)Utils.GetNumberShort(this.serviceDuration[k]);
                    serv.price = (decimal)Utils.GetNumberDouble(this.servicePrice[k]);
                    //add to installation service
                    _with4.Add(serv);
                }

                //services Provided By Staff    
                var _with5 = i.ServicesProvidedByStaff;
                _with5.serviceNames = this.serviceName;
                _with5.staffPerfServiceNames = this.serviceStaff;
            }

            if (!isComplete)
                //add installation back to session
                WebUtils.PutInstallationObjectinSession(i);

            if (isComplete) {
                //process data and save to database
                InstallationBLL.SaveInstallationToDB(ref i, SessionVariables.ISummaryXML);
                SessionVariables.CompanyID = i.Company.ID;
            }
        }
        catch (Exception ex) {
            System.Diagnostics.Debug.Print("<h2>Register.aspx, PolulateInstallation(x6)</h2>\n" + ex.ToString() + "\n" + ex.InnerException + "\n" + ex.Message);
            // Log the exception and notify system operators
            ExceptionUtility.LogException(ex, "Register.aspx, PolulateInstallation(x6)");
            ExceptionUtility.NotifySystemOps(ex);
        }
    }//end PolulateInstallation(x6)