Ejemplo n.º 1
0
    protected void InitPage()
    {
        string sn = Request.QueryString.Get("sn");

        if (com.hooyes.crc.helper.Validate.GuidString(sn))
        {

            CRCapply model = new CRCapply();
            RegisterAdmin reg = new RegisterAdmin();
            model = reg.model(sn);
            CompanyAddress.Text = model.CompanyAddress;
            CompanyName.Text = model.CompanyName;
            CompanyNameEn.Text = model.CompanyNameEn;
            WebSite.Text = model.WebSite;
            Phone.Text = model.Phone;
            CellPhone.Text = model.CellPhone;
            Fax.Text = model.Fax;
            PostCode.Text = model.PostCode;
            Suggestion.Text = model.Suggestion;
            Contact.Text = model.Contact;
            Email.Text = model.Email;
            //单选框初始化
            RadioButtonListPay.SelectedIndex = (model.Pay) ? 0 : 1;
            RadioButtonListInvoic.SelectedIndex = (model.Invoice) ? 0 : 1;
            string TypeScript = "<script type=\"text/javascript\">SelectAapter('{0}','{1}');</script>";

            this.Page.ClientScript.RegisterStartupScript(typeof(Page), "script1", string.Format(TypeScript,"RadioButtonCompanyType", model.CompanyType));
            this.Page.ClientScript.RegisterStartupScript(typeof(Page), "script2", string.Format(TypeScript, "RadioButtonProductType", model.ProductType));

            //Vistors

            string Vistors = model.Vistors;
            string[] vSpace ={ "|#|" };
            string[] vComma ={ "," };
            string[] vS = Vistors.Split(vSpace, StringSplitOptions.None);
            string[] vName = vS[0].Split(vComma, StringSplitOptions.None);
            string[] vGender = vS[1].Split(vComma, StringSplitOptions.None);
            string[] vTitle = vS[2].Split(vComma, StringSplitOptions.None);
            string[] vPhone = vS[3].Split(vComma, StringSplitOptions.None);
            string[] vCellPhone = vS[4].Split(vComma, StringSplitOptions.None);

            // HTML
            StringBuilder sb = new StringBuilder();

            string HTMLTemplate = @"<div id=""HOOYESDIVCCC{7}""><table width='100%'>
        <tr><td><input name=""vName""  class=""RegisterInputShort"" type=""text"" value='{0}' /></td><td>
        <select  name=""vGender""><option  value="""">请选择</option><option {5} value=""female"">女</option>
        <option {6} value=""male"">男</option>
        </select>
        </td>
        <td><input name=""vTitle"" class=""RegisterInputShort"" type=""text"" value='{2}' /></td><td>
        <input name=""vPhone""  class=""RegisterInputShort"" type=""text"" value='{3}' /></td><td>
        <input name=""vCellPhone""  class=""RegisterInputShort"" type=""text"" value='{4}' /></td><td width='5%'><a href='javascript:void(0)' onclick=""Remove('HOOYESDIVCCC{7}')"">删除</a></td></tr></table></div>";
            object[] param = new object[8];
            for (int i = 0; i < vName.Length; i++)
            {

                param[0] = vName[i];
                param[1] = vGender[i];
                param[2] = vTitle[i];
                param[3] = vPhone[i];
                param[4] = vCellPhone[i];
                param[5] = "";
                param[6] = "";
                param[7] = i;
                // Response.Write(param[1]);
                if (vGender[i] == "female")
                {
                    param[5] = "selected=\"selected\"";
                }
                if (vGender[i] == "male")
                {

                    param[6] = "selected=\"selected\"";
                }
                sb.AppendFormat(HTMLTemplate, param);

            }

            vLiteral1.Text = sb.ToString();

        }
        else
        {
            Response.Write("sn 参数不正确");
            Response.End();
        }
    }