using System; using System.Data; using System.Web; using System.Collections; using System.Web.Services; using System.Web.Services.Protocols; using System.ComponentModel; using WeiSha.Common; using Song.ServiceInterfaces; using Song.Entities; namespace Song.Site.SOAP { /// /// Mobile 的摘要说明 /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] public class Mobile : System.Web.Services.WebService { #region 通记录功能院系 /// /// 通过手机号判断当前员工是否在职 /// /// 员工的手机号,从手机中自动获取 /// 验证码 /// [WebMethod] public bool IsOnJob(string phone,string code) { if (!isVerify(code)) return false; return Business.Do().IsOnJob(phone); } ///// ///// 通过员工手机号,获取员工信息 ///// ///// 员工的手机号,从手机中自动获取 ///// 验证码 ///// //[WebMethod] //public Song.Entities.EmpAccount Employee(string phoneNumber, string code) //{ // if (!isVerify(code)) return null; // return Business.Do().GetSingleByPhone(phoneNumber); //} /// /// 获取所有在职员工 /// /// 验证码 /// [WebMethod] public Song.Entities.EmpAccount[] Employees(string code) { if (!isVerify(code)) return null; int orgid = Extend.LoginState.Admin.CurrentUser.Org_ID; Song.Entities.EmpAccount[] eas = null; eas = Business.Do().GetAll(orgid,-1,true, ""); foreach (Song.Entities.EmpAccount ea in eas) { if (!ea.Acc_IsOpenTel) ea.Acc_Tel = ""; if (!ea.Acc_IsOpenMobile) ea.Acc_MobileTel = ""; ea.Acc_Pw = ""; } return eas; } /// /// 获取企业信息 /// /// 验证码 /// [WebMethod] public Song.Entities.Organization OrgInfo(string code) { if (!isVerify(code)) return null; return Business.Do().OrganDefault(); } #endregion #region 私有方法 /// /// 验证是否服务端允许手机客户端访问,是否需要验证码,验证码是否正确 /// /// /// 不通过,返回false private bool isVerify(string verifyCode) { //是否允许客户端访问 bool isAllow = Business.Do()["IsAllowMobile"].Boolean ?? true; if (!isAllow) return false; //是否需要验证码 bool isVerify = Business.Do()["IsAllowMobileVerifyCode"].Boolean ?? true; if (!isVerify) return true; //如果不需要验证,则返回true //验证码是否正确 string code = Business.Do()["MobileVerifyCode"].String; if (code == verifyCode.Trim()) return true; return false; } #endregion } }