コード例 #1
0
ファイル: reg_EntityInfo.aspx.cs プロジェクト: lxp-zj/z3s
        public static string saveInfo(string SignUpNum, string Zkzh, string Sfzh, string Mobile, string Nation,
                                      string ZZMM, int Health, string KSLB, string AreaCode, string Byxx, string BYLB, string LikeSpecial,
                                      string Tel, string Yzbm, string Txdz, string FrsZY, string SecZy, int IsAdjust, string AcceptPeople)
        {
            int    code    = 1;
            string message = "保存成功!!";
            string strCsrq = Sfzh.Substring(6, 4) + "-" + Sfzh.Substring(10, 2) + "-" + Sfzh.Substring(12, 2);
            int    _XB     = 0;//n女

            if (int.Parse(Sfzh.Substring(14, 3)) % 2 != 0)
            {
                _XB = 1;//男
            }
            string PicPath = HttpContext.Current.Session["PicPath_"].ToString();

            if (PicPath != null)
            {
                try
                {
                    StudentInfo _setInfo = new StudentInfo();
                    _setInfo.AcceptPeople = AcceptPeople;
                    _setInfo.AreaCode     = AreaCode;
                    _setInfo.BYLB         = BYLB;
                    _setInfo.Byyx         = Byxx;
                    _setInfo.Csrq         = DateTime.Parse(strCsrq);
                    _setInfo.Health       = Health;
                    _setInfo.KSLB         = KSLB;
                    _setInfo.LikeSpecial  = LikeSpecial;
                    _setInfo.Mobile       = Mobile;
                    _setInfo.Nation       = Nation;
                    _setInfo.Sfzh         = Sfzh;
                    _setInfo.Tel          = Tel;
                    _setInfo.Txdz         = Txdz;
                    _setInfo.Xb           = _XB;
                    _setInfo.Yzbm         = Yzbm;
                    _setInfo.ZZMM         = ZZMM;
                    _setInfo.PicPath      = PicPath;
                    using (StudentInfoBLL bll = new StudentInfoBLL())
                    {
                        if (bll.getEntity(Sfzh) == null)
                        {
                            bll.Insert(_setInfo);
                        }
                        else
                        {
                            bll.Update(_setInfo);
                        }
                    }
                    Wish _Wish = new Wish();
                    _Wish.IsAdjust = IsAdjust;
                    _Wish.FrsZY    = FrsZY;
                    _Wish.SecZY    = SecZy;
                    _Wish.Sfzh     = Sfzh;
                    using (WishBLL bll = new WishBLL())
                    {
                        if (bll.getEntity(Sfzh) == null)
                        {
                            bll.Insert(_Wish);
                        }
                        else
                        {
                            bll.Update(_Wish);
                        }
                    }
                }
                catch (Exception)
                {
                    code    = 0;
                    message = "数据合法性错误,请检查!";
                }
            }
            else
            {
                code    = 0;
                message = "后台数据错误!!";
            }
            return(JsonConvert.SerializeObject(new { code = code, message = message }));
        }