示例#1
0
        public void createCustomer(Customer customer)
        {
            try
            {
                log4net.Config.XmlConfigurator.Configure();
                CustomerModel cmodel = new CustomerModel();
                cmodel.firstname  = customer.firstname;
                cmodel.lastname   = customer.lastname;
                cmodel.email      = customer.email;
                cmodel.password   = customer.password;
                cmodel.username   = customer.username;
                cmodel.engineerid = customer.engineerid;

                IUnityContainer           container = new UnityContainer();
                UnityConfigurationSection section   = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
                section.Configure(container);
                IEngineerBL rservicebl = container.Resolve <IEngineerBL>();
                rservicebl.createCustomer(cmodel);
            }
            catch (Exception exp)
            {
                log.Error("Customer via Soap konnte nicht gespeichert werden.");
                throw new Exception("Customer via Soap konnte nicht gespeichert werden.", exp);
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IUnityContainer           container = new UnityContainer();
            UnityConfigurationSection section   = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");

            section.Configure(container);


            if (Request["user"] != null)
            {
                if (Request["user"].ToString().Equals("engineer"))
                {
                    int                      engineerid = Int32.Parse(Request["userid"]);
                    IEngineerBL              eservice   = container.Resolve <IEngineerBL>();
                    ICustomerBL              cservice   = container.Resolve <ICustomerBL>();
                    List <CustomerModel>     clist      = eservice.showMyCustomers(engineerid);
                    List <InstallationModel> ilist      = new List <InstallationModel>();
                    foreach (var item in clist)
                    {
                        ilist.AddRange(cservice.getInstallations(item));
                    }
                    StringBuilder str = new StringBuilder();
                    str.Append("<table border = '1'><tr><th>Id</th><th>Description</th></tr>");
                    foreach (var item in ilist)
                    {
                        str.Append("<tr><td>" + item.installationid + "</td><td>" + item.description + "</td><td><a href='InstallationDetail.aspx?installation=" + item.installationid + "&user=engineer&userid=" + engineerid + "'>Details</a></td></tr>");
                    }
                    str.Append("</table>");
                    divtable.InnerHtml = str.ToString();
                }
                else
                {
                    int         customerid         = Int32.Parse(Request["userid"]);
                    ICustomerBL cservice           = container.Resolve <ICustomerBL>();
                    List <InstallationModel> ilist = cservice.getInstallations(cservice.getCustomer(customerid));
                    StringBuilder            str   = new StringBuilder();
                    str.Append("<table border = '1'><tr><th>Id</th><th>Description</th></tr>");
                    foreach (var item in ilist)
                    {
                        str.Append("<tr><td>" + item.installationid + "</td><td>" + item.description + "</td><td><a href='InstallationDetail.aspx?installation=" + item.installationid + "&user=engineer&userid=" + customerid + "'>Details</a></td></tr>");
                    }
                    str.Append("</table>");
                    divtable.InnerHtml = str.ToString();
                }
            }
        }
示例#3
0
        protected void btnlogin_Click(object sender, EventArgs e)
        {
            IUnityContainer           container = new UnityContainer();
            UnityConfigurationSection section   = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");

            section.Configure(container);
            IEngineerBL eservice = container.Resolve <IEngineerBL>();
            ICustomerBL cservice = container.Resolve <ICustomerBL>();

            if (eservice.validateEngineer(txtbenutzername.Value, txtpasswort.Value) >= 0)
            {
                Response.Redirect("~/InstallationList.aspx?user=engineer&userid=" + eservice.validateEngineer(txtbenutzername.Value, txtpasswort.Value));
            }
            else if (cservice.validateCustomer(txtbenutzername.Value, txtpasswort.Value) >= 0)
            {
                Response.Redirect("~/InstallationList.aspx?user=customer&userid=" + cservice.validateCustomer(txtbenutzername.Value, txtpasswort.Value));
            }
            else
            {
                loginresponse.InnerText += "Falscher Benutzername bzw. Passwort";
            }
        }
示例#4
0
        public void createInstallation(Installation installation)
        {
            try
            {
                InstallationModel imodel = new InstallationModel();
                imodel.latitude    = installation.latitude;
                imodel.longitude   = installation.longitude;
                imodel.serialno    = installation.serialno;
                imodel.description = installation.description;
                imodel.customerid  = installation.customerid;

                IUnityContainer           container = new UnityContainer();
                UnityConfigurationSection section   = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
                section.Configure(container);
                IEngineerBL rservicebl = container.Resolve <IEngineerBL>();

                rservicebl.createInstallation(imodel);
            }
            catch (Exception exp)
            {
                log.Error("Installation via Soap konnte nicht gespeichert werden.");
                throw new Exception("Installation via Soap konnte nicht gespeichert werden.", exp);
            }
        }
示例#5
0
        public override void Validate(string userName, string password)
        {
            try
            {
                if (userName == null || password == null)
                {
                    throw new ArgumentNullException();
                }
                IUnityContainer           container = new UnityContainer();
                UnityConfigurationSection section   = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
                section.Configure(container);
                IEngineerBL rservicebl = container.Resolve <IEngineerBL>();

                if (rservicebl.validateEngineer(userName, password) >= 0)
                {
                    throw new FaultException("Incorrect Username or Password");
                }
            }
            catch (Exception exp)
            {
                log.Error("Fehler bei Validierung des Engineers via Soap.");
                throw new Exception("Fehler bei Validierung des Engineers via Soap.", exp);
            }
        }