Пример #1
0
        public string Get_jcxbh_by_jcxmc(string jcxmc)
        {
            string sql = "select * from JCXXXB where JCXMC=@jcxmc";

            SqlParameter[] spr =
            {
                new SqlParameter("@jcxmc", jcxmc)
            };
            try
            {
                SYS.Model.JCXXXB sb = new SYS.Model.JCXXXB();
                DataTable        dt = new DataTable();
                dt = DBHelperSQL.GetDataTable(sql, CommandType.Text, spr);
                if (dt.Rows.Count > 0)
                {
                    sb.JCXBH = dt.Rows[0]["JCXBH"].ToString();
                }
                return(sb.JCXBH);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SYS.Model.JCXXXB model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update JCXXXB set");
            //strSql.Append("JCXBH=@JCXBH,");
            strSql.Append(" GYJSJIP=@GYJSJIP,");
            strSql.Append("JCXMC=@JCXMC,");
            strSql.Append("JCFFLX=@JCFFLX,");
            strSql.Append("DPCGJBH=@DPCGJBH,");
            strSql.Append("FQFXYBH=@FQFXYBH,");
            strSql.Append("BTGYDJBH=@BTGYDJBH,");
            strSql.Append("WYZSBBH=@WYZSBBH,");
            strSql.Append("QTLLFXYBH=@QTLLFXYBH,");
            strSql.Append("LEDDPBH=@LEDDPBH,");
            strSql.Append("LEDPZ=@LEDPZ,");
            strSql.Append("XH=@XH,");
            strSql.Append("RZBH=@RZBH,");
            strSql.Append("ZZCS=@ZZCS,");
            strSql.Append("LLJBH=@LLJBH,");
            strSql.Append("DPCGJPZ=@DPCGJPZ,");
            strSql.Append("FQFXYPZ=@FQFXYPZ,");
            strSql.Append("BTGYDJPZ=@BTGYDJPZ,");
            strSql.Append("LLJPZ=@LLJPZ,");
            strSql.Append("PCBH=@PCBH,");
            strSql.Append("HJZBH=@HJZBH ");
            //strSql.Append("LJSYS=@LJSYS");//更新时不改变累计试验数
            strSql.Append(" where JCXBH=@JCXBH");
            //strSql.Append("values (@JCXBH,@GYJSJIP,@JCXMC,@JCFFLX,@DPCGJBH,@FQFXYBH,@BTGYDJBH,@WYZSBBH,@QTLLFXYBH,@LEDDPBH,@XH,@RZBH,@ZZCS,@LLJBH,@LJSYS)");
            SqlParameter[] parameters =
            {
                //new SqlParameter("@JCXBH", SqlDbType.VarChar,32),
                new SqlParameter("@GYJSJIP",   SqlDbType.VarChar, 16),
                new SqlParameter("@JCXMC",     SqlDbType.VarChar, 64),
                new SqlParameter("@JCFFLX",    SqlDbType.Int,      4),
                new SqlParameter("@DPCGJBH",   SqlDbType.Int,      4),
                new SqlParameter("@FQFXYBH",   SqlDbType.Int,      4),
                new SqlParameter("@BTGYDJBH",  SqlDbType.Int,      4),
                new SqlParameter("@WYZSBBH",   SqlDbType.Int,      4),
                new SqlParameter("@QTLLFXYBH", SqlDbType.Int,      4),
                new SqlParameter("@LEDDPBH",   SqlDbType.Int,      4),
                new SqlParameter("@LEDPZ",     SqlDbType.VarChar, 32),
                new SqlParameter("@XH",        SqlDbType.VarChar, 32),
                new SqlParameter("@RZBH",      SqlDbType.VarChar, 64),
                new SqlParameter("@ZZCS",      SqlDbType.VarChar, 64),
                new SqlParameter("@LLJBH",     SqlDbType.Int,      4),
                new SqlParameter("@DPCGJPZ",   SqlDbType.VarChar, 64),
                new SqlParameter("@FQFXYPZ",   SqlDbType.VarChar, 64),
                new SqlParameter("@BTGYDJPZ",  SqlDbType.VarChar, 64),
                new SqlParameter("@LLJPZ",     SqlDbType.VarChar, 64),
                new SqlParameter("@PCBH",      SqlDbType.Int,      4),
                new SqlParameter("@HJZBH",     SqlDbType.Int,      4),
                //new SqlParameter("@LJSYS", SqlDbType.Int,4),
                new SqlParameter("@JCXBH",     SqlDbType.VarChar, 32)
            };
            //parameters[0].Value = model.JCXBH;
            parameters[0].Value  = model.GYJSJIP;
            parameters[1].Value  = model.JCXMC;
            parameters[2].Value  = model.JCFFLX;
            parameters[3].Value  = model.DPCGJBH;
            parameters[4].Value  = model.FQFXYBH;
            parameters[5].Value  = model.BTGYDJBH;
            parameters[6].Value  = model.WYZSBBH;
            parameters[7].Value  = model.QTLLFXYBH;
            parameters[8].Value  = model.LEDDPBH;
            parameters[9].Value  = model.LEDPZ;
            parameters[10].Value = model.XH;
            parameters[11].Value = model.RZBH;
            parameters[12].Value = model.ZZCS;
            parameters[13].Value = model.LLJBH;
            parameters[14].Value = model.DPCGJPZ;
            parameters[15].Value = model.FQFXYPZ;
            parameters[16].Value = model.BTGYDJPZ;
            parameters[17].Value = model.LLJPZ;
            parameters[18].Value = model.PCBH;
            parameters[19].Value = model.HJZBH;
            //parameters[14].Value = model.LJSYS;
            parameters[20].Value = model.JCXBH;
            try
            {
                int rows = DBHelperSQL.Execute(strSql.ToString(), parameters);
                if (rows > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        public bool AddLine(SYS.Model.JCXXXB model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into JCXXXB (");
            strSql.Append("JCXBH,");     //=@PZLX,");
            strSql.Append("GYJSJIP,");   //=@JCCLPH,");
            strSql.Append("JCXMC,");     //=@CLXHBH,");
            strSql.Append("JCFFLX,");    //=@JCCS,");
            strSql.Append("DPCGJBH,");   //=@CCRQ,");
            strSql.Append("FQFXYBH,");   //=@DJRQ,");
            strSql.Append("BTGYDJBH,");  //=@FDJH,");
            strSql.Append("WYZSBBH,");   //=@CJH,");
            strSql.Append("QTLLFXYBH,"); //=@CZ,");
            strSql.Append("LEDDPBH,");   //=@CZDH,");
            strSql.Append("LEDPZ,");     //=@CZDH,");
            strSql.Append("XH,");        //=@CZDZ,");
            strSql.Append("RZBH,");      //=@LCBDS,");
            strSql.Append("ZZCS,");      //=@HBBZ,");
            strSql.Append("LLJBH,");     //=@SYQK,");
            strSql.Append("LJSYS)");
            strSql.Append("values (@JCXBH,@GYJSJIP,@JCXMC,@JCFFLX,@DPCGJBH,@FQFXYBH,@BTGYDJBH,@WYZSBBH,@QTLLFXYBH,@LEDDPBH,@LEDPZ,@XH,@RZBH,@ZZCS,@LLJBH,@LJSYS)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@JCXBH",     SqlDbType.VarChar, 32),
                new SqlParameter("@GYJSJIP",   SqlDbType.VarChar, 16),
                new SqlParameter("@JCXMC",     SqlDbType.VarChar, 64),
                new SqlParameter("@JCFFLX",    SqlDbType.Int,      4),
                new SqlParameter("@DPCGJBH",   SqlDbType.Int,      4),
                new SqlParameter("@FQFXYBH",   SqlDbType.Int,      4),
                new SqlParameter("@BTGYDJBH",  SqlDbType.Int,      4),
                new SqlParameter("@WYZSBBH",   SqlDbType.Int,      4),
                new SqlParameter("@QTLLFXYBH", SqlDbType.Int,      4),
                new SqlParameter("@LEDDPBH",   SqlDbType.Int,      4),
                new SqlParameter("@LEDPZ",     SqlDbType.VarChar, 32),
                new SqlParameter("@XH",        SqlDbType.VarChar, 32),
                new SqlParameter("@RZBH",      SqlDbType.VarChar, 64),
                new SqlParameter("@ZZCS",      SqlDbType.VarChar, 64),
                new SqlParameter("@LLJBH",     SqlDbType.Int,      4),
                new SqlParameter("@LJSYS",     SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.JCXBH;
            parameters[1].Value  = model.GYJSJIP;
            parameters[2].Value  = model.JCXMC;
            parameters[3].Value  = model.JCFFLX;
            parameters[4].Value  = model.DPCGJBH;
            parameters[5].Value  = model.FQFXYBH;
            parameters[6].Value  = model.BTGYDJBH;
            parameters[7].Value  = model.WYZSBBH;
            parameters[8].Value  = model.QTLLFXYBH;
            parameters[9].Value  = model.LEDDPBH;
            parameters[10].Value = model.LEDPZ;
            parameters[11].Value = model.XH;
            parameters[12].Value = model.RZBH;
            parameters[13].Value = model.ZZCS;
            parameters[14].Value = model.LLJBH;
            parameters[15].Value = model.LJSYS;
            try
            {
                if (Have_ThisLine(model.JCXBH, model.JCXMC, model.GYJSJIP))
                {
                    if (Update(model))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    if (DBHelperSQL.Execute(strSql.ToString(), parameters) > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }