Ejemplo n.º 1
0
        /// <summary>
        /// 更新社会保险申请信息
        /// </summary>
        /// <param name="model">社会保险申请信息</param>
        /// <returns></returns>
        private static SqlCommand UpdateInsuSocialInfo(InsuSocialModel model)
        {

            #region SQL文拼写
            StringBuilder updateSql = new StringBuilder();
            updateSql.AppendLine(" UPDATE officedba.InsuSocial         ");
            updateSql.AppendLine(" SET  InsuranceName = @InsuranceName ");
            updateSql.AppendLine(" 	,InsuranceWay = @InsuranceWay      ");
            updateSql.AppendLine(" 	,CompanyPayRate = @CompanyPayRate  ");
            updateSql.AppendLine(" 	,PersonPayRate = @PersonPayRate    ");
            updateSql.AppendLine(" 	,UsedStatus = @UsedStatus          ");
            updateSql.AppendLine(" 	,ModifiedDate = getdate()          ");
            updateSql.AppendLine(" 	,ModifiedUserID = @ModifiedUserID  ");
            updateSql.AppendLine(" WHERE                               ");
            updateSql.AppendLine("companyCD=@companyCD and  	ID = @ID                           ");
            #endregion

            //定义更新基本信息的命令  
            SqlCommand comm = new SqlCommand();
            comm.CommandText = updateSql.ToString();
            //社会保险编号
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@ID", model.ID));
            //comm.Parameters.Add(SqlHelper.GetParameterFromString("@companyCD", model.CompanyCD ));
            //其他参数
            SetSaveParameter(comm, model);
            //执行更新
            return comm;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 保存时参数设置
 /// </summary>
 /// <param name="comm">命令</param>
 /// <param name="model">人才代理信息</param>
 private static void SetSaveParameter(SqlCommand comm, InsuSocialModel model)
 {
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD));//公司代码
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@InsuranceName", model.InsuranceName));//社会保险名称
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@InsuranceWay", model.InsuranceWay));//投保方式
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyPayRate", model.CompanyPayRate));//单位缴费比例
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@PersonPayRate", model.PersonPayRate));//个人缴费比例
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@UsedStatus", model.UsedStatus));//启用状态(0停用,1启用)
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@ModifiedUserID", model.ModifiedUserID));//更新用户ID
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 新建社会保险申请信息 
        /// </summary>
        /// <param name="model">社会保险申请信息</param>
        /// <returns></returns>
        private static SqlCommand InsertInsuSocialInfo(InsuSocialModel model)
        {
            #region 登陆SQL文
            StringBuilder insertSql = new StringBuilder();
            insertSql.AppendLine(" INSERT INTO          ");
            insertSql.AppendLine(" officedba.InsuSocial ");
            insertSql.AppendLine(" 	(CompanyCD          ");
            insertSql.AppendLine(" 	,InsuranceName      ");
            insertSql.AppendLine(" 	,InsuranceWay       ");
            insertSql.AppendLine(" 	,CompanyPayRate     ");
            insertSql.AppendLine(" 	,PersonPayRate      ");
            insertSql.AppendLine(" 	,UsedStatus         ");
            insertSql.AppendLine(" 	,ModifiedDate       ");
            insertSql.AppendLine(" 	,ModifiedUserID)    ");
            insertSql.AppendLine(" VALUES               ");
            insertSql.AppendLine(" 	(@CompanyCD         ");
            insertSql.AppendLine(" 	,@InsuranceName     ");
            insertSql.AppendLine(" 	,@InsuranceWay      ");
            insertSql.AppendLine(" 	,@CompanyPayRate    ");
            insertSql.AppendLine(" 	,@PersonPayRate     ");
            insertSql.AppendLine(" 	,@UsedStatus        ");
            insertSql.AppendLine(" 	,getdate()          ");
            insertSql.AppendLine(" 	,@ModifiedUserID)   ");
            insertSql.AppendLine("   SET @InsuSocialID= @@IDENTITY  ");
            #endregion

            //定义更新基本信息的命令
            SqlCommand comm = new SqlCommand();
            //设置存储过程名
            comm.CommandText = insertSql.ToString();
            //设置保存的参数
            SetSaveParameter(comm, model);

            //添加返回参数
            comm.Parameters.Add(SqlHelper.GetOutputParameter("@InsuSocialID", SqlDbType.Int));

            //执行插入并返回插入结果
            return comm;
        }