$(function () {
$("#demo_2").citySelect({
provId: "prov_2",
cityId: "city_2",
distId: "dist_2",
prov: "北京",
nodata: "none"
});
$("#demo_2").citySelect({
provId: "prov_2",
cityId: "city_2",
distId: "dist_2",
prov: $("#body_hidProv").val(),
city: $("#body_hidCity").val(),
dist: $("#body_hidDist").val(),
nodata: "none"
});
});
</script>
<script language="javascript" type="text/javascript">
var sheng ;
var shi;
var dq;
function StringToArray(str, substr) {
var arrTmp = new Array();
if (substr == "") {
arrTmp.push(str);
return arrTmp;
}
var i = 0, j = 0, k = str.length;
while (i < k) {
j = str.indexOf(substr, i);
if (j != -1) {
if (str.substring(i, j) != "") {
arrTmp.push(str.substring(i, j));
}
i = j + 1;
}
else {
if (str.substring(i, k) != "") {
arrTmp.push(str.substring(i, k));
}
i = k;
}
}
return arrTmp;
}
var ckuser = false;
$(document).ready(function () {
$("#<%=drop_lawyertype.ClientID%>").bind("change", function (event) {
alert('0');
var dropDownList = document.getElementById("drop_lawyertype"); //获取DropDownList控件
var selectvalue = dropDownList.options[dropDownList.selectedIndex].value; //获取选择项的值
if (selectvalue == "1") {
$("#rowcompany").css("display", "none");
$("#yhjssss").css("display", "none");
}
else {
var role = '<%=Session["yhjs"]%>';
if (role == "最高管理员") {
$("#yhjssss").css("display", "");
$("#rowcompany").css("display", "");
}
else {
$("#rowcompany").css("display", "none");
$("#yhjssss").css("display", "none");
}
}
});
$("#<%=drop_user.ClientID%>").bind("change", function (event) {
var dropDownList = document.getElementById("drop_user"); //获取DropDownList控件
var user = dropDownList.options[dropDownList.selectedIndex].value; //获取选择项的值
$.ajax({
type: "post",
dataType: "text",
url: "Mnet.ashx",
cache: false,
//async: false,
data: { operate: "checksuser", userName: user },
success: function (text) {
if (text != "") {
var data = eval("(" + text + ")");
if (data.flag == 'true') {
$("#<%=txt_email.ClientID%>").val(data.yx);
$("#<%=txtmobPhone.ClientID%>").val(data.sj);
$("#<%=txt_name.ClientID%>").val(data.names);
var places = StringToArray(data.dz, "-");
var tels = StringToArray(data.tel, "-");
if (tels.length == 0) {
$("#<%=txtPhone_qh.ClientID%>").val("区号:027");
$("#<%=txtPhone_no.ClientID%>").val("座机号码:87654321");
$("#<%=txtPhone_fj.ClientID%>").val("分机号:123");
}
else {
if (tels.Length == 2) {
$("#<%=txtPhone_qh.ClientID%>").val(tels[0]);
$("#<%=txtPhone_no.ClientID%>").val(tels[1]);
$("#<%=txtPhone_fj.ClientID%>").val("");
}
else {
$("#<%=txtPhone_qh.ClientID%>").val(tels[0]);
$("#<%=txtPhone_no.ClientID%>").val(tels[1]);
$("#<%=txtPhone_fj.ClientID%>").val(tels[2]);
}
}
if (places.length == 0) {
sheng = "北京"; shi = "东城区"
$("#<%=txt_dizhi.ClientID%>").val("");
}
else {
if (places.length == 2) {
sheng = places[0];
shi = places[1];
$("#<%=txt_dizhi.ClientID%>").val("");
}
else if (places.length == 3) {
sheng = places[0];
shi = places[1];
dq = places[2];
$("#<%=txt_dizhi.ClientID%>").val("");
}
else if (places.length == 4) {
sheng = places[0];
shi = places[1];
dq = places[2];
$("#<%=txt_dizhi.ClientID%>").val(places[3]);
}
else if (places.length == 5) {
sheng = places[0];
shi = places[1];
dq = places[2];
$("#<%=txt_dizhi.ClientID%>").val(places[3] + places[4]);
}
else if (places.length == 6) {
sheng = places[0];
shi = places[1];
dq = places[2];
$("#<%=txt_dizhi.ClientID%>").val(places[3] + places[4] + places[5]);
}
else if (places.length == 7) {
sheng = places[0];
shi = places[1];
dq = places[2];
$("#<%=txt_dizhi.ClientID%>").val(places[3] + places[4] + places[5] + places[6]);
}
}
$("#demo_2").citySelect({
provId: "prov_2",
cityId: "city_2",
distId: "dist_2",
prov: sheng,
city: shi,
dist: dq,
nodata: "none"
});
ckuser = true;
}
else {
//不能添加为律师
alert(data.msg);
ckuser = false;
}
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
//alert(XMLHttpRequest.responseText);
}
});
});
});
</script>
<script language="javascript" type="text/javascript">
// 获取URL参数
function getParam(paramName) {
paramValue = "";
isFound = false;
if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
//arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&");
arrSource = decodeURI(this.location.search).substring(1, this.location.search.length).split("&");
//arrSource = this.location.search.substring(1, this.location.search.length).split("&");
i = 0;
while (i < arrSource.length && !isFound) {
if (arrSource[i].indexOf("=") > 0) {
if (arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase()) {
paramValue = arrSource[i].split("=")[1];
isFound = true;
}
}
i++;
}
}
return paramValue;
}
var flag = false;
function check() {
var dwmc = $("#<%=txt_companyName.ClientID%>");
var lawyername = $("#<%=txt_name.ClientID%>");
var dizhi = $("#<%=txt_dizhi.ClientID%>");
var email = $("#<%=txt_email.ClientID%>");
var sj = $("#<%=txtmobPhone.ClientID%>");
var goodnumber = $("#<%=txt_goodcomment.ClientID%>");
var Comname = $('#<%=txt_companyName.ClientID %>');
var jianjie = $("#txt_jianjie");
var is_hidden = $('#<%=txt_companyName.ClientID %>').is(":visible");
if (is_hidden == true) {
if (Comname.val().length == 0) {
alert('单位名称不能为空');
flag = false;
return false;
}
}
if (lawyername.val().length == 0) {
alert('律师名称不能为空');
flag = false;
return false;
}
if (dizhi.val().length == 0) {
alert('详细地址不能为空');
flag = false;
return false;
}
if (email.val().length == 0 || email.val() == "请输入电子邮箱") {
alert('电子邮箱不能为空');
flag = false;
return false;
}
else {
var strEmail = email.val().match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/);
if (strEmail == null) {
alert('邮箱格式不正确');
email.val("");
flag = false;
return false;
}
}
if (sj.val().length == 0) {
alert('手机号码不能为空');
flag = false;
return false;
}
else {
var sj = /^1[3|4|5|7|8][0-9]\d{4,8}$/.test(sj.val());
if (sj == false) {
alert('手机号码格式不正确');
sj.val("");
flag = false;
return false;
}
}
if (goodnumber.val().length == 0) {
alert('好评数不能为空');
return false;
}
else {
var reg = /^([1-9]\d*|[0]{1,1})$/;
if (!reg.test(goodnumber.val())) {
alert("请输入数字!");
flag = false;
return false;
}
}
//勾选的checkbox
var colleges = $("input[type='checkbox']:checked");
alert(colleges.length);
if (colleges.length <= 0) {
alert("请选择用户提供的服务的大类!");
flag = false;
return false;
}
if (jianjie.val().length == 0) {
alert('律师简介不能为空');
flag = false;
return false;
}
//判断用户能否添加为律师
var types = getParam("type");
alert(types);
if (types == "update") {
ckuser = true;
}
else {
var dropDownList = document.getElementById("drop_user"); //获取DropDownList控件
var user = dropDownList.options[dropDownList.selectedIndex].value; //获取选择项的值
$.ajax({
type: "post",
dataType: "text",
url: "Mnet.ashx",
cache: false,
//async: false,
data: { operate: "checksuser", userName: user },
success: function (text) {
if (text != "") {
var data = eval("(" + text + ")");
if (data.flag == 'true') {
ckuser = true;
}
else {
//不能添加为律师
alert(data.msg);
ckuser = false;
return false;
}
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
//alert(XMLHttpRequest.responseText);
}
});
}
flag = true;
return true;
}
function checkinfo() {
check();
alert(flag);
alert(ckuser);
if (flag == true && ckuser == true) {
return true;
}
else {
return false;
}
}
function f() {
var dropDownList = document.getElementById("drop_lawyertype"); //获取DropDownList控件
var selectvalue = dropDownList.options[dropDownList.selectedIndex].value; //获取选择项的值
if (selectvalue == "1") {
$("#rowcompany").css("display", "none");
$("#yhjssss").css("display", "none");
}
else {
var role = '<%=Session["yhjs"]%>';
if (role == "最高管理员") {
$("#yhjssss").css("display", "");
$("#rowcompany").css("display", "");
}
else {
$("#rowcompany").css("display", "none");
$("#yhjssss").css("display", "none");
}
}
}
</script>
ahhx:
/// <summary>
///
/// </summary>
private void Cklawyer(HttpContext context)
{
CodeModel.BLL.lawyerinfos lawbll = new CodeModel.BLL.lawyerinfos();
var rqid = context.Request["userName"].ToString();
CodeModel.BLL.userinfo yhbll = new CodeModel.BLL.userinfo();
DataSet ds2 = yhbll.GetList(" id= '" + rqid + "' ");
string yh = ds2.Tables[0].Rows[0]["username"].ToString();
bool f = UCHelper.UCS.CheckUser(yh);
if (f == false)
{
context.Response.Write("{'flag':'false','names':'-1','yh':'-1', 'dz':'-1', 'tel':'-1', 'yx':'-1', 'sj':'-1', 'msg':'该用户用户中心不存在,不能开通律师服务,请重新选择用户!'}");
}
else
{
DataSet ds_lawyesss = lawbll.GetList(" username = '" + yh + "' and state=1");
if (ds_lawyesss.Tables[0].Rows.Count > 0)
{
context.Response.Write("{'flag':'false','names':'-1','yh':'-1', 'dz':'-1', 'tel':'-1', 'yx':'-1', 'sj':'-1','msg':'该用户已经是法律服务方了,请重新选择用户!'}");
}
else
{
UpdateUsers(yh);
DataSet ds = yhbll.GetList(" username= '" + yh + "' ");
string names = ds.Tables[0].Rows[0]["name"].ToString();
string place = ds.Tables[0].Rows[0]["place"].ToString();
string tel = ds.Tables[0].Rows[0]["phone"].ToString();
string yx = ds.Tables[0].Rows[0]["email"].ToString();
string sj = ds.Tables[0].Rows[0]["CMobPhone"].ToString();
context.Response.Write("{'flag':'true','names':'" + names + "','yh':'" + yh + "', 'dz':'" + place + "', 'tel':'" + tel + "', 'yx':'" + yx + "', 'sj':'" + sj + "','msg':'可以添加为法律服务方!'}");
}
}
}