Beispiel #1
0
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public BWJS.Model.NL_ProfessionInfo DataRowToModel(DataRow row)
        {
            BWJS.Model.NL_ProfessionInfo model = new BWJS.Model.NL_ProfessionInfo();

            if (row != null)
            {
                if (row["ConsultId"].ToString() != "")
                {
                    model.ConsultId = int.Parse(row["ConsultId"].ToString());
                }
                model.FullName = row["FullName"].ToString();
                if (row["Age"].ToString() != "")
                {
                    model.Age = int.Parse(row["Age"].ToString());
                }
                if (row["MonthlyIncome"].ToString() != "")
                {
                    model.MonthlyIncome = int.Parse(row["MonthlyIncome"].ToString());
                }
                model.Company = row["Company"].ToString();
                if (row["UnitNature"].ToString() != "")
                {
                    model.UnitNature = int.Parse(row["UnitNature"].ToString());
                }
                if (row["WorkingHour"].ToString() != "")
                {
                    model.WorkingHour = int.Parse(row["WorkingHour"].ToString());
                }
                if (row["Payroll"].ToString() != "")
                {
                    model.Payroll = int.Parse(row["Payroll"].ToString());
                }
                if (row["JobPosition"].ToString() != "")
                {
                    model.JobPosition = int.Parse(row["JobPosition"].ToString());
                }
                if (row["SocialSecurit"].ToString() != "")
                {
                    model.SocialSecurit = int.Parse(row["SocialSecurit"].ToString());
                }
                if (row["Fund"].ToString() != "")
                {
                    model.Fund = int.Parse(row["Fund"].ToString());
                }
                if (row["Degree"].ToString() != "")
                {
                    model.Degree = int.Parse(row["Degree"].ToString());
                }
                if (row["GraduationYear"].ToString() != "")
                {
                    model.GraduationYear = int.Parse(row["GraduationYear"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BWJS.Model.NL_ProfessionInfo GetModel(int ConsultId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ConsultId, FullName, Age, MonthlyIncome, Company, UnitNature, WorkingHour, Payroll, JobPosition, SocialSecurit, Fund, Degree, GraduationYear  ");
            strSql.Append("  from dbo.[NL_ProfessionInfo] ");
            strSql.Append(" where ConsultId=@ConsultId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ConsultId", SqlDbType.Int, 4)
            };
            parameters[0].Value = ConsultId;


            BWJS.Model.NL_ProfessionInfo model = new BWJS.Model.NL_ProfessionInfo();
            DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BWJS.Model.NL_ProfessionInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo.[NL_ProfessionInfo] set ");

            strSql.Append(" ConsultId=@ConsultId , ");
            strSql.Append(" FullName=@FullName , ");
            strSql.Append(" Age=@Age , ");
            strSql.Append(" MonthlyIncome=@MonthlyIncome , ");
            strSql.Append(" Company=@Company , ");
            strSql.Append(" UnitNature=@UnitNature , ");
            strSql.Append(" WorkingHour=@WorkingHour , ");
            strSql.Append(" Payroll=@Payroll , ");
            strSql.Append(" JobPosition=@JobPosition , ");
            strSql.Append(" SocialSecurit=@SocialSecurit , ");
            strSql.Append(" Fund=@Fund , ");
            strSql.Append(" Degree=@Degree , ");
            strSql.Append(" GraduationYear=@GraduationYear  ");
            strSql.Append(" where ConsultId=@ConsultId  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@ConsultId",      model.ConsultId),
                new SqlParameter("@FullName",       model.FullName),
                new SqlParameter("@Age",            model.Age),
                new SqlParameter("@MonthlyIncome",  model.MonthlyIncome),
                new SqlParameter("@Company",        model.Company),
                new SqlParameter("@UnitNature",     model.UnitNature),
                new SqlParameter("@WorkingHour",    model.WorkingHour),
                new SqlParameter("@Payroll",        model.Payroll),
                new SqlParameter("@JobPosition",    model.JobPosition),
                new SqlParameter("@SocialSecurit",  model.SocialSecurit),
                new SqlParameter("@Fund",           model.Fund),
                new SqlParameter("@Degree",         model.Degree),
                new SqlParameter("@GraduationYear", model.GraduationYear)
            };

            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BWJS.Model.NL_ProfessionInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.[NL_ProfessionInfo](");
            strSql.Append("ConsultId,FullName,Age,MonthlyIncome,Company,UnitNature,WorkingHour,Payroll,JobPosition,SocialSecurit,Fund,Degree,GraduationYear");
            strSql.Append(") values (");
            strSql.Append("@ConsultId,@FullName,@Age,@MonthlyIncome,@Company,@UnitNature,@WorkingHour,@Payroll,@JobPosition,@SocialSecurit,@Fund,@Degree,@GraduationYear");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");

            SqlParameter[] parameters =
            {
                new SqlParameter("@ConsultId",      model.ConsultId),
                new SqlParameter("@FullName",       model.FullName),
                new SqlParameter("@Age",            model.Age),
                new SqlParameter("@MonthlyIncome",  model.MonthlyIncome),
                new SqlParameter("@Company",        model.Company),
                new SqlParameter("@UnitNature",     model.UnitNature),
                new SqlParameter("@WorkingHour",    model.WorkingHour),
                new SqlParameter("@Payroll",        model.Payroll),
                new SqlParameter("@JobPosition",    model.JobPosition),
                new SqlParameter("@SocialSecurit",  model.SocialSecurit),
                new SqlParameter("@Fund",           model.Fund),
                new SqlParameter("@Degree",         model.Degree),
                new SqlParameter("@GraduationYear", model.GraduationYear)
            };
            object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BWJS.Model.NL_ProfessionInfo model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int   Add(BWJS.Model.NL_ProfessionInfo model)
 {
     return(dal.Add(model));
 }