Esempio n. 1
0
        public void ResourceData(int i)
        {
            string head       = System.Configuration.ConfigurationManager.AppSettings["MetadataService"];
            string tail       = System.Configuration.ConfigurationManager.AppSettings["mField"];
            string urlRSORT   = String.Format(head + tail, "RSORT");          //14资源类型
            string jsonRSORT  = Common.HttpGet(urlRSORT);                     //y({....})
            string jsonRSORT2 = jsonRSORT.Substring(2, jsonRSORT.Length - 3); //{}
            string tep        = jsonRSORT2.Substring(7, jsonRSORT2.Length - 8);

            m.Title        = worksheet[i, 2].ToString();
            m.StandardBook = DealData.RetSubstringUnderline(worksheet[i, 5].ToString());
            #region  版本 册别 学科 年级
            //foreach (KeyValuePair<string, string> kvp in Testdic)
            //{
            //    if (kvp.Key == m.StandardBook.ToString())
            //    {
            //        testValue = kvp.Value;
            //    }
            //}
            //if (testValue != "")
            //{
            //    string[] sArray = testValue.Split(',');
            //    if (sArray == null || sArray.Length == 0)
            //    {
            //        m.SchoolStage = null;
            //        m.Subject = null;
            //        m.Grade = null;
            //        m.BookReel = null;
            //        m.Edition = null;
            //    }
            //    else
            //    {
            //        m.SchoolStage = int.Parse(sArray[0]);
            //        m.Subject = int.Parse(sArray[1]);
            //        m.Grade = int.Parse(sArray[2]);
            //        m.BookReel = int.Parse(sArray[3]);
            //        m.Edition = int.Parse(sArray[4]);

            //    }
            //}
            //else
            //{
            //    m.SchoolStage = null;

            //    m.Subject = null;

            //    m.Grade = null;

            //    m.BookReel = null;

            //    m.Edition = null;
            //}
            #endregion
            m.Catalog = DealData.RetSubstringBracket(worksheet[i, 6].ToString());
            //m.Copyright = Mirror[worksheet[i, 23].ToString()];
            //string CopyrightName = banquanxinxi[m.Copyright].Split('_')[0];

            //资源类型
            int    eId           = DealData.RetSubstringBracket(worksheet[i, 4].ToString());
            string ResourceType  = string.Empty;
            string ResourceStyle = string.Empty;
            GetResType(tep, eId.ToString(), out ResourceType, out ResourceStyle);
            if (ResourceType != string.Empty)
            {
                ResourceType = int.Parse(ResourceType).ToString();
            }
            if (ResourceStyle != string.Empty)
            {
                ResourceStyle = int.Parse(ResourceStyle).ToString();
            }
            m.KeyWords    = worksheet[i, 7].ToString().Replace("\'", "\'\'");
            m.Description = worksheet[i, 8].ToString().Replace("\'", "\'\'");

            updateStr = "update dbo.[tb_Resource] set Title = '" + m.Title + "',Catalog ='" + m.Catalog + "', ResourceType ='" + ResourceType
                        + "',ResourceStyle = '" + ResourceStyle + "',KeyWords ='" + m.KeyWords + "',Description = '" + m.Description + "' where " + "FileID ='" + worksheet[i, 13] + "'";
            SqlConnection sqlconn = new SqlConnection(sqlstr);
            sqlconn.Open();
            SqlCommand cmd    = new SqlCommand(updateStr, sqlconn);
            int        uptnum = cmd.ExecuteNonQuery();
            if (false)
            {
                string url      = System.Configuration.ConfigurationManager.AppSettings["ResourceImplement"] + "Handler.ashx";
                string str      = "'{'Form':'{\'RID\':\'BEC2C674-AADE-283D-A506-35BFE61B1387\',\'SKEY\':\'ResourceImplement\',\'Pack\':\'{\\\'ID\\\':\\\'BEC2C674-AADE-283D-A506-35BFE61B1387\\\',\\\'Function\\\':\\\'PushResource\\\',\\\'Data\\\':\\\'{}\\\'}\',\'Ticket\':\'\'}'}'";
                var    response = PostData.RequestData(url, str);
            }
        }