Пример #1
0
        protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
        {
            Response response;
            StringBuilder body = new StringBuilder("<h1>ViewClient</h1>");
            try
            {
                IClientService cs = serviceFactory.CreateClientService();
                Guid id = new Guid(form["id"]);

                Client client = cs.GetElement(id);

                body.Append(Environment.NewLine);
                body.Append("<p><b>Name:</b>").Append(client.Name).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Surname:</b>").Append(client.Surname).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Address:</b>").Append(client.Address).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Phone number::</b>").Append(client.Phone).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("<a href='UpdateClient?id=").Append(id).Append("'>Update Client</a>");

            }
            catch (Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }

            return body.ToString();
        }
Пример #2
0
        protected override string AddBody(System.Collections.Generic.IDictionary<string, string> form, string sessionId = null, System.Collections.Generic.IDictionary<string, string> errors = null)
        {
            Response response;
            StringBuilder body = new StringBuilder();
            try
            {
                body.Append(Environment.NewLine).Append("<div class='connect'>");
                body.Append("<h1>Call if you have questions!</h1>");
                body.Append(Environment.NewLine);
                body.Append("<pre>").Append(" moby phone: +3 8(067) 345 65 76");
                body.Append(Environment.NewLine);
                body.Append(" city phone:   (044) 345 67 89").Append("</pre>");
                body.Append(Environment.NewLine);
                body.Append("</div>");
                body.Append("<img src='telephone.jpg' style='width:900px;height:500px;border:0'>");
                body.Append(Environment.NewLine);
            }
            catch (Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }

            return body.ToString();
        }
Пример #3
0
        protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
        {
            Response response;
            StringBuilder body = new StringBuilder("<h1>ViewAppeal</h1>");

            try
            {
                // AppealServiсe aps = new AppealServiсe("appealclient.txt");
                // ClientService cs = new ClientService("client.txt");
                IAppealService aps = serviceFactory.CreateAppealService();
                IClientService cs = serviceFactory.CreateClientService();
                Guid id = new Guid(form["id"]);
                Appeal appealclient = aps.GetElement(id);
                body.Append(Environment.NewLine);
                var client = cs.GetElement(appealclient.IdClient);
                body.Append("<p><b>Name client:   </b>").Append(client.Name + " " + client.Surname).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Content appeal:   </b>").Append(appealclient.ClientAppeal).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Problem solved?:   </b>").Append(appealclient.Rez).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Comment:   </b>").Append(appealclient.Comment).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>References:   </b>").Append(appealclient.References).Append("</p>");
                body.Append(Environment.NewLine);

            }
            catch (Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }

            return body.ToString();
        }
Пример #4
0
 public Response Get(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
 {
     StringBuilder answer = new StringBuilder();
     answer.Append(AddHeader(sessionId));
     answer.Append(AddBody(form, sessionId, errors));
     answer.Append(AddFooter());
     Response response = new Response(answer.ToString(), TypeOfAnswer.Success, "");
     return response;
 }
Пример #5
0
        public override Response Post(IDictionary<string, string> form, string sessionId = null)
        {
            Response response;
            try
            {
                Dictionary<string, string> errors = new Dictionary<string, string>();
                //ManagerService ms = new ManagerService("manager.txt");
                IManagerService ms = serviceFactory.CreateManagerService();
                Manager manager = null;

                string value = ConfigurationManager.AppSettings["Admin"];
                Guid guid = new Guid("c32f3d67-26da-4cba-9595-8a9f0efa0e5b");

                if (form["password"] == value)
                {
                    manager = new Manager(guid, "admin", "admin", (WorkExperience)1, "", "911", "admin", "admin");
                }
                else
                {
                    manager = ((SQLManagerService)ms).GetElementByLogin(form["login"]);
                }

                if (manager == null)
                {
                    errors.Add("login", "User with such login does not exist!");
                    response = this.Get(form, sessionId, errors);
                }
                else if (manager.Password != form["password"])
                {
                    errors.Add("password", "Password is wrong!");
                    response = this.Get(form, sessionId, errors);
                }
                else
                {
                    response = new Response("", TypeOfAnswer.Redirection, "Index");

                        if (sessionId == null)
                        sessionId = Guid.NewGuid().ToString();

                    Session.Instance.RegisterSessions[sessionId].SetUser(manager.Id.ToString(), manager.Name, manager.Surname);

                    response.SessionId = sessionId;
                }
            }
            catch(Exception ex)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                Console.WriteLine(ex.Message);
                return response;
            }

            return response;
        }
        public Response Get(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
        {
            Response response;
            try
            {
                IManagerService ms = serviceFactory.CreateManagerService();
                Guid id = new Guid(form["id"]);
                ms.Delete(id);
            }
            catch (Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return response;
            }

            return new Response("", TypeOfAnswer.Redirection, "ManagersList");
        }
Пример #7
0
        public Response Get(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
        {
            Response response;
            try
            {
                //FormServiсe fs = new FormServiсe("forms.txt");
                IFormService fs = serviceFactory.CreateFormService();
                Guid id = new Guid(form["id"]);
                fs.Delete(id);
            }
            catch (Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return response;
            }

            return new Response("", TypeOfAnswer.Redirection, "FormList");
        }
Пример #8
0
        public Response Get(System.Collections.Generic.IDictionary<string, string> form, string sessionId = null, System.Collections.Generic.IDictionary<string, string> errors = null)
        {
            Response response;
            try
            {
                IClientService cs = serviceFactory.CreateClientService();
                Guid id = new Guid(form["id"]);
                //cs.Delete(id);
                cs.Delete(id);
            }
               catch(Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return response;
            }

            return new Response("", TypeOfAnswer.Redirection, "ClientsList");
        }
Пример #9
0
        public Response Get(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
        {
            Response response;
            try
            {
                //AppealServiсe cs = new AppealServiсe("appealclient.txt");
                IAppealService aps = serviceFactory.CreateAppealService();

                Guid id = new Guid(form["id"]);
                aps.Delete(id);
            }
            catch (Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return response;
            }

            return new Response("", TypeOfAnswer.Redirection, "AppealList");
        }
Пример #10
0
        public override Response Post(IDictionary<string, string> form, string sessionId = null)
        {
            Response response;
            try
            {
                Appeal appealclient = new Appeal(Guid.NewGuid(),
                new Guid(form["managerId"]),  new Guid(form["clientId"]), (ClientAppeal)Convert.ToInt32(form["reason"]));

                appealclient.Comment = form["comment"];
                appealclient.References = form["references"];

                if (form.ContainsKey("solve1") == form.ContainsKey("solve2"))
                {
                    appealclient.Rez = "no";
                }
                else
                {
                    if (form.ContainsKey("solve1"))
                    {
                        appealclient.Rez = form["solve1"];
                    }
                    else
                    {
                        appealclient.Rez = form["solve2"];
                    }
                }
                // AppealServiсe aser = new AppealServiсe("appealclient.txt");
                IAppealService aser = serviceFactory.CreateAppealService();
                aser.Add(appealclient);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                response = new Response("", TypeOfAnswer.ServerError, "");
                return response;
            }

            response = new Response("", TypeOfAnswer.Redirection, "AppealList");

            return response;
        }
Пример #11
0
        public override Response Post(IDictionary<string, string> form, string sessionId = null)
        {
            Response response;
            try
            {
                IClientService cs = serviceFactory.CreateClientService();
                Guid id = new Guid(form["id"]);
                Client client = new Client(id, form["name"], form["surname"], form["address"], form["phone"]);
                cs.Update(client);

            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
                response = new Response("", TypeOfAnswer.ServerError, "");
                return response;
            }

            response = new Response("", TypeOfAnswer.Redirection, "ClientsList");

            return response;
        }
Пример #12
0
        protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
        {
            Response response;
            StringBuilder body = new StringBuilder("<h1>View Manager</h1>");
            try
            {
                IManagerService sms = serviceFactory.CreateManagerService();
                //ManagerService ms = new ManagerService("manager.txt");
                Guid id = new Guid(form["id"]);
                //Manager manager = ms.GetElement(id);
                Manager manager = sms.GetElement(id);
                body.Append(Environment.NewLine);
                body.Append("<p><b>Name:   </b>").Append(manager.Name).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Surname:   </b>").Append(manager.Surname).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Work:   </b>").Append(manager.Work).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Address:   </b>").Append(manager.Address).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Phone number:   </b>").Append(manager.Phone).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Login:   </b>").Append(manager.Login).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append("<p><b>Password:   </b>").Append(manager.Password).Append("</p>");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("<a href='UpdateManager?id=").Append(id).Append("'>Update Manager</a>");

            }
            catch (Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }

            return body.ToString();
        }
Пример #13
0
        protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
        {
            StringBuilder body = new StringBuilder();
            try
            {
                //ManagerService ms = new ManagerService("manager.txt");
                IManagerService sms = serviceFactory.CreateManagerService();
                Dictionary<Guid, Manager> managers = sms.GetAll();
                body.Append(Environment.NewLine);
                body.Append("<h1>List Managers</h1>");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("<table width='100%' border='1' cellspacing='0' cellpadding='4'>");
                body.Append(Environment.NewLine);
                body.Append("<tr>");
                body.Append(Environment.NewLine);
                body.Append("<th>Number</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Name</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Surname</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Experience of Work</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Address</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Phone</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Login</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Password</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>controls</th>");
                body.Append(Environment.NewLine);
                body.Append("</tr>");

                int n = 1;
                foreach (var man in managers)
                {
                    body.Append("<tr>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(n).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(man.Value.Name).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(man.Value.Surname).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(man.Value.Work.ToString()).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(man.Value.Address).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(man.Value.Phone).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(man.Value.Login).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(man.Value.Password).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>");
                    body.Append("<a href='ViewManager?id=").Append(man.Key).Append("'>View</a>");
                    body.Append("<a href='UpdateManager?id=").Append(man.Key).Append("'>Update</a>");
                    body.Append("<a href='DeleteManager?id=").Append(man.Key).Append("'>Delete</a>");
                    body.Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<tr>");
                    n++;
                }

                body.Append("</table>");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("<a href='CreateManager'>   Create new manager </a>");
                body.Append(Environment.NewLine);
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Response response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }

            return body.ToString();
        }
Пример #14
0
        public override Response Post(IDictionary<string, string> form, string sessionId = null)
        {
            Response response;
            try
            {

                Form formclient = new Form(Guid.NewGuid(), new Guid(form["managerId"]), new Guid(form["clientId"]));
                formclient.F1 = FormsClient.Are_you_satisfied_with_the_service;
                formclient.Comment1 = form["comment1"];
                formclient.F2 = FormsClient.Are_you_satisfied_with_the_speed_of_the_Internet;
                formclient.Comment2 = form["comment2"];
                 formclient.F3 = FormsClient.Do_you_like_the_service_manager;
                 formclient.Comment3 = form["comment3"];
                 formclient.F4 = FormsClient.Do_you_use_the_Internet_and_TV;
                 formclient.Comment4 = form["comment4"];
                 formclient.F5 = FormsClient.Do_you_want_to_participate_in_the_loyalty_program;
                 formclient.Comment5 = form["comment5"];
                if (form.ContainsKey("form1") == form.ContainsKey("form2"))
                {
                    formclient.Answer1 = "yes";
                }
                else
                {
                    if (form.ContainsKey("form1"))
                    {
                        formclient.Answer1 = form["form1"];
                    }
                    else
                    {
                        formclient.Answer1 = form["form2"];
                    }
                }
                //----------------------------------------------
                if (form.ContainsKey("form3") == form.ContainsKey("form4"))
                {
                    formclient.Answer2 = "yes";
                }
                else
                {
                    if (form.ContainsKey("form3"))
                    {
                        formclient.Answer2 = form["form3"];
                    }
                    else
                    {
                        formclient.Answer2 = form["form4"];
                    }
                }
                //----------------------------------------------
                 if (form.ContainsKey("form5") == form.ContainsKey("form6"))
                 {
                     formclient.Answer3 = "yes";
                 }
                 else
                 {
                if (form.ContainsKey("form5"))
                 {
                     formclient.Answer3 = form["form5"];
                 }
                 else
                 {
                     formclient.Answer3 = form["form6"];
                 }
                 }
                 //----------------------------------------------
                 if (form.ContainsKey("form7") == form.ContainsKey("form8"))
                {
                    formclient.Answer4 = "yes";
                }
                else
                {
                 if (form.ContainsKey("form7"))
                 {
                     formclient.Answer4 = form["form7"];
                 }
                 else
                 {
                     formclient.Answer4 = form["form8"];
                 }
                 }
                 //----------------------------------------------
                 if (form.ContainsKey("form9") == form.ContainsKey("form10"))
                {
                    formclient.Answer5 = "yes";
                }
                else
                {
                 if (form.ContainsKey("form9"))
                 {
                     formclient.Answer5 = form["form9"];
                 }
                 else
                 {
                     formclient.Answer5 = form["form10"];
                 }
                 }
                //FormServiсe fs = new FormServiсe("forms.txt");
                IFormService fs = serviceFactory.CreateFormService();
                fs.Add(formclient);
            }
            catch (Exception ex)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                Console.WriteLine(ex.Message );
                return response;
            }

            response = new Response("", TypeOfAnswer.Redirection, "FormList");

            return response;
        }
Пример #15
0
        protected override string AddBody(IDictionary<string, string> form, string sessionId = null,IDictionary<string, string> errors = null)
        {
            StringBuilder body = new StringBuilder();
            try
            {
                // AppealServiсe aps = new AppealServiсe("appealclient.txt");
                IAppealService aps = serviceFactory.CreateAppealService();
                Dictionary<Guid, Appeal> appealclients = aps.GetAll();
                body.Append(Environment.NewLine);
                body.Append("<h1>List Appeals</h1>");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("<table width='100%' border='1' cellspacing='0' cellpadding='4'>");
                body.Append(Environment.NewLine);
                body.Append("<tr>");
                body.Append(Environment.NewLine);
                body.Append("<th>Number</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Name client</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Appeal of client</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Rezult</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Controls</th>");
                body.Append(Environment.NewLine);
                body.Append("</tr>");

                //ClientService cs = new ClientService("client.txt");
               // SQLClientService cs = new SQLClientService("Clients");
                IClientService cs = serviceFactory.CreateClientService();
                int n = 1;
                foreach (var element in appealclients)
                {
                    body.Append("<tr>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(n).Append("</td>");
                    body.Append(Environment.NewLine);
                    var client = cs.GetElement(element.Value.IdClient);
                    body.Append("<td>").Append(client.Name +" "+ client.Surname).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(element.Value.ClientAppeal.ToString()).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(element.Value.Rez).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td><a href='ViewAppeal?id=").Append(element.Key).Append("'>View</a>");
                    body.Append("<a href='DeleteAppeal?id=").Append(element.Key).Append("'>Delete</a></td>");
                    body.Append(Environment.NewLine);
                    body.Append("<tr>");
                    n++;
                }

                body.Append("</table>");
                body.Append("<br>");
                body.Append(Environment.NewLine);
                body.Append("<a href='CreateAppeal'> Create new appeal </a>");
                body.Append(Environment.NewLine);

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Response response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }

            return body.ToString();
        }
Пример #16
0
        protected override string AddBody(IDictionary<string, string> form, string sessionId = null,IDictionary<string, string> errors = null)
        {
            StringBuilder body = new StringBuilder();
            try
            {
                IClientService cs = serviceFactory.CreateClientService();

                Dictionary<Guid, Client> clients = cs.GetAll();

                body.Append(Environment.NewLine);
                body.Append("<h1>List Client</h1>");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("<table width='100%' border='1' cellspacing='0' cellpadding='4'>");
                body.Append(Environment.NewLine);
                body.Append("<tr>");
                body.Append(Environment.NewLine);
                body.Append("<th>Number</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Name</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Surname</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Address</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>Phone</th>");
                body.Append(Environment.NewLine);
                body.Append("<th>controls</th>");
                body.Append(Environment.NewLine);
                body.Append("</tr>");

                int n = 1;
                foreach (var client in clients)
                {
                    body.Append("<tr>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(n).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(client.Value.Name).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(client.Value.Surname).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(client.Value.Address).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(client.Value.Phone).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>");
                    body.Append("<a href='ViewClient?id=").Append(client.Key).Append("'>View</a>");
                    body.Append("<a href='UpdateClient?id=").Append(client.Key).Append("'>Update</a>");
                    body.Append("<a href='DeleteClient?id=").Append(client.Key).Append("'>Delete</a>");
                    body.Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("</tr>");
                    n++;
                }

                body.Append("</table>");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("<a href='CreateClient'> Create new client </a>");
                body.Append(Environment.NewLine);
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
                Response response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }

            return body.ToString();
        }
Пример #17
0
        protected override string AddBody(IDictionary<string, string> form, string sessionId = null,IDictionary<string, string> errors = null)
        {
            Response response;
            StringBuilder body = new StringBuilder("<h1>ViewForm</h1>");
            try
            {
                //FormServiсe fs = new FormServiсe("forms.txt");
                IFormService fs = serviceFactory.CreateFormService();
                Guid id = new Guid(form["id"]);

               // Form formclient = fs.GetElement(id);
                Form formclient = fs.GetElement(id);
                // ClientServiсe cs = new ClientServiсe("client.txt");
                IClientService cs = serviceFactory.CreateClientService();
                Client c = cs.GetElement(formclient.IdClient);

                body.Append(Environment.NewLine);
                body.Append("<p><b id='col'>Name client:  </b>").Append(c.Name + " " + c.Surname);
                body.Append(Environment.NewLine);
                body.Append("<p><b id='col'>FormClient:</b>");
                body.Append(Environment.NewLine);
                body.Append("<table width='100%' border='1' cellspacing='0' cellpadding='4'>");
                body.Append(Environment.NewLine);
                body.Append("<tr>");
                body.Append(Environment.NewLine);
                body.Append("<th id='col'>Number</th>");
                body.Append(Environment.NewLine);
                body.Append("<th id='col'>Questions</th>");
                body.Append(Environment.NewLine);
                body.Append("<th id='col'>Answers</th>");
                body.Append(Environment.NewLine);
                body.Append("<th id='col'>Comments</th>");
                body.Append(Environment.NewLine);
                body.Append("</tr>");
                var forms = fs.GetAll();
                //var forms = sfs.GetAll();
                int n = 1;
                foreach (var element in forms)
                {
                    body.Append("<tr>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(n).Append("</td>");
                    body.Append(Environment.NewLine);
                    body.Append("<td>").Append(element.Value.F1);
                    body.Append("<br>");
                    body.Append(element.Value.F2);
                    body.Append("<br>");
                    body.Append(element.Value.F3.ToString());
                    body.Append("<br>");
                    body.Append(element.Value.F4.ToString());
                    body.Append("<br>");
                    body.Append(element.Value.F5.ToString());
                    body.Append("</td>").Append(Environment.NewLine);
                    body.Append("<td>").Append(element.Value.Answer1);
                    body.Append("<br>");
                    body.Append(element.Value.Answer2);
                    body.Append("<br>");
                    body.Append(element.Value.Answer3);
                    body.Append("<br>");
                    body.Append(element.Value.Answer4);
                    body.Append("<br>");
                    body.Append(element.Value.Answer5);
                    body.Append("</td>").Append(Environment.NewLine);
                    body.Append("<td>").Append(element.Value.Comment1);
                    body.Append("<br>");
                    body.Append(element.Value.Comment2);
                    body.Append("<br>");
                    body.Append(element.Value.Comment3);
                    body.Append("<br>");
                    body.Append(element.Value.Comment4);
                    body.Append("<br>");
                    body.Append(element.Value.Comment5);
                    body.Append("</td>").Append(Environment.NewLine);
                    body.Append("</tr>");
                    n++;
                }

                body.Append("</table>");
                body.Append("<br>");
                // ManagerService ms = new ManagerService("manager.txt");
                IManagerService ms = serviceFactory.CreateManagerService();
                Manager man = ms.GetElement(formclient.IdManager);
                body.Append(Environment.NewLine);
                body.Append("<p><b id='col'>Manager:  </b>").Append(man.Name + " " + man.Surname);
                body.Append(Environment.NewLine);
                body.Append("<script>");
                body.Append("function(){ document.getElementById('col').style.color ='black'; }");
                body.Append("</script>");
                body.Append(Environment.NewLine);
            }
            catch (Exception)
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }

            return body.ToString();
        }
Пример #18
0
        protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null)
        {
            Response response;

            try
            {
                IClientService cs = serviceFactory.CreateClientService();
                Guid id = new Guid(form["id"]);

                //Client client = cs.GetElement(id);
                Client client = cs.GetElement(id);

                HtmlForm htmlForm = new HtmlForm(RequestMethod.POST, "UpdateClient", errors);
                htmlForm.SetAttribut("novalidate", "novalidate");
                htmlForm.AddTag(new HtmlInput(InputType.Hidden, "id", client.Id.ToString()));

                HtmlBaseTag div1 = htmlForm.AddTag("div", null).SetAttribut("class", "row");
                HtmlBaseTag divLabel1 = div1.AddTag("div", null).SetAttribut("class", "forlabel");
                HtmlBaseTag divInput1 = div1.AddTag("div", null).SetAttribut("class", "forinput");
                divLabel1.AddTag("lable", "Name :");
                divInput1.AddTag(new HtmlInput(InputType.Text, "name", client.Name))
                    .SetAttribut("maxlength", "15")
                    .SetAttribut("required", "required")
                    .SetAttribut("onblur", "InputIsValid('name')");
                divInput1.AddTag("span").SetAttribut("id", "forname");

                HtmlBaseTag div2 = htmlForm.AddTag("div", null).SetAttribut("class", "row");
                HtmlBaseTag divLabel2 = div2.AddTag("div", null).SetAttribut("class", "forlabel");
                HtmlBaseTag divInput2 = div2.AddTag("div", null).SetAttribut("class", "forinput");
                divLabel2.AddTag("lable", "Surname :");
                divInput2.AddTag(new HtmlInput(InputType.Text, "surname", client.Surname))
                    .SetAttribut("maxlength", "15")
                    .SetAttribut("required", "required")
                    .SetAttribut("onblur", "InputIsValid(this)");
                divInput2.AddTag("span").SetAttribut("id", "forsurname");

                HtmlBaseTag div3 = htmlForm.AddTag("div", null).SetAttribut("class", "row");
                HtmlBaseTag divLabel3 = div3.AddTag("div", null).SetAttribut("class", "forlabel");
                HtmlBaseTag divInput3 = div3.AddTag("div", null).SetAttribut("class", "forinput");
                divLabel3.AddTag("lable", "Address :");
                divInput3.AddTag(new HtmlInput(InputType.Text, "address", client.Address))
                    .SetAttribut("maxlength", "50");
                div3.AddTag("span").SetAttribut("id", "foraddress");

                HtmlBaseTag div4 = htmlForm.AddTag("div", null).SetAttribut("class", "row");
                HtmlBaseTag divLabel4 = div4.AddTag("div", null).SetAttribut("class", "forlabel");
                HtmlBaseTag divInput4 = div4.AddTag("div", null).SetAttribut("class", "forinput");
                divLabel4.AddTag("lable", "Phone :");
                divInput4.AddTag(new HtmlInput(InputType.Text, "phone", client.Phone))
                    .SetAttribut("required", "required")
                    .SetAttribut("onblur", "InputIsValid(this)");
                div4.AddTag("span").SetAttribut("id", "forphone");

                HtmlBaseTag div5 = htmlForm.AddTag("div", null).SetAttribut("class", "row");
                HtmlBaseTag divLabel5 = div5.AddTag("div", null).SetAttribut("class", "forlabel");
                HtmlBaseTag divInput5 = div5.AddTag("div", null).SetAttribut("class", "forinput");
                divInput5.AddTag(new HtmlInput(InputType.Reset, "Reset", "Clin")
                    .SetAttribut("class", "buttonsubmit"));
                divInput5.AddTag(new HtmlInput(InputType.Submit, "Submit", "Submit")
                    .SetAttribut("class", "buttonsubmit"));

                StringBuilder body = new StringBuilder(Environment.NewLine);
                body.Append(AddGreeting(sessionId));
                body.Append(Environment.NewLine);
                body.Append(htmlForm.ToString(errors));
                body.Append(Environment.NewLine);

                return body.ToString();
            }
            catch (Exception )
            {
                response = new Response("", TypeOfAnswer.ServerError, "");
                return "";
            }
        }