Exemple #1
0
        public Int32 Insert(OEStudent item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define
            if (string.IsNullOrEmpty(item.FStudentName))
            {
                ErrInfo = new ErrorEntity("ST010001", "学员姓名不能为空!");
                return -1;
            }

            if (string.IsNullOrEmpty(item.FStudentIDNumber))
            {
                ErrInfo = new ErrorEntity("ST010002", "学员身份证号码不能为空!");
                return -1;
            }

            if (!ChkIDDuplicate(item.FStudentIDNumber))
            {
                ErrInfo = new ErrorEntity("ST010003", "学员身份证已经存在,不能新增!");
                return -1;
            }

            if (string.IsNullOrEmpty(item.FStudentPSW))
            {
                item.FStudentPSW = Utils.Md5Sign("123456");
            }
            if (!string.IsNullOrEmpty(item.FEmail))
            {
                if (!PublicMethod.IsEmail(item.FEmail))
                {
                    ErrInfo = new ErrorEntity("ST010003", "请正确输入邮件地址!");
                    return -1;
                }
            }
            if (!string.IsNullOrEmpty(item.FMobile))
            {
                if (!PublicMethod.IsMobile(item.FMobile))
                {
                    ErrInfo = new ErrorEntity("ST010004", "请正确输入手机号码!");
                    return -1;
                }
            }
            string errstr = "";
            if (!PublicMethod.IsIdNo(item.FStudentIDNumber,out  errstr))
            {
                ErrInfo = new ErrorEntity("ST010005", "请正确输入身份证号码!");
                return -1;
            }
            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FStudentName", item.FStudentName);
            parameters.Add("FStudentIDNumber", item.FStudentIDNumber);
            parameters.Add("FEmail", item.FEmail);
            parameters.Add("FMobile", item.FMobile);
            parameters.Add("FStudentPSW", item.FStudentPSW);
            return Insert(parameters, out ErrInfo);
        }
 public void GetItem()
 {
     string _id = Parameters["pid"];
     OEStudent item = new OEStudent();
     OEStudentBiz biz = new OEStudentBiz();
     item = biz.Select(_id);
     if (item == null)
     {
         Response.Write("");
     }
     else
     {
         Response.Write(item.ToJson());
     }
 }
Exemple #3
0
        public Int32 Update(OEStudent item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define
            if (string.IsNullOrEmpty(item.FStudentName))
            {
                ErrInfo = new ErrorEntity("ST010001", "学员姓名不能为空!");
                return -1;
            }

            if (string.IsNullOrEmpty(item.FStudentIDNumber))
            {
                ErrInfo = new ErrorEntity("ST010002", "学员身份证号码不能为空!");
                return -1;
            }

            if (!string.IsNullOrEmpty(item.FEmail))
            {
                if (!PublicMethod.IsEmail(item.FEmail))
                {
                    ErrInfo = new ErrorEntity("ST010003", "请正确输入邮件地址!");
                    return -1;
                }
            }
            if (!string.IsNullOrEmpty(item.FMobile))
            {
                if (!PublicMethod.IsMobile(item.FMobile))
                {
                    ErrInfo = new ErrorEntity("ST010004", "请正确输入手机号码!");
                    return -1;
                }
            }
            string errstr = "";
            if (!PublicMethod.IsIdNo(item.FStudentIDNumber, out  errstr))
            {
                ErrInfo = new ErrorEntity("ST010005", "请正确输入身份证号码!");
                return -1;
            }
            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FStudentName", item.FStudentName);
            parameters.Add("FStudentIDNumber", item.FStudentIDNumber);
            parameters.Add("FEmail", item.FEmail);
            parameters.Add("FMobile", item.FMobile);
            NameValueCollection where = new NameValueCollection();
            where.Add("FStudentId", item.FStudentId.ToString());
            return Update(parameters, where, out ErrInfo);
        }
 public void SaveItem()
 {
     string _FStudentId = Parameters["pFStudentId"];
     // other paramters fill here
     string _FStudentName = Parameters["pFStudentName"];
     string _FStudentIDNumber = Parameters["pFStudentIDNumber"];
     string _Email = Parameters["pFEmail"];
     string _Mobile = Parameters["pFMobile"];
     OEStudent item = new OEStudent();
     if (!string.IsNullOrEmpty(_FStudentId))
     {
         Guid newid = new Guid(_FStudentId);
         item.FStudentId = newid;
     }
     item.FStudentName = _FStudentName;
     item.FStudentIDNumber = _FStudentIDNumber;
     item.FEmail = _Email;
     item.FMobile = _Mobile;
     OEStudentBiz biz = new OEStudentBiz();
     ErrorEntity ErrInfo = new ErrorEntity();
     if (string.IsNullOrEmpty(_FStudentId))
     {
         biz.Insert(item, out ErrInfo);
     }
     else
     {
         biz.Update(item, out ErrInfo);
     }
     Response.Write(ErrInfo.ToJson());
 }