public void LoadCombox()
 {
     UltilFunc.BindCombox(cboAnPham, "Ma_Anpham", "Ten_Anpham", "T_Anpham", "1=1", (string)HttpContext.GetGlobalResourceObject("cms.language", "lblChonanpham"));
     UltilFunc.BindCombox_CategoryDequy(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", " WHERE Ma_ChuyenMuc in (select Ma_ChuyenMuc from T_Nguoidung_Chuyenmuc where Ma_Nguoidung = " + _user.UserID.ToString() + ") ", (string)HttpContext.GetGlobalResourceObject("cms.language", "lblChonchuyenmuc"), "Ma_Chuyenmuc_Cha");
 }
 private void LoadComboBox()
 {
     UltilFunc.BindCombox(cboNgonNgu, "Ma_AnPham", "Ten_AnPham", "T_AnPham", " 1=1 ", CommonLib.ReadXML("lblTatca"));
 }
Exemplo n.º 3
0
 public void LoadCombox()
 {
     UltilFunc.BindCombox(cbokhachang, "Ma_KhachHang", "Ten_khachhang", "T_Khachhang", "1=1 and Loai_KH=1", "---Select all---");
     UltilFunc.BindCombox(cbo_loaibao, "Ma_Anpham", "Ten_Anpham", "T_Anpham", "1=1", "---Select all---");
 }
Exemplo n.º 4
0
        protected string BuildSQL(int status, string sOrder)
        {
            //dgr_tintuc1.Columns[8].Visible = false;
            LinkButton_updateTT.Visible = false;
            string sql     = string.Empty;
            string sClause = " 1=1 And News_DatePublished is NOT null  AND News_Status=" + status + " and CAT_ID in (select DISTINCT(T_Nguoidung_Chuyenmuc.Ma_chuyenmuc) from T_Nguoidung_Chuyenmuc where Ma_Nguoidung = " + _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name).UserID + ") ";
            string sWhere  = string.Empty;

            if (chkNewsIsBaidinh.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_IsHomePages=1 ";
            }
            if (chkNewsIsFocus.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_IsHot=1 ";
            }

            if (chkNewTieudiem.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_IsFocus=1 ";
            }
            if (chkNewFocusParent.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_IsCategoryParrent=1 ";
            }
            if (chkNewFocusChild.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_IsCategorys=1 ";
            }

            if (chkImageIsFocus.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_IsImages=1 ";
            }
            if (chkVideoIsFocus.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_IsVideo=1 ";
            }
            if (chkHosoIsFocus.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_IsHistory=1 ";
            }
            if (chDisplayMobi.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_DisplayMobile=1 ";
            }
            if (cbMoreViews.Checked)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_Delete=1 ";
            }
            if (txtTieuDetin.Text.Length > 0)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += " News_Tittle LIKE " + string.Format("N'%{0}%'", UltilFunc.SqlFormatText(txtTieuDetin.Text.Trim()));
            }
            if (cbo_chuyenmuc.SelectedIndex > 0)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "" + string.Format(" CAT_ID IN (SELECT * FROM [fn_Return_Category_Tree] ({0}))", this.cbo_chuyenmuc.SelectedValue);
            }
            if (cboNgonNgu.SelectedIndex > 0)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  Lang_ID=" + cboNgonNgu.SelectedValue.ToString();
            }

            if (txt_tungay.Text.Length > 0)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_DatePublished >= convert(datetime,'" + txt_tungay.Text.Trim() + " 00:00:00',103) ";
            }
            if (txt_denngay.Text.Length > 0)
            {
                if (sWhere.Trim().Length > 0)
                {
                    sWhere += " AND ";
                }
                sWhere += "  News_DatePublished <= convert(datetime,'" + txt_denngay.Text.Trim() + " 23:59:59',103) ";
            }
            sql += sClause;
            if (sWhere.Trim().Length > 0)
            {
                sql += " AND" + sWhere;
            }
            return(sql + sOrder);
        }
Exemplo n.º 5
0
        protected void LoadData_UnPublisher()
        {
            string sOrder = " Order by News_DateSend DESC ";

            PagerUnPublish.PageSize = Global.MembersPerPage;
            HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
            string tieude = txt_tieude.Text.Trim();

            Session["searchvalueroot"] = null;
            if (tieude != "")
            {
                Session["searchvalueroot"] = UltilFunc.SplitString(tieude);
            }
            DataSet _ds;

            _ds = _T_newsDAL.BindGridT_NewsDynamic(PagerUnPublish.PageIndex, PagerUnPublish.PageSize, BuildSQL(ConstNews.NewsUnPublishing, sOrder), UltilFunc.ReplaceAll(UltilFunc.SplitString(tieude), "'", "’"));

            int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString());
            int TotalRecord  = Convert.ToInt32(_ds.Tables[0].Rows.Count);

            if (TotalRecord == 0)
            {
                for (int i = 1; i <= TotalRecords; i++)
                {
                    _ds = _T_newsDAL.BindGridT_NewsDynamic(PagerUnPublish.PageIndex - i, PagerUnPublish.PageSize, BuildSQL(ConstNews.NewsUnPublishing, sOrder), UltilFunc.ReplaceAll(UltilFunc.SplitString(tieude), "'", "’"));
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        break;
                    }
                }
            }
            this.dgListNewsUnPublish.DataSource = _ds;
            this.dgListNewsUnPublish.DataBind();
            this.PagerUnPublish.TotalRecords     = this.CurrentPageUnPublish.TotalRecords = TotalRecords;
            this.CurrentPageUnPublish.TotalPages = this.PagerUnPublish.CalculateTotalPages();
            this.CurrentPageUnPublish.PageIndex  = this.PagerUnPublish.PageIndex;

            GetTotal();
            _ds.Clear();
        }
Exemplo n.º 6
0
 private void LoadComboBox()
 {
     UltilFunc.BindCombox(cbo_lanquage, "Ma_AnPham", "Ten_AnPham", "T_AnPham", " 1=1 ", CommonLib.ReadXML("lblTatca"));
     if (cbo_lanquage.Items.Count >= 3)
     {
         cbo_lanquage.SelectedIndex = HPCComponents.Global.DefaultLangID;
     }
     else
     {
         cbo_lanquage.SelectedIndex = UltilFunc.GetIndexControl(this.cbo_lanquage, HPCComponents.Global.DefaultCombobox);
     }
     if (cbo_lanquage.SelectedIndex != 0)
     {
         UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" 1=1 and HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cbo_lanquage.SelectedValue + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
     }
 }
Exemplo n.º 7
0
        private void LoadData_DangXuly()
        {
            string sOrder = GetOrderString() == "" ? "" : " ORDER BY " + GetOrderString();

            pages.PageSize = Global.MembersPerPage;
            HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
            string tieude = txt_tieude.Text.Trim();

            Session["searchvalueroot"] = null;
            if (tieude != "")
            {
                Session["searchvalueroot"] = UltilFunc.SplitString(tieude);
            }
            DataSet _ds;

            _ds = _T_newsDAL.BindGridT_NewsDynamic(pages.PageIndex, pages.PageSize, BuildSQL(6, sOrder), UltilFunc.ReplaceAll(UltilFunc.SplitString(tieude), "'", "’"));
            int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString());
            int TotalRecord  = Convert.ToInt32(_ds.Tables[0].Rows.Count);

            if (TotalRecord == 0)
            {
                for (int i = 1; i <= TotalRecords; i++)
                {
                    _ds = _T_newsDAL.BindGridT_NewsDynamic(pages.PageIndex - i, pages.PageSize, BuildSQL(6, sOrder), UltilFunc.ReplaceAll(UltilFunc.SplitString(tieude), "'", "’"));
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        break;
                    }
                }
            }
            dgr_tintuc1.DataSource = _ds;
            dgr_tintuc1.DataBind();
            pages.TotalRecords      = CurrentPage2.TotalRecords = TotalRecords;
            CurrentPage2.TotalPages = pages.CalculateTotalPages();
            CurrentPage2.PageIndex  = pages.PageIndex;

            GetTotal();
            _ds.Clear();
        }
Exemplo n.º 8
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     context.Response.Expires     = -1;
     try
     {
         HttpPostedFile postedFile = context.Request.Files["Filedata"];
         string[]       sArrProdID = null;
         char[]         sep        = { '?' };
         string[]       sArrVkey   = null;
         string         strUserID  = "";
         char[]         sep2       = { ',' };
         sArrProdID = context.Request.QueryString["user"].ToString().Trim().Split(sep);
         sArrVkey   = sArrProdID[0].ToString().Trim().Split(sep2);
         string _urlSave           = "";
         string FolderCat          = "";
         string savepath           = "";
         string tempPath           = "";
         string strRootPathVirtual = "";
         _user     = _userDAL.GetUserByUserName(sArrVkey[0].ToString());
         strUserID = _user.UserID.ToString();
         string vType   = sArrVkey[1].ToString();
         string AlbumID = sArrVkey[2].ToString();
         if (vType == "1")
         {
             FolderCat = "/Article/";
         }
         else if (vType == "2")
         {
             FolderCat = "/Ads/";
         }
         else if (vType == "3")
         {
             FolderCat = "/Video/";
         }
         else if (vType == "4")
         {
             FolderCat = "/Photo24/";
         }
         else
         {
             FolderCat = "";
         }
         tempPath           = System.Configuration.ConfigurationManager.AppSettings["UploadPathBDT"] + FolderCat + sArrVkey[0].ToString() + "/";
         strRootPathVirtual = tempPath + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/";
         savepath           = context.Server.MapPath(strRootPathVirtual);
         string filename   = DateTime.Now.Millisecond.ToString() + "_" + postedFile.FileName;
         string _extenfile = Path.GetExtension(filename.ToString().Trim()).Replace(".", "");
         if (!Directory.Exists(savepath))
         {
             Directory.CreateDirectory(savepath);
         }
         postedFile.SaveAs(savepath + @"\" + filename);
         string _logo = context.Server.MapPath("../Dungchung/Images/IconHPC/LoGoDongDau.png");
         string _imagesEndWatermark = DateTime.Now.ToString("yyyyMMdd").ToString() + DateTime.Now.ToString("HHmmss") + DateTime.Now.Millisecond + UltilFunc.ReplaceCharsRewrite(filename.Replace(Path.GetExtension(filename.ToString().Trim()), "")) + "." + _extenfile;
         _urlSave = UrlPathImage_RemoveUpload(strRootPathVirtual + _imagesEndWatermark);
         // Begin BO CT EDIT Đóng dấu ảnh
         if (Convert.ToBoolean(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["WatermarkImages"])))
         {
             HPCImageResize.SaveImage2Server(savepath, filename, "rez_" + filename, _imagesEndWatermark, _logo, Convert.ToInt32(HPCComponents.Global.VNPResizeImages), Convert.ToInt32(HPCComponents.Global.VNPResizeImages));
         }
         else// Không đóng dấu ảnh //END
         {
             HPCImageResize.SaveImage2Server(savepath, filename, _imagesEndWatermark, Convert.ToInt32(HPCComponents.Global.VNPResizeImages), Convert.ToInt32(HPCComponents.Global.VNPResizeImages));
         }
         // INSERT DATABASE
         //phan insert co so du lieu
         T_ImageFiles  _objImage = new T_ImageFiles();
         ImageFilesDAL _DAL      = new ImageFilesDAL();
         _objImage = SetItemImageFiles(filename, postedFile.ContentLength, _urlSave, _extenfile, Convert.ToInt16(strUserID), Convert.ToInt16(vType), 0);
         int _idReturn = _DAL.InsertT_ImageFiles(_objImage);
         //phan insert Anh phong su
         T_Photo_EventDAL _cateDAL = new T_Photo_EventDAL();
         T_Photo_Event    _obj     = new T_Photo_Event();
         _obj = setItem(_urlSave, postedFile.FileName);
         int _return = _cateDAL.InsertT_Photo_Events(_obj);
         context.Response.Write(savepath + "/" + filename);
         context.Response.StatusCode = 200;
     }
     catch (Exception ex)
     {
         context.Response.Write("Error: " + ex.Message);
     }
 }
Exemplo n.º 9
0
 protected void Search_Click(object sender, EventArgs e)
 {
     Session["where_chuyenmuc"] = null;
     string where = " Ma_Chuyenmuc_Cha=0";
     if (cbo_Anpham.SelectedIndex > 0)
     {
         where += " and Ma_AnPham=" + cbo_Anpham.SelectedValue.ToString();
     }
     if (!String.IsNullOrEmpty(this.txtSearch_ChuyenMuc.Text.Trim()))
     {
         where += " and " + string.Format(" Ten_ChuyenMuc like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch_ChuyenMuc.Text.Trim()))
                  + " or Ma_ChuyenMuc in( select Ma_Chuyenmuc_Cha from T_ChuyenMuc where Ma_ChuyenMuc in (select Ma_ChuyenMuc from T_ChuyenMuc where " + string.Format(" Ten_ChuyenMuc like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch_ChuyenMuc.Text.Trim())) + "))";
     }
     if (chk_Hoatdong.Checked)
     {
         where += " and Hoatdong=1";
     }
     if (!chk_Hoatdong.Checked)
     {
         where += " and Hoatdong=0";
     }
     if (CheckBoxBaoDT.Checked)
     {
         where += " and HienThi_BDT=1";
     }
     if (CheckBoxBaoIn.Checked)
     {
         where += " and HienThi_BaoIn=1";
     }
     Session["where_chuyenmuc"] = where;
     pages.PageIndex            = 0;
     Danhsach_ChuyenMuc();
 }
        protected void linkSave_Click(object sender, EventArgs e)
        {
            //dung them vao de kiem tra dieu dau vao và để busybox khong bi dung trong IE
            if (Txt_tieude.Text.Length <= 0)
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanLuu") + "');", true);
                return;
            }
            if (cbo_lanquage.SelectedIndex == 0)
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanLuu") + "');", true);
                return;
            }

            if (cbo_chuyenmuc.SelectedIndex == 0)
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanLuu") + "');", true);
                return;
            }
            if (!string.IsNullOrEmpty(txtTienNhuanBut.Text))
            {
                try { int.Parse(txtTienNhuanBut.Text.Replace(",", "")); }
                catch
                {
                    System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanTien") + "');", true);
                    return;
                }
            }
            T_News    _t_news    = SetItem(ConstNews.NewsApproving_tb);
            int       id         = 0;
            T_NewsDAL _T_newsDAL = new T_NewsDAL();

            //T_News _objSet = SetItem(ConstNews.NewsApproving_tb);
            // Insert
            id = _T_newsDAL.InsertT_news(_t_news);
            // Insert keyword
            InsertKeyword(id, _user.UserID);
            UltilFunc.Insert_News_Image(txt_noidung.Text.Trim(), Convert.ToDouble(Page.Request["id"]));
            int tab = 0;

            if (Request["ID"] == null)
            {
                if (Page.Request["Tab"] != null && Page.Request["Tab"].ToString() != "-1")
                {
                    tab = Convert.ToInt32(Page.Request["Tab"].ToString());
                    if (tab == 10)
                    {
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                       Request["Menu_ID"].ToString(), "[Tin tức đang đăng] [Thao tác cập nhật]", id, ConstAction.BaoDT);
                    }
                    else
                    {
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                       Request["Menu_ID"].ToString(), "[Biên tập tin bài] [Tin bài đang biên tập] [Thao tác cập nhật]", id, ConstAction.BaoDT);
                    }
                }
                else
                {
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                   Request["Menu_ID"].ToString(), "[Biên tập tin bài] [Tin tức đang chờ xuất bản:] [Thao tác cập nhật]", id, ConstAction.BaoDT);
                }
            }
            else
            {
                if (Page.Request["Tab"] != null && Page.Request["Tab"].ToString() != "-1")
                {
                    tab = Convert.ToInt32(Page.Request["Tab"].ToString());
                    if (tab == 10)
                    {
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                       Request["Menu_ID"].ToString(), "[Tin tức đang đăng] [Thao tác cập nhật]", _t_news.News_ID, ConstAction.BaoDT);
                    }
                    else
                    {
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                       Request["Menu_ID"].ToString(), "[Biên tập tin bài] [Tin bài đang biên tập] [Thao tác cập nhật]", _t_news.News_ID, ConstAction.BaoDT);
                    }
                }
                else
                {
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _t_news.News_Tittle,
                                                                   Request["Menu_ID"].ToString(), "[Biên tập tin bài] [Tin tức đang chờ xuất bản] [Thao tác cập nhật]", _t_news.News_ID, ConstAction.BaoDT);
                }
            }
            if (_t_news.Images_Summary.Length > 0)
            {
                this.ImgTemp.Src = HPCComponents.Global.TinPathBDT + "/" + _t_news.Images_Summary;
            }
            _T_newsDAL.IsLock(double.Parse(_t_news.News_ID.ToString()), 1, _user.UserID);
            if (Request["Tab"] != null && Request["Tab"].ToString() != "" && Request["Tab"].ToString() != String.Empty)
            {
                Response.Redirect("ArticleApproveEditTB.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString() + "&ID=" + id.ToString());
            }
            else
            {
                Response.Redirect("ArticleApproveEditTB.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + id.ToString());
            }
        }
 public override void DataBind()
 {
     if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty)
     {
         lblTitleCaption.Text = CommonLib.ReadXML("lblCapnhatbaiviet");
         if (CommonLib.IsNumeric(Request["ID"]) == true)
         {
             int ChildID = Convert.ToInt32(Request["ID"].ToString());
             PopulateItem(ChildID);
         }
     }
     else
     {
         lblTitleCaption.Text = CommonLib.ReadXML("lblSuabaiviet");
         this.ImgTemp.Attributes.CssStyle.Add("display", "none");
         this.cbHienthiAnh.Checked = false;
         //if (cbo_lanquage.SelectedIndex > 0)
         //{
         //    cbo_chuyenmuc.Items.Clear();
         //    if (cbo_lanquage.SelectedIndex >= 0)
         //    {
         UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
         cbo_chuyenmuc.UpdateAfterCallBack = true;
         //    }
         //    else
         //    {
         //        this.cbo_chuyenmuc.DataSource = null;
         //        this.cbo_chuyenmuc.DataBind();
         //        this.cbo_chuyenmuc.UpdateAfterCallBack = true;
         //    }
         //}
     }
 }
        private void PopulateItem(int _id)
        {
            //Lấy ID trong T_AutoSave
            AutoSavesDAL _dal        = new AutoSavesDAL();
            int          id_autoSave = _dal.Get_ID_AutoSave(_id, _user.UserID);

            txtID.Text = id_autoSave.ToString();
            //end
            HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
            HPCInfo.T_News _obj = new T_News();
            _obj = _untilDAL.load_T_news(_id);
            if (_obj != null)
            {
                this.txt_Author_name.Text = _obj.News_AuthorName;
                this.Txt_tieude.Text      = _obj.News_Tittle;
                this.txt_TieuDePhu.Text   = _obj.News_Sub_Title;
                this.txt_noidung.Text     = _obj.News_Body;
                //this.ddlNews_Priority.SelectedValue = _obj.News_Priority.ToString();
                this.chk_IsCategorys.Checked       = _obj.News_IsCategorys;
                this.chk_IsHomePages.Checked       = _obj.News_IsHomePages;
                this.chk_IsCategoryParrent.Checked = _obj.News_IsCategoryParrent;
                this.chkHistorys.Checked           = _obj.News_IsHistory;
                this.chkImages.Checked             = _obj.News_IsImages;
                this.chkVideo.Checked = _obj.News_IsVideo;
                if (_obj.News_TienNB > 0.0)
                {
                    this.txtTienNhuanBut.Text = string.Format("{0:#,#}", _obj.News_TienNB).Replace(".", ",");
                }
                //this.ddlNews_IsType.SelectedValue = _obj.News_IsType.ToString();
                this.chkNewsIsFocus.Checked = _obj.News_IsFocus;
                this.chkNewsIsHot.Checked   = _obj.News_IsHot;
                if (_obj.Images_Summary.Length > 0)
                {
                    this.ImgTemp.Src = HPCComponents.Global.UploadPathBDT + _obj.Images_Summary;
                }
                else
                {
                    this.ImgTemp.Attributes.CssStyle.Add("display", "none");
                }
                this.Txt_Comments.Text = _obj.News_Comment;
                this.txt_tomtat.Text   = _obj.News_Summary;
                this.txtThumbnail.Text = _obj.Images_Summary;
                this.txtTukhoa.Text    = _untilDAL.GetKeywordsByNewsID(_id);

                this.cbo_lanquage.SelectedValue = _obj.Lang_ID.ToString();
                this.cbo_chuyenmuc.Items.Clear();
                if (cbo_lanquage.SelectedIndex > 0)
                {
                    UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cbo_lanquage.SelectedValue + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by Ten_ChuyenMuc ASC");
                    cbo_chuyenmuc.UpdateAfterCallBack = true;
                    cbo_chuyenmuc.SelectedIndex       = CommonLib.GetIndexControl(cbo_chuyenmuc, _obj.CAT_ID.ToString());
                }
                else
                {
                    this.cbo_chuyenmuc.DataSource = null;
                    this.cbo_chuyenmuc.DataBind();
                    this.cbo_chuyenmuc.UpdateAfterCallBack = true;
                }
                //bind bai viet lien quan
                if (_obj.News_Realate.ToString().Trim() != "")
                {
                    txtListID.Text = _obj.News_Realate.ToString().Trim().Replace(",0", "");
                }
                LoadNewRealation();
                txtVideoPath.Text            = _obj.News_PhotoAtt;
                txtChuthichanh.Text          = _obj.News_DescImages;
                this.cbHienthiAnh.Checked    = _obj.Image_Hot;
                this.txtNguon.Text           = _obj.News_Nguon;
                this.cbDisplayMobile.Checked = _obj.News_DisplayMobile;
                this.cbMoreViews.Checked     = _obj.News_Delete;
                //if (_obj.Image_Hot)
                //    this.cbHienthiAnh.Text = "Hiển thị trong tin chi tiết";
                //else
                //    this.cbHienthiAnh.Text = "Không hiển thị trong tin chi tiết";
                if (_untilDAL.Get_NewsVersion(_untilDAL.load_T_news(Convert.ToInt32(_id)).News_CopyFrom, 7, 92) ||
                    _untilDAL.Get_NewsVersion(_untilDAL.load_T_news(Convert.ToInt32(_id)).News_CopyFrom, 7, 82))
                {
                    btn_Layout.Visible = true;
                }
                else
                {
                    btn_Layout.Visible = false;
                }
            }
        }
Exemplo n.º 13
0
 private void LoadComboBox()
 {
     UltilFunc.BindCombox(ddlLang, "Ma_AnPham", "Ten_AnPham", "T_AnPham", " 1=1 ", CommonLib.ReadXML("lblTatca"));
     if (ddlLang.Items.Count >= 3)
     {
         ddlLang.SelectedIndex = Global.DefaultLangID;
     }
     else
     {
         ddlLang.SelectedIndex = UltilFunc.GetIndexControl(ddlLang, Global.DefaultCombobox);
     }
     if (ddlLang.SelectedIndex != 0)
     {
         UltilFunc.BindCombox(ddlCategorys, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham=" + this.ddlLang.SelectedValue.ToString() + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
     }
     else
     {
         UltilFunc.BindCombox(ddlCategorys, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham=" + this.ddlLang.SelectedValue.ToString() + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
     }
 }
Exemplo n.º 14
0
        public void LoadDetails(int NewsID, bool ViewHistory, bool chieu, int currentindex, bool clickgrid)
        {
            if (!ViewHistory)
            {
                T_News       obj   = new T_News();
                T_NewsDAL    dal   = new T_NewsDAL();
                ChuyenmucDAL caDal = new ChuyenmucDAL();
                obj = dal.load_T_news(NewsID);
                System.Text.StringBuilder _Builer = new System.Text.StringBuilder();
                string _image = "";
                if (obj != null && obj.News_ID > 0)
                {
                    try
                    {
                        if (obj.News_DateEdit != null && obj.News_DateEdit.ToString().Length > 0)
                        {
                            this.litDateTime.Text = Convert.ToDateTime(obj.News_DateEdit.ToString()).ToString("dd/MM/yyyy HH:mm");
                        }
                        if (obj.News_DatePublished != null && obj.News_DatePublished.ToString().Length > 0)
                        {
                            this.litDateTime.Text = Convert.ToDateTime(obj.News_DatePublished.ToString()).ToString("dd/MM/yyyy HH:mm");
                        }
                        this.litTittle.Text    = obj.News_Tittle.ToString();
                        this.litSapo.Text      = obj.News_Summary.ToString();
                        this.litCategorys.Text = "<a href=\"#\">" + HPCBusinessLogic.UltilFunc.GetCategoryName(obj.CAT_ID) + "</a>";
                        if (obj.News_PhotoAtt != null && obj.News_PhotoAtt.ToString().Length > 0)
                        {
                            if (UltilFunc.CheckFrames(obj.News_PhotoAtt.ToString()) == false)
                            {
                                _Builer.Append("<div id=\"liveTV\"></div>");
                                _Builer.Append(" <script type=\"text/javascript\">jwplayer('liveTV').setup({ ");
                                _Builer.Append(" image: '" + HPCComponents.Global.TinPath + obj.Images_Summary.ToString() + "',");
                                _Builer.Append(" file: '" + HPCComponents.Global.TinPath + obj.News_PhotoAtt.ToString() + "', ");
                                _Builer.Append(" width: 665,height: 400,autostart: false,");
                                _Builer.Append(" backcolor: '#000000',frontcolor: '#ffffff',lightcolor: '#ffffff',screencolor: '#ffffff',");
                                _Builer.Append(" allowscriptaccess: true,allowfullscreen: true,controlbar: 'over',stretching:'fill'});</script>");
                                if (obj.News_DescImages != null && obj.News_DescImages.ToString().Length > 0)
                                {
                                    _Builer.Append("<div class=\"title\"><span>" + obj.News_DescImages.ToString() + "</span></div>");
                                }
                                //this.litImage.Text = _Builer.ToString();
                            }
                            else
                            {
                                string _youReziHeigh = "";
                                try
                                {
                                    string _youReziWith = UltilFunc.ReplapceYoutoubeWidth(obj.News_PhotoAtt.ToString(), "665");
                                    _youReziHeigh = UltilFunc.ReplapceYoutoubeHight(_youReziWith.ToString(), "400");
                                }
                                catch
                                {
                                    _youReziHeigh = "";
                                }
                                //this.litImage.Text = _youReziHeigh.ToString();
                            }
                        }
                        else
                        {
                            if (obj.Images_Summary != null && obj.Images_Summary.ToString().Length > 0)
                            {
                                _image = "<img style=\"width:665px;\" alt=\"" + obj.News_Tittle.ToString() + "\" title=\"" + obj.News_Tittle.ToString() + "\" src=\"" + HPCComponents.Global.TinPath + obj.Images_Summary.ToString() + "\" />";
                                if (obj.News_DescImages != null && obj.News_DescImages.ToString().Length > 0)
                                {
                                    _image += "<div class=\"title\"><span>" + obj.News_DescImages.ToString() + "</span></div>";
                                }
                            }
                            //this.litImage.Text = _image.ToString();
                        }
                        this.litContents.Text = SearchImgTag(SearchSlideImg(obj.News_Body.ToString()));
                        //this.litCategorys.Text = "<a href=\"#\">" + dt.Rows[0]["Categorys_Name"] + "</a>";
                        if (obj.News_AuthorName != null && obj.News_AuthorName.ToString().Length > 0)
                        {
                            this.litAuthor.Text = "<div class=\"author\">" + obj.News_AuthorName.ToString() + "</div>";
                        }
                        //this.LitNhuanbut.Text = obj.News_TienNB.ToString();
                        if (obj.News_TienNB > 0.0)
                        {
                            this.LitNhuanbut.Text = string.Format("{0:#,#}", obj.News_TienNB).Replace(".", ",");
                        }
                        else
                        {
                            this.LitNhuanbut.Text = "";
                        }
                        //string count = string.Empty;
                        //count = this.litContents.Text;
                        //if (count != "")
                        //    this.LitCount.Text = UltilFunc.WordCount(count) + " từ ";
                        //else
                        //    this.LitCount.Text = "";
                        this.Literal_nguoinhap.Text = HPCBusinessLogic.UltilFunc.GetUserFullName(obj.News_AuthorID);
                        this.Literal_nguoiluu.Text  = HPCBusinessLogic.UltilFunc.GetUserFullName(obj.News_EditorID);
                        this.Literal_ngayluu.Text   = Convert.ToDateTime(obj.News_DateEdit).ToString("dd/MM/yyyy HH:mm");

                        ViewState["ver"] = -1;
                    }
                    catch {; }
                }
            }
            else
            {
                T_News       obj   = new T_News();
                T_NewsDAL    dal   = new T_NewsDAL();
                ChuyenmucDAL caDal = new ChuyenmucDAL();
                obj = dal.load_T_news(NewsID);
                DataSet ds = dal.GetDetailHistory(NewsID);
                System.Text.StringBuilder _Builer = new System.Text.StringBuilder();
                string _image         = "";
                int    gridview_index = 0;
                if (ds != null)
                {
                    try
                    {
                        DataTable dt = ds.Tables[0];
                        if (dt.Rows[0]["News_DateEdit"] != null && dt.Rows[0]["News_DateEdit"].ToString().Length > 0)
                        {
                            this.litDateTime.Text = Convert.ToDateTime(dt.Rows[0]["News_DateEdit"].ToString()).ToString("dd/MM/yyyy HH:mm");
                        }
                        if (dt.Rows[0]["News_DatePublished"] != null && dt.Rows[0]["News_DatePublished"].ToString().Length > 0)
                        {
                            this.litDateTime.Text = Convert.ToDateTime(dt.Rows[0]["News_DatePublished"].ToString()).ToString("dd/MM/yyyy HH:mm");
                        }
                        this.litTittle.Text    = dt.Rows[0]["News_Tittle"].ToString();
                        this.litSapo.Text      = dt.Rows[0]["News_Summary"].ToString();
                        this.litCategorys.Text = "<a href=\"#\">" + HPCBusinessLogic.UltilFunc.GetCategoryName(dt.Rows[0]["CAT_ID"]) + "</a>";

                        if (dt.Rows[0]["News_PhotoAtt"] != null && dt.Rows[0]["News_PhotoAtt"].ToString().Length > 0)
                        {
                            if (UltilFunc.CheckFrames(dt.Rows[0]["News_PhotoAtt"].ToString()) == false)
                            {
                                _Builer.Append("<div id=\"liveTV\"></div>");
                                _Builer.Append(" <script type=\"text/javascript\">jwplayer('liveTV').setup({ ");
                                _Builer.Append(" image: '" + HPCComponents.Global.TinPath + dt.Rows[0]["Images_Summary"].ToString() + "',");
                                _Builer.Append(" file: '" + HPCComponents.Global.TinPath + dt.Rows[0]["News_PhotoAtt"].ToString() + "', ");
                                _Builer.Append(" width: 665,height: 400,autostart: false,");
                                _Builer.Append(" backcolor: '#000000',frontcolor: '#ffffff',lightcolor: '#ffffff',screencolor: '#ffffff',");
                                _Builer.Append(" allowscriptaccess: true,allowfullscreen: true,controlbar: 'over',stretching:'fill'});</script>");

                                //this.litImage.Text = _Builer.ToString();
                            }
                            else
                            {
                                string _youReziHeigh = "";
                                try
                                {
                                    string _youReziWith = UltilFunc.ReplapceYoutoubeWidth(dt.Rows[0]["News_PhotoAtt"].ToString(), "665");
                                    _youReziHeigh = UltilFunc.ReplapceYoutoubeHight(_youReziWith.ToString(), "400");
                                }
                                catch
                                {
                                    _youReziHeigh = "";
                                }
                                //this.litImage.Text = _youReziHeigh.ToString();
                            }
                        }
                        else
                        {
                            if (dt.Rows[0]["Images_Summary"] != null && dt.Rows[0]["Images_Summary"].ToString().Length > 0)
                            {
                                _image = "<img style=\"width:665px;\" alt=\"" + dt.Rows[0]["News_Tittle"].ToString() + "\" title=\"" + dt.Rows[0]["News_Tittle"].ToString() + "\" src=\"" + HPCComponents.Global.TinPath + dt.Rows[0]["Images_Summary"].ToString() + "\" />";
                            }
                            //this.litImage.Text = _image.ToString();
                        }

                        if (!string.IsNullOrEmpty(lbl_index.Text))
                        {
                            gridview_index = int.Parse(lbl_index.Text);
                            DataSet ds1 = dal.GetDetailHistory(int.Parse(this.dgr_tintuc1.DataKeys[gridview_index].ToString()));

                            if (clickgrid)
                            {
                                this.litContents.Text = MergeEngineCompare(ds1.Tables[0].Rows[0]["News_Body"].ToString(),
                                                                           dt.Rows[0]["News_Body"].ToString());
                            }
                            else
                            {
                                this.litContents.Text = MergeEngineCompare(ds1.Tables[0].Rows[0]["News_Body"].ToString(), dt.Rows[0]["News_Body"].ToString());
                            }
                        }
                        else
                        {
                            this.litContents.Text = SearchImgTag(SearchSlideImg(dt.Rows[0]["News_Body"].ToString()));
                        }
                        if (dt.Rows[0]["News_AuthorName"] != null && dt.Rows[0]["News_AuthorName"].ToString().Length > 0)
                        {
                            this.litAuthor.Text = "<div class=\"author\">" + dt.Rows[0]["News_AuthorName"].ToString() + "</div>";
                        }
                        if (double.Parse(dt.Rows[0]["News_TienNB"].ToString()) > 0.0)
                        {
                            this.LitNhuanbut.Text = string.Format("{0:#,#}", dt.Rows[0]["News_TienNB"]).Replace(".", ",");
                        }
                        else
                        {
                            this.LitNhuanbut.Text = "";
                        }
                        //string count = string.Empty;
                        //count = this.litContents.Text;
                        //if (count != "")
                        //    this.LitCount.Text = UltilFunc.WordCount(count) + " từ ";
                        //else
                        //    this.LitCount.Text = "";
                        this.Literal_nguoinhap.Text = HPCBusinessLogic.UltilFunc.GetUserFullName(dt.Rows[0]["News_AuthorID"]);
                        this.Literal_nguoiluu.Text  = HPCBusinessLogic.UltilFunc.GetUserFullName(dt.Rows[0]["News_EditorID"]);
                        this.Literal_ngayluu.Text   = Convert.ToDateTime(dt.Rows[0]["News_DateEdit"]).ToString("dd/MM/yyyy HH:mm");

                        ViewState["ver"] = -1;
                    }
                    catch {; }
                }
            }
        }
Exemplo n.º 15
0
 private void PopulateItem(int _id)
 {
     HPCInfo.T_Album_Categories _cateObj = new HPCInfo.T_Album_Categories();
     HPCBusinessLogic.DAL.T_Album_CategoriesDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
     _cateObj = _cateDAL.load_T_Album_Categories(_id);
     if (_cateObj != null)
     {
         Txt_tieudeAbum.Text             = _cateObj.Cat_Album_Name.ToString();
         txt_noidungAlbum.Text           = _cateObj.Cat_AlbumDesc.ToString();
         txtOrder.Text                   = _cateObj.Possition.ToString();
         lbl_status.Text                 = _cateObj.Cat_Album_Status_Approve.ToString();
         this.cbo_lanquage.SelectedValue = _cateObj.Lang_ID.ToString();
         this.cbo_chuyenmuc.Items.Clear();
         if (cbo_lanquage.SelectedIndex > 0)
         {
             UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cbo_lanquage.SelectedValue + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
             cbo_chuyenmuc.UpdateAfterCallBack = true;
             cbo_chuyenmuc.SelectedIndex       = CommonLib.GetIndexControl(cbo_chuyenmuc, _cateObj.Cat_Album_CATID.ToString());
         }
         else
         {
             this.cbo_chuyenmuc.DataSource = null;
             this.cbo_chuyenmuc.DataBind();
             this.cbo_chuyenmuc.UpdateAfterCallBack = true;
         }
         //ddlnews_chatluong.SelectedIndex = _cateObj.Chatluong;
         txt_Author_name.Text = _cateObj.Tacgia;
         if (_cateObj.TongtienTT > 0)
         {
             if (_cateObj.TongtienTT > 0)
             {
                 this.txt_tiennhanbut.Text = string.Format("{0:#,#}", _cateObj.TongtienTT).Replace(".", ",");
             }
         }
         this.txtGhichu.Text = _cateObj.Comment;
         HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL();
         this.txt_Author_name.Text = obj.GetBD_Name(_cateObj.AuthorID);
     }
 }
Exemplo n.º 16
0
        public void Danhsach_ChuyenMuc()
        {
            string where = " Ma_Chuyenmuc_Cha=0";
            if (cbo_Anpham.SelectedIndex > 0)
            {
                where += " and Ma_AnPham=" + cbo_Anpham.SelectedValue.ToString();
            }
            if (!String.IsNullOrEmpty(this.txtSearch_ChuyenMuc.Text.Trim()))
            {
                where += " and " + string.Format(" Ten_ChuyenMuc like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch_ChuyenMuc.Text.Trim()))
                         + " or Ma_ChuyenMuc in( select Ma_Chuyenmuc_Cha from T_ChuyenMuc where Ma_ChuyenMuc in (select Ma_ChuyenMuc from T_ChuyenMuc where " + string.Format(" Ten_ChuyenMuc like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch_ChuyenMuc.Text.Trim())) + "))";
            }
            if (chk_Hoatdong.Checked)
            {
                where += " and Hoatdong=1";
            }
            if (!chk_Hoatdong.Checked)
            {
                where += " and Hoatdong=0";
            }
            if (CheckBoxBaoDT.Checked)
            {
                where += " and HienThi_BDT=1";
            }
            if (CheckBoxBaoIn.Checked)
            {
                where += " and HienThi_BaoIn=1";
            }

            pages.PageSize = Global.MembersPerPage;
            ChuyenmucDAL _chuyenmucDAL = new ChuyenmucDAL();
            DataSet      _ds;

            if (Session["where_chuyenmuc"] != null)
            {
                _ds = _chuyenmucDAL.BindGridT_Cagegorys(pages.PageIndex, pages.PageSize, Session["where_chuyenmuc"].ToString());
            }
            else
            {
                _ds = _chuyenmucDAL.BindGridT_Cagegorys(pages.PageIndex, pages.PageSize, where);
            }
            int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString());
            int TotalRecord  = Convert.ToInt32(_ds.Tables[0].Rows.Count);

            if (TotalRecord == 0)
            {
                if (Session["where_chuyenmuc"] != null)
                {
                    _ds = _chuyenmucDAL.BindGridT_Cagegorys(pages.PageIndex - 1, pages.PageSize, Session["where_chuyenmuc"].ToString());
                }
                else
                {
                    _ds = _chuyenmucDAL.BindGridT_Cagegorys(pages.PageIndex - 1, pages.PageSize, where);
                }
            }
            DataTable dt = _chuyenmucDAL.BindGridCategory(_ds.Tables[0]);

            grdListCate.DataSource = dt;
            grdListCate.DataBind();
            _ds.Clear();
            pages.TotalRecords     = curentPages.TotalRecords = TotalRecords;
            curentPages.TotalPages = pages.CalculateTotalPages();
            curentPages.PageIndex  = pages.PageIndex;
            Session["PageIndex"]   = pages.PageIndex;
        }
Exemplo n.º 17
0
 public override void DataBind()
 {
     if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty)
     {
         if (CommonLib.IsNumeric(Request["ID"]) == true)
         {
             HPCBusinessLogic.DAL.T_Album_CategoriesDAL dal = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
             int _id = Convert.ToInt32(Request["ID"].ToString());
             if (CheckPermission(_id))
             {
                 PopulateItem(_id);
                 if (dal.load_T_Album_Categories(_id).Lang_ID != 1)
                 {
                     cbo_lanquage.Enabled = false;
                 }
                 else
                 {
                     cbo_lanquage.Enabled = true;
                 }
             }
         }
     }
     else
     {
         if (cbo_lanquage.SelectedIndex > 0)
         {
             cbo_chuyenmuc.Items.Clear();
             if (cbo_lanquage.SelectedIndex >= 0)
             {
                 UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cbo_lanquage.SelectedValue + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
                 cbo_chuyenmuc.UpdateAfterCallBack = true;
             }
             else
             {
                 this.cbo_chuyenmuc.DataSource = null;
                 this.cbo_chuyenmuc.DataBind();
                 this.cbo_chuyenmuc.UpdateAfterCallBack = true;
             }
         }
     }
 }
Exemplo n.º 18
0
 public void LoadCombox()
 {
     UltilFunc.BindCombox(cbo_Anpham, "Ma_Anpham", "Ten_Anpham", "T_Anpham", " 1=1 ", (string)HttpContext.GetGlobalResourceObject("cms.language", "lblChonanpham"));
 }
Exemplo n.º 19
0
        public DataTable BindGridT_Cagegorys(int LangID, int AdsLogoID)
        {
            DataSet   _ds       = null;
            DataTable _dtChild  = null;
            DataTable _dtChild2 = null;
            UltilFunc _untilDAL = new UltilFunc();
            DataTable dt        = new DataTable();
            DataRow   drtop;
            DataRow   dr;
            DataRow   dr2;
            DataRow   dr3;

            dt.Columns.Add(new DataColumn("Ma_ChuyenMuc", typeof(string)));
            dt.Columns.Add(new DataColumn("Ten_ChuyenMuc", typeof(string)));
            dt.Columns.Add(new DataColumn("Role", typeof(bool)));
            DataTable _dt = null;

            try
            {
                _ds = HPCDataProvider.Instance().GetStoreDataSet("[CMS_getAllCategorysByLangID]", new string[] { "@LangID", "@AdsLogoID" }, new object[] { LangID, AdsLogoID });
                if (_ds != null)
                {
                    _dt = _ds.Tables[0];

                    drtop    = dt.NewRow();
                    drtop[0] = "0";
                    drtop[1] = "<b>" + "Trang chủ";
                    drtop[2] = Check_RoleByAdvID(AdsLogoID, 0);
                    dt.Rows.Add(drtop);

                    if (_dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < _dt.Rows.Count; i++)
                        {
                            dr    = dt.NewRow();
                            dr[0] = _dt.Rows[i]["Ma_ChuyenMuc"].ToString();
                            dr[1] = "<b>" + _dt.Rows[i]["Ten_ChuyenMuc"].ToString();
                            if (_dt.Rows[i]["Role"].ToString() == "1")
                            {
                                dr[2] = true;
                            }
                            else
                            {
                                dr[2] = false;
                            }
                            dt.Rows.Add(dr);

                            DataSet ds2 = new DataSet();

                            ds2 = HPCDataProvider.Instance().GetStoreDataSet("[Get_ChildCAT_RoleAds]",
                                                                             new string[] { "@ParentID", "@AdsLogoID" }, new object[] { _dt.Rows[i]["Ma_ChuyenMuc"], AdsLogoID });
                            if (ds2 != null && ds2.Tables.Count > 0)
                            {
                                _dtChild = ds2.Tables[0];
                                if (_dtChild.Rows.Count > 0)
                                {
                                    for (int m = 0; m < _dtChild.Rows.Count; m++)
                                    {
                                        dr2    = dt.NewRow();
                                        dr2[0] = _dtChild.Rows[m]["Ma_ChuyenMuc"].ToString();
                                        dr2[1] = "&nbsp;&nbsp;&nbsp;&nbsp;" + _dtChild.Rows[m]["Ten_ChuyenMuc"].ToString();
                                        dr2[2] = Check_RoleByAdvID(AdsLogoID, Convert.ToInt32(_dtChild.Rows[m]["Ma_ChuyenMuc"].ToString()));
                                        dt.Rows.Add(dr2);


                                        DataSet ds3 = new DataSet();

                                        ds3 = HPCDataProvider.Instance().GetStoreDataSet("[Get_ChildCAT_RoleAds]",
                                                                                         new string[] { "@ParentID", "@AdsLogoID" }, new object[] { _dtChild.Rows[m]["Ma_ChuyenMuc"], AdsLogoID });

                                        if (ds3 != null && ds3.Tables.Count > 0)
                                        {
                                            _dtChild2 = ds3.Tables[0];
                                            if (_dtChild2.Rows.Count > 0)
                                            {
                                                for (int k = 0; k < _dtChild2.Rows.Count; k++)
                                                {
                                                    dr3    = dt.NewRow();
                                                    dr3[0] = _dtChild2.Rows[k]["Ma_ChuyenMuc"].ToString();
                                                    dr3[1] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + _dtChild2.Rows[k]["Ten_ChuyenMuc"].ToString();
                                                    dr3[2] = Check_RoleByAdvID(AdsLogoID, Convert.ToInt32(_dtChild2.Rows[k]["Ma_ChuyenMuc"].ToString()));
                                                    dt.Rows.Add(dr3);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _ds       = null;
                _dt       = null;
                _dtChild  = null;
                _dtChild2 = null;
            }
            return(dt);
        }
Exemplo n.º 20
0
        public void DataGridTacGiaTinBai_EditCommand(object source, DataGridCommandEventArgs e)
        {
            double news_id    = double.Parse(Page.Request.QueryString["ID"].ToString());
            double id_select  = int.Parse(this.DataGridTacGiaTinBai.DataKeys[e.Item.ItemIndex].ToString());
            double id_current = int.Parse(ViewState["ver"].ToString());

            if (e.CommandArgument.ToString().ToLower() == "edit")
            {
                T_TinBai objtinbai = new T_TinBai();
                objtinbai = Daltinbai.load_T_news(news_id);
                if (dalcm.GetOneFromT_ChuyenmucByID(objtinbai.Ma_Chuyenmuc) != null)
                {
                    Chuyenmuc = dalcm.GetOneFromT_ChuyenmucByID(objtinbai.Ma_Chuyenmuc).Ten_ChuyenMuc;
                }
                else
                {
                    Chuyenmuc = "";
                }
                T_PhienBan objver_current = new T_PhienBan();
                T_PhienBan objver_select  = new T_PhienBan();

                objver_current = Daltinbai.Sp_SelectOneFromT_PhienBan(id_current);
                objver_select  = Daltinbai.Sp_SelectOneFromT_PhienBan(id_select);

                if (objver_select.Sotu != 0)
                {
                    Sotu = objver_select.Sotu.ToString();
                }
                else
                {
                    Sotu = "0";
                }
                if (objver_select.Tiennhuanbut > 0)
                {
                    Nhuanbut = String.Format("{0:00,0}", Convert.ToDecimal(objver_select.Tiennhuanbut.ToString()));
                }
                else
                {
                    Nhuanbut = String.Format("{0:00,0}", "0");
                }
                //string sqltien = "select Sotien,Ma_tacgia from T_NhuanBut where Ma_tacgia<>" + objver_select.Ma_TacGia + " and Ma_TinBai=" + news_id + " and Nguoicham=" + objver_select.Ma_Nguoitao;
                //DataTable dtnhuanbut = _ulti.ExecSqlDataSet(sqltien).Tables[0];
                //if (dtnhuanbut != null && dtnhuanbut.Rows.Count > 0)
                //{
                //    for (int i = 0; i < dtnhuanbut.Rows.Count; i++)
                //    {
                //        if (i == 0)
                //            Nhuanbut += "; " + String.Format("{0:00,0}", Convert.ToDecimal(dtnhuanbut.Rows[i]["Sotien"].ToString())) + "; ";
                //        else
                //            Nhuanbut += String.Format("{0:00,0}", Convert.ToDecimal(dtnhuanbut.Rows[i]["Sotien"].ToString())) + "; ";
                //    }
                //}
                DataTable dttrangbaosobao = UltilFunc.GetTrangSoBaoFrom_T_VitriTiBai(int.Parse(news_id.ToString()));
                if (dttrangbaosobao != null && dttrangbaosobao.Rows.Count > 0)
                {
                    Sotrang = " Trang: " + dttrangbaosobao.Rows[0]["Trang"].ToString();
                }
                else
                {
                    Sotrang = "";
                }


                if (checkversion.Checked == true)
                {
                    if (id_select > id_current)
                    {
                        Tieude  = MergeEngineCompare(objver_current.Tieude, objver_select.Tieude.ToString());
                        Noidung = MergeEngineCompare(objver_current.Noidung.ToString(), objver_select.Noidung.ToString());
                    }
                    else
                    {
                        Tieude  = MergeEngineCompare(objver_select.Tieude, objver_current.Tieude.ToString());
                        Noidung = MergeEngineCompare(objver_select.Noidung.ToString(), objver_current.Noidung.ToString());
                    }
                }
                else
                {
                    Noidung = UltilFunc.CleanWordHtml(objver_select.Noidung.ToString());
                }

                Ghichu = objver_select.GhiChu;
                Tacgia = objver_select.TacGia;


                if (_NguoidungDAL.GetUserByUserName_ID((int)objver_select.Ma_Nguoitao) != null)
                {
                    nguoisua = _NguoidungDAL.GetUserByUserName_ID((int)objver_select.Ma_Nguoitao).UserFullName;
                }
                else
                {
                    nguoisua = "User does not exist";
                }

                if (objver_current != null)
                {
                    nguoisuaprev = _NguoidungDAL.GetUserByUserName_ID((int)objver_current.Ma_Nguoitao).UserFullName;
                    if (id_select > id_current)
                    {
                        checkversion.Text = nguoisuaprev + " <img src=\"../Dungchung/Images/rt1.gif\" /> " + nguoisua;
                    }
                    else
                    {
                        checkversion.Text = nguoisua + "<img src=\"../Dungchung/Images/lt1.gif\" /> " + nguoisuaprev;
                    }
                }
                ViewState["ver"] = objver_select.Ma_Phienban;
                LoadDataImagePhienban(ViewState["ver"].ToString());
            }
        }
Exemplo n.º 21
0
        protected void GetTotal()
        {
            string sOrder = "";

            if (TabContainer1.ActiveTabIndex == 0)
            {
                sOrder = GetOrderString() == "" ? "" : " ORDER BY " + GetOrderString();
            }
            else
            {
                sOrder = " ORDER BY News_DateSend DESC ";
            }
            string tieude = txt_tieude.Text.Trim();

            Session["searchvalueroot"] = null;
            if (tieude != "")
            {
                Session["searchvalueroot"] = UltilFunc.SplitString(tieude);
            }
            string _dangdang, _dsngungdang;

            _dangdang    = UltilFunc.GetTotalCountT_NewsStatus(BuildSQL(ConstNews.NewsPublishing, sOrder), UltilFunc.ReplaceAll(UltilFunc.SplitString(tieude), "'", "’"), "[CMS_ListCountT_News_FullTextSearch]").ToString();
            _dsngungdang = UltilFunc.GetTotalCountT_NewsStatus(BuildSQL(ConstNews.NewsUnPublishing, sOrder), UltilFunc.ReplaceAll(UltilFunc.SplitString(tieude), "'", "’"), "[CMS_ListCountT_News_FullTextSearch]").ToString();
            _dangdang    = (string)HttpContext.GetGlobalResourceObject("cms.language", "lblTinxuatban") + " (" + _dangdang + ")";
            _dsngungdang = (string)HttpContext.GetGlobalResourceObject("cms.language", "lblTinngungdang") + " (" + _dsngungdang + ")";
            System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "javascript", "javascript: SetInnerProcess('" + _dangdang + "','" + _dsngungdang + "');", true);
        }
Exemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = int.Parse(Page.Request.QueryString["ID"].ToString());

            if (Page.Request.QueryString["Menu_ID"] != null)
            {
                if (!IsPostBack)
                {
                    T_TinBai obj = new T_TinBai();
                    obj    = Daltinbai.load_T_news(id);
                    Tieude = obj.Tieude;
                    if (obj.Sotu != 0)
                    {
                        Sotu = obj.Sotu.ToString();
                    }
                    else
                    {
                        Sotu = "0";
                    }
                    if (obj.Tiennhuanbut > 0)
                    {
                        Nhuanbut = String.Format("{0:00,0}", Convert.ToDecimal(obj.Tiennhuanbut.ToString()));
                    }
                    else
                    {
                        Nhuanbut = String.Format("{0:00,0}", "0");
                    }
                    //string sqltien = "select Sotien,Ma_tacgia from T_NhuanBut where Ma_tacgia<>" + obj.Ma_TacGia + " and Ma_TinBai=" + id;
                    //DataTable dtnhuanbut = _ulti.ExecSqlDataSet(sqltien).Tables[0];
                    //if (dtnhuanbut != null && dtnhuanbut.Rows.Count > 0)
                    //{
                    //    for (int i = 0; i < dtnhuanbut.Rows.Count; i++)
                    //    {
                    //        if (i == 0)
                    //            Nhuanbut += "; " + String.Format("{0:00,0}", Convert.ToDecimal(dtnhuanbut.Rows[i]["Sotien"].ToString())) + "; ";
                    //        else
                    //            Nhuanbut += String.Format("{0:00,0}", Convert.ToDecimal(dtnhuanbut.Rows[i]["Sotien"].ToString())) + "; ";
                    //    }
                    //}


                    if (dalcm.GetOneFromT_ChuyenmucByID(obj.Ma_Chuyenmuc) != null)
                    {
                        Chuyenmuc = dalcm.GetOneFromT_ChuyenmucByID(obj.Ma_Chuyenmuc).Ten_ChuyenMuc;
                    }
                    else
                    {
                        Chuyenmuc = "";
                    }
                    Tieude  = obj.Tieude.ToString();
                    Noidung = obj.Noidung.ToString();
                    Ghichu  = obj.GhiChu;
                    Tacgia  = obj.TacGia;

                    DataTable dttrangbaosobao = UltilFunc.GetTrangSoBaoFrom_T_VitriTiBai(id);
                    if (dttrangbaosobao != null && dttrangbaosobao.Rows.Count > 0)
                    {
                        Sotrang = " Trang: " + dttrangbaosobao.Rows[0]["Trang"].ToString();
                    }
                    else
                    {
                        Sotrang = "";
                    }

                    if (_NguoidungDAL.GetUserByUserName_ID((int)obj.Ma_Nguoitao) != null)
                    {
                        nguoisua = _NguoidungDAL.GetUserByUserName_ID((int)obj.Ma_Nguoitao).UserFullName;
                    }
                    else
                    {
                        nguoisua = "User does not exist";
                    }
                    DataTable dtphienban = Daltinbai.GetOneFromT_PhienbanByNews_ID(id, -1, false).Tables[0];
                    if (dtphienban != null && dtphienban.Rows.Count > 0)
                    {
                        ViewState["ver"] = dtphienban.Rows[0]["Ma_Phienban"].ToString();
                    }
                    else
                    {
                        ViewState["ver"] = -1;
                    }
                    LoadDataImageTinBai(id.ToString());
                    BindGrid();
                }
            }
        }
Exemplo n.º 23
0
 protected void cbo_lanquage_SelectedIndexChanged(object sender, EventArgs e)
 {
     cbo_chuyenmuc.Items.Clear();
     if (cboNgonNgu.SelectedIndex > 0)
     {
         UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), (string)HttpContext.GetGlobalResourceObject("cms.language", "lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
         cbo_chuyenmuc.UpdateAfterCallBack = true;
     }
     else
     {
         cbo_chuyenmuc.DataSource = null;
         cbo_chuyenmuc.DataBind();
         cbo_chuyenmuc.UpdateAfterCallBack = true;
     }
 }
Exemplo n.º 24
0
        public DataTable BindGridMenuByGroup(int GroupID, string langid)
        {
            UltilFunc _untilDAL = new UltilFunc();
            DataTable dt        = new DataTable();
            DataRow   dr;

            dt.Columns.Add(new DataColumn("Ma_Chucnang", typeof(int)));
            dt.Columns.Add(new DataColumn("Ten_chucnang", typeof(string)));
            dt.Columns.Add(new DataColumn("STT", typeof(string)));
            dt.Columns.Add(new DataColumn("URL_Chucnang", typeof(string)));
            dt.Columns.Add(new DataColumn("Mota", typeof(string)));
            dt.Columns.Add(new DataColumn("Role_Menu", typeof(bool)));

            dt.Columns.Add(new DataColumn("Doc", typeof(bool)));
            dt.Columns.Add(new DataColumn("Ghi", typeof(bool)));
            dt.Columns.Add(new DataColumn("Xoa", typeof(bool)));

            DataTable _dt = _untilDAL.GetStoreDataSet("sp_BindGridMenuByGroup", new string[] { "@Parrent_ID", "@Group_ID", "@lang_ID" }, new object[] { 0, GroupID, langid }).Tables[0];

            if (_dt.Rows.Count > 0)
            {
                for (int i = 0; i < _dt.Rows.Count; i++)
                {
                    dr    = dt.NewRow();
                    dr[0] = _dt.Rows[i]["Ma_Chucnang"].ToString();
                    dr[1] = _dt.Rows[i]["Ten_chucnang"].ToString();
                    dr[2] = _dt.Rows[i]["STT"].ToString();
                    dr[3] = _dt.Rows[i]["URL_Chucnang"].ToString();
                    dr[4] = _dt.Rows[i]["Mota"].ToString();

                    dr[5] = Convert.ToBoolean(_dt.Rows[i]["role"]);
                    if (_dt.Rows[i]["Doc"] != DBNull.Value)
                    {
                        dr[6] = Convert.ToBoolean(_dt.Rows[i]["Doc"]);
                    }
                    else
                    {
                        dr[6] = false;
                    }
                    if (_dt.Rows[i]["Ghi"] != DBNull.Value)
                    {
                        dr[7] = Convert.ToBoolean(_dt.Rows[i]["Ghi"]);
                    }
                    else
                    {
                        dr[7] = false;
                    }
                    if (_dt.Rows[i]["Xoa"] != DBNull.Value)
                    {
                        dr[8] = Convert.ToBoolean(_dt.Rows[i]["Xoa"]);
                    }
                    else
                    {
                        dr[8] = false;
                    }

                    dt.Rows.Add(dr);
                    //Kiem tra xem chuc nang co chuyen muc con hay khong
                    if (HPCBusinessLogic.UltilFunc.GetLatestID("T_Chucnang", "Ma_Chucnang", "WHERE Ma_Chucnang_Cha=" + _dt.Rows[i].ItemArray[0].ToString()) > 0)
                    {
                        DataTable _dtChild = _untilDAL.GetStoreDataSet("sp_BindGridMenuByGroup", new string[] { "@Parrent_ID", "@Group_ID", "@lang_ID" }, new object[] { _dt.Rows[i].ItemArray[0], GroupID, langid }).Tables[0];
                        if (_dtChild.Rows.Count > 0)
                        {
                            for (int j = 0; j < _dtChild.Rows.Count; j++)
                            {
                                dr    = dt.NewRow();
                                dr[0] = _dtChild.Rows[j]["Ma_Chucnang"].ToString();
                                dr[1] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + _dtChild.Rows[j]["Ten_chucnang"].ToString();
                                dr[2] = _dtChild.Rows[j]["STT"].ToString();
                                dr[3] = _dtChild.Rows[j]["URL_Chucnang"].ToString();
                                dr[4] = _dtChild.Rows[j]["Mota"].ToString();
                                dr[5] = Convert.ToBoolean(_dtChild.Rows[j]["role"]);

                                if (_dtChild.Rows[j]["Doc"] != DBNull.Value)
                                {
                                    dr[6] = Convert.ToBoolean(_dtChild.Rows[j]["Doc"]);
                                }
                                else
                                {
                                    dr[6] = false;
                                }
                                if (_dtChild.Rows[j]["Ghi"] != DBNull.Value)
                                {
                                    dr[7] = Convert.ToBoolean(_dtChild.Rows[j]["Ghi"]);
                                }
                                else
                                {
                                    dr[7] = false;
                                }
                                if (_dtChild.Rows[j]["Xoa"] != DBNull.Value)
                                {
                                    dr[8] = Convert.ToBoolean(_dtChild.Rows[j]["Xoa"]);
                                }
                                else
                                {
                                    dr[8] = false;
                                }

                                dt.Rows.Add(dr);

                                //// Kiem tra xem chuc nang hien tai co chuyen muc cap 3 hay khong
                                if (HPCBusinessLogic.UltilFunc.GetLatestID("T_chucnang", "Ma_chucnang", "WHERE Ma_chucnangcha=" + _dtChild.Rows[j].ItemArray[0].ToString()) > 0)
                                {
                                    DataTable _dtChild1 = _untilDAL.GetStoreDataSet("sp_BindGridMenuByGroup", new string[] { "@Parrent_ID", "@Group_ID", "@lang_ID" }, new object[] { _dtChild.Rows[j].ItemArray[0], GroupID, langid }).Tables[0];

                                    for (int j1 = 0; j1 < _dtChild1.Rows.Count; j1++)
                                    {
                                        dr    = dt.NewRow();
                                        dr[0] = _dtChild1.Rows[j1]["Ma_chucnang"].ToString();
                                        dr[1] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + _dtChild1.Rows[j1]["Ten_chucnang"].ToString();
                                        dr[2] = _dtChild1.Rows[j1]["STT"].ToString();
                                        dr[3] = _dtChild1.Rows[j1]["URL_Chucnang"].ToString();
                                        dr[4] = _dtChild1.Rows[j1]["Mota"].ToString();
                                        dr[5] = Convert.ToBoolean(_dtChild1.Rows[j1]["role"]);

                                        if (_dtChild1.Rows[j1]["Doc"] != DBNull.Value)
                                        {
                                            dr[6] = Convert.ToBoolean(_dtChild1.Rows[j1]["Doc"]);
                                        }
                                        else
                                        {
                                            dr[6] = false;
                                        }
                                        if (_dtChild1.Rows[j1]["Ghi"] != DBNull.Value)
                                        {
                                            dr[7] = Convert.ToBoolean(_dtChild1.Rows[j1]["Ghi"]);
                                        }
                                        else
                                        {
                                            dr[7] = false;
                                        }
                                        if (_dtChild1.Rows[j1]["Xoa"] != DBNull.Value)
                                        {
                                            dr[8] = Convert.ToBoolean(_dtChild1.Rows[j1]["Xoa"]);
                                        }
                                        else
                                        {
                                            dr[8] = false;
                                        }

                                        dt.Rows.Add(dr);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(dt);
        }
Exemplo n.º 25
0
 public void LoadCombox()
 {
     UltilFunc.BindCombox(cboNgonNgu, "Ma_AnPham", "Ten_AnPham", "T_AnPham", " 1=1 ", CommonLib.ReadXML("lblTatca"));
     if (cboNgonNgu.Items.Count >= 3)
     {
         cboNgonNgu.SelectedIndex = Global.DefaultLangID;
     }
     else
     {
         cboNgonNgu.SelectedIndex = UltilFunc.GetIndexControl(cboNgonNgu, Global.DefaultCombobox);
     }
     if (cboNgonNgu.SelectedIndex != 0)
     {
         UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cboNgonNgu.SelectedValue + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), (string)HttpContext.GetGlobalResourceObject("cms.language", "lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
     }
     else
     {
         UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cboNgonNgu.SelectedValue + " and Ma_AnPham in (" + UltilFunc.GetLanguagesByUser(_user.UserID) + ") AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), (string)HttpContext.GetGlobalResourceObject("cms.language", "lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
     }
 }
Exemplo n.º 26
0
        public DataTable BindGridCategoryByGroup(int Group_ID, int MaAnPham)
        {
            UltilFunc _untilDAL = new UltilFunc();
            DataTable dt        = new DataTable();
            DataRow   dr;

            dt.Columns.Add(new DataColumn("Ma_Chuyenmuc", typeof(int)));
            dt.Columns.Add(new DataColumn("Ten_Chuyenmuc", typeof(string)));
            dt.Columns.Add(new DataColumn("Role", typeof(string)));
            dt.Columns.Add(new DataColumn("CategoryParrent", typeof(string)));
            dt.Columns.Add(new DataColumn("OnClick_Event", typeof(string)));
            DataTable _dt = _untilDAL.GetStoreDataSet("sp_BindGridCategoryByGroup", new string[] { "@Ma_AnPham", "@Category_ParrentID", "@Group_ID" }, new object[] { MaAnPham, 0, Group_ID }).Tables[0];

            if (_dt.Rows.Count > 0)
            {
                for (int i = 0; i < _dt.Rows.Count; i++)
                {
                    dr    = dt.NewRow();
                    dr[0] = _dt.Rows[i]["Ma_chuyenmuc"].ToString();
                    dr[1] = "<b>" + _dt.Rows[i]["Ten_chuyenmuc"].ToString();
                    if (Convert.ToBoolean(_dt.Rows[i]["Role"]))
                    {
                        dr[2] = "checked";
                    }
                    else
                    {
                        dr[2] = "";
                    }
                    dr[3] = "Parrent" + _dt.Rows[i]["Ma_chuyenmuc"].ToString();
                    if (UltilFunc.GetLatestID("T_ChuyenMuc", "Ma_chuyenmuc", " WHERE Ma_Chuyenmuc_Cha=" + _dt.Rows[i]["Ma_chuyenmuc"].ToString()) > 0)
                    {
                        dr[4] = " ParrentClick(" + _dt.Rows[i]["Ma_chuyenmuc"].ToString() + ")";
                    }
                    else
                    {
                        dr[4] = " ChildeClick(" + _dt.Rows[i]["Ma_chuyenmuc"].ToString() + ")";
                    }
                    dt.Rows.Add(dr);
                    //Kiem tra xem chuc nang co chuyen muc con hay khong
                    if (HPCBusinessLogic.UltilFunc.GetLatestID("T_Chuyenmuc", "Ma_chuyenmuc", "WHERE Ma_Chuyenmuc_Cha=" + _dt.Rows[i]["Ma_chuyenmuc"].ToString()) > 0)
                    {
                        DataTable _dtChild = _untilDAL.GetStoreDataSet("sp_BindGridCategoryByGroup", new string[] { "@Ma_AnPham", "@Category_ParrentID", "@Group_ID" }, new object[] { MaAnPham, _dt.Rows[i]["Ma_chuyenmuc"].ToString(), Group_ID }).Tables[0];
                        if (_dtChild.Rows.Count > 0)
                        {
                            for (int j = 0; j < _dtChild.Rows.Count; j++)
                            {
                                dr    = dt.NewRow();
                                dr[0] = _dtChild.Rows[j]["Ma_chuyenmuc"].ToString();
                                dr[1] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + _dtChild.Rows[j]["Ten_chuyenmuc"].ToString();

                                if (Convert.ToBoolean(_dtChild.Rows[j]["Role"]))
                                {
                                    dr[2] = "checked";
                                }
                                else
                                {
                                    dr[2] = "";
                                }
                                dr[3] = "Parrent" + _dtChild.Rows[j]["Ma_Chuyenmuc_Cha"].ToString() + _dtChild.Rows[j]["Ma_chuyenmuc"].ToString();
                                if (UltilFunc.GetLatestID("T_ChuyenMuc", "Ma_chuyenmuc", " WHERE Ma_Chuyenmuc_Cha=" + _dtChild.Rows[j]["Ma_chuyenmuc"].ToString()) > 0)
                                {
                                    dr[4] = " ParrentClick(" + _dtChild.Rows[j]["Ma_Chuyenmuc_Cha"].ToString() + _dtChild.Rows[j]["Ma_chuyenmuc"].ToString() + ")";
                                }
                                else
                                {
                                    dr[4] = " ChildeClick(" + _dtChild.Rows[j]["Ma_Chuyenmuc_Cha"].ToString() + _dtChild.Rows[j]["Ma_chuyenmuc"].ToString() + ")";
                                }

                                dt.Rows.Add(dr);
                                //// Kiem tra xem chuc nang hien tai co chuyen muc cap 3 hay khong
                                if (HPCBusinessLogic.UltilFunc.GetLatestID("T_Chuyenmuc", "Ma_chuyenmuc", "WHERE Ma_Chuyenmuc_Cha=" + _dtChild.Rows[j]["Ma_chuyenmuc"].ToString()) > 0)
                                {
                                    DataTable _dtChild1 = _untilDAL.GetStoreDataSet("sp_BindGridCategoryByGroup", new string[] { "@Ma_AnPham", "@Category_ParrentID", "@Group_ID" }, new object[] { MaAnPham, _dtChild.Rows[j]["Ma_chuyenmuc"].ToString(), Group_ID }).Tables[0];

                                    for (int j1 = 0; j1 < _dtChild1.Rows.Count; j1++)
                                    {
                                        dr    = dt.NewRow();
                                        dr[0] = _dtChild1.Rows[j1]["Ma_chuyenmuc"].ToString();
                                        dr[1] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + _dtChild1.Rows[j1]["Ten_chuyenmuc"].ToString();
                                        if (Convert.ToBoolean(_dtChild1.Rows[j1]["Role"]))
                                        {
                                            dr[2] = "checked";
                                        }
                                        else
                                        {
                                            dr[2] = "";
                                        }
                                        dr[3] = "Parrent" + _dtChild.Rows[j]["Ma_Chuyenmuc_Cha"].ToString() + _dtChild1.Rows[j1]["Ma_Chuyenmuc_Cha"].ToString() + _dtChild1.Rows[j1]["Ma_chuyenmuc"].ToString();
                                        dr[4] = " ChildeClick(" + _dtChild.Rows[j]["Ma_Chuyenmuc_Cha"].ToString() + _dtChild1.Rows[j1]["Ma_Chuyenmuc_Cha"].ToString() + _dtChild1.Rows[j1]["Ma_chuyenmuc"].ToString() + ")";
                                        dt.Rows.Add(dr);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(dt);
        }
Exemplo n.º 27
0
 public void BindCombo()
 {
     ddl_Anpham.Items.Clear();
     UltilFunc.BindCombox(ddl_Anpham, "Ma_AnPham", "Ten_AnPham", "T_AnPham", " 1=1 ");
 }
Exemplo n.º 28
0
        private HPCInfo.T_Album_Categories GetObject()
        {
            HPCInfo.T_Album_Categories _objCate = new HPCInfo.T_Album_Categories();
            if (Page.Request.Params["id"] != null)
            {
                _objCate.Cat_Album_ID = int.Parse(Page.Request["id"].ToString());
            }
            else
            {
                _objCate.Cat_Album_ID = 0;
            }
            _objCate.Cat_Album_Name = Txt_tieudeAbum.Text;
            _objCate.Lang_ID        = Convert.ToInt32(cbo_lanquage.SelectedValue);
            _objCate.Status         = true;// this.chkDisplay.Checked;
            if (txtOrder.Text.Length > 0)
            {
                if (UltilFunc.IsNumeric(this.txtOrder.Text.Trim()))
                {
                    _objCate.Possition = Convert.ToInt32(this.txtOrder.Text.Trim());
                }
            }
            _objCate.Links                   = "";
            _objCate.Cat_AlbumDesc           = this.txt_noidungAlbum.Text.Trim();
            _objCate.Target                  = true;
            _objCate.Copy_From               = 0;
            _objCate.Cat_Album_DateCreate    = DateTime.Now;
            _objCate.DateModify              = DateTime.Now;
            _objCate.UserCreated             = _user.UserID;
            _objCate.UserModify              = _user.UserID;
            _objCate.Cat_Album_DateSend      = DateTime.Now;
            _objCate.Cat_Album_DateApprove   = DateTime.Now;
            _objCate.Cat_Album_UserIDApprove = _user.UserID;
            int statusid = 1;

            try { statusid = int.Parse(lbl_status.Text); }
            catch {; }
            _objCate.Cat_Album_Status_Approve = statusid;
            if (this.cbo_chuyenmuc.SelectedIndex > 0)
            {
                _objCate.Cat_Album_CATID = int.Parse(cbo_chuyenmuc.SelectedValue);
            }
            else
            {
                _objCate.Cat_Album_CATID = 0;
            }
            _objCate.Tacgia = txt_Author_name.Text;
            //_objCate.Chatluong = ddlnews_chatluong.SelectedIndex;

            HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL();
            T_Butdanh obj_BD    = new T_Butdanh();
            int       butdanhID = 0;

            if (!string.IsNullOrEmpty(txt_Author_name.Text.Trim()))
            {
                obj_BD.BD_ID   = 0;
                obj_BD.BD_Name = txt_Author_name.Text.Trim();
                obj_BD.UserID  = _user.UserID;
                butdanhID      = obj.Insert_Butdang(obj_BD);
            }
            _objCate.AuthorID = butdanhID;
            if (!string.IsNullOrEmpty(txt_tiennhanbut.Text))
            {
                _objCate.TongtienTT = int.Parse(txt_tiennhanbut.Text.Replace(",", ""));
            }
            else
            {
                _objCate.TongtienTT = 0;
            }
            //_objCate.Theloai = int.Parse(ddlNews_IsType.SelectedValue);
            //if (ddlnews_chatluong.SelectedIndex > 0)
            //    _objCate.Loaihinh = int.Parse(Drop_loaihinh.SelectedValue);
            //else
            //    _objCate.Loaihinh = 0;

            //_objCate.NguoichamNBID = _user.UserID;
            //_objCate.NgaychamNB = DateTime.Now;
            //_objCate.HesoTT = 0.0;
            _objCate.Comment = txtGhichu.Text;
            return(_objCate);
        }
Exemplo n.º 29
0
 protected void ddlLang_SelectedIndexChanged(object sender, EventArgs e)
 {
     ddlCategorysAll.Items.Clear();
     if (ddlLang.SelectedIndex > 0)
     {
         UltilFunc.BindCombox(ddlCategorysAll, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.ddlLang.SelectedValue + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
         ddlCategorysAll.UpdateAfterCallBack = true;
     }
     else
     {
         ddlCategorysAll.DataSource = null;
         ddlCategorysAll.DataBind();
         ddlCategorysAll.UpdateAfterCallBack = true;
     }
 }
        string BuildSQL(string sOrder)
        {
            string sWhere = "  Trangthai_xoa=0 and Doituong_DangXuly=N'" + Global.MaXuatBan + "' ";

            if (txt_tieude.Text.Length > 0 && txt_tieude.Text.Trim() != "")
            {
                if (sWhere.Trim() != "")
                {
                    sWhere += " AND ";
                }
                sWhere += " Tieude LIKE " + string.Format("N'%{0}%'", UltilFunc.SqlFormatText(txt_tieude.Text.Trim()));
            }
            if (cboAnPham.SelectedIndex > 0)
            {
                if (sWhere.Trim() != "")
                {
                    sWhere += " AND ";
                }
                sWhere += "  Ma_AnPham=" + cboAnPham.SelectedValue;
            }
            if (cboSoBao.SelectedIndex > 0)
            {
                if (sWhere.Trim() != "")
                {
                    sWhere += " AND ";
                }
                sWhere += " Ma_Sobao=" + cboSoBao.SelectedValue;
            }
            if (txt_tungay.Text.Trim() != "" && txt_denngay.Text.Trim() != "")
            {
                if (UltilFunc.ToDate(txt_tungay.Text.Trim(), "dd/MM/yyyy") > UltilFunc.ToDate(txt_denngay.Text.Trim(), "dd/MM/yyyy"))
                {
                    FuncAlert.AlertJS(this, "Từ ngày phải nhỏ hơn đến ngày");
                    return(" and 1=0");
                }
                else
                {
                    if (sWhere.Trim() != "")
                    {
                        sWhere += " AND ";
                    }
                    sWhere += " Ma_Sobao in (select Ma_Sobao from T_Sobao where Ngay_Xuatban>='" + txt_tungay.Text.Trim() + " 00:00:00' and Ngay_Xuatban<='" + txt_denngay.Text.Trim() + " 23:59:59')";
                }
            }
            if (cbo_chuyenmuc.SelectedIndex > 0)
            {
                if (sWhere.Trim() != "")
                {
                    sWhere += " AND ";
                }
                sWhere += "  Ma_Chuyenmuc=" + cbo_chuyenmuc.SelectedValue.ToString();
            }
            if (txt_PVCTV.Text.Trim() == "")
            {
                HiddenFieldTacgiatin.Value = "";
            }
            if (HiddenFieldTacgiatin.Value != "")
            {
                sWhere += " AND Ma_Tinbai in (select Ma_Tinbai from T_Nhuanbut where Ma_tacgia=" + HiddenFieldTacgiatin.Value + ")";
            }

            return(sWhere + sOrder);
        }