示例#1
0
 protected void btnXoa_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < grvTaskNew.Rows.Count; i++)
     {
         CheckBox chk = (CheckBox)grvTaskNew.Rows[i].FindControl("chkChon");
         if (chk.Checked == true)
         {
             _db.OnInsert_Update_Delete_Menu(ToSQL.SQLToInt(chk.CssClass), txtTen.Text, txtURL.Text, rdhienthi.Checked, ToSQL.SQLToInt(ddlparent.SelectedValue), 0, 0, "del");
         }
     }
     getData(0);
 }
示例#2
0
 protected void ddlDanhMuc_SelectedIndexChanged(object sender, EventArgs e)
 {
     getDropdownListMuc1(ToSQL.SQLToInt(ddlDanhMuc.SelectedValue));
 }
    private void getInfo()
    {
        if (!String.IsNullOrEmpty(Request.QueryString["id"]))
        {
            DiamondProcessCode _dm      = new DiamondProcessCode();
            DBClass            _db      = new DBClass();
            string             url      = Request.QueryString["id"] + ".html";
            string[]           urlShort = Request.QueryString["id"].Split('/');
            if (urlShort.Length > 0)
            {
                url = urlShort[urlShort.Length - 1] + ".html";
            }
            DataRow rowPost = _dm.GetSinglePost(null, url, null, true);
            //int countKey = 0;
            if (rowPost == null)
            {
                rowPost = _db.Get_URL_Pages(url);
            }
            if (rowPost != null)
            {
                string name     = BaseView.GetStringFieldValue(rowPost, "tieude");
                string title    = BaseView.GetStringFieldValue(rowPost, "title");
                string desc     = BaseView.GetStringFieldValue(rowPost, "desc");
                string tomtat   = BaseView.GetStringFieldValue(rowPost, "tomtat");
                string content  = BaseView.GetStringFieldValue(rowPost, "noidung");
                string keywords = BaseView.GetStringFieldValue(rowPost, "keywords");
                int    maloai   = BaseView.GetIntFieldValue(rowPost, "maloai");

                Page.Title           = title == "" ? BaseView.GetStringFieldValue(rowPost, "name") : title;
                Page.MetaDescription = desc;
                Page.MetaKeywords    = keywords;
                ltImg.Text           = "<meta property='og:image' content='" + BaseView.UrlServer() + "/UploadFile/postImages/" + BaseView.GetStringFieldValue(rowPost, "hinhanh") + "'>";
                LbTieuDeChinh.Text   = name;
                ltDescPost.Text      = "<div class=''>" + tomtat + "</div>";
                ltContent.Text       = content;
                getDataLQ(BaseView.GetStringFieldValue(rowPost, "id"));
                DataRow infoLoai = _db.get_info_loai(maloai);
                if (infoLoai != null)
                {
                    ltCat.Text  = "<a itemprop='url' href='" + BaseView.GetStringFieldValue(infoLoai, "code").ToLower() + ".hxml'>" + BaseView.GetStringFieldValue(infoLoai, "name") + "</a>";
                    ltCat2.Text = BaseView.GetStringFieldValue(infoLoai, "name");
                    string hinhanh = BaseView.GetStringFieldValue(infoLoai, "Images").ToLower();
                    //if (hinhanh == "")
                    //imgDanhMuc.Visible = false;
                    //else
                    //imgDanhMuc.Visible = true;
                    //imgDanhMuc.ImageUrl = BaseView.UrlServer() + "/uploadFile/DanhMuc/" + hinhanh;
                    //imgDanhMuc.AlternateText = name;
                }
                //ltCat.Text = "<a itemprop='url' href='" + BaseView.GetStringFieldValue(rowPost, "code").ToLower() + ".hxml'>" + name + "</a>";

                BindRepeater(maloai);

                //btnSua.PostBackUrl = "~/EditPost/default.aspx?id=" + BaseView.GetStringFieldValue(rowPost, "id");
                //try
                //{
                string[] keywordArr = BaseView.GetStringFieldValue(rowPost, "keywords").Split(',');
                string   tags       = "";
                if (keywordArr.Length > 0)
                {
                    for (int i = 0; i < keywordArr.Length - 1; i++)
                    {
                        //lbTags.Text += i.ToString() + " ";
                        string[] ids   = keywordArr[i].Split('-');
                        int      idKey = ToSQL.SQLToInt(ids[ids.Length - 1]);
                        DataRow  row   = _db.get_info_words(idKey);
                        if (row != null)
                        {
                            tags += "<a class='button small' itemprop='keywords' href='../tags/" + BaseView.GetStringFieldValue(row, "id") + "-" + convertStringLinks(BaseView.GetStringFieldValue(row, "keywords")) + "'>" + BaseView.GetStringFieldValue(row, "keywords") + "</a>";
                        }
                    }
                }
                lbTags.Text = tags;
                //}
                //catch { }


                //getLienQuan(BaseView.GetIntFieldValue(r, "maloai"));
                //getCamNangLienQuan(BaseView.GetIntFieldValue(r, "maloai"));
            }
            else
            {
                Response.Redirect("~/404/");
            }
        }
        if (Page.Title == "")
        {
            Page.Title = "Trang không tồn tại.";
        }
    }
示例#4
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 { }
 }
示例#5
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());
            }
        }
    }
        private void BindItemsList()
        {
            List <OrderHistory> orderHistories = orderHistoryRepo.GetManagementOrderHistories(ToSQL.SQLToInt(txtOrderID.Text), ToSQL.SQLToInt(ddlOrderStatus.SelectedValue));

            this.gvOrderHistories.DataSource = orderHistories;
            this.gvOrderHistories.DataBind();
            this.gvOrderHistories.UseAccessibleHeader    = true;
            this.gvOrderHistories.HeaderRow.TableSection = TableRowSection.TableHeader;
        }
 protected void grvTaskNew_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     getData(e.NewPageIndex, ToSQL.SQLToInt(ddlDanhMuc.SelectedValue));
 }
        private void BindItemsList()
        {
            List <Customer> users = customerRepo.GetManagementCustomers(ToSQL.SQLToInt(txtCustomerID.Text), ToSQL.EmptyNull(txtUsername.Text), ToSQL.EmptyNull(txtFirstName.Text),
                                                                        ToSQL.EmptyNull(txtLastName.Text), ToSQL.EmptyNull(txtEmail.Text), ToSQL.EmptyNull(txtPhone.Text));

            _PageDataSource.DataSource       = users;
            _PageDataSource.AllowPaging      = true;
            _PageDataSource.PageSize         = 10;
            _PageDataSource.CurrentPageIndex = CurrentPage;
            ViewState["TotalPages"]          = _PageDataSource.PageCount;

            //this.lblPageInfo.Text = "Results: " + ProductList.Count.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;Page " + (CurrentPage + 1) + " of " + _PageDataSource.PageCount + "&nbsp;&nbsp;";

            this.btnPre.Visible  = !_PageDataSource.IsFirstPage;
            this.btnNext.Visible = !_PageDataSource.IsLastPage;
            //this.lbtnFirst.Visible = !_PageDataSource.IsFirstPage;
            //this.lbtnLast.Visible = !_PageDataSource.IsLastPage;

            this.gvProducts.DataSource = _PageDataSource;
            this.gvProducts.DataBind();
            //this.gvProducts.UseAccessibleHeader = true;
            //this.gvProducts.HeaderRow.TableSection = TableRowSection.TableHeader;
            this.doPaging();
        }
 protected void btnChuaDuyet_Click(object sender, EventArgs e)
 {
     grvTaskNew.DataSource = _db.get_data_LoaiTin("", ToSQL.SQLToInt(ddlDanhMuc.SelectedValue), false);
     grvTaskNew.DataBind();
 }
    protected void btnDuyet_Click(object sender, EventArgs e)
    {
        string username = ReadCookie("adminUserName");

        for (int i = 0; i < grvTaskNew.Rows.Count; i++)
        {
            CheckBox chk  = (CheckBox)grvTaskNew.Rows[i].FindControl("chk");
            Label    lbTD = (Label)grvTaskNew.Rows[i].FindControl("lbTD");
            if (chk.Checked == true)
            {
                //_db.OnInsert_Update_Delete_News(ToSQL.SQLToInt(chk.CssClass), "", "", "", "", "", DateTime.Now, "", "", true, "", 1, "", "", "", 0, 0, "", null, "", "del");
                _db.OnInsert_Update_Delete_LoaiTin(ToSQL.SQLToInt(chk.CssClass), lbTD.Text, "", "", "", "", "", "", "", "", ToSQL.SQLToInt(ddlDanhMuc.SelectedValue), true, 0, 0, true, username, "actived");
            }
        }
        getData(0, 0);
    }
示例#11
0
 private DataTable getDataTable(bool?isactived)
 {
     return(_db.get_data_news(txtSearch.Text, ToSQL.SQLToInt(ddlLoai.SelectedValue), isactived));
 }
示例#12
0
    // 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_all_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>";
        }
    }
示例#13
0
 protected void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         _db.insert_update_caidat(1, ToSQL.SQLToInt(txtSoBaiDang.Text), ToSQL.SQLToInt(txtLinksBaiViet.Text), ToSQL.SQLToInt(txtNgayDang.Text), txtTieuDeTrang.Text, txtTieuDeTrangChu.Text, txtDescription.Text, txtKeywords.Text, txtVideo.Text, txtRaoVat.Text, "");
         getCaiDat();
         lbTB.Text = "Đã cập nhật";
     }
     catch { }
 }
示例#14
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"));
    }
 protected void ddlDanhMuc_SelectedIndexChanged(object sender, EventArgs e)
 {
     getData(0, ToSQL.SQLToInt(ddlDanhMuc.SelectedValue));
 }
示例#16
0
 protected void lsBacsi_SelectedIndexChanged(object sender, EventArgs e)
 {
     getData(ToSQL.SQLToInt(lsBacsi.SelectedValue));
 }
    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 + ".html", DateTime.Now.ToShortDateString());
        }
        //}
        //else
        //{
        //    Label1.Text = "Chưa chọn Danh Mục";
        //}
    }
示例#18
0
        private void VentsMatdll(IList<string> materialP1, IList<string> покрытие, string newName)
        {
            ModelDoc2 model = _swApp.ActivateDoc2(newName, true, 0);
            if (model == null) return;            

            try
            {
                MessageBox.Show(newName);
                
                var setMaterials = new SetMaterials();
                ToSQL.Conn = Settings.Default.ConnectionToSQL;
                var toSql = new ToSQL();
                
                //MessageBox.Show($"Conn - {ToSQL.Conn} SetMaterials {setMaterials == null} toSql - {toSql == null} _swApp {_swApp == null} levelId - {Convert.ToInt32(materialP1[0])}");

                setMaterials?.ApplyMaterial("", "00", Convert.ToInt32(materialP1[0]), _swApp);
                model?.Save();

                foreach (var confname in setMaterials.GetConfigurationNames(_swApp))
                {
                    foreach (var matname in setMaterials.GetCustomProperty(confname, _swApp))
                    {
                        toSql.AddCustomProperty(confname, matname.Name, _swApp);
                    }
                }

                if (покрытие != null)
                {
                    if (покрытие[1] != "0")
                    {
                        setMaterials.SetColor("00", покрытие[0], покрытие[1], покрытие[2], _swApp);
                    }
                    _swApp.IActiveDoc2.Save();
                }

                try
                {
                    string message;
                    setMaterials.CheckSheetMetalProperty("00", _swApp, out message);
                    if (message != null)
                    {
                       // MessageBox.Show(message, newName + " 858 ");
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show($"{newName}\n{e.Message}\n{e.StackTrace}", "VentsMatdll");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show($"{newName}\n{e.Message}\n{e.StackTrace}\n{newName}", "VentsMatdll 2");
            }

            GabaritsForPaintingCamera(model);

            model?.Save();
        }
示例#19
0
    private int SavePost(string url_from_rss, string tieude, string description, string content, string img, string code_url_friendly, int idLoai)
    {
        try
        {
            DBClass _db = new DBClass();
            if (checkNews(url_from_rss) == 0)
            {
                if (code_url_friendly.Length > 50)
                {
                    code_url_friendly = code_url_friendly.Substring(0, 50);
                }
                if (code_url_friendly.Trim().Length == 0)
                {
                    code_url_friendly = BaseView.RemoveKiTuDacBietVaKhoangTrang(tieude.ToLower()) + ".html";
                }
                else
                {
                    if (code_url_friendly.IndexOf(".html") == -1)
                    {
                        code_url_friendly = code_url_friendly + ".html";
                    }
                }

                if (content.Trim().Length > 200)
                {
                    DataRow rowL = _db.get_info_loai(idLoai);
                    if (rowL != null)
                    {
                        _db.OnInsert_Update_Delete_News(0, url_from_rss, tieude, description, "", tieude, ToSQL.SQLToDateRic(BaseView.getDateTimeNow()), description, content, true, img, idLoai, code_url_friendly, "", "", 0, 0, "", null, "", "", "insert");
                        // ltHome.Text +="<img src='"+ img+ "'/></br>";
                        return(1);
                    }
                }
            }
            return(0);
        }
        catch { return(0); }
    }