Exemple #1
0
        public int Insert(string userid, int portalid, string culturecode, string code, string title, string headline, string abstract_info,
                          string frontimage, string mainimage, string maintext, string source, string navigateurl, string status)
        {
            /*** PostedDate ******************************************************************************/
            //System.Globalization.CultureInfo customCulture = new System.Globalization.CultureInfo("en-US");
            //customCulture.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy";
            //customCulture.DateTimeFormat.ShortTimePattern = "HH:mm:ss";
            //System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
            //System.Threading.Thread.CurrentThread.CurrentUICulture = customCulture;
            //string PostedDate = System.DateTime.Now.ToString("G");
            /*********************************************************************************************/

            string alias = ModuleClass.convertTitle2Link(headline);

            maintext = module_obj.UTF8_Encode(maintext);
            string tags = module_obj.createTags(headline);

            SqlCommand cmd = new SqlCommand("[Articles].[sp_Articles_Insert]", con)
            {
                CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout
            };

            cmd.Parameters.AddWithValue("@userid", userid);
            cmd.Parameters.AddWithValue("@ip", ip);
            cmd.Parameters.AddWithValue("@portalid", portalid);
            cmd.Parameters.AddWithValue("@culturecode", culturecode);
            cmd.Parameters.AddWithValue("@code", code);
            cmd.Parameters.AddWithValue("@title", title);
            cmd.Parameters.AddWithValue("@headline", headline);
            cmd.Parameters.AddWithValue("@alias", alias);
            cmd.Parameters.AddWithValue("@abstract", abstract_info);
            cmd.Parameters.AddWithValue("@frontimage", frontimage);
            cmd.Parameters.AddWithValue("@mainimage", mainimage);
            cmd.Parameters.AddWithValue("@maintext", maintext);
            cmd.Parameters.AddWithValue("@tags", tags);
            cmd.Parameters.AddWithValue("@source", source);
            cmd.Parameters.AddWithValue("@navigateurl", navigateurl);
            cmd.Parameters.AddWithValue("@status", status);
            cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int)
            {
                Direction = ParameterDirection.Output
            });
            con.Open();
            int i          = cmd.ExecuteNonQuery();
            int retunvalue = (int)cmd.Parameters["@o_return"].Value;

            con.Close();
            return(retunvalue);
        }