Exemple #1
0
        public static int Insert(SqlTransaction trans, AllocationModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" insert into Sm_Allocation(aid,acode,flowstate,tcodea,tcodeb,isouta,isinb,person,intime,annx,explain,OutAllocationPerson,InAllocationPerson, ");
            builder.Append("isouttime,isintime ) ");
            builder.Append(" values(@aid,@acode,@flowstate,@tcodea,@tcodeb,@isouta,@isinb,@person,");
            builder.Append("@intime,@annx,@explain,@OutAllocationPerson,@InAllocationPerson, ");
            builder.Append("@isOutTime,@isInTime) ");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@acode", SqlDbType.NVarChar, 0x40), new SqlParameter("@flowstate", SqlDbType.Int), new SqlParameter("@tcodea", SqlDbType.NVarChar, 0x200), new SqlParameter("@tcodeb", SqlDbType.NVarChar, 0x200), new SqlParameter("@isouta", SqlDbType.Bit), new SqlParameter("@isinb", SqlDbType.Bit), new SqlParameter("@person", SqlDbType.NVarChar, 0x40), new SqlParameter("@intime", SqlDbType.VarChar, 0x10), new SqlParameter("@annx", SqlDbType.NVarChar, 0x80), new SqlParameter("@explain", SqlDbType.NVarChar, 0x800), new SqlParameter("@OutAllocationPerson", SqlDbType.NVarChar, 0x40), new SqlParameter("@InAllocationPerson", SqlDbType.NVarChar, 0x40), new SqlParameter("@aid", SqlDbType.NVarChar, 0x40), new SqlParameter("@isOutTime", SqlDbType.NVarChar, 0x40), new SqlParameter("@isInTime", SqlDbType.NVarChar, 0x40) };
            commandParameters[0].Value  = model.Acode;
            commandParameters[1].Value  = model.FlowState;
            commandParameters[2].Value  = model.TCodea;
            commandParameters[3].Value  = model.TCodeb;
            commandParameters[4].Value  = model.IsOutA;
            commandParameters[5].Value  = model.IsInB;
            commandParameters[6].Value  = model.Person;
            commandParameters[7].Value  = model.InTime;
            commandParameters[8].Value  = model.Annex;
            commandParameters[9].Value  = model.Explain;
            commandParameters[10].Value = model.OutAllocationPerson;
            commandParameters[11].Value = model.InAllocationPerson;
            commandParameters[12].Value = model.Aid;
            if (!string.IsNullOrEmpty(model.IsOutTime))
            {
                commandParameters[13].Value = model.IsOutTime;
            }
            else
            {
                commandParameters[13].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(model.IsInTime))
            {
                commandParameters[14].Value = model.IsInTime;
            }
            else
            {
                commandParameters[14].Value = DBNull.Value;
            }
            return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters));
        }
Exemple #2
0
        public static int Update(SqlTransaction trans, AllocationModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update sm_allocation set ");
            builder.Append("tcodea=@tcodea,tcodeb=@tcodeb,");
            builder.Append("person=@person,intime=@intime,annx=@annx,explain=@explain,");
            builder.Append("OutAllocationPerson=@OutAllocationPerson,InAllocationPerson=@InAllocationPerson ");
            builder.Append("where acode=@acode ");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@tcodea", SqlDbType.NVarChar, 0x200), new SqlParameter("@tcodeb", SqlDbType.NVarChar, 0x200), new SqlParameter("@person", SqlDbType.NVarChar, 0x40), new SqlParameter("@intime", SqlDbType.VarChar, 30), new SqlParameter("@annx", SqlDbType.NVarChar, 0x63), new SqlParameter("@explain", SqlDbType.NVarChar, 0x800), new SqlParameter("@OutAllocationPerson", SqlDbType.NVarChar, 0x40), new SqlParameter("@InAllocationPerson", SqlDbType.NVarChar, 0x40), new SqlParameter("@acode", SqlDbType.NVarChar, 0x40) };
            commandParameters[0].Value = model.TCodea;
            commandParameters[1].Value = model.TCodeb;
            commandParameters[2].Value = model.Person;
            commandParameters[3].Value = model.InTime;
            commandParameters[4].Value = model.Annex;
            commandParameters[5].Value = model.Explain;
            commandParameters[6].Value = model.OutAllocationPerson;
            commandParameters[7].Value = model.InAllocationPerson;
            commandParameters[8].Value = model.Acode;
            return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters));
        }