protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null) { HtmlForm htmlForm = new HtmlForm(RequestMethod.POST, "CreateManager", errors); htmlForm.SetAttribut("novalidate", "novalidate"); if (errors != null && errors.Count > 0) { htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Name: ") .SetAttribut("class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "name", form["name"])) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters") .SetAttribut("required", "required"); if (errors.ContainsKey("name")) { htmlForm.AddTag("span", errors["name"]) .SetAttribut("id", "forname"); } else { htmlForm.AddTag("span").SetAttribut("id", "forname"); } htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Surname: ") .SetAttribut("class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "surname", form["surname"])) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters") .SetAttribut("required", "required"); if (errors.ContainsKey("name")) { htmlForm.AddTag("span", errors["name"]) .SetAttribut("id", "forsurname"); } else { htmlForm.AddTag("span").SetAttribut("id", "forsurname"); } htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Address: ") .SetAttribut("class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "address", form["address"])) .SetAttribut("maxlength", "50") .SetAttribut("placeholder", "max length of 50 characters") .SetAttribut("required", "required"); if (errors.ContainsKey("name")) { htmlForm.AddTag("span", errors["name"]) .SetAttribut("id", "foraddress"); } else { htmlForm.AddTag("span").SetAttribut("id", "foraddress"); } htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Phone: ") .SetAttribut("class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "phone", form["phone"])) .SetAttribut("placeholder", "000-000-00-00") .SetAttribut("required", "required"); if (errors.ContainsKey("name")) { htmlForm.AddTag("span", errors["name"]) .SetAttribut("id", "forphone"); } else { htmlForm.AddTag("span").SetAttribut("id", "forphone"); } htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Login: "******"class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "login", form["login"])) .SetAttribut("maxlength", "10") .SetAttribut("placeholder", "max length of 10 characters") .SetAttribut("required", "required"); if (errors.ContainsKey("name")) { htmlForm.AddTag("span", errors["name"]) .SetAttribut("id", "forlogin"); } else { htmlForm.AddTag("span").SetAttribut("id", "forlogin"); } htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Password: "******"class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Password, "password", form["password"])) .SetAttribut("maxlength", "10") .SetAttribut("placeholder", "max length of 10 characters") .SetAttribut("required", "required"); if (errors.ContainsKey("name")) { htmlForm.AddTag("span", errors["name"]) .SetAttribut("id", "forpassword"); } else { htmlForm.AddTag("span").SetAttribut("id", "forpassword"); } htmlForm.AddTag("br"); htmlForm.AddTag("lable", "WorkExperience: ") .SetAttribut("class", "lable"); // ------------------------------------------------------------------------------ HtmlBaseTag selectWork = htmlForm.AddTag("select").SetAttribut("name", "experience") .SetAttribut("class", "select") .SetAttribut("size", "1"); foreach (KeyValuePair<WorkExperience, int> element in EnumService.GetAllWorkExperience()) { if (element.Key.Equals(form["experience"])) { selectWork.AddTag("option", element.Key.ToString()) .SetAttribut("selected") .SetAttribut("value", element.Value.ToString()); } else { selectWork.AddTag("option", element.Key.ToString()) .SetAttribut("value", element.Value.ToString()); } } htmlForm.AddTag("br"); htmlForm.AddTag(new HtmlInput(InputType.Reset, "Reset", "Clin")) .SetAttribut("class", "buttonclin"); htmlForm.AddTag(new HtmlInput(InputType.Submit, "Submit", "Submit")) .SetAttribut("class", "buttonsubmit"); htmlForm.AddTag("br"); } else { htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Name: ") .SetAttribut("class", "lable"); htmlForm.AddTag((new HtmlInput(InputType.Text, "name", "")) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters")) .SetAttribut("required", "required"); htmlForm.AddTag("span").SetAttribut("id", "forname"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Surname: ") .SetAttribut("class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "surname", "")) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters") .SetAttribut("required", "required"); htmlForm.AddTag("span").SetAttribut("id", "forsurname"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Address: ") .SetAttribut("class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "address", "")) .SetAttribut("maxlength", "50") .SetAttribut("placeholder", "max length of 50 characters") .SetAttribut("required", "required"); htmlForm.AddTag("span").SetAttribut("id", "foraddress"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Phone: ") .SetAttribut("class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "phone", "")) .SetAttribut("placeholder", "000-000-00-00") .SetAttribut("required", "required"); htmlForm.AddTag("span").SetAttribut("id", "forphone"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Login: "******"class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "login", "")) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters") .SetAttribut("required", "required"); htmlForm.AddTag("span").SetAttribut("id", "forlogin"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Password: "******"class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Password, "password", "")) .SetAttribut("maxlength", "10") .SetAttribut("placeholder", "max length of 10 characters") .SetAttribut("required", "required"); htmlForm.AddTag("span").SetAttribut("id", "forpassword"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "WorkExperience: ") .SetAttribut("class", "lable"); HtmlBaseTag selectWork = htmlForm.AddTag("select").SetAttribut("name", "experience") .SetAttribut("class", "select") .SetAttribut("size", "1"); foreach (KeyValuePair<WorkExperience, int> element in EnumService.GetAllWorkExperience()) { selectWork.AddTag("option", element.Key.ToString()) .SetAttribut("value", element.Value.ToString()); } htmlForm.AddTag("br"); htmlForm.AddTag(new HtmlInput(InputType.Reset, "Reset", "Clin")) .SetAttribut("class", "buttonclin"); htmlForm.AddTag(new HtmlInput(InputType.Submit, "Submit", "Submit")) .SetAttribut("class", "buttonsubmit"); htmlForm.AddTag("br"); } StringBuilder body = new StringBuilder(); body.Append(Environment.NewLine); body.Append(htmlForm.ToString(errors)); body.Append(Environment.NewLine); return body.ToString(); }
protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null) { HtmlForm htmlForm = new HtmlForm(RequestMethod.POST, "CreateClient", errors); htmlForm.SetAttribut("novalidate", "novalidate"); if(errors != null && errors.Count > 0) { 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", form["name"])) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters") .SetAttribut("required", "required") .SetAttribut("onblur", "InputIsValid('name')"); if (errors.ContainsKey("name")) divInput1.AddTag("span", errors["name"]).SetAttribut("id", "forname"); else 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", form["surname"])) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters") .SetAttribut("required", "required") .SetAttribut("onblur", "InputIsValid(this)"); if (errors.ContainsKey("surname")) divInput2.AddTag("span", errors["surname"]).SetAttribut("id", "forsurname"); else 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", form["address"])) .SetAttribut("maxlength", "50") .SetAttribut("placeholder", "max length of 50 characters"); if (errors.ContainsKey("address")) div3.AddTag("span", errors["address"]).SetAttribut("id", "foraddress"); else 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", form["phone"])) .SetAttribut("placeholder", "000-000-00-00") .SetAttribut("required", "required") .SetAttribut("onblur", "InputIsValid(this)"); if (errors.ContainsKey("phone")) div4.AddTag("span", errors["phone"]).SetAttribut("id", "forphone"); else 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")); } else { 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", "")) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters") .SetAttribut("required", "required") .SetAttribut("onblur", "InputIsValid(this)"); divInput1.AddTag("span", null).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", "")) .SetAttribut("maxlength", "15") .SetAttribut("placeholder", "max length of 15 characters") .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", "")) .SetAttribut("maxlength", "50") .SetAttribut("placeholder", "max length of 50 characters"); divInput3.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", "")) .SetAttribut("placeholder", "000-000-00-00") .SetAttribut("required", "required") .SetAttribut("onblur", "InputIsValid(this)"); divInput4.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(); }
protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null) { HtmlForm htmlForm = new HtmlForm(RequestMethod.POST, "LogIn", errors); if (errors != null && errors.Count > 0) { htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Enter login :"******"class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "login", form["login"])) .SetAttribut("class", "inputtext"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Enter password :"******"class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Password, "password", form["password"])) .SetAttribut("class", "inputtext"); htmlForm.AddTag("br"); htmlForm.AddTag(new HtmlInput(InputType.Reset, "Clean", "Clean")) .SetAttribut("class", "buttonclin"); htmlForm.AddTag(new HtmlInput(InputType.Submit, "Submit", "Submit")) .SetAttribut("class", "buttonsubmit"); htmlForm.AddTag("br"); } else { htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Enter login :"******"class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Text, "login", "admin")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Enter password :"******"class", "lable"); htmlForm.AddTag(new HtmlInput(InputType.Password, "password", "admin")); htmlForm.AddTag("br"); htmlForm.AddTag(new HtmlInput(InputType.Reset, "Clean", "Clean")) .SetAttribut("class", "buttonclin"); htmlForm.AddTag(new HtmlInput(InputType.Submit, "Submit", "Submit")) .SetAttribut("class", "buttonsubmit"); } StringBuilder body = new StringBuilder("<br>"); body.Append(htmlForm.ToString(errors)); body.Append(Environment.NewLine); return body.ToString(); }
protected override string AddBody(IDictionary<string, string> form, string sessionId = null, IDictionary<string, string> errors = null) { HtmlForm htmlForm = new HtmlForm(RequestMethod.POST, "CreateAppeal", errors); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Name client:") .SetAttribut("class", "lable"); //ClientService cs = new ClientService("client.txt"); IClientService cs = serviceFactory.CreateClientService(); Dictionary<Guid, Client> clients = cs.GetAll(); HtmlBaseTag selecclient = htmlForm.AddTag("select").SetAttribut("name", "clientId") .SetAttribut("class", "select") .SetAttribut("size", "1"); foreach (KeyValuePair<Guid, Client> element in clients) { selecclient.AddTag("option", element.Value.Name + " " + element.Value.Surname) .SetAttribut("value", element.Key.ToString()); } htmlForm.AddTag("br"); //-------------------------------------------------------------- htmlForm.AddTag("lable", "The reason for petition:") .SetAttribut("class", "lable"); HtmlBaseTag selectWork = htmlForm.AddTag("select").SetAttribut("name", "reason") .SetAttribut("class", "select") .SetAttribut("size", "1"); foreach (KeyValuePair<ClientAppeal, int> element in EnumService.GetAllClientAppeals()) { selectWork.AddTag("option", element.Key.ToString()) .SetAttribut("value", element.Value.ToString()); } htmlForm.AddTag("br"); //------------------------------------------------------------------------------------- htmlForm.AddTag("lable", "Comment:") .SetAttribut("class", "lable"); htmlForm.AddTag("textarea", "") .SetAttribut("class", "inputtextarea") .SetAttribut("name", "comment") .SetAttribut("cols", "50") .SetAttribut("rows", "3"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "References:") .SetAttribut("class", "lable"); htmlForm.AddTag("textarea", "") .SetAttribut("class", "inputtextarea") .SetAttribut("name", "references") .SetAttribut("cols", "50") .SetAttribut("rows", "5"); htmlForm.AddTag("br"); //----------------------------------------------------------------------- htmlForm.AddTag("lable", "The problem is solved?") .SetAttribut("class", "lable"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Yes") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "solve1", "yes")) .SetAttribut("class", "inrutradio"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "No") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "solve2", "no")) .SetAttribut("class", "inrutradio"); htmlForm.AddTag("br"); //----------------------------------------------------------------------------- htmlForm.AddTag("lable", "Serviced manager:") .SetAttribut("class", "lable"); // ManagerService ms = new ManagerService("manager.txt"); IManagerService sms = serviceFactory.CreateManagerService(); Dictionary<Guid, Manager> managers = sms.GetAll(); HtmlBaseTag selectmanager = htmlForm.AddTag("select").SetAttribut("name", "managerId") .SetAttribut("class", "select") .SetAttribut("size", "1"); foreach (KeyValuePair<Guid, Manager> element in managers) { selectmanager.AddTag("option", element.Value.Name + " " + element.Value.Surname) .SetAttribut("value", element.Key.ToString()); } htmlForm.AddTag("br"); htmlForm.AddTag(new HtmlInput(InputType.Reset, "Reset", "Clin")) .SetAttribut("class", "buttonclin"); htmlForm.AddTag(new HtmlInput(InputType.Submit, "Submit", "Submit")) .SetAttribut("class", "buttonsubmit"); htmlForm.AddTag("br"); StringBuilder body = new StringBuilder(); body.Append(Environment.NewLine); body.Append(htmlForm.ToString(errors)); return body.ToString(); }
protected override string AddBody(IDictionary<string, string> form, string sessionId = null,IDictionary<string, string> errors = null) { HtmlForm htmlForm = new HtmlForm(RequestMethod.POST, "CreateForm", errors); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Name client: ") .SetAttribut("class", "lable"); //ClientService cs = new ClientService("client.txt"); IClientService cs = serviceFactory.CreateClientService(); Dictionary<Guid, Client> clients = cs.GetAll(); HtmlBaseTag selectclient = htmlForm.AddTag("select").SetAttribut("name", "clientId") .SetAttribut("class", "select") .SetAttribut("size", "1"); foreach (KeyValuePair<Guid, Client> element in clients) { selectclient.AddTag("option", element.Value.Name + " " + element.Value.Surname) .SetAttribut("value", element.Key.ToString()); } htmlForm.AddTag("br"); //---------------------------------------------------------------------------------- htmlForm.AddTag("lable", "Are you satisfied with the service?") .SetAttribut("class", "lablequestion"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Yes") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form1", "yes")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "No") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form2", "no")); //---------------------------------------------------------------- htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Comment:") .SetAttribut("class", "lable"); htmlForm.AddTag("textarea", "") .SetAttribut("class", "inputtextarea") .SetAttribut("name", "comment1") .SetAttribut("cols", "70") .SetAttribut("rows", "3"); //------------------------------------------------------- htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Are you satisfied with the speed of the Internet?") .SetAttribut("class", "lablequestion"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Yes") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form3", "yes")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "No") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form4", "no")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Comment:") .SetAttribut("class", "lable"); htmlForm.AddTag("textarea", "") .SetAttribut("class", "inputtextarea") .SetAttribut("name", "comment2") .SetAttribut("cols", "70") .SetAttribut("rows", "3"); //--------------------------------------------------------------------------------------------------- htmlForm.AddTag("br"); htmlForm.AddTag("lable", " Do you like the service manager?") .SetAttribut("class", "lablequestion"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Yes") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form5", "yes")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "No") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form6", "no")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Comment:") .SetAttribut("class", "lable"); htmlForm.AddTag("textarea", "") .SetAttribut("class", "inputtextarea") .SetAttribut("name", "comment3") .SetAttribut("cols", "70") .SetAttribut("rows", "3"); //--------------------------------------------------------------------------------------------------- htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Do you use the Internet and TV?") .SetAttribut("class", "lablequestion"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Yes") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form7", "yes")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "No") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form8", "no")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Comment:") .SetAttribut("class", "lable"); htmlForm.AddTag("textarea", "") .SetAttribut("class", "inputtextarea") .SetAttribut("name", "comment4") .SetAttribut("cols", "70") .SetAttribut("rows", "3"); //--------------------------------------------------------------------------------------------------- htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Do you want to participate in the loyalty program?") .SetAttribut("class", "lablequestion"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Yes") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form9", "yes")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "No") .SetAttribut("class", "lableradio"); htmlForm.AddTag(new HtmlInput(InputType.Radio, "form10", "no")); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Comment:") .SetAttribut("class", "lable"); htmlForm.AddTag("textarea", "") .SetAttribut("class", "inputtextarea") .SetAttribut("name", "comment5") .SetAttribut("cols", "70") .SetAttribut("rows", "3"); htmlForm.AddTag("br"); htmlForm.AddTag("lable", "Filled manager: ") .SetAttribut("class", "lable"); //ManagerService ms = new ManagerService("manager.txt"); IManagerService ms = serviceFactory.CreateManagerService(); Dictionary<Guid, Manager> managers = ms.GetAll(); HtmlBaseTag selectmanager = htmlForm.AddTag("select").SetAttribut("name", "managerId") .SetAttribut("class", "select") .SetAttribut("size", "1"); foreach (KeyValuePair<Guid, Manager> element in managers) { selectmanager.AddTag("option", element.Value.Name + " " + element.Value.Surname) .SetAttribut("value", element.Key.ToString()); } htmlForm.AddTag("br"); htmlForm.AddTag(new HtmlInput(InputType.Reset, "Reset", "Clin")) .SetAttribut("class", "buttonclin"); htmlForm.AddTag(new HtmlInput(InputType.Submit, "Submit", "Submit")) .SetAttribut("class", "buttonsubmit"); htmlForm.AddTag("br"); htmlForm.AddTag(new HtmlBaseTag("div") .SetAttribut("class", "row1")); StringBuilder body = new StringBuilder(); body.Append(Environment.NewLine); body.Append(htmlForm.ToString(errors)); return body.ToString(); }
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 ""; } }