protected void Page_Load(object sender, EventArgs e)
 {
     //Show GroupContact:
     try
     {
         DataSet dsonline = new SupportOnlineSystem().OnlineAdminSelectAll();
         if (dsonline.Tables.Count > 0)
         {
             int num = dsonline.Tables[0].Rows.Count;
             if (num > 0)
             {
                 stronline  = "<table border='1' cellpadding='2' cellspacing='0' bordercolor='#DFDFDF' style='border-collapse:collapse;'>";
                 stronline += "<tr class='tlist'><td width='30'>STT</td><td width='60'>Hỗ trợ</td><td width='40'>Mã nhóm</td><td width='120'>Nhóm trực tuyến</td><td width='120'>Tên thành viên</td><td width='120'>Nick name</td><td width='120'>Tiêu đề</td><td width='60'>Xóa bỏ</td></tr>";
                 for (int i = 1; i <= num; i++)
                 {
                     string id         = dsonline.Tables[0].Rows[i - 1]["id"].ToString();
                     string strsupport = "Máy tính";
                     if (dsonline.Tables[0].Rows[i - 1]["typeid"].Equals(2))
                     {
                         strsupport = "Điện thoại";
                     }
                     stronline += "<tr><td align='center'>" + i.ToString() + "</td><td align='center'>" + strsupport + "</td><td align='center'>" + dsonline.Tables[0].Rows[i - 1]["idgroup"].ToString() + "</td><td>" + dsonline.Tables[0].Rows[i - 1]["namegroup"].ToString() + "</td><td class='title1'><a href='?menu=onlinesupportedit&id=" + id + "'>" + dsonline.Tables[0].Rows[i - 1]["name"].ToString() + "</a></td><td align='center'>" + dsonline.Tables[0].Rows[i - 1]["nickname"].ToString() + "</td><td align='center'>" + dsonline.Tables[0].Rows[i - 1]["title"].ToString() + "</td><td align='center'><span class='spanbt' onclick='Dfunction(" + id + ",4);'>Xóa</span></td></tr>";
                 }
                 stronline += "</table>";
             }
             else
             {
                 stronline = "Chưa có hỗ trợ trực tuyến nào.";
             }
         }
     }
     catch
     {
     }
 }
Exemple #2
0
    public string SupportOnline()
    {
        string strOnline  = "";
        string strOnline2 = "";

        try
        {
            if (Application["appOnline"] == null)
            {
                DataSet dsOnline  = new SupportOnlineSystem().OnlineSelectAll();
                int     numOnline = dsOnline.Tables[0].Rows.Count;
                if (numOnline > 0)
                {
                    strOnline = "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
                    string idgroup1 = dsOnline.Tables[0].Rows[0]["idgroup"].ToString();
                    strOnline += "<tr><td class='text_b2'>" + dsOnline.Tables[0].Rows[0]["namegroup"].ToString() + "</td></tr>";
                    for (int i = 0; i < numOnline; i++)
                    {
                        if (idgroup1 != dsOnline.Tables[0].Rows[i]["idgroup"].ToString())
                        {
                            strOnline += "<tr><td class='text_b2'>" + dsOnline.Tables[0].Rows[i]["namegroup"].ToString() + "</td></tr>";
                            idgroup1   = dsOnline.Tables[0].Rows[i]["idgroup"].ToString();
                        }
                        string name = dsOnline.Tables[0].Rows[i]["name"].ToString();
                        if (dsOnline.Tables[0].Rows[i]["title"].ToString().Length > 0)
                        {
                            name = "<br /><span class='text_5'>" + dsOnline.Tables[0].Rows[i]["title"].ToString() + ":</span> " + name;
                        }
                        strOnline += "<tr height='26'><td class='text_title' align='left'>";
                        strOnline += "&nbsp;&nbsp;<a href ='ymsgr:sendim?" + dsOnline.Tables[0].Rows[i]["nickname"].ToString() + "'><img src='http://opi.yahoo.com/online?u=" + dsOnline.Tables[0].Rows[i]["nickname"].ToString() + "&m=g&t=1' border='0' style='vertical-align:middle'/></a> " + name + "</td></tr>";
                        if (i < numOnline - 1 && idgroup1 == dsOnline.Tables[0].Rows[i + 1]["idgroup"].ToString())
                        {
                            strOnline += "<tr><td class='bg_line2'></td></tr>";
                        }
                        else if (i == numOnline - 1)
                        {
                            strOnline += "<tr><td height='2'></td></tr>";
                        }
                        strOnline2 += "<a href ='ymsgr:sendim?" + dsOnline.Tables[0].Rows[i]["nickname"].ToString() + "' title='" + dsOnline.Tables[0].Rows[i]["namegroup"].ToString() + "'><img src='http://opi.yahoo.com/online?u=" + dsOnline.Tables[0].Rows[i]["nickname"].ToString() + "&m=g&t=1' border='0' class='space'/></a><br />";
                        ;
                    }
                    strOnline += "</table>";
                    Application["appOnline"]  = strOnline;
                    Application["appOnline2"] = strOnline2;
                }
            }
            else
            {
                strOnline = Application["appOnline"].ToString();
            }
        }
        catch
        { }
        return(strOnline);
    }
 protected void btadd_ServerClick(object sender, EventArgs e)
 {
     try
     {
         int    idgroup  = int.Parse(slgroup.Value);
         string group    = txtgroup.Value.Trim();
         string name     = txtname.Value.Trim();
         string nickname = txtnickname.Value.Trim();
         string title    = txttitle.Value.Trim();
         int    sort     = int.Parse(slsort.Value);
         int    type     = int.Parse(SlType.Text.ToString());
         if (group.Length == 0)
         {
             diverror.Visible   = true;
             diverror.InnerHtml = "<div class='diverror'>Xin hãy nhập nhóm hỗ trợ</div>";
             return;
         }
         else if (name.Length == 0)
         {
             diverror.Visible   = true;
             diverror.InnerHtml = "<div class='diverror'>Xin hãy nhập tên nhân viên</div>";
             return;
         }
         else if (nickname.Length == 0)
         {
             diverror.Visible   = true;
             diverror.InnerHtml = "<div class='diverror'>Xin hãy nhập Nick Name</div>";
             return;
         }
         SupportOnlineSystem SupportOnline = new SupportOnlineSystem();
         if (SupportOnline.OnlineInsert(name, nickname, title, idgroup, group, sort, type))
         {
             diverror.Visible   = true;
             diverror.InnerHtml = "<div class='diverror'>Hỗ trợ trực tuyến đã được thêm mới</div>";
             ResetAppOnline();
             txtname.Value     = "";
             txtnickname.Value = "";
             txttitle.Value    = "";
             return;
         }
         else
         {
             diverror.Visible   = true;
             diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL, không thể thêm mới</div>";
             return;
         }
     }
     catch
     {
         diverror.Visible   = true;
         diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL, không thể thêm mới</div>";
         return;
     }
 }
    public string SupportOnline()
    {
        string strOnline = "";

        try
        {
            Application["appOnline"] = null;
            if (Application["appOnline"] == null)
            {
                DataSet dsOnline  = new SupportOnlineSystem().OnlineSelectAll("1");
                int     numOnline = dsOnline.Tables[0].Rows.Count;
                if (numOnline > 0)
                {
                    strOnline = "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
                    string idgroup1 = dsOnline.Tables[0].Rows[0]["idgroup"].ToString();
                    strOnline += "<tr><td class='blol' title='Xin mời quý khách Click vào đây.' onclick='OnMOverDOnline(" + idgroup1 + ");'>" + dsOnline.Tables[0].Rows[0]["namegroup"].ToString() + "</td></tr>";
                    strOnline += "<tr><td align='left'>";
                    strOnline += "<div class='donline' id='donline" + idgroup1 + "' style='display:none;'>";
                    for (int i = 0; i < numOnline; i++)
                    {
                        if (idgroup1 != dsOnline.Tables[0].Rows[i]["idgroup"].ToString())
                        {
                            strOnline += "</div></td></tr>";
                            idgroup1   = dsOnline.Tables[0].Rows[i]["idgroup"].ToString();
                            strOnline += "<tr><td class='blol' title='Xin mời quý khách Click vào đây.' onclick='OnMOverDOnline(" + idgroup1 + ");'>" + dsOnline.Tables[0].Rows[i]["namegroup"].ToString() + "</td></tr>";
                            strOnline += "<tr><td align='left'>";
                            strOnline += "<div class='donline' id='donline" + idgroup1 + "' style='display:none;'>";
                        }
                        string name = dsOnline.Tables[0].Rows[i]["name"].ToString();
                        strOnline += "<a href ='ymsgr:sendim?" + dsOnline.Tables[0].Rows[i]["nickname"].ToString() + "'><img src='http://opi.yahoo.com/online?u=" + dsOnline.Tables[0].Rows[i]["nickname"].ToString() + "' border='0' style='vertical-align:middle;'/> " + name + "</a>";
                        if (i < numOnline - 1 && idgroup1 == dsOnline.Tables[0].Rows[i + 1]["idgroup"].ToString())
                        {
                            strOnline += "<div class='bg_line2' style='height:5px;'></div>";
                        }
                        else if (i == numOnline - 1)
                        {
                            strOnline += "</div></td></tr>";
                        }
                    }
                    strOnline += "</table>";
                    //Application["appOnline"] = strOnline;
                }
            }
            else
            {
                strOnline = Application["appOnline"].ToString();
            }
        }
        catch
        { }
        return(strOnline);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string menu      = Request.QueryString["menu"].ToString();
            string strmobile = "";
            switch (menu)
            {
            case ("imgpro"):
            {
                try
                {
                    string id      = Request.QueryString["id"].ToString();
                    string name    = Request.QueryString["name"].ToString();
                    string namepro = Request.QueryString["namepro"].ToString();
                    string subName = "";
                    int    leng    = namepro.Length;
                    for (int i = 0; i < leng; i++)
                    {
                        if (namepro[i].Equals('('))
                        {
                            break;
                        }
                        if (!namepro[i].Equals(','))
                        {
                            subName += namepro[i];
                        }
                    }
                    subName = subName.Trim();
                    Session["SSIdProUpload"] = id + "," + name + "," + subName;
                }
                catch
                {
                }
                Response.Write("ok");
                break;
            }

            case ("bestsell"):
            {
                string strreturn = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    ProductBestSellSystem products = new ProductBestSellSystem();
                    Boolean test = products.ProductBestUpdate(int.Parse(id), int.Parse(type));
                    if (!test)
                    {
                        strreturn = "err";
                    }
                    else
                    {
                        //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll();
                        //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table];
                    }
                }
                catch
                {
                    strreturn = "err";
                }
                Response.Write(strreturn);
            }
            break;

            case ("justhave"):
            {
                string strreturn = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    ProductBestSellSystem products = new ProductBestSellSystem();
                    Boolean test = products.ProductJustHaveUpdate(int.Parse(id), int.Parse(type));
                    if (!test)
                    {
                        strreturn = "err";
                    }
                    else
                    {
                        //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll();
                        //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table];
                    }
                }
                catch
                {
                    strreturn = "err";
                }
                Response.Write(strreturn);
            }
            break;

            //prepare out:
            case ("prepareout"):
            {
                string PrepareStr = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    ProductBestSellSystem products = new ProductBestSellSystem();
                    Boolean test = products.ProductPrepareoutUpdate(int.Parse(id), int.Parse(type));
                    if (!test)
                    {
                        PrepareStr = "err";
                    }
                    else
                    {
                        //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll();
                        //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table];
                    }
                }
                catch
                {
                    PrepareStr = "err";
                }
                Response.Write(PrepareStr);
            }
            break;

            //proselloff:
            case ("proselloff"):
            {
                string strselloff = "";
                try
                {
                    string type  = Request.QueryString["type"].ToString();
                    string id    = Request.QueryString["id"].ToString();
                    float  price = float.Parse(Request.QueryString["price"].ToString());
                    ProductBestSellSystem products = new ProductBestSellSystem();
                    Boolean test = products.ProductSelloffUpdate(int.Parse(id), int.Parse(type), price);
                    if (!test)
                    {
                        strselloff = "err";
                    }
                    else
                    {
                        //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll();
                        //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table];
                    }
                }
                catch
                {
                    strselloff = "err";
                }
                Response.Write(strselloff);
            }
            break;

            case ("mainpage"):
                string strmain = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    string sort = Request.QueryString["sort"].ToString();
                    ProductMainPageSystem products = new ProductMainPageSystem();
                    Boolean test = products.ProductMainpageUpdate(int.Parse(id), int.Parse(type), int.Parse(sort));
                    if (!test)
                    {
                        strmain = "err";
                    }
                }
                catch
                {
                    strmain = "err";
                }
                Response.Write(strmain);
                break;

            case ("original"):
                string stroriginal = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    string sort = Request.QueryString["sort"].ToString();
                    ProductMainPageSystem products = new ProductMainPageSystem();
                    Boolean test = products.ProductOriginalUpdate(int.Parse(id), int.Parse(type), int.Parse(sort));
                    if (!test)
                    {
                        stroriginal = "err";
                    }
                }
                catch
                {
                    strmain = "err";
                }
                Response.Write(stroriginal);
                break;

            case ("dgroup"):
                string strdelete = "";
                try
                {
                    string id = Request.QueryString["id"].ToString();
                    ArticleManagerSystem Articles = new ArticleManagerSystem();

                    if (Articles.AdminGroupDeleteId(id))
                    {
                        strdelete = "1";
                    }
                    else
                    {
                        strdelete = "0";
                    }
                }catch
                {
                    strdelete = "0";
                }
                Response.Write(strdelete);
                break;

            case ("dgcontact"):
                string strdcontact = "";
                try
                {
                    string         id       = Request.QueryString["id"].ToString();
                    ContacstSystem Contacts = new ContacstSystem();

                    if (Contacts.GroupContactDeleteId(id))
                    {
                        strdcontact = "1";
                    }
                    else
                    {
                        strdcontact = "0";
                    }
                }
                catch
                {
                    strdcontact = "0";
                }
                Response.Write(strdcontact);
                break;

            case ("dglocation"):
                string strdlocation = "";
                try
                {
                    string         id       = Request.QueryString["id"].ToString();
                    ContacstSystem Contacts = new ContacstSystem();

                    if (Contacts.LocationContactDelete(id))
                    {
                        strdlocation = "1";
                    }
                    else
                    {
                        strdlocation = "0";
                    }
                }
                catch
                {
                    strdlocation = "0";
                }
                Response.Write(strdlocation);
                break;

            case ("dhelp"):
                string strdhelp = "0";
                try
                {
                    string      id    = Request.QueryString["id"].ToString();
                    HelpsSystem helps = new HelpsSystem();

                    if (helps.HelpsDelete(id))
                    {
                        strdhelp = "1";
                    }
                }
                catch
                {
                    strdhelp = "0";
                }
                Response.Write(strdhelp);
                break;

            case ("donline"):
                string stronline = "0";
                try
                {
                    string id = Request.QueryString["id"].ToString();
                    SupportOnlineSystem Support = new SupportOnlineSystem();
                    if (Support.OnlineDelete(id))
                    {
                        stronline = "1";
                        Application["appOnline"] = null;
                    }
                }
                catch
                {
                    stronline = "0";
                }
                Response.Write(stronline);
                break;

            case ("dadvertise"):
                string strdadvertise = "0";
                try
                {
                    string          id        = Request.QueryString["id"].ToString();
                    AdvertiseSystem advertise = new AdvertiseSystem();
                    DataSet         ds        = advertise.AdvertiseSelectId(id);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string url1 = ds.Tables[0].Rows[0]["urlimage"].ToString();
                        string path = Server.MapPath("../image/advertise/");
                        CvalidateImageForPost manageImage = new CvalidateImageForPost();
                        if (url1.Length > 0)
                        {
                            manageImage.DeleteFile(path + url1);
                        }
                    }
                    if (advertise.AdvertiseDelete(id))
                    {
                        strdadvertise = "1";
                        Application["appAdvertiset"] = null;
                    }
                }
                catch
                {
                    strdadvertise = "0";
                }
                Response.Write(strdadvertise);
                break;

            case ("dadvertisespecial"):
                string strspecial = "0";
                try
                {
                    string          id        = Request.QueryString["id"].ToString();
                    AdvertiseSystem advertise = new AdvertiseSystem();
                    DataSet         ds        = advertise.SpecialSelectId(int.Parse(id));
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string url1 = ds.Tables[0].Rows[0]["urlimage1"].ToString();
                        string url2 = ds.Tables[0].Rows[0]["urlimage2"].ToString();
                        string path = Server.MapPath("../image/advertise/");
                        CvalidateImageForPost manageImage = new CvalidateImageForPost();
                        if (url1.Length > 0)
                        {
                            manageImage.DeleteFile(path + url1);
                        }
                        if (url2.Length > 0)
                        {
                            manageImage.DeleteFile(path + url2);
                        }
                    }
                    if (advertise.SpecialDelete(id))
                    {
                        strspecial = "1";
                    }
                }
                catch
                {
                    strspecial = "0";
                }
                Response.Write(strspecial);
                break;

            case "darticle":
                string strdarticle = "0";
                try
                {
                    string id = Request.QueryString["id"].ToString();
                    ArticleManagerSystem article = new ArticleManagerSystem();
                    DataSet ds = article.ArticleSelectDetail(int.Parse(id));
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string url1 = ds.Tables[0].Rows[0]["urlimage"].ToString();
                        string path = Server.MapPath("../image/img_article/");
                        CvalidateImageForPost manageImage = new CvalidateImageForPost();
                        if (url1.Length > 0)
                        {
                            manageImage.DeleteFile(path + url1);
                        }
                    }
                    if (article.AdminArticleDelete(id))
                    {
                        strdarticle = "1";
                    }
                }
                catch
                {
                    strdarticle = "0";
                }
                Response.Write(strdarticle);
                break;

            //for mobile:
            case "mobile1":
                try
                {
                    string       type   = Request.QueryString["type"].ToString();
                    string       id     = Request.QueryString["id"].ToString();
                    string       sort   = Request.QueryString["sort"].ToString();
                    string       insert = Request.QueryString["insert"].ToString();
                    Mobilesystem Mobile = new Mobilesystem();
                    Boolean      test   = Mobile.MobileUpdate(int.Parse(id), int.Parse(insert), int.Parse(type), int.Parse(sort));
                    if (!test)
                    {
                        strmobile = "err";
                    }
                }
                catch
                {
                    strmobile = "err";
                }
                Response.Write(strmobile);
                break;
            }
        }
        catch
        {
        }
    }