Exemplo n.º 1
0
    /// <summary>
    /// 保存个人信息
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    private long Save_Personal(dynamic data)
    {
        var         s_personal = JsonConvert.SerializeObject(data.personal);
        CT_All_User personal   = JsonConvert.DeserializeObject <CT_All_User>(s_personal);

        if (!string.IsNullOrWhiteSpace(personal.AU_Username))
        {
            if (CT_All_User.Exists("AU_Code != @0 and AU_Username = @1", personal.AU_Code, personal.AU_Username))
            {
                throw new Exception(Interna ? "User account already exists!" : "用户账号已存在!");
            }
        }

        long au_code = personal.AU_Code;

        personal.AU_Update_dt = DateTime.Now;

        if (!string.IsNullOrWhiteSpace(personal.AU_Password))
        {
            personal.AU_Password = ShInfoTech.Common.Security.Md5(personal.AU_Password);
        }

        if (personal.AU_Code > 0)
        {
            var cols = new string[] {
                "AU_Update_dt",
                "AU_Name",
                "AU_Username",
                "AU_Married",
                "AU_Dr_Lic",
                "AU_Gender",
                "AU_ID_Type",
                "AU_ID_No",
                "AU_Education",
                "AU_Type",
                "AU_UG_Code",
                "AU_Active_tag",
                //"AU_Occupation",
                //"AU_Industry",
                "AU_B_date"
            };
            var listCols = cols.ToList <string>();
            if (!string.IsNullOrWhiteSpace(personal.AU_Password))
            {
                listCols.Add("AU_Password");
            }

            personal.Update(listCols);
        }
        else
        {
            au_code = (long)personal.Insert();
        }

        return(au_code);
    }
    private void Save_CustomerByName(dynamic data)
    {
        CT_All_User user = new CT_All_User();

        user.AU_Name       = (string)data.AU_Name;
        user.AU_Update_dt  = DateTime.Now;
        user.AU_Active_tag = 1;

        var au_code = (long)user.Insert();

        Response.Write(JsonConvert.SerializeObject(new { AU_Code = au_code, AU_Name = user.AU_Name }));
    }