Esempio n. 1
0
    public void SetStatus_notok(string id)
    {
        DataRow dr = this.GetInfo(id);

        if (dr == null)
        {
            return;
        }
        int status = 0;

        if (Convert.ToInt32(dr["status"]) == 4)
        {
            status = 3;//Bientap
        }
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " status = ?status ";
        Sql += " WHERE id = ?id ";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "status", DbType.Int32, status);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 2
0
    public void Setthucdon(string id)
    {
        DataRow dr = this.GetInfo(id);

        if (dr == null)
        {
            return;
        }
        int thucdon = 0;

        if (Convert.ToInt32(dr["thucdon"]) == 0)
        {
            thucdon = 1;
        }
        else
        {
            thucdon = 0;
        }
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " thucdon = ?thucdon ";
        Sql += " WHERE id = ?id ";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "thucdon", DbType.Int32, thucdon);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 3
0
    public void SetAnh(string id)
    {
        DataRow dr = this.GetInfo(id);

        if (dr == null)
        {
            return;
        }
        int status = 0;

        if (Convert.ToInt32(dr["anh"]) == 0)
        {
            status = 1;
        }
        else
        {
            status = 0;
        }
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " anh = ?anh ";
        Sql += " WHERE id = ?id ";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "anh", DbType.Int32, status);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 4
0
    public void AddTopartner(string id, string groupid)
    {
        try
        {
            DbTask db  = new DbTask();
            string Sql = string.Empty;
            Sql = "UPDATE " + TableName + " SET idx = idx + 1";
            db.ExecuteNonQuery(Sql);

            DateTime sStartDate = DateTime.Now;
            DateTime dt         = DateTime.Now;
            int      nYear      = dt.Year + 1;
            dt = new DateTime(nYear, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second);

            Sql  = "INSERT INTO " + TableName + "(groupid, id, startdate, enddate, idx) ";
            Sql += " VALUES(?groupid, ?id, ?startdate, ?enddate, ?idx)";
            DataTable datatable = null;
            db.AddParameters(ref datatable, "groupid", DbType.NVarChar, groupid);
            db.AddParameters(ref datatable, "id", DbType.NVarChar, id);
            db.AddParameters(ref datatable, "startdate", DbType.Datetime, sStartDate);
            db.AddParameters(ref datatable, "enddate", DbType.Datetime, dt);
            db.AddParameters(ref datatable, "idx", DbType.Int32, 1);

            db.ExecuteNonQuery(Sql, datatable);
        }
        catch (Exception ae)
        {
            string error = ae.ToString();
        }
    }
Esempio n. 5
0
    public void Update(string id, string title, string linkurl, string summary, string filename, string sWidth, string sHeight)
    {
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " title = ?title,  ";
        Sql += " linkurl = ?linkurl,  ";
        Sql += " summary = ?summary,  ";
        Sql += " created = ?created,  ";
        Sql += " filename = ?filename, ";
        Sql += " fwidth = ?fwidth, ";
        Sql += " fHeight = ?fheight, ";
        Sql += " userid = ?userid ";
        Sql += " WHERE id=?id";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "summary", DbType.NVarChar, summary);
        db.AddParameters(ref dt, "fwidth", DbType.NVarChar, sWidth);
        db.AddParameters(ref dt, "fheight", DbType.NVarChar, sHeight);
        db.AddParameters(ref dt, "linkurl", DbType.NVarChar, linkurl);
        db.AddParameters(ref dt, "created", DbType.Datetime, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        db.AddParameters(ref dt, "filename", DbType.NVarChar, filename);
        db.AddParameters(ref dt, "userid", DbType.NVarChar, Membertask.Name);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 6
0
    public void Update(string id, string title, string groupid, string summary, string content, string fimage, string sTitleMeta, string KeywordMeta, string DescriptionMeta, string sShortLink)
    {
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " title = ?title,  ";
        Sql += " groupid = ?groupid,  ";
        Sql += " summary = ?summary,  ";
        Sql += " fimage = ?fimage,  ";
        Sql += " titlemeta = ?titlemeta, ";
        Sql += " Description = ?Description, ";
        Sql += " keywords = ?keywords, ";
        Sql += " shortlink = ?shortlink "; // sử dung linkurl thay cho trường sokyhieu để đỡ đổi db
        Sql += " WHERE id=?id";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "summary", DbType.NVarChar, summary);
        db.AddParameters(ref dt, "groupid", DbType.NVarChar, groupid);
        db.AddParameters(ref dt, "fimage", DbType.NVarChar, fimage);
        db.AddParameters(ref dt, "titlemeta", DbType.NVarChar, sTitleMeta);
        db.AddParameters(ref dt, "Description", DbType.NVarChar, DescriptionMeta);
        db.AddParameters(ref dt, "shortlink", DbType.NVarChar, sShortLink);
        db.AddParameters(ref dt, "keywords", DbType.NVarChar, KeywordMeta);
        db.ExecuteNonQuery(Sql, dt);
        this.WriteContentToHtml(id, content);
    }
Esempio n. 7
0
 public void update_Pass(string id, string password)
 {
     string Sql = "UPDATE " + TableName + " SET ";
     Sql += " password = ?password ";
     Sql += " WHERE id = ?id ";
     DbTask db = new DbTask();
     DataTable dt = null;
     db.AddParameters(ref dt, "id", DbType.NVarChar, id);
     db.AddParameters(ref dt, "password", DbType.NVarChar, password);
     db.ExecuteNonQuery(Sql, dt);
 }
Esempio n. 8
0
 public void ChangePwd(string username, string password)
 {
     string Sql = "UPDATE " + TableName + " SET ";
     Sql += "password = ?password ";
     Sql += "WHERE username=?username";
     DbTask db = new DbTask();
     DataTable dt = null;
     db.AddParameters(ref dt, "username", DbType.NVarChar, username);
     db.AddParameters(ref dt, "password", DbType.NVarChar, password);
     db.ExecuteNonQuery(Sql, dt);
 }
Esempio n. 9
0
    public DataTable GetSanphamlienquan(string id, string idhoivien)
    {
        DbTask    db  = new DbTask();
        DataTable dt  = null;
        string    Sql = "Select title, shortlink, fimage, id from " + TableName + " Where idhoivien = ?idhoivien AND status = 1  AND id <> '" + id + "'";

        db.AddParameters(ref dt, "idhoivien", DbType.NVarChar, idhoivien);
        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        dt = db.GetData(Sql, dt);
        return(dt);
    }
Esempio n. 10
0
    public void Insert(string name, string link, int sott)
    {
        DbTask    db  = new DbTask();
        DataTable dt  = null;
        string    Sql = "INSERT INTO " + TableName + "(name,link,sott) ";

        Sql += " VALUES(?name,?link,?sott)";
        db.AddParameters(ref dt, "name", DbType.NVarChar, name);
        db.AddParameters(ref dt, "link", DbType.NVarChar, link);
        db.AddParameters(ref dt, "sott", DbType.Int32, sott);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 11
0
    public void Insert(string name, string fimage, string width, string height)
    {
        DbTask    db  = new DbTask();
        DataTable dt  = null;
        string    Sql = "INSERT INTO " + TableName + "(name,fimage,width,height) ";

        Sql += " VALUES(?name,?fimage,?width,?height)";
        db.AddParameters(ref dt, "name", DbType.NVarChar, name);
        db.AddParameters(ref dt, "fimage", DbType.NVarChar, fimage);
        db.AddParameters(ref dt, "width", DbType.NVarChar, width);
        db.AddParameters(ref dt, "height", DbType.NVarChar, height);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 12
0
    public void Insert(string stitle, string TenBang)
    {
        string Sql = "INSERT INTO " + TenBang + "(id, title)";

        Sql += " VALUES (?id, ?title)";
        DbTask    db = new DbTask();
        string    id = db.GetNewKey(TenBang, "id", string.Empty);
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, stitle);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 13
0
 public DataRow Login(string username, string password)
 {
     DbTask db = new DbTask();
     DataTable dttemp = null;
     string sql = "select * from " + TableName + " ";
     sql += "Where username = ?usename1 and password = ?password1 ";
     db.AddParameters(ref dttemp, "usename1", DbType.NVarChar, username);
     db.AddParameters(ref dttemp, "password1", DbType.NVarChar, password);
     DataTable dt = db.GetData(sql, dttemp);
     if (dt == null || dt.Rows.Count == 0)
         return null;
     return dt.Rows[0];
 }
Esempio n. 14
0
    public void Update(string id, string title)
    {
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " title = ?title  ";
        Sql += " WHERE id=?id";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 15
0
    public string InsertHoiVien(string groupid, string title, string summary, string created, int status, string logo, string capbac, string content)
    {
        string Sql = string.Empty;

        Sql += " INSERT INTO " + TableHoiVien + "(groupid, title, summary, created, status, logo, capbac, Content)";
        Sql += " VALUES(?groupid, ?title, ?summary, ?created, ?status, ?logo, ?capbac, ?Content )";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "groupid", DbType.NVarChar, groupid);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "summary", DbType.NVarChar, summary);
        db.AddParameters(ref dt, "created", DbType.NVarChar, created);
        db.AddParameters(ref dt, "status", DbType.Int32, status);
        db.AddParameters(ref dt, "logo", DbType.NVarChar, logo);
        db.AddParameters(ref dt, "Content", DbType.Ntext, content);
        db.AddParameters(ref dt, "capbac", DbType.NVarChar, capbac);
        db.ExecuteNonQuery(Sql, dt);

        Sql = "select * from " + TableHoiVien + " order by created DESC";
        DataTable dtGetID = db.GetData(Sql);

        if (dtGetID == null || dtGetID.Rows.Count == 0)
        {
            return(string.Empty);
        }
        string ID = dtGetID.Rows[0]["id"].ToString();

        //
        return(ID);
    }
Esempio n. 16
0
    public void InsertKeyWord(string title, string link)
    {
        DbTask db  = new DbTask();
        string Sql = "Insert Into " + TableName + " (id,title,link) ";

        Sql += "Values (?id, ?title,?link)";
        string    id = db.GetNewKey(TableName, "id", string.Empty);
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "link", DbType.NVarChar, link);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 17
0
    public void UpDate(string id, string title, string sContent)
    {
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " title = ?title,  ";
        Sql += " footertext = ?footertext  ";
        Sql += " WHERE ?id = id ";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "footertext", DbType.Ntext, sContent);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 18
0
    public void Inser(string title, string sContent, string Created)
    {
        DbTask    db = new DbTask();
        DataTable dt = null;
        // tao Id moi ;
        string id  = db.GetNewKey(TableName, "id", string.Empty);
        string Sql = "INSERT INTO " + TableName + "(id,title,footertext,created) ";

        Sql += " VALUES(?id,?title,?footertext,?created )";
        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "footertext", DbType.Ntext, sContent);
        db.AddParameters(ref dt, "created", DbType.NVarChar, Created);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 19
0
    public void Update(string id, string title, string idx, string TenBang)
    {
        DbTask db  = new DbTask();
        string SQL = "Update " + TenBang + " SET ";

        SQL += "title = ?title,  ";
        SQL += "idx = ?idx ";
        SQL += "Where id = ?id ";
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "idx", DbType.NVarChar, idx);
        db.ExecuteNonQuery(SQL, dt);
    }
Esempio n. 20
0
    public void Insert(string title, string summary, string fimage, string url)
    {
        DbTask db  = new DbTask();
        string Sql = "Insert Into " + TableName + " (title,summary, fimage, Created, url) ";

        Sql += " Values (?title,?summary, ?fimage, ?Created, ?url)";
        DataTable dt = null;

        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "fimage", DbType.NVarChar, fimage);
        db.AddParameters(ref dt, "summary", DbType.NVarChar, summary);
        db.AddParameters(ref dt, "url", DbType.NVarChar, url);
        db.AddParameters(ref dt, "Created", DbType.Datetime, DateTime.Now.ToString());
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 21
0
    public void Update(string vid, string name, string link)
    {
        int    id  = Convert.ToInt32(vid);
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " link = ?link,  ";
        Sql += " name = ?name  ";
        Sql += "WHERE ?id = id ";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.Int32, id);
        db.AddParameters(ref dt, "name", DbType.NVarChar, name);
        db.AddParameters(ref dt, "link", DbType.NVarChar, link);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 22
0
    public void Insert(string title, string groupid, string parentid)
    {
        string parent = (parentid == null || parentid == string.Empty || parentid == "") ? "00" : parentid;
        string Sql    = "INSERT INTO " + TableName + "(id, title, status, groupid, parentid) ";

        Sql += " VALUES(?id, ?title, ?status, ?groupid, ?parentid)";
        DbTask    db = new DbTask();
        string    id = db.GetNewKey(TableName, "id", string.Empty);
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "status", DbType.Int32, 1);
        db.AddParameters(ref dt, "parentid", DbType.NVarChar, parent);
        db.AddParameters(ref dt, "groupid", DbType.NVarChar, groupid);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 23
0
 public void UpdateSTT(string id, int ncount)
 {
     try
     {
         string Sql = "UPDATE " + TableName + " SET ";
         Sql += " idx = ?idx  ";
         Sql += "WHERE id = '" + id + "' ";
         DbTask    db = new DbTask();
         DataTable dt = null;
         db.AddParameters(ref dt, "idx", DbType.Int32, ncount);
         db.AddParameters(ref dt, "id", DbType.NVarChar, id);
         db.ExecuteNonQuery(Sql, dt);
     }
     catch (Exception ae)
     {
         string error = ae.ToString();
     }
 }
Esempio n. 24
0
    public void Inceatncount(string id)
    {
        DbTask    db  = new DbTask();
        DataTable dt  = null;
        string    SQL = "Update " + TableName + " SET ncount = ncount + 1 Where id = ?id ";

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.ExecuteNonQuery(SQL, dt);
        HttpContext.Current.Session["view_" + id] = id;
    }
Esempio n. 25
0
 public void Insert(string username, string password, string fullname, string tel, string email, string address, string jobtitle)
 {
     string Sql = "INSERT INTO " + TableName + "(id,username,password,fullname,tel,email,address,jobtitle,IsAdmin,status)";
     Sql += " VALUES(?id, ?username, ?password, ?fullname, ?tel, ?email, ?address, ?jobtitle,?IsAdmin, ?status)";
     DbTask db = new DbTask();
     string id = db.GetNewKey(TableName, "id", string.Empty);
     DataTable dt = null;
     db.AddParameters(ref dt, "id", DbType.NVarChar, id);
     db.AddParameters(ref dt, "username", DbType.NVarChar, username);
     db.AddParameters(ref dt, "password", DbType.NVarChar, password);
     db.AddParameters(ref dt, "fullname", DbType.NVarChar, fullname);
     db.AddParameters(ref dt, "tel", DbType.NVarChar, tel);
     db.AddParameters(ref dt, "email", DbType.NVarChar, email);
     db.AddParameters(ref dt, "address", DbType.NVarChar, address);
     db.AddParameters(ref dt, "jobtitle", DbType.NVarChar, jobtitle);
     db.AddParameters(ref dt, "IsAdmin", DbType.Int32, 0);
     db.AddParameters(ref dt, "status", DbType.Int32, 0);
     db.ExecuteNonQuery(Sql, dt);
 }
Esempio n. 26
0
    public void UpdateVideo(string id, string title, string filename, string summary, string filenameimg)
    {
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " title = ?title,  ";
        Sql += " filename = ?filename,  ";
        Sql += " summary = ?summary, ";
        Sql += " filenameimg = ?filenameimg ";
        Sql += " WHERE id = ?id";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.NVarChar, id);
        db.AddParameters(ref dt, "title", DbType.NVarChar, title);
        db.AddParameters(ref dt, "filename", DbType.NVarChar, filename);
        db.AddParameters(ref dt, "summary", DbType.NVarChar, summary);
        db.AddParameters(ref dt, "filenameimg", DbType.NVarChar, filenameimg);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 27
0
 public void insertDatalog(string LogId, string Ngaythang, int TrangthaiID, string GhiChu)
 {
     try
     {
         DbTask    db  = new DbTask();
         DataTable dt  = null;
         string    Sql = "INSERT INTO " + TableName + "(LogId,userId,Ngaythang,TrangthaiID,GhiChu)";
         Sql += " VALUES (?LogId, ?userId, ?Ngaythang, ?TrangthaiID, ?GhiChu)";
         db.AddParameters(ref dt, "LogId", DbType.NVarChar, LogId);
         db.AddParameters(ref dt, "userId", DbType.NVarChar, Membertask.Name);
         db.AddParameters(ref dt, "Ngaythang", DbType.Datetime, Ngaythang);
         db.AddParameters(ref dt, "TrangthaiID", DbType.Int32, TrangthaiID);
         db.AddParameters(ref dt, "GhiChu", DbType.NVarChar, GhiChu);
         db.ExecuteNonQuery(Sql, dt);
     }
     catch (Exception e)
     {
         string messasge = e.Message;
     }
 }
Esempio n. 28
0
    public void Update(string vid, string name, string fimage, string width, string height)
    {
        int    id  = Convert.ToInt32(vid);
        string Sql = "UPDATE " + TableName + " SET ";

        Sql += " name = ?name,  ";
        Sql += " fimage = ?fimage,  ";
        Sql += " width = ?width,  ";
        Sql += " height = ?height  ";
        Sql += "WHERE ?id = id ";
        DbTask    db = new DbTask();
        DataTable dt = null;

        db.AddParameters(ref dt, "id", DbType.Int32, id);
        db.AddParameters(ref dt, "name", DbType.NVarChar, name);
        db.AddParameters(ref dt, "fimage", DbType.NVarChar, fimage);
        db.AddParameters(ref dt, "width", DbType.NVarChar, width);
        db.AddParameters(ref dt, "height", DbType.NVarChar, height);
        db.ExecuteNonQuery(Sql, dt);
    }
Esempio n. 29
0
 public void Update(string id, DateTime startdate, DateTime enddate, int idx)
 {
     try
     {
         string Sql = "UPDATE " + _TableName + " SET ";
         Sql += " idx = ?idx,  ";
         Sql += " startdate = ?startdate,  ";
         Sql += " enddate = ?enddate  ";
         Sql += "WHERE groupid = '" + _GroupID + "' ";
         Sql += "AND id = '" + id + "' ";
         Sql += "AND col = '" + _Col + "' ";
         DbTask    db = new DbTask();
         DataTable dt = null;
         db.AddParameters(ref dt, "groupid", DbType.NVarChar, _GroupID);
         db.AddParameters(ref dt, "id", DbType.NVarChar, id);
         db.AddParameters(ref dt, "col", DbType.NVarChar, _Col);
         db.AddParameters(ref dt, "startdate", DbType.Datetime, startdate);
         db.AddParameters(ref dt, "enddate", DbType.Datetime, enddate);
         db.AddParameters(ref dt, "idx", DbType.Int32, idx);
         db.ExecuteNonQuery(Sql, dt);
     }
     catch (Exception ae)
     {
         string error = ae.ToString();
     }
 }
Esempio n. 30
0
    public DataRow GetInfoAllByShortLink(string shortlink)
    {
        DbTask    db  = new DbTask();
        DataTable dt  = null;
        string    Sql = "Select * from " + TableName + " Where shortlink = ?shortlink AND status = 1 ";

        db.AddParameters(ref dt, "shortlink", DbType.NVarChar, shortlink);

        dt = db.GetData(Sql, dt);
        if (dt.Rows.Count > 0)
        {
            return(dt.Rows[0]);
        }
        else
        {
            return(null);
        }
    }