示例#1
0
 protected void btn_okchang_Click(object sender, EventArgs e)
 {
     try {
         ua = (user)Session["Adminu"];
         //Buckup.Buckup_ChangePower(ua.name, txt_name.Text, Hidden1.Value);
         Buckup.Buckup_AccountOperation("修改账号权限", ua.name, clientIP, txt_name.Text, Hidden1.Value.Trim());
         string id  = SqlFunction.Sql_ReturnNumberES("select id from admin where user_name='" + txt_name.Text + "'");
         string sql = "";
         sql = string.Format(@"update admin set User_Name='{0}', User_Email='{1}', 
         phone='{2}', a_state='{3}', isadd='{4}', isupdate='{5}', isselect='{6}', 
         isdelete='{7}', isregedit='{8}', isexport='{9}' where id=" + id,
                             txt_name.Text, txt_email.Value, txt_phone.Value, ddl_s.SelectedIndex,
                             Convert.ToInt32(cb_add.Checked), Convert.ToInt32(cb_update.Checked), Convert.ToInt32(cb_select.Checked),
                             Convert.ToInt32(cb_dele.Checked), Convert.ToInt32(cb_regedit.Checked), Convert.ToInt32(cb_export.Checked));
         int r = SqlFunction.Sql_ReturnNumberENQ(sql);
         if (r == 1)
         {
             LayerA("修改成功!", 6, Page);
         }
         else
         {
             LayerA("修改失败!错误信息:" + r, 5, Page);
         }
     } catch (Exception ee) {
         LayerA("修改失败!错误信息:" + ee.Message, 5, Page);
     }
 }
示例#2
0
 public void ToSqlServer()
 {
     //string strCon = @"Data Source=bds13396396.my3w.com;initial catalog=bds13396396_db;user id=bds13396396;password=icox2015;multipleactiveresultsets=True;";
     //data source=bds13396396.my3w.com;initial catalog=bds13396396_db;user id=bds13396396;password=icox2015;multipleactiveresultsets=True;
     try {
         int yes = 0;
         int no  = 0;
         int c1  = GridView2.Rows.Count;
         //MessageBox.Show("表格行数=" + GridView2.Rows.Count, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         for (int i = 0; i < c1; i++)
         {
             if (GridView2.Rows[i].Cells[2].Text == "youku")
             {
                 string temppath = GridView2.Rows[i].Cells[3].Text.ToString();
                 string sql      = "insert into dbo.VideoUrl(Vid,Source,Path,sort,Describe) values(" + GridView2.Rows[i].Cells[0].Text + ",'"
                                   + GridView2.Rows[i].Cells[2].Text.ToString() + "','" + GridView2.Rows[i].Cells[3].Text.ToString() + "','"
                                   + GridView2.Rows[i].Cells[4].Text.ToString() + "','" + GridView2.Rows[i].Cells[5].Text.ToString() + "') ";
                 if (SqlFunction.Sql_ReturnNumberENQ(sql) > 0)
                 {
                     yes++;
                 }
                 else
                 {
                     no++;
                 }
             }
             else
             {
                 string temppath = GridView2.Rows[i].Cells[3].Text.ToString();
                 temppath = AES.Encrypt(temppath);
                 string sql = "insert into dbo.VideoUrl(Vid,Source,TempPath,sort,Describe) values(" + GridView2.Rows[i].Cells[0].Text + ",'"
                              + GridView2.Rows[i].Cells[2].Text.ToString() + "','" + temppath + "','"
                              + GridView2.Rows[i].Cells[4].Text.ToString() + "','" + GridView2.Rows[i].Cells[5].Text.ToString() + "') ";
                 if (SqlFunction.Sql_ReturnNumberENQ(sql) > 0)
                 {
                     yes++;
                 }
                 else
                 {
                     no++;
                 }
             }
         }
         string clientIP = HttpContext.Current.Request.UserHostAddress;
         u = (user)Session["Adminu"];
         Buckup.Buckup_Add("添加信道", u.name, clientIP, yes);
         //MessageBox.Show("导入SqlServer成功!成功数:" + yes + "失败数:" + no, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Label2.Text = "导入成功:" + yes + "; 失败:" + no;
     } catch (Exception ex) {
         Label2.Text = ("导入过程中出错,请联系开发人员:" + ex.Message).Replace("'", "〞");
         Layer(string.Format(@"layer.alert('{0}', {
                       icon: 5,title: false,shade:false,
                       shadeClose: true,skin: 'layer-ext-moon'  
                     })", Label2.Text), Page);
     } finally {
     }
 }
示例#3
0
        protected void btn_deleteUser_Click(object sender, EventArgs e)
        {
            try {
                ua = (user)Session["Adminu"];

                Buckup.Buckup_AccountOperation("删除用户", ua.name, clientIP, txt_name.Text, "");
                int r = SqlFunction.Sql_ReturnNumberENQ("delete from admin where user_name='" + info[0] + "'");
                if (r == 1)
                {
                    LayerA("删除成功!", 6, Page);
                }
                else
                {
                    LayerA("删除失败!错误信息:" + r, 5, Page);
                }
            } catch (Exception ee) {
                LayerA("删除失败!错误信息:" + ee.Message, 5, Page);
            }
        }
示例#4
0
        protected void btn_changepwd_Click(object sender, EventArgs e)
        {
            ua = (user)Session["Adminu"];
            string clientIP = HttpContext.Current.Request.UserHostAddress;
            string pwd      = MD5pwd.MD5zsgc.MD5Entry(old_pwd.Value);
            string newpwd   = MD5pwd.MD5zsgc.MD5Entry(new_pwd.Value);

            if (SqlFunction.Sql_ReturnNumberES("select user_pwd from admin where user_name='" + ua.name + "'") == pwd)
            {
                int jg = SqlFunction.Sql_ReturnNumberENQ("update admin set user_pwd='" + newpwd + "' where user_name='" + ua.name + "'");
                if (jg == 1)
                {
                    Buckup.Buckup_AccountOperation("更改密码", ua.name, ua.name, clientIP, string.Format("将原密码{0},更改成{1}", pwd, newpwd));
                    LayerA("修改成功", 6, Page);
                }
            }
            else
            {
                LayerA("原密码错误", 5, Page);
            }
        }
示例#5
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (TreeView1.SelectedValue == "")
     {
         Layer(@"layer.alert('请选中左侧节点类型', {
                       icon: 0,title: false,
                       shadeClose: true,skin: 'layer-ext-moon'  
                     })", Page);
     }
     else
     {
         if (title.Value != "" && img.Value != "" && sort.Value != "")
         {
             if (TreeView1.SelectedNode.ChildNodes.Count == 0)  //判断选择节点下是否有类型,没有则将原来tid替换成新的tid
             {
                 string sql = "insert into  videotype (Tid,Title,Cover,Sort,State) Values(" + TreeView1.SelectedValue + ",'" + title.Value + "','" + img.Value + "'," + sort.Value + ",1 )";
                 if (SqlFunction.Sql_ReturnNumberENQ(sql) > 0)
                 {
                     string clientIP = HttpContext.Current.Request.UserHostAddress;
                     u = (user)Session["Adminu"];
                     Buckup.Buckup_Add("添加类型", u.name, clientIP, 1);
                     string rtid = "select  id from videotype where title='" + title.Value + "'";
                     Text1.Value = SqlFunction.Sql_ReturnNumberES(rtid);
                     if (SqlFunction.Sql_ReturnNumberENQ("update video set tid=(" + rtid + ") where tid=" + TreeView1.SelectedValue) > 0)
                     {
                         bing();
                         Layer(@"layer.alert('类型添加成功,原类型转移成功', {
                               icon: 6,title: false,
                               shadeClose: true,skin: 'layer-ext-moon'  
                             })", Page);
                     }
                     else
                     {
                         bing();
                         Layer(@"layer.alert('类型添加成功,但原类型转移失败,请通知开发者转移', {
                               icon: 0,title: false,
                               shadeClose: true,skin: 'layer-ext-moon'  
                             })", Page);
                     }
                 }
                 else
                 {
                     Layer(@"layer.alert('添加失败', {
                               icon: 5,title: false,
                               shadeClose: true,skin: 'layer-ext-moon'  
                             })", Page);
                 }
             }
             else
             {
                 string sql = "insert into  videotype (Tid,Title,Cover,Sort,State) Values(" + TreeView1.SelectedValue + ",'" + title.Value + "','" + img.Value + "'," + sort.Value + ",0 )";
                 if (SqlFunction.Sql_ReturnNumberENQ(sql) > 0)
                 {
                     string rtid = "select  id from videotype where title='" + title.Value + "'";
                     Text1.Value = SqlFunction.Sql_ReturnNumberES(rtid); bing();
                     Layer(@"layer.alert('添加成功', {
                               icon: 6,title: false,
                               shadeClose: true,skin: 'layer-ext-moon'  
                             })", Page);
                 }
                 else
                 {
                     bing();
                     Layer(@"layer.alert('添加失败', {
                               icon: 5,title: false,
                               shadeClose: true,skin: 'layer-ext-moon'  
                             })", Page);
                 }
             }
         }
         else
         {
             Layer(@"layer.alert('有数据未填写', {
                               icon: 0,title: false,
                               shadeClose: true,skin: 'layer-ext-moon'  
                             })", Page);
         }
     }
 }
示例#6
0
        //注册
        protected void btn_r_ok_Click(object sender, EventArgs e)
        {
            string info = check();

            if (Convert.ToInt32(SqlFunction.Sql_ReturnNumberES("select count(*) from admin where user_name='" + txt_name.Value + "'")) != 0)
            {
                LayerA("注册失败,已存在此用户", 5, Page);
                return;
            }
            if (info == "")  //检查注册信息
            {
                int[] bl;
                bl = new int[6];
                if (cb_add.Checked == true)
                {
                    bl[0] = 1;
                }
                else
                {
                    bl[0] = 0;
                }
                if (cb_update.Checked == true)
                {
                    bl[2] = 1;
                }
                else
                {
                    bl[1] = 0;
                }
                if (cb_select.Checked == true)
                {
                    bl[3] = 1;
                }
                else
                {
                    bl[2] = 0;
                }
                if (cb_dele.Checked == true)
                {
                    bl[1] = 1;
                }
                else
                {
                    bl[3] = 0;
                }
                if (cb_regedit.Checked == true)
                {
                    bl[4] = 1;
                }
                else
                {
                    bl[4] = 0;
                }
                if (cb_export.Checked == true)
                {
                    bl[5] = 1;
                }
                else
                {
                    bl[5] = 0;
                }
                string   sql = "";
                DateTime dt  = DateTime.Now;
                sql = string.Format(@"insert into Admin (User_Name,User_Pwd,
                    User_Email,phone,a_state,isadd,isupdate,isselect,isdelete,isregedit,isexport,creatTime)
                    values(" + "'" + txt_name.Value + "',"
                                    + "'" + MD5pwd.MD5zsgc.MD5Entry(this.txt_pwd.Value) + "',"
                                    + "'" + txt_email.Value + "',"
                                    + "'" + txt_phone.Value + "',"
                                    + "'" + ddl_s.Text + "',"
                                    + "'" + bl[0] + "',"
                                    + "'" + bl[1] + "',"
                                    + "'" + bl[2] + "',"
                                    + "'" + bl[3] + "',"
                                    + "'" + bl[4] + "',"
                                    + "'" + bl[5] + "',"
                                    + "'" + dt.ToString() + "')");
                if (SqlFunction.Sql_ReturnNumberENQ(sql) == 1)
                {
                    string power = "";
                    power = string.Format("[增:{0}],[改:{1}],[查:{2}],[删:{3}],[注册:{4}],[导出:{5}];1表示有权限0表示无权限"
                                          , bl[0], bl[1], bl[2], bl[3], bl[4], bl[5]);
                    ua = (user)Session["Adminu"];
                    string info2 = "";//备份的注册信息
                    info2 = string.Format("[密码:{0}][状态:{1}]{2}",
                                          MD5pwd.MD5zsgc.MD5Entry(txt_pwd.Value), ddl_s.SelectedValue, power);
                    string clientIP = HttpContext.Current.Request.UserHostAddress;
                    Buckup.Buckup_AccountOperation("注册用户", ua.name, clientIP, txt_name.Value, info2);
                    LayerA("注册成功", 6, Page);
                }
                else
                {
                    LayerA("注册失败", 5, Page);
                }
            }
            else     //检查不规范
            {
                LayerA(info, 5, Page);
            }
        }
示例#7
0
        /// <summary>
        /// 开始更新数据库
        /// </summary>
        /// <returns></returns>
        protected void startUpdate()
        {
            int  count        = GridView1.Rows.Count;
            bool isok         = false;
            int  sourcenum    = 0;
            int  state0source = 0;

            string [] state0index = new string[3];
            int       index       = 0;
            string    error       = "";

            for (int j = 0; j < count; j++)
            {
                int    xindaoNum = 0, xindaoIndex = 0;
                string sort = "";
                for (int i = 17; i > 0; i -= 7)
                {
                    if (GridView1.Rows[j].Cells[i].Text == "" || GridView1.Rows[j].Cells[i].Text == "&nbsp;")
                    {
                    }
                    else
                    {
                        xindaoNum++;
                        xindaoIndex = i;
                        switch (xindaoIndex)
                        {
                        case 3: sort = "999"; break;

                        case 10: sort = "99"; break;

                        case 17: sort = "9"; break;
                        }
                    }
                }

                DateTime dt = DateTime.Now;
                string   sql = "";
                string   cover = "", Describe = "";
                cover    = GridView1.Rows[j].Cells[1].Text.ToString();
                Describe = GridView1.Rows[j].Cells[xindaoIndex + 2].Text.ToString();
                if (cover == "&nbsp;")
                {
                    cover = "";
                }
                if (Describe == "&nbsp;")
                {
                    Describe = "";
                }
                //video表增加
                sql = "insert into video (tid,title,cover,Describe,CreateDate,Sort,State,Definition,Advertisement)" +
                      "values(" + "'" + GridView1.Rows[j].Cells[2].Text.ToString() + "',"
                      + "'" + GridView1.Rows[j].Cells[0].Text.ToString() + "',"
                      + "'" + cover + "',"
                      + "'" + Describe + "',"                                                 //描述默认为信道1的原标题
                      + "'" + dt.ToString() + "',"
                      + "'" + GridView1.Rows[j].Cells[xindaoIndex + 1].Text.ToString() + "'," //优先级默认为信道1的优先级
                      + "'" + GridView1.Rows[j].Cells[xindaoIndex + 4].Text.ToString() + "'," //状态默认为信道1的状态
                      + "'',"                                                                 //清晰度在video表中默认为空
                      + "'')";                                                                //是否存在广告在video表中默认为空
                int Vnum = SqlFunction.Sql_UpdatePL(sql);
                if (Vnum > 0)
                {
                    //Alert("成功添加"+Vnum+"条数据",Page);
                }
                else
                {
                    Layer(@"layer.alert('给Video表添加数据失败,已停止', {
                              icon: 5,title: false,
                              shadeClose: true,skin: 'layer-ext-moon'  
                            })", Page);
                    return;
                }
                //获取VideoId添加信道
                string sql_id = "select id from Video where title='" + GridView1.Rows[j].Cells[0].Text.ToString() + "'";
                string vid    = SqlFunction.Sql_ReturnNumberES(sql_id);


                //videourl表增加
                List <bool> bl = new List <bool>();
                bl.Add(false);
                bl.Add(false);
                bl.Add(false);
                if (GridView1.Rows[j].Cells[17].Text != "" && GridView1.Rows[j].Cells[17].Text != "&nbsp;")
                {
                    bl[2] = true;//有信道1
                }
                if (GridView1.Rows[j].Cells[10].Text != "" && GridView1.Rows[j].Cells[10].Text != "&nbsp;")
                {
                    bl[1] = true;//有信道2
                }
                if (GridView1.Rows[j].Cells[3].Text != "" && GridView1.Rows[j].Cells[3].Text != "&nbsp;")
                {
                    bl[0] = true;//有信道3
                }
                for (int i = 0; i < 3; i++)
                {
                    if (bl[i])
                    {
                        int uindex = 0;
                        switch (i)
                        {
                        case 0: sort = "999"; uindex = 3; break;

                        case 1: sort = "99"; uindex = 10; break;

                        case 2: sort = "9"; uindex = 17; break;
                        }
                        string Definition = "", Advertisement = "";
                        Definition    = GridView1.Rows[j].Cells[uindex + 5].Text.ToString();
                        Advertisement = GridView1.Rows[j].Cells[uindex + 6].Text.ToString();

                        if (Definition == "&nbsp;")
                        {
                            Definition = "";
                        }
                        if (Advertisement == "&nbsp;")
                        {
                            Advertisement = "";
                        }
                        DateTime dtU = DateTime.Now;
                        if (GridView1.Rows[j].Cells[uindex].Text.ToString() == "youku")
                        {
                            sql = "insert into videoUrl (Vid,Source,Path,State,Sort,CreateDate,Definition,Advertisement,Describe)values("
                                  + "'" + vid + "',"
                                  + "'" + GridView1.Rows[j].Cells[uindex].Text.ToString() + "',"
                                  + "'" + GridView1.Rows[j].Cells[uindex + 3].Text.ToString() + "',"
                                  + "'" + GridView1.Rows[j].Cells[uindex + 4].Text.ToString() + "',"
                                  + "'" + GridView1.Rows[j].Cells[uindex + 1].Text.ToString() + "',"
                                  + "'" + dtU.ToString() + "',"
                                  + "'" + Definition + "',"
                                  + "'" + Advertisement + "',"
                                  + "'" + GridView1.Rows[j].Cells[uindex + 2].Text.ToString() + "')";
                        }
                        else
                        {
                            string temppath = GridView1.Rows[i].Cells[uindex + 3].Text.ToString();
                            temppath = AES.Encrypt(temppath);
                            sql      = "insert into videoUrl (Vid,Source,TempPath,State,Sort,CreateDate,Definition,Advertisement,Describe)values("
                                       + "'" + vid + "',"
                                       + "'" + GridView1.Rows[j].Cells[uindex].Text.ToString() + "',"
                                       + "'" + temppath + "',"
                                       + "'" + GridView1.Rows[j].Cells[uindex + 4].Text.ToString() + "',"
                                       + "'" + GridView1.Rows[j].Cells[uindex + 1].Text.ToString() + "',"
                                       + "'" + dtU.ToString() + "',"
                                       + "'" + Definition + "',"
                                       + "'" + Advertisement + "',"
                                       + "'" + GridView1.Rows[j].Cells[uindex + 2].Text.ToString() + "')";
                        }
                        int Unum = SqlFunction.Sql_UpdatePL(sql);
                        if (Unum > 0)
                        {
                            isok = true;
                            sourcenum++;
                        }
                    }
                }
                if (isok)
                {
                    try {
                        if (SqlFunction.Sql_ReturnNumberENQ("update videoType set state=1 where id=" + GridView1.Rows[1].Cells[2].Text.ToString()) > 0)
                        {
                            //sourcenum++;
                        }
                    } catch (Exception e) {
                        state0source++;
                        error = e.Message;
                        state0index[index] = j.ToString(); index++;
                    }
                }
                else
                {
                    Label1.Text = "添加中出现问题:Vnum=" + Vnum;
                    Layer(string.Format(@"layer.alert('{0}', {{
                              icon: 5,title: false,
                              shadeClose: true,skin: 'layer-ext-moon'  
                            }})", Label1.Text), Page);
                }
            }
            string clientIP = HttpContext.Current.Request.UserHostAddress;

            u = (user)Session["Adminu"];
            if (sourcenum > 0)
            {
                Buckup.Buckup_Add("添加视频", u.name, clientIP, count);
                Label1.Text = "添加成功," + sourcenum + "条信道" + count + "行数据";
                Layer(string.Format(@"layer.alert('{0}', {{
                              icon: 6,title: false,
                              shadeClose: true,skin: 'layer-ext-moon'  
                            }})", Label1.Text), Page);
            }
            else
            {
                if (state0source == 0)
                {
                    Layer(string.Format(@"layer.alert('{0}', {{
                              icon: 5,title: false,
                              shadeClose: true,skin: 'layer-ext-moon'  
                            }})", "全部行添加失败"), Page);
                }
                else
                {
                    Buckup.Buckup_Add("添加视频", u.name, clientIP, count);
                    string errorinfo = "";
                    for (int m = 0; m < state0index.Length; m++)
                    {
                        if (state0index[m] != null && state0index[m] != "")
                        {
                            errorinfo += state0index[m] + ",";
                        }
                    }
                    errorinfo   = errorinfo.Substring(0, errorinfo.Length - 1);
                    Label1.Text = ("添加成功," + count +
                                   "行数据,但是当前类型是状态为0,请修改为1就可以显示,发生在第" + errorinfo + "条信道" +
                                   error).Replace("'", "〞");
                    Layer(string.Format(@"layer.alert('{0}', {{
                              icon: 6,title: false,
                              shadeClose: true,skin: 'layer-ext-moon'  
                            }})", Label1.Text), Page);
                }
            }
        }