예제 #1
0
파일: Source.cs 프로젝트: rongcheng/benz
        /// <summary>
        /// 根据groupID得到所有用途
        /// </summary>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public static List<Source> GetSourceList()
        {

        

            //List<Source> sourceList = new List<Source>();
            //using (DataTable table = SqlHelper.ExecuteDataset(SqlHelper.SqlCon_QJVRMS, CommandType.StoredProcedure, "Source_GetSource").Tables[0])
            //{
            //    foreach (DataRow row in table.Rows)
            //    {
            //        Source u = new Source();
                   
            //        u.sourceID = int.Parse(row["SourceID"].ToString());
            //        u.sourceName = row["SourceName"].ToString();
            //        u.sourceDesc = row["SourceDesc"].ToString();
            //        sourceList.Add(u);
            //    }
            //}

            //return sourceList;
            QJVRMS.Business.BaseInfoWS.BaseInfoService bis = new QJVRMS.Business.BaseInfoWS.BaseInfoService();
            List<Source> sourceList = new List<Source>();
            using (DataTable table = bis.GetSourceTable())
            {
                foreach (DataRow row in table.Rows)
                {
                    Source u = new Source();

                    u.sourceID = int.Parse(row["SourceID"].ToString());
                    u.sourceName = row["SourceName"].ToString();
                    u.sourceDesc = row["SourceDesc"].ToString();
                    sourceList.Add(u);
                }
            }

            return sourceList;
        }
예제 #2
0
파일: Source.cs 프로젝트: rongcheng/benz
        /// <summary>
        /// 添加某项用途
        /// </summary>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public static bool AddSource(Source sc)
        {

            //SqlParameter[] Parameters = new SqlParameter[3];


            //Parameters[0] = new SqlParameter("@SourceName", SqlDbType.NVarChar);
            //Parameters[1] = new SqlParameter("@SourceDesc", SqlDbType.NVarChar);
            //Parameters[2] = new SqlParameter("@GroupID", SqlDbType.UniqueIdentifier);

            //Parameters[0].Value = sc.SourceName;
            //Parameters[1].Value = sc.SourceDesc;
            //Parameters[2].Value = sc.GroupID;

            //int result = SqlHelper.ExecuteNonQuery(SqlHelper.SqlCon_QJVRMS, CommandType.StoredProcedure, "Source_AddSource", Parameters);
            //return result == 1;

            QJVRMS.Business.BaseInfoWS.BaseInfoService bis = new QJVRMS.Business.BaseInfoWS.BaseInfoService();
            return bis.AddSource(sc.SourceName, sc.SourceDesc);
        }