<%@ Page Language="C#" AutoEventWireup="true" debug="true" Inherits="WinLibClass.Form.Admin.Sms.UI_Update"  CodePage="65001" %>


<script type="text/javascript"> 



function SaveSub2(){
		
		var pass= true;// $.formValidator.pageIsValid('4');

//		var _text=jQuery("#SmsContent").val();
//		if(_text.length>210)
//		{
//			pass = false;
//			Alert("短信内容过长，限制在3条(1~200字)以内。");
//		}
		
		if(pass){
			var queryString = $('#form_add').serialize()
			jQuery.ajax({
				type: "POST",
				url: "update.aspx?IsAdd=2",
				data:queryString,
				cache: false,
				success: function(msg){
						if(msg>0){ //先保留msg这个值以备以后使用
							Alert('<%=(DataInfo.ID>0)?"修改":"添加" %>短信成功!',1,function(){Common.Refresh();});
							//Common.Refresh();
						}
						else if(msg==-1000){Alert("该会员发送短信量超过系统限定数量，本次短信发送取消。");}
						else if(msg==-1001){Alert("该短信已发送成功，不必重复发送，本次短信发送取消。");}
						else{
							msg = '<%=(DataInfo.ID>0)?"修改":"添加" %>手机短信失败,请检查各项输入是否正确或网络连接状态.代码('+ msg +')';
							AlertErr(msg,1);
						}
				},
				error:function(msg){
					AlertErr("写入数据库异常.");
				}
				
			});		
			
		}
		else
		{
		//	AlertErr("出错啦:连接异常,操作失败");
		}
return false;
	}

function SaveSub()
{
////弹出框ID，标题，显示内容，OK操作，取消操作
	var _t = checkform();
	if(_t)
	Common.Confirm("SMS_List_confirm","发送确认","您是否确定您的短信内容及对方手机号码准确无误？",SaveSub2,null);
	return false;
}

$(document).ready(function(){


});

function funSucc(id,msg){}
function funFail(id,msg){Common.ShowTipFaceSmile(false,msg,3);}
function checkform(){
    var ok = jQuery.checkForm2({
        ctrls: [   
        {id: "UserId",type:"mustRegular", par:/[\d]{1,}$/,funSuccess: function(ctr){ funSucc(ctr.id,"");},funFailed:function(ctr){funFail(ctr.id,"请填写该会员的编号");}}   
        ,{id: "UserPhoneNo",type:"mustRegular", par:/1[3~8][\d]{9,9}$/,funSuccess: function(ctr){ funSucc(ctr.id,"");},funFailed:function(ctr){funFail(ctr.id,"手机号码为11位，检查一下呗^_^");}}     
		,{id: "SmsContent",type:"mustRegular", par:/[\w\u4e00-\u9fa5]{1,200}$/,funSuccess: function(ctr){ funSucc(ctr.id,"");},funFailed:function(ctr){funFail(ctr.id,"(短信字数:200字以内，允许中文)<br />您的短信字数不太符合要求，请检查一下呗^_^");}}
            ]
        //,success: function(){ },failed: function(msg){}
        });
	return ok;	

}

</script> 


<div class="FS14 W360 ">

	<form id="form_add">
	
<div class="TableUpdateDiv"  style="width:96%;">
<div style="width:96.5%; FN">	
	
	<table border="0" class="TableUpdate Table FS14">
	<tr>
	<td class="FS14">
		<input id="ID" name="ID" type="hidden" value="<%=DataInfo.ID%>"  />
		会员编号:
		<input id="UserId" name="UserId" type="text" value="<%=DataInfo.UserId%>"  />
		<input id="CreateTime" name="CreateTime" type="hidden" value="<%=DataInfo.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")%>"  />
		<input id="CreateTime" name="UpdateTime" type="hidden" value="<%=DataInfo.UpdateTime.ToString("yyyy-MM-dd HH:mm:ss")%>"  />
		<input id="OperateAdminUserId" name="OperateAdminUserId" type="hidden" value="<%=DataInfo.OperateAdminUserId%>"  />
		
	</td>	
	</tr>
	
	<tr>
	<td class="FS14">
		手机号:
		<input id="UserPhoneNo" name="UserPhoneNo" type="text" class="input" style="width:220px;"  maxlength="11" value="<%=DataInfo.UserPhoneNo%>" />
	</td>	
	</tr>	
	<tr>
	<td class="FS14">
		短信:(1~200字以内)
		<br />
		<input id="SmsTitle" name="SmsTitle" type="hidden" class="input" style="width:220px;"  value="<%=DataInfo.SmsTitle%>" />
		<textarea id="SmsContent" name="SmsContent" type="hidden" class="input" style="width:300px;height:60px" ><%=DataInfo.SmsContent%> </textarea>
	</td>
	</tr>
	<tr>
	<td class="FS14">
		状态:
		<select id="SendState" name="SendState" style="width:60px;" >
		<option value="0" style="color:red" <%=((DataInfo.SendState==0)?"selected":"")%> >未发送</option>
		<option value="1" <%=((DataInfo.SendState==1)?"selected":"")%> >已发送</option>
		</select>	
		</td>
	</tr>		
	


	</table>
	</DIV>
</DIV>	
	
	
</form>
	
</div>

