Пример #1
0
        /// <summary>
        /// 更新一条数据  ---modify by caiyuying 2011-1-20
        /// </summary>
        public void Update(ZQUSR.Model.sr_Produce model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sr_Produce set ");
            //strSql.Append("XueKe=@XueKe,");
            strSql.Append("Source=@Source,");
            strSql.Append("JiBie=@JiBie,");
            strSql.Append("LevelFactor=@LevelFactor");
            strSql.Append(" where PK_PID=@PK_PID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PK_PID",      SqlDbType.Int,       4),
                //new SqlParameter("@XueKe", SqlDbType.Char,4),
                new SqlParameter("@Source",      SqlDbType.NVarChar, 70),
                new SqlParameter("@JiBie",       SqlDbType.Char,      1),
                new SqlParameter("@LevelFactor", SqlDbType.Float, 8)
            };
            parameters[0].Value = model.PK_PID;
            //parameters[1].Value = model.XueKe;
            parameters[1].Value = model.Source;
            parameters[2].Value = model.JiBie;
            parameters[3].Value = model.LevelFactor;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ZQUSR.Model.sr_Produce model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sr_Produce(");
            strSql.Append("XueKe,Source,JiBie,LevelFactor)");
            strSql.Append(" values (");
            strSql.Append("@XueKe,@Source,@JiBie,@LevelFactor)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@XueKe",       SqlDbType.Char,      4),
                new SqlParameter("@Source",      SqlDbType.NVarChar, 70),
                new SqlParameter("@JiBie",       SqlDbType.Char,      1),
                new SqlParameter("@LevelFactor", SqlDbType.Float, 8)
            };
            parameters[0].Value = model.XueKe;
            parameters[1].Value = model.Source;
            parameters[2].Value = model.JiBie;
            parameters[3].Value = model.LevelFactor;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #3
0
        /// <summary>
        /// 创作类成果:根据发表刊物名称/来源(Source)返回级别和级别分系数     ——By Jianguo Fung
        /// </summary>
        public ZQUSR.Model.sr_Produce GetJiBieBySource(string Source)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 JiBie,LevelFactor from sr_Produce ");
            strSql.Append(" where Source=@Source ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Source", SqlDbType.NVarChar, 70)
            };
            parameters[0].Value = Source;

            ZQUSR.Model.sr_Produce model = new ZQUSR.Model.sr_Produce();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.JiBie = ds.Tables[0].Rows[0]["JiBie"].ToString();
                if (ds.Tables[0].Rows[0]["LevelFactor"].ToString() != "")
                {
                    model.LevelFactor = decimal.Parse(ds.Tables[0].Rows[0]["LevelFactor"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        /// <summary>
        /// 是否存在该记录(XueKe/Source)-By Jianguo Fung
        /// </summary>
        public bool Exists(ZQUSR.Model.sr_Produce model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from sr_Produce");
            strSql.Append(" where XueKe=@XueKe and ");
            strSql.Append("  Source=@Source ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@XueKe",  SqlDbType.Char,     10),
                new SqlParameter("@Source", SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = model.XueKe;
            parameters[1].Value = model.Source;

            return(DbHelperSQL.Exists(strSql.ToString(), parameters));
        }
Пример #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZQUSR.Model.sr_Produce GetModel(int PK_PID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 PK_PID,XueKe,Source,JiBie,LevelFactor from sr_Produce ");
            strSql.Append(" where PK_PID=@PK_PID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PK_PID", SqlDbType.Int, 4)
            };
            parameters[0].Value = PK_PID;

            ZQUSR.Model.sr_Produce model = new ZQUSR.Model.sr_Produce();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PK_PID"].ToString() != "")
                {
                    model.PK_PID = int.Parse(ds.Tables[0].Rows[0]["PK_PID"].ToString());
                }
                model.XueKe  = ds.Tables[0].Rows[0]["XueKe"].ToString();
                model.Source = ds.Tables[0].Rows[0]["Source"].ToString();
                model.JiBie  = ds.Tables[0].Rows[0]["JiBie"].ToString();
                if (ds.Tables[0].Rows[0]["LevelFactor"].ToString() != "")
                {
                    model.LevelFactor = decimal.Parse(ds.Tables[0].Rows[0]["LevelFactor"].ToString());
                    //model.LevelFactor = ds.Tables[0].Rows[0]["LevelFactor"].ToString();    //--by caiyuying
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public ZQUSR.Model.sr_Produce GetModel(int PK_PID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 PK_PID,XueKe,Source,JiBie,LevelFactor from sr_Produce ");
            strSql.Append(" where PK_PID=@PK_PID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@PK_PID", SqlDbType.Int,4)};
            parameters[0].Value = PK_PID;

            ZQUSR.Model.sr_Produce model=new ZQUSR.Model.sr_Produce();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["PK_PID"].ToString()!="")
                {
                    model.PK_PID=int.Parse(ds.Tables[0].Rows[0]["PK_PID"].ToString());
                }
                model.XueKe=ds.Tables[0].Rows[0]["XueKe"].ToString();
                model.Source=ds.Tables[0].Rows[0]["Source"].ToString();
                model.JiBie=ds.Tables[0].Rows[0]["JiBie"].ToString();
                if(ds.Tables[0].Rows[0]["LevelFactor"].ToString()!="")
                {
                    model.LevelFactor=decimal.Parse(ds.Tables[0].Rows[0]["LevelFactor"].ToString());
                    //model.LevelFactor = ds.Tables[0].Rows[0]["LevelFactor"].ToString();    //--by caiyuying
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Пример #7
0
        /// <summary>
        /// ������ɹ������ݷ����������/��Դ��Source�����ؼ���ͼ����ϵ��     ����By Jianguo Fung
        /// </summary>
        public ZQUSR.Model.sr_Produce GetJiBieBySource(string Source)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 JiBie,LevelFactor from sr_Produce ");
            strSql.Append(" where Source=@Source ");
            SqlParameter[] parameters = {
                    new SqlParameter("@Source", SqlDbType.NVarChar,70)};
            parameters[0].Value = Source;

            ZQUSR.Model.sr_Produce model = new ZQUSR.Model.sr_Produce();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.JiBie = ds.Tables[0].Rows[0]["JiBie"].ToString();
                if (ds.Tables[0].Rows[0]["LevelFactor"].ToString() != "")
                {
                    model.LevelFactor = decimal.Parse(ds.Tables[0].Rows[0]["LevelFactor"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }