Exemple #1
0
        private void Poc(ref string str, int startloc, int length, string idleaf)
        {
            var id       = Math.Abs(Guid.NewGuid().GetHashCode());
            var table    = str.Substring(startloc, length);
            var startstr = str.Substring(0, startloc);
            var endstr   = str.Substring(startloc + length, str.Length - table.Length - startstr.Length);

            byte[] pdfFile = this.ConvertHtmlTextToPDF(table);
            string urlkey  = "http://@#";
            string rev     = PostResponse(ConfigurationManager.AppSettings["posturl"].ToString(), new Dictionary <string, string>(), Encoding.UTF8, pdfFile);
            var    re      = JsonConvert.DeserializeObject <result>(rev);

            string a = "<a href=\"" + re.url + "\"   title=\"" + re.title + "\">" + re.title + "</a>";

            listkeyvalue.Add(new KeyValuePair <string, string>(urlkey, a));
            str = startstr + urlkey.PadRight(table.Length, ' ') + endstr;
            string sql = @"insert into media_attrach
                                   (attr_id, attr_type, attr_title, attr_tag, attr_path, start_page, attr_author, attr_note, creator, createtime, inputtime)
                             values(" + id + ", 2, '" + re.title + "','','" + re.url + "','','系统', '后台表格替换','后台系统','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";

            SqlHeplerTo.ExcuteSQL(sql);
            sql = "select  isnull(max(auto_no),0) no from dbo.media_attr_use";
            var maxdata = SqlHeplerTo.GetTable(sql);

            sql = @"insert into media_attr_use
                          (auto_no, attr_id, use_tag, mapping_key, mapping_val, creator, createtime)
                    values(" + Convert.ToInt32(maxdata.Rows[0][0]) + ", '" + id + "', '','IDLeaf','" + idleaf + "','系统','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";
            SqlHeplerTo.ExcuteSQL(sql);
        }
Exemple #2
0
        private void InsertMedia()
        {
            string sql        = "select content_id,path,name from v_content_ext";
            var    mediatData = SqlHeplerFrom.GetTable(sql);

            foreach (DataRow row in mediatData.Rows)
            {
                try
                {
                    sql = "select attr_id from  dbo.media_attrach where attr_path='" + Convert.ToString(row["path"]) + "'";
                    var    isExistData = SqlHeplerTo.GetTable(sql);
                    string attrid      = string.Empty;
                    if (isExistData.Rows.Count == 0)
                    {
                        attrid = Math.Abs(Guid.NewGuid().GetHashCode()).ToString();

                        sql = @"insert into media_attrach(attr_id,attr_type,attr_title,attr_tag,attr_path,start_page,attr_author,attr_note,creator,createtime,inputtime) 
                                               values('" + attrid + "',2,'" + Convert.ToString(row["name"]) + "','','" + Convert.ToString(row["path"]) + "','','administrator','系统','administrator','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";
                        SqlHeplerTo.ExcuteSQL(sql);
                    }
                    else
                    {
                        attrid = Convert.ToString(isExistData.Rows[0]["attr_id"]);
                    }
                    sql = @"insert into  dbo.media_attr_use  
                            (auto_no,attr_id,use_tag,mapping_key,mapping_val,creator,createtime) 
                             values('" + Math.Abs(Guid.NewGuid().GetHashCode()).ToString() + "','" + attrid + "',1,'IDLeaf','" + Convert.ToString(row["content_id"]) + "','administrator','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";
                    SqlHeplerTo.ExcuteSQL(sql);
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        private void InsertNode()
        {
            var    site        = ConfigurationManager.AppSettings["site"].ToString();
            var    mapkey      = ConfigurationManager.AppSettings["objName"].ToString();
            string sql         = "select id,isnull(parent_id,0) parent_id,name from v_channel";
            var    Channeldata = SqlHeplerFrom.GetTable(sql);

            foreach (DataRow row in Channeldata.Rows)
            {
                try
                {
                    sql = @"insert into site_node_bak 
                              (node_id,site_code,node_name,node_type,map_type,map_key,node_status,is_audit,audit_wf,is_review,is_auedit,creator,createtime,inputtime,isdept,urlPre)
                              values
                              (" + Convert.ToString(row["id"]) + ",'" + site + "','" + Convert.ToString(row["name"]) + "',0,0,'" + mapkey + "',0,1,'" + mapkey + "',0,1,'Creator','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "',0,'gg')";
                    SqlHeplerTo.ExcuteSQL(sql);
                    sql = @"select  node_path  from node_net_bak where node_id='" + Convert.ToString(row["parent_id"]) + "'";
                    var nodeTable = SqlHeplerTo.GetTable(sql);
                    if (nodeTable.Rows.Count > 0)
                    {
                        foreach (DataRow netrow in nodeTable.Rows)
                        {
                            sql = @"insert into  node_net_bak 
                                        (node_id,node_pid,node_path,order_no)
                                  values('" + Convert.ToString(row["id"]) + "','" + Convert.ToString(netrow["node_path"]) + "','" + Convert.ToString(netrow["node_path"]) + "-" + Convert.ToString(row["id"]) + "',1)";
                            SqlHeplerTo.ExcuteSQL(sql);
                        }
                    }
                    else
                    {
                        sql = @"insert into  node_net_bak
                                        (node_id,node_pid,node_path,order_no)
                                  values('" + Convert.ToString(row["id"]) + "',0,'0-" + Convert.ToString(row["id"]) + "',1)";
                        SqlHeplerTo.ExcuteSQL(sql);
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
        }