Exemple #1
0
 protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         Product product        = (Product)e.Row.DataItem;
         Label   lbProductType  = (Label)e.Row.FindControl("lbProductType");
         Label   lbManufacturer = (Label)e.Row.FindControl("lbManufacturer");
         Label   lbName         = (Label)e.Row.FindControl("lbName");
         if (lbProductType != null)
         {
             if (product.ProductType != null)
             {
                 lbProductType.Text = product.ProductType.Name;
             }
         }
         if (lbManufacturer != null)
         {
             if (product.Manufacturer != null)
             {
                 lbManufacturer.Text = product.Manufacturer.Name;
             }
         }
         if (lbName != null)
         {
             lbName.Text    = ToSQL.ShortString(product.Name, 32);
             lbName.ToolTip = product.Name;
         }
         int      Id = ToSQL.SQLToInt(gvProducts.DataKeys[e.Row.RowIndex].Value.ToString());
         DataList dtlImagesProduct = e.Row.FindControl("dtlImagesProduct") as DataList;
         dtlImagesProduct.DataSource = (new ProductImageRepo()).GetAllImagesByProductId(Id);
         dtlImagesProduct.DataBind();
     }
 }
Exemple #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        DataTable dt = getListRSS();
        int       j = 0, co = 0, ko = 0;

        foreach (DataRow row in dt.Rows)
        {
            string url        = BaseView.GetStringFieldValue(row, "url");
            string hinhanh    = BaseView.GetStringFieldValue(row, "hinhanh");
            int    IdGroupRSS = ToSQL.SQLToInt(ddlCT.SelectedValue);
            j++;
            int i = Post(url, hinhanh, IdGroupRSS);
            if (i == 0)
            {
                lthtml.Text += "<span style='display:block;padding:5px;border:1px solid #F39C12;color:#F39C12;margin-top:2px'>" + j + ". Url: " + url + " không thành công </span>";
                ko++;
            }
            else
            {
                lthtml.Text += "<span style='display:block;padding:5px;border:1px solid #00A65A;color:#00A65A;margin-top:2px'>" + j + ". Url: " + url + " thành công!  </span>";
                co++;
            }
        }
        ltThongSo.Text = "<b>Thống kê:</b> " + co + " bài đã đăng / " + ko + " không đăng được.";
    }
 private void getInfoNews()
 {
     if (!String.IsNullOrEmpty(Request.QueryString["id"]))
     {
         int     id  = ToSQL.SQLToInt(Request.QueryString["id"]);
         DataRow row = _db.Get_Info_News(id);
         if (row != null)
         {
             lbLinks.Text             = BaseView.GetStringFieldValue(row, "id_tt");
             txtContent.Text          = BaseView.GetStringFieldValue(row, "noidung");
             ltTitle.Text             = BaseView.GetStringFieldValue(row, "tieude");
             Page.Title               = "Sửa bài: " + BaseView.GetStringFieldValue(row, "tieude");
             ddlLoaiTin.SelectedValue = BaseView.GetStringFieldValue(row, "maloai");
             btnHuy.PostBackUrl       = "~/" + BaseView.GetStringFieldValue(row, "id_tt");
             string[] keywords = BaseView.GetStringFieldValue(row, "keywords").Split(',');
             string   tags     = "";
             for (int i = 0; i < keywords.Length - 1; i++)
             {
                 string[] ids   = keywords[i].Split('-');
                 int      idKey = ToSQL.SQLToInt(ids[ids.Length - 1]);
                 DataRow  rowK  = _db.get_info_words(idKey);
                 if (row != null)
                 {
                     tags += BaseView.GetStringFieldValue(rowK, "keywords") + ", ";
                 }
             }
         }
     }
 }
Exemple #4
0
    protected void btnCapNhat_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(Request.QueryString["id"]))
        {
            int autoId = ToSQL.SQLToInt(Request.QueryString["id"]);

            string content = txtContent.Text;

            DataRow row = _db.Get_Info_News(autoId);
            string  _title, _desc, _keywords, _tieude, _tomtat, _maloai, _hinhanh, _url;
            int     _iSeo = 0;
            if (row != null)
            {
                _title    = BaseView.GetStringFieldValue(row, "title");
                _desc     = BaseView.GetStringFieldValue(row, "desc");
                _tieude   = BaseView.GetStringFieldValue(row, "tieude");
                _tomtat   = BaseView.GetStringFieldValue(row, "tomtat");
                _maloai   = BaseView.GetStringFieldValue(row, "maloai");
                _keywords = BaseView.GetStringFieldValue(row, "keywords");
                _hinhanh  = BaseView.GetStringFieldValue(row, "HinhAnh");
                _url      = BaseView.GetStringFieldValue(row, "url");

                if (BaseView.GetStringFieldValue(row, "tinh") == "1")
                {
                    _iSeo = 1;
                }
                _db.OnInsert_Update_Delete_News(autoId, "", _title, _desc, _keywords, BaseView.replaceLinkHtml(_tieude), DateTime.Now, _tomtat, content, false, _hinhanh, ToSQL.SQLToInt(_maloai), _url, "", "", 1, _iSeo, "admin", null, "", "", "update");
                Response.Redirect("~/" + urlCode());
            }
        }
    }
Exemple #5
0
        protected void dtlImagesProduct_ItemCommand(object source, DataListCommandEventArgs e)
        {
            int ID = ToSQL.SQLToInt(e.CommandArgument);

            (new ProductImageRepo()).DeleteProductImage(ID);
            BindItemsList();
        }
Exemple #6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string FullName = "";

            if (Session["Customer"] != null)
            {
                Customer c = (Customer)Session["Customer"];
                FullName = c.FirstName + " " + c.LastName;
            }
            else
            {
                FullName = txtName.Text;
            }
            try
            {
                Review r = new Review();
                r.FullName    = FullName;
                r.Comment     = txtComment.Text;
                r.DateCreated = DateTime.Now;
                r.Product_ID  = ToSQL.SQLToInt(Request.QueryString["ProductId"]);
                int i = new ReviewRepo().CreateReview(r);
                Response.Redirect(Request.Url.PathAndQuery + "#divreview");
            }
            catch
            {
            }
        }
Exemple #7
0
        private void LoadManufacturer()
        {
            int Id = ToSQL.SQLToInt(Request.QueryString["Id"]);

            if (Id > 0)
            {
                Manufacturer manufacturer = manufacturerRepo.GetById(Id);
                if (manufacturer != null)
                {
                    txtName.Text      = ToSQL.EmptyNull(manufacturer.Name);
                    txtPhone.Text     = ToSQL.EmptyNull(manufacturer.Phone);
                    txtWebsite.Text   = ToSQL.EmptyNull(manufacturer.Website);
                    txtNote.Text      = ToSQL.EmptyNull(manufacturer.Note);
                    chkActive.Checked = ToSQL.SQLToBool(manufacturer.IsActive);
                    if (manufacturer.Address != null)
                    {
                        txtStreet1.Text = ToSQL.EmptyNull(manufacturer.Address.Street1);
                        txtStreet2.Text = ToSQL.EmptyNull(manufacturer.Address.Street2);
                        txtCity.Text    = ToSQL.EmptyNull(manufacturer.Address.City);
                        txtState.Text   = ToSQL.EmptyNull(manufacturer.Address.State);
                        txtCountry.Text = ToSQL.EmptyNull(manufacturer.Address.Country);
                        txtZipCode.Text = ToSQL.EmptyNull(manufacturer.Address.ZipCode);
                    }
                }
                else
                {
                    Response.Redirect("Management-Manafacturer.aspx");
                }
            }
            else
            {
                Response.Redirect("Management-Manafacturer.aspx");
            }
        }
Exemple #8
0
 protected void btnCapNhat_Click(object sender, EventArgs e)
 {
     try
     {
         if (ddRSSFeeds.SelectedValue != "0")
         {
             int    id      = 0;
             string command = "insert";
             if (txtID.Text != "")
             {
                 id      = ToSQL.SQLToInt(txtID.Text);
                 command = "update";
             }
             string idDanhmuc = "0";
             if (!String.IsNullOrEmpty(Request.QueryString["dm"]))
             {
                 idDanhmuc = ToSQL.SQLToInt(Request.QueryString["dm"]).ToString();
                 string sql = "insert into RssRigisteds(idLoai,idRSS) values( " + idDanhmuc + " , " + ddRSSFeeds.SelectedValue + ")";
                 if (command == "update")
                 {
                     sql = "update RssRigisteds set idLoai = " + idDanhmuc + " , idRSS = " + ddRSSFeeds.SelectedValue + " where id = " + id;
                 }
                 _db.sqlSetData(sql);
                 //lbE.Text = "Đã cập nhật";
                 getData();
                 AddControl(false);
                 txtID.Text = "";
             }
         }
     }
     catch { }
 }
    private DataTable dataPages()
    {
        DBClass _db = new DBClass();

        try
        {
            string[] ids      = Request.QueryString["code"].Split(',');
            string   idString = Request.QueryString["code"];
            if (ids.Length > 1)
            {
                idString = ids[0];
            }
            string[] sKey = idString.Split('-');
            if (sKey.Length > 0)
            {
                idString = "";
                for (int i = 1; i < sKey.Length; i++)
                {
                    idString += sKey[i] + "-";
                }
            }
            int    id  = ToSQL.SQLToInt(idString[0]);
            string key = "%" + idString + "%";

            return(_db.Get_Top_News_Tag(key, 2000));
        }
        catch
        {
            return(_db.Get_All_News());
        }
    }
        protected void gvOrders_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            Order order = (Order)e.Row.DataItem;

            if (order != null)
            {
                OrderStatu orderStatus = new OrderStatusRepo().GetById(ToSQL.SQLToInt(order.OrderStatus_ID));
                if (orderStatus != null)
                {
                    e.Row.Cells[2].Text = orderStatus.Name;//order stat
                }
                Customer customer = new CustomerRepo().GetById(ToSQL.SQLToInt(order.Customer_ID));
                if (customer != null)
                {
                    e.Row.Cells[3].Text = customer.FirstName;//customer nam
                }
                Model.Payment payment = new PaymentRepo().GetById(ToSQL.SQLToInt(order.Payment_ID));
                if (payment != null)
                {
                    e.Row.Cells[4].Text = payment.Name;//payment method
                }
                ShippingAddress shippingAddress = new ShippingAddressRepo().GetById(ToSQL.SQLToInt(order.ShippingAddress_ID));
                if (shippingAddress != null)
                {
                    e.Row.Cells[5].Text = shippingAddress.Name;//Recipient's Name
                    e.Row.Cells[6].Text = shippingAddress.Phone;
                    string strAddress = new AddressRepo().GetToString(shippingAddress.Address);
                    e.Row.Cells[7].Text    = new AddressRepo().ShortString(strAddress);
                    e.Row.Cells[7].ToolTip = strAddress;
                }
            }
        }
Exemple #11
0
 private void LoadProductDetails()
 {
     if (Request.QueryString["ProductId"] != null)
     {
         int     ProductId = ToSQL.SQLToInt(Request.QueryString["ProductId"]);
         Product p         = (new ProductRepo()).GetById(ProductId);
         if (p != null)
         {
             rptImage.DataSource = (new ProductImageRepo()).ImageProductDefaultToList(ProductId);
             rptImage.DataBind();
             rptListImages.DataSource = (new ProductImageRepo()).GetAllImagesByProductId(ProductId);
             rptListImages.DataBind();
             ltrDetails.Text = p.Description;
             lblName.Text    = p.Name;
             lblPrice.Text   = p.Price.ToString("$#,###.##");
         }
         else
         {
             Response.Redirect("~/Index.aspx");
         }
     }
     else
     {
         Response.Write("<script>alert('Not found product!');</script>");
         Response.Redirect("~/Index.aspx");
     }
 }
Exemple #12
0
    private void getInfoPages()
    {
        if (!String.IsNullOrEmpty(Request.QueryString["id"]))
        {
            int     id  = ToSQL.SQLToInt(Request.QueryString["id"]);
            DataRow row = _db.Get_Info_Pages(id);
            if (row != null)
            {
                txtTitle.Text      = BaseView.GetStringFieldValue(row, "title");
                txtDesc.Text       = BaseView.GetStringFieldValue(row, "desc");
                lbIDKey.Text       = BaseView.GetStringFieldValue(row, "keywords");
                txtTieuDe.Text     = BaseView.GetStringFieldValue(row, "tieude");
                txtTomTat.Text     = BaseView.GetStringFieldValue(row, "tomtat");
                txtContent.Text    = BaseView.GetStringFieldValue(row, "noidung");
                txtUrl.Text        = BaseView.GetStringFieldValue(row, "url");
                txtCssClass.Text   = BaseView.GetStringFieldValue(row, "code");
                imgBS.ImageUrl     = "~/uploadFile/" + BaseView.GetStringFieldValue(row, "HinhAnh");
                chkHienThi.Checked = BaseView.GetBooleanFieldValue(row, "isHome");
                string[] keywords = BaseView.GetStringFieldValue(row, "keywords").Split(',');
                string   tags     = "";
                for (int i = 0; i < keywords.Length - 1; i++)
                {
                    string[] ids   = keywords[i].Split('-');
                    int      idKey = ToSQL.SQLToInt(ids[ids.Length - 1]);
                    DataRow  rowK  = _db.get_info_words(idKey);
                    if (row != null)
                    {
                        tags += BaseView.GetStringFieldValue(rowK, "keywords") + ", ";
                    }
                }

                lbkeyWord.Text = tags;
            }
        }
    }
 private void getInfo()
 {
     if (!String.IsNullOrEmpty(Request.QueryString["id"]))
     {
         int     id  = ToSQL.SQLToInt(Request.QueryString["id"].Replace("'", ""));
         DataRow row = _db.get_info_loai(id);
         if (row != null)
         {
             txtName.Text    = BaseView.GetStringFieldValue(row, "name");
             txtUrl.Text     = BaseView.GetStringFieldValue(row, "url");
             txtUrlCT.Text   = BaseView.GetStringFieldValue(row, "urlct");
             txtTT.Text      = BaseView.GetStringFieldValue(row, "title");
             txtMT.Text      = BaseView.GetStringFieldValue(row, "description");
             txtNoiDung.Text = BaseView.GetStringFieldValue(row, "noidung");
             txtKeyWord.Text = BaseView.GetStringFieldValue(row, "keywords");
             txtCode.Text    = BaseView.GetStringFieldValue(row, "code");
             imgBS.ImageUrl  = "~/uploadFile/DanhMuc/" + BaseView.GetStringFieldValue(row, "Images");
             try
             {
                 ddlLoai.SelectedValue = BaseView.GetStringFieldValue(row, "isPatient");
             }
             catch { }
             try
             {
                 ddlDanhMuc.SelectedValue = BaseView.GetStringFieldValue(row, "madanhmuc");
             }
             catch { }
         }
     }
 }
Exemple #14
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Customer customer = customerRepo.GetById(ToSQL.SQLToInt(Request.QueryString["Id"]));

            if (customer != null)
            {
                lbMessage.Text = "";
                if (customerRepo.DoesEmailExist(txtEmail.Text) && !customer.Email.ToLower().Equals(txtEmail.Text.ToLower()) && ToSQL.EmptyNull(txtEmail.Text) != "")
                {
                    lbMessage.Text      = "Email already exists!";
                    lbMessage.ForeColor = System.Drawing.Color.Red;
                    txtEmail.Text       = "";
                    return;
                }

                customer.FirstName   = txtFirstName.Text;
                customer.LastName    = txtLastName.Text;
                customer.Email       = txtEmail.Text;
                customer.Phone       = txtPhone.Text;
                customer.DateOfBirth = ToSQL.SQLToDateTimeNull(txtDateOfBirth.Text);
                customer.Gender      = rdbtnGender.SelectedIndex == 0 ? true : false;
                int i = customerRepo.UpdateCustomer(customer);
                Response.Redirect("Management-Customer.aspx");
            }
            else
            {
                Response.Redirect("Management-Customer.aspx");
            }
        }
Exemple #15
0
 protected void btnCapNhat_Click(object sender, EventArgs e)
 {
     try
     {
         int    id      = 0;
         string command = "insert";
         if (txtID.Text != "")
         {
             id      = ToSQL.SQLToInt(txtID.Text);
             command = "update";
             _db.OnInsert_Update_Delete_Menu(id, txtTen.Text, txtURL.Text, rdhienthi.Checked, ToSQL.SQLToInt(ddlparent.SelectedValue), ToSQL.SQLToInt(txtIndex.Text), ToSQL.SQLToInt(ddlKieu.SelectedValue), command);
         }
         if (command == "insert")
         {
             string    sql   = "select * from menu where url = '" + txtURL.Text + "'";
             DataTable dtUrl = _db.sqlGetData(sql);
             if (dtUrl.Rows.Count == 0)
             {
                 _db.OnInsert_Update_Delete_Menu(id, txtTen.Text, txtURL.Text, rdhienthi.Checked, ToSQL.SQLToInt(ddlparent.SelectedValue), ToSQL.SQLToInt(txtIndex.Text), ToSQL.SQLToInt(ddlKieu.SelectedValue), command);
             }
             else
             {
                 lbE.Text = "Trùng url, không lưu được!";
                 return;
             }
         }
         lbE.Text = "Đã cập nhật";
         getData(0);
         getDataDropdownListMenuParent();
         AddControl(false);
         txtID.Text = "";
     }
     catch { }
 }
Exemple #16
0
    protected void btnChon_Click(object sender, EventArgs e)
    {
        int id = ToSQL.SQLToInt(ddlMucCon.SelectedValue);

        if (id == 0)
        {
            id = ToSQL.SQLToInt(ddlMuc1.SelectedValue);
        }
        DataRow row = _db.get_info_loai(id);

        if (row != null)
        {
            txtTen.Text = BaseView.GetStringFieldValue(row, "name");
            txtURL.Text = BaseView.GetStringFieldValue(row, "code") + ".html";
        }
        // id loai tin khong co chon danh muc
        if (id == 0)
        {
            id = ToSQL.SQLToInt(ddlDanhMuc.SelectedValue);
        }
        row = _db.get_Info_DanhMucTin(id);
        if (row != null)
        {
            txtTen.Text = BaseView.GetStringFieldValue(row, "tenDanhMuc");
            txtURL.Text = BaseView.repalce_UrlFriendly(BaseView.convertToUnSign2(BaseView.GetStringFieldValue(row, "tenDanhMuc"))) + "-" + BaseView.GetStringFieldValue(row, "madanhMuc") + ".hxml";
        }
        string  sql  = "select top 1 * from Menu where 1 = 1 order by numberSort desc";
        DataRow rowS = _db.sqlGetDataRow(sql);

        if (rowS != null)
        {
            txtIndex.Text = (BaseView.GetIntFieldValue(rowS, "numberSort") + 1).ToString();
        }
        txtID.Text = "";
    }
Exemple #17
0
    protected void grDataTinh_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            for (int i = 1; i < grvTaskNew.Columns.Count - 1; i++)
            {
                e.Row.Cells[i].Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(grvTaskNew, "Select$" + e.Row.RowIndex);
                e.Row.Cells[i].ToolTip = "Nhấn vào đây để chọn ";
            }

            Label lbisParent = (Label)e.Row.FindControl("lbisParent");
            int   iPa        = ToSQL.SQLToInt(lbisParent.Text);
            lbisParent.Text = "-";
            if (iPa != 0)
            {
                DataRow dr = _db.get_Info_Menu(iPa);
                if (dr != null)
                {
                    lbisParent.Text = BaseView.GetStringFieldValue(dr, "name");
                }
            }
            Label lbstyleShow = (Label)e.Row.FindControl("lbstyleShow");
            if (lbstyleShow.Text == "0")
            {
                lbstyleShow.Text = "-";
            }
            else
            {
                lbstyleShow.Text = "Dạng 1 cột";
            }
        }
    }
Exemple #18
0
 private void LoadUser()
 {
     Model.User u = userRepo.GetById(ToSQL.SQLToInt(Request.QueryString["ID"]));
     if (u != null)
     {
         txtFirstName.Text = u.FirstName;
         txtLastName.Text  = u.LastName;
         lblUserName.Text  = u.Username;
         txtEmail.Text     = u.Email;
         txtPhone.Text     = u.Phone;
         if (u.Address != null)
         {
             txtStreet1.Text = u.Address.Street1;
             txtStreet2.Text = u.Address.Street2;
             txtCity.Text    = u.Address.City;
             txtState.Text   = u.Address.State;
             txtCountry.Text = u.Address.Country;
             txtZipCode.Text = u.Address.ZipCode;
         }
     }
     else
     {
         Response.Redirect("~/Admincp/Management-User.aspx");
     }
 }
Exemple #19
0
        private void LoadProductsByProductTypeID()
        {
            int productTypeID = ToSQL.SQLToInt(Request.QueryString["ServiceID"]);

            rptProducts.DataSource = (new ProductRepo()).GetListProductByProductTypeID(productTypeID);
            rptProducts.DataBind();
        }
Exemple #20
0
    protected void grDataTinh_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            for (int i = 1; i < grvTaskNew.Columns.Count - 1; i++)
            {
                e.Row.Cells[i].Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(grvTaskNew, "Select$" + e.Row.RowIndex);
                e.Row.Cells[i].ToolTip = "Nhấn vào đây để chọn ";
            }

            Label   lbidRss = (Label)e.Row.FindControl("lbidRss");
            DataRow dr      = _db.sqlGetDataRow("select * from RssFeeds where id = " + ToSQL.SQLToInt(lbidRss.Text));
            if (dr != null)
            {
                lbidRss.Text = BaseView.GetStringFieldValue(dr, "name");
            }

            Label lbID_LoaiTin = (Label)e.Row.FindControl("lbidloai");
            dr = _db.sqlGetDataRow("select * from LoaiTin where id = " + ToSQL.SQLToInt(lbID_LoaiTin.Text));
            if (dr != null)
            {
                lbID_LoaiTin.Text = BaseView.GetStringFieldValue(dr, "name");
            }
        }
    }
    private void Insert_Update_Data()
    {
        //if (ToSQL.SQLToInt(ddlDanhMuc.SelectedValue) > 0)
        //{
        string username   = ReadCookie("adminUserName");
        int    id         = 0;
        string sqlCommand = "insert";

        if (!String.IsNullOrEmpty(Request.QueryString["id"]))
        {
            id         = ToSQL.SQLToInt(Request.QueryString["id"]);
            sqlCommand = "update";
        }

        string code = txtCode.Text.Trim().ToLower();

        if (code.Length == 0)
        {
            code = BaseView.convertToUnSign2(txtName.Text).ToLower();
            code = BaseView.repalce_UrlFriendly(code);
        }

        _db.OnInsert_Update_Delete_LoaiTin(id, txtName.Text, txtUrl.Text, getImageDD(), txtTT.Text, txtMT.Text, txtNoiDung.Text, txtKeyWord.Text, getImage(), code, ToSQL.SQLToInt(ddlDanhMuc.SelectedValue), true, ToSQL.SQLToInt(ddlLoai.SelectedValue), 0, true, username, sqlCommand);
        BaseView _bv = new BaseView();

        if (sqlCommand != "update")
        {
            writeXML(_bv.serverUrl() + "/" + code + ".hxml", DateTime.Now.ToShortDateString());
        }
        //}
        //else
        //{
        //    Label1.Text = "Chưa chọn Danh Mục";
        //}
    }
Exemple #22
0
    private DataTable dataTags()
    {
        DBClass _db = new DBClass();

        try
        {
            string idString = Request.QueryString["urlcode"];

            //Info Key ------------------------------------------------------
            string[] sKey  = idString.Split('-');
            int      idKey = ToSQL.SQLToInt(sKey[sKey.Length - 1]);
            DataRow  row   = _db.get_info_words(idKey);
            if (row != null)
            {
                string keytext = BaseView.GetStringFieldValue(row, "keywords");
                string title   = BaseView.GetStringFieldValue(row, "Title") == "" ? keytext : BaseView.GetStringFieldValue(row, "Title");
                string desc    = BaseView.GetStringFieldValue(row, "desc") == "" ? keytext : BaseView.GetStringFieldValue(row, "desc");
                string url     = BaseView.convertStringLinks(keytext) + "-" + idKey;
                WritePost(title, desc, keytext, "", "", url, title, desc, keytext);
            }

            //-----------------------------------------------------------
            string key = "%" + idString + "%";
            return(_db.Get_Top_News_Tag(key, 2000));
        }
        catch
        {
            return(null);
        }
    }
Exemple #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         getItem(ToSQL.SQLToInt(Request.QueryString["id"]));
     }
 }
Exemple #24
0
        private void LoadReview()
        {
            int           ProductId = ToSQL.SQLToInt(Request.QueryString["ProductId"]);
            List <Review> Reviews   = new ReviewRepo().GetByProductId(ProductId);

            rptReview.DataSource = Reviews;
            rptReview.DataBind();
        }
Exemple #25
0
 protected void rptProducts_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Add")
     {
         HiddenField hdf     = (HiddenField)e.Item.FindControl("hdfProductId");
         Product     product = new ProductRepo().GetById(ToSQL.SQLToInt(hdf.Value));
         if (product != null)
         {
             List <Cart> carts = (List <Cart>)Session["Carts"];
             Cart        cart  = new Cart(carts);
             cart  = cart.ConverProductToCart(product);
             carts = cart.Add(cart);
             UpdateLabelShipping(carts);
             Session["Carts"] = carts;
             Response.Redirect("ViewCart.aspx");
         }
     }
     else if (e.CommandName == "AddCompare")
     {
         CompareAndWish list = (CompareAndWish)Session["Compare"];
         if (list == null)
         {
             list = new CompareAndWish();
         }
         Product p = (new ProductRepo()).GetById(ToSQL.SQLToInt(e.CommandArgument));
         if (p != null && list.Products.Count <= 3)
         {
             if (!list.Add(p))
             {
                 Response.Write("<script type='text/javascript'>alert('Product is exist in list compare');</script>");
             }
         }
         else
         {
             Response.Write("<script type='text/javascript'>alert('You should select between 1 and 4 item!');</script>");
         }
         UpdateCompareList(list.Products);
         Session["Compare"] = list;
     }
     else if (e.CommandName == "AddWishList")
     {
         CompareAndWish list = (CompareAndWish)Session["WishList"];
         if (list == null)
         {
             list = new CompareAndWish();
         }
         Product p = (new ProductRepo()).GetById(ToSQL.SQLToInt(e.CommandArgument));
         if (p != null)
         {
             if (!list.Add(p))
             {
                 Response.Write("<script type='text/javascript'>alert('Product is exist in list compare');</script>");
             }
         }
         UpdateWishList(list.Products);
         Session["WishList"] = list;
     }
 }
Exemple #26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         getChuyenKhoa();
         getBacSi();
         getData(ToSQL.SQLToInt(lsBacsi.SelectedValue));
     }
 }
    private void getInfoNews()
    {
        if (!String.IsNullOrEmpty(Request.QueryString["id"]))
        {
            int     id  = ToSQL.SQLToInt(Request.QueryString["id"]);
            DataRow row = _db.Get_Info_News(id);
            if (row != null)
            {
                ddlLoaiTin.SelectedValue = BaseView.GetStringFieldValue(row, "maloai");

                txtTitle.Text = BaseView.GetStringFieldValue(row, "title");
                txtDesc.Text  = BaseView.GetStringFieldValue(row, "desc");
                //lbIDKey.Text = BaseView.GetStringFieldValue(row, "keywords");
                txtTieuDe.Text = BaseView.GetStringFieldValue(row, "tieude");
                txtTomTat.Text = BaseView.GetStringFieldValue(row, "tomtat");
                string noidung = BaseView.GetStringFieldValue(row, "noidung");
                txtContent.Text = noidung;
                txtUrl.Enabled  = false;
                string hinhDD = BaseView.GetStringFieldValue(row, "HinhAnh");
                if (hinhDD.IndexOf("http") == -1)
                {
                    hinhDD = "~/uploadFile/postImages/" + hinhDD;
                }
                imgBS.ImageUrl = hinhDD;

                bool iSeo = false;
                if (BaseView.GetStringFieldValue(row, "tinh") == "1")
                {
                    iSeo = true;
                }
                chSEO.Checked = iSeo;

                txtUrl.Text = BaseView.GetStringFieldValue(row, "url").Replace(".html", "");

                string[] keywords = BaseView.GetStringFieldValue(row, "keywords").Split(',');

                string tags = "";
                for (int i = 0; i < keywords.Length - 1; i++)
                {
                    string[] ids   = keywords[i].Split('-');
                    int      idKey = ToSQL.SQLToInt(ids[ids.Length - 1]);
                    DataRow  rowK  = _db.get_info_words(idKey);
                    try
                    {
                        if (row != null)
                        {
                            tags = BaseView.GetStringFieldValue(rowK, "keywords");
                            chkList.Items.Add(new ListItem(tags, keywords[i]));
                        }
                    }
                    catch { }
                }

                //lbkeyWord.Text = tags;
            }
        }
    }
    // isActived = true -> public ; isActived = false -> draff
    private void UpdatePost(bool isActived)
    {
        if (ToSQL.SQLToInt(ddlLoaiTin.SelectedValue) > 0)
        {
            string username   = ReadCookie("adminUserName");
            string sqlCommand = "";
            int    autoId     = 0;

            string content = txtContent.Text;
            string url     = txtUrl.Text;
            if (url == "")
            {
                url = linkReplace(txtTieuDe.Text);
            }
            url += ".html";// Add .html for url
            //DataRow dr = _db.get_info_news_url(url);
            //if (dr != null && sqlCommand == "insert")
            //{
            //Random ran = new Random();
            //url = linkReplace(txtTieuDe.Text) + ran.Next(1, 1000) + ".html";
            //}
            string _title = txtTitle.Text;
            if (_title == "")
            {
                _title = txtTieuDe.Text;
            }
            string _desc = txtDesc.Text;
            if (_desc == "")
            {
                _desc = txtTomTat.Text;
            }
            if (!String.IsNullOrEmpty(Request.QueryString["id"]))
            {
                sqlCommand = "update";
                autoId     = ToSQL.SQLToInt(Request.QueryString["id"]);
                //url = txtUrl.Text;
            }
            BaseView _bv = new BaseView();
            if (autoId == 0)
            {
                sqlCommand = "insert";
                writeXML(_bv.serverUrl() + "/" + url, DateTime.Now.ToShortDateString());
            }
            int baiSeo = 0;
            if (chSEO.Checked)
            {
                baiSeo = 1;
            }
            _db.OnInsert_Update_Delete_News(autoId, "", _title, _desc, getTag(), BaseView.replaceLinkHtml(txtTieuDe.Text), DateTime.Now, txtTomTat.Text, content, isActived, getImage(), ToSQL.SQLToInt(ddlLoaiTin.SelectedValue), url, "", "", 1, baiSeo, username, null, "", "", sqlCommand);

            Response.Redirect("~/admin-us/bai-viet/");
        }
        else
        {
            ltError.Text = "<span style='padding:5px;border:1px solid #FF0000;border-radius:10px;'>Chọn danh mục</span>";
        }
    }
    private void getData()
    {
        int       autoId     = ToSQL.SQLToInt(Request.QueryString["id"]);
        string    sqlCommand = "select * from LichDoctor where idDoctor = " + autoId;
        DataTable dt         = _db.sqlGetData(sqlCommand);

        grvTaskNew.DataSource = dt;
        grvTaskNew.DataBind();
    }
Exemple #30
0
    protected void ddlChuyenKhoa_SelectedIndexChanged(object sender, EventArgs e)
    {
        string    sqlCommand = "select * from Doctor where idChuyenKhoa = " + ToSQL.SQLToInt(ddlChuyenKhoa.SelectedValue) + " or 0 = " + ToSQL.SQLToInt(ddlChuyenKhoa.SelectedValue);
        DataTable dt         = _db.sqlGetData(sqlCommand);

        lsBacsi.DataSource = dt;
        lsBacsi.DataBind();
        lsBacsi.Items.Insert(0, new ListItem("-- (chọn bác sĩ ) ---", "0"));
    }