Esempio n. 1
0
 protected void linkSave_Click(object sender, EventArgs e)
 {
     try
     {
         #region "Duyet danh sach cac doi tuong tren luoi"
         T_Photo_EventDAL _cateDAL = new T_Photo_EventDAL();
         T_Photo_Event    _catObj  = new T_Photo_Event();
         //HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL();
         foreach (DataGridItem m_Item in grdListCate.Items)
         {
             TextBox      txtTitle   = (TextBox)m_Item.FindControl("txtTitle");
             TextBox      txttacgia  = (TextBox)m_Item.FindControl("txt_tacgia");
             Label        lblUrlPath = (Label)m_Item.FindControl("lblUrlPath");
             DropDownList cboNgonNgu = (DropDownList)m_Item.FindControl("cboNgonNgu");
             int          PhotoID    = Convert.ToInt32(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString());
             _catObj = setItem(PhotoID, lblUrlPath.Text, txtTitle.Text, Convert.ToInt32(cboNgonNgu.SelectedValue), txttacgia.Text);
             _cateDAL.InsertT_Photo_Events(_catObj);
         }
         LoadData(status);
         this.litMessages.Text = "Lưu giữ thành công";
         #endregion
     }
     catch (Exception ex)
     {
         HPCServerDataAccess.Lib.ShowAlertMessage(ex.Message.ToString());
     }
 }
Esempio n. 2
0
        protected void btnLinkTra_Click(object sender, EventArgs e)
        {
            T_Photo_EventDAL _cateDAL = new T_Photo_EventDAL();
            T_Photo_Event    _catObj  = new T_Photo_Event();

            foreach (DataGridItem m_Item in grdListCate.Items)
            {
                CheckBox     chk_Select = (CheckBox)m_Item.FindControl("optSelect");
                TextBox      txtTitle   = (TextBox)m_Item.FindControl("txtTitle");
                TextBox      txttacgia  = (TextBox)m_Item.FindControl("txt_tacgia");
                Label        lblUrlPath = (Label)m_Item.FindControl("lblUrlPath");
                DropDownList cboNgonNgu = (DropDownList)m_Item.FindControl("cboNgonNgu");
                double       PhotoID    = double.Parse(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString());
                _catObj = setItem(int.Parse(PhotoID.ToString()), lblUrlPath.Text, txtTitle.Text, Convert.ToInt32(cboNgonNgu.SelectedValue), txttacgia.Text);
                _cateDAL.InsertT_Photo_Events(_catObj);
                if (chk_Select != null && chk_Select.Checked)
                {
                    T_Photo_EventDAL _untilDAL = new T_Photo_EventDAL();
                    T_Photo_Event    _obj      = new T_Photo_Event();
                    _obj = _untilDAL.GetOneFromT_Photo_EventsByID(PhotoID);
                    _untilDAL.UpdateStatus_Photo_Events(PhotoID, 7, _user.UserID, DateTime.Now);
                    string _ActionsCode = "[Thời sự qua ảnh] " + menuName + " [Trả Ảnh] [Ảnh: " + _obj.Photo_Name + "]";
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Trả Ảnh]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, PhotoID, ConstAction.TSAnh);
                }
            }
            LoadData(status);
        }
Esempio n. 3
0
        protected void LinkNgungDang_Click(object sender, EventArgs e)
        {
            HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL();
            T_Photo_Event    _obj = new T_Photo_Event();
            T_Photo_EventDAL DAL  = new T_Photo_EventDAL();

            foreach (DataGridItem m_Item in grdListCate.Items)
            {
                CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect");
                TextBox  txtGhichu  = (TextBox)m_Item.FindControl("txtGhichu");
                TextBox  txt_tienNB = m_Item.FindControl("txt_tienNB") as TextBox;
                if (chk_Select != null && chk_Select.Checked)
                {
                    double id = double.Parse(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString());
                    _obj = DAL.GetOneFromT_Photo_EventsByID(id);
                    //ghi chu
                    T_Photo_Event _objNew = new T_Photo_Event();
                    _objNew = setItem(_obj.Photo_ID, _obj.Photo_Medium, _obj.Photo_Name, _obj.Lang_ID, _obj.Author_Name, txt_tienNB.Text, txtGhichu.Text, _obj.Photo_Status);
                    int _return = _untilDAL.InsertT_Photo_Events(_objNew);
                    //string _ActionsCode1 = "[Thời sự qua ảnh] [Duyệt ảnh thời sự] [Cập nhật ảnh] [Ảnh: " + _obj.Photo_Name + "]";
                    //WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Cập nhật]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode1, _return, ConstAction.TSAnh);
                    // Update on Server Destinations
                    _untilDAL.UpdateStatus_Photo_Events(id, 2, _user.UserID, DateTime.Now);
                    string _ActionsCode = "[Thời sự qua ảnh] [Ngừng đăng ][Ảnh: " + _obj.Photo_Name + "";
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Ngừng đăng]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, id, ConstAction.TSAnh);
                }
            }
            LoadData(this.txtPageIndex.Text.Trim());
        }
Esempio n. 4
0
        protected void LinkEdit_Click(object sender, EventArgs e)
        {
            int count = 0;

            foreach (DataGridItem m_Item in grdListCate.Items)
            {
                T_Photo_EventDAL _DAL       = new T_Photo_EventDAL();
                T_Photo_Event    _obj       = new T_Photo_Event();
                ImageButton      btnModify  = m_Item.FindControl("btnModify") as ImageButton;
                ImageButton      btnSave    = m_Item.FindControl("btnSave") as ImageButton;
                ImageButton      btnBack    = m_Item.FindControl("btnBack") as ImageButton;
                Label            lblNgonNgu = m_Item.FindControl("lblNgonNgu") as Label;
                LinkButton       btnEdit    = m_Item.FindControl("btnEdit") as LinkButton;
                Label            lblTacGia  = m_Item.FindControl("lblTacGia") as Label;
                DropDownList     cboNgonNgu = m_Item.FindControl("cboNgonNgu") as DropDownList;
                TextBox          txtTitle   = m_Item.FindControl("txtTitle") as TextBox;
                TextBox          txtTacGia  = m_Item.FindControl("txt_tacgia") as TextBox;
                btnSave.Visible    = true;
                btnBack.Visible    = true;
                btnModify.Visible  = false;
                lblNgonNgu.Visible = false;
                lblTacGia.Visible  = false;
                btnEdit.Visible    = false;
                cboNgonNgu.Visible = true;
                txtTitle.Visible   = true;
                txtTacGia.Visible  = true;
                if (count == 0)
                {
                    txtTitle.Focus();
                }
                count++;
                litMessages.Text = "";
            }
        }
Esempio n. 5
0
        public void grdListCategory_EditCommand(object source, DataGridCommandEventArgs e)
        {
            T_Photo_EventDAL _DAL       = new T_Photo_EventDAL();
            T_Photo_Event    _obj       = new T_Photo_Event();
            TextBox          txt_tienNB = e.Item.FindControl("txt_tienNB") as TextBox;
            int _ID = Convert.ToInt32(grdListCate.DataKeys[e.Item.ItemIndex].ToString());

            _obj = _DAL.GetOneFromT_Photo_EventsByID(_ID);
            if (e.CommandArgument.ToString().ToLower() == "savephoto")
            {
                int tien = 0;
                if (!string.IsNullOrEmpty(txt_tienNB.Text))
                {
                    try { tien = int.Parse(txt_tienNB.Text.Replace(",", "")); }
                    catch {; }
                }
                if (txt_tienNB.Text.Trim().Length > 0)
                {
                    string sql = "Update T_Photo_Event set TienNB = " + tien + " where Photo_ID = " + _ID;
                    HPCDataProvider.Instance().ExecSql(sql);
                    string _ActionsCode = "[Thời sự qua ảnh] [Xuất bản ảnh thời sự] [Chấm nhuận bút ảnh trong ngày] [Ảnh: " + _obj.Photo_Name + "]";
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Cập nhật]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, _ID, ConstAction.TSAnh);
                    ScriptManager.RegisterStartupScript(this, GetType(), "myFunction", "alert('Bạn đã chấm nhuận bút thành công !');", true);
                }
                else
                {
                    txt_tienNB.Focus();
                    ScriptManager.RegisterStartupScript(this, GetType(), "myFunction", "alert('Bạn chưa nhập tiêu đề ảnh !');", true);
                }
            }
        }
        protected void linkSave_Click(object sender, EventArgs e)
        {
            //if (!Page.IsValid) return;
            T_Photo_EventDAL _untilDAL = new T_Photo_EventDAL();

            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_Photo_Event _Obj    = GetObject();
            int           _return = 0;

            if (_Obj.Photo_ID == 0)
            {
                _return = _untilDAL.InsertT_Photo_Events(_Obj);
                string _ActionsCode = "[Thời sự qua ảnh] [Thao tác Thêm] [Ảnh: " + _Obj.Photo_Name + "]";
                WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Thêm mới]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, _return, ConstAction.TSAnh);
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("VALIDATE_ADDNEWS") + "');", true);
            }
            else
            {
                _return = _untilDAL.InsertT_Photo_Events(_Obj);
                string _ActionsCode = "[Thời sự qua ảnh] [Cập nhật ảnh trong ngày] [Ảnh: " + _Obj.Photo_Name + "]";
                WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Cập nhật]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, _return, ConstAction.TSAnh);
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("VALIDATE_ADDNEWS") + "');", true);
            }
            if (Page.Request["Tab"].ToString() != "-1")
            {
                if (Page.Request["Menu_ID"] != null)
                {
                    Page.Response.Redirect("~/Anh24h/List_PhotosChoDuyet.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString());
                }
                else
                {
                    return;
                }
            }
            else
            {
                if (Page.Request["Menu_ID"] != null)
                {
                    Page.Response.Redirect("~/Anh24h/List_PhotosChoDuyet.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString());
                }
                else
                {
                    return;
                }
            }
        }
Esempio n. 7
0
        protected void btnLinkDuyetAnh_Click(object sender, EventArgs e)
        {
            T_Photo_EventDAL _cateDAL = new T_Photo_EventDAL();
            T_Photo_Event    _catObj  = new T_Photo_Event();

            foreach (DataGridItem m_Item in grdListCate.Items)
            {
                CheckBox     chk_Select = (CheckBox)m_Item.FindControl("optSelect");
                TextBox      txtTitle   = (TextBox)m_Item.FindControl("txtTitle");
                TextBox      txttacgia  = (TextBox)m_Item.FindControl("txt_tacgia");
                Label        lblUrlPath = (Label)m_Item.FindControl("lblUrlPath");
                DropDownList cboNgonNgu = (DropDownList)m_Item.FindControl("cboNgonNgu");
                double       PhotoID    = double.Parse(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString());
                _catObj = setItem(int.Parse(PhotoID.ToString()), lblUrlPath.Text, txtTitle.Text, Convert.ToInt32(cboNgonNgu.SelectedValue), txttacgia.Text);
                _cateDAL.InsertT_Photo_Events(_catObj);
                if (chk_Select != null && chk_Select.Checked)
                {
                    T_Photo_EventDAL _untilDAL = new T_Photo_EventDAL();
                    T_Photo_Event    _obj      = new T_Photo_Event();
                    _obj = _untilDAL.GetOneFromT_Photo_EventsByID(PhotoID);
                    if (pageback == 1)
                    {
                        if (_obj.Photo_Name.Trim().Length > 0)
                        {
                            _untilDAL.UpdateStatus_Photo_Events(PhotoID, 8, _user.UserID, DateTime.Now);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "myFunction", "alert('Bạn chưa nhập tiêu đề ảnh !');", true);
                        }
                    }
                    else if (pageback == 2)
                    {
                        _untilDAL.UpdateStatus_Photo_Events(PhotoID, 3, _user.UserID, DateTime.Now);
                        #region Sync
                        // DONG BO ANH
                        SynFiles _syncfile = new SynFiles();
                        if (_obj.Photo_Medium.Length > 0)
                        {
                            _syncfile.SynData_UploadImgOne(_obj.Photo_Medium, HPCComponents.Global.ImagesService);
                        }
                        //END
                        #endregion
                    }
                    string _ActionsCode = "[Thời sự qua ảnh] " + menuName + " [Gửi duyệt Ảnh] [Ảnh: " + _untilDAL.GetOneFromT_Photo_EventsByID(PhotoID).Photo_Name + "]";
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Gửi duyệt]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, PhotoID, ConstAction.TSAnh);
                }
            }
            LoadData(status);
        }
Esempio n. 8
0
        public int InsertT_Photo_Events(T_Photo_Event _obj)
        {
            int _inserted = 0;

            try
            {
                _inserted = HPCDataProvider.Instance().InsertObjectReturn(_obj, "[Sp_InsertT_Photo_Event]");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(_inserted);
        }
Esempio n. 9
0
        private T_Photo_Event setItem(string urlImage, string photoName)
        {
            photoName = photoName.Substring(0, (photoName.IndexOf(".") - 1));
            T_Photo_Event    _objPoto = new T_Photo_Event();
            T_Photo_EventDAL _DAL     = new T_Photo_EventDAL();

            _objPoto.Photo_ID = 0;
            //_objPoto.Photo_Name = "Nhập tiêu đề ảnh";
            _objPoto.Photo_Medium = urlImage;
            _objPoto.Date_Create  = DateTime.Now;
            _objPoto.Creator      = _user.UserID;
            _objPoto.Photo_Status = 5;
            _objPoto.Lang_ID      = 1;
            _objPoto.Copy_From    = 0;
            return(_objPoto);
        }
Esempio n. 10
0
 protected void LinkCancel_Click(object sender, EventArgs e)
 {
     foreach (DataGridItem m_Item in grdListCate.Items)
     {
         CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect");
         if (chk_Select != null && chk_Select.Checked)
         {
             int ID = int.Parse(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString());
             T_Photo_EventDAL _DAL = new T_Photo_EventDAL();
             T_Photo_Event    _obj = new T_Photo_Event();
             _obj = _DAL.GetOneFromT_Photo_EventsByID(ID);
             _DAL.DeleteFromT_Photo_Event(ID);
             string _ActionsCode = "[Thời sự qua ảnh] " + menuName + " [Xóa Ảnh] [Ảnh: " + _obj.Photo_Name + "]";
             WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Xóa ảnh]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, ID, ConstAction.TSAnh);
         }
     }
     LoadData(status);
 }
Esempio n. 11
0
 protected void LinkDanganh_Click(object sender, EventArgs e)
 {
     //if (!Page.IsValid) return;
     #region SYNC
     HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL();
     T_Photo_Event _Obj = GetObject();
     if (Request["id"] == null)
     {
         int _return = _untilDAL.InsertT_Photo_Events(_Obj);
         _untilDAL.UpdateStatus_Photo_Events(Convert.ToDouble(_return.ToString()), 8, _user.UserID, DateTime.Now);
     }
     else
     {
         _untilDAL.InsertT_Photo_Events(_Obj);
         _untilDAL.UpdateStatus_Photo_Events(_Obj.Photo_ID, 8, _user.UserID, DateTime.Now);
     }
     #endregion
     string _ActionsCode = "[Thời sự qua ảnh] [Gửi duyệt Ảnh] [Ảnh: " + _Obj.Photo_Name + "]";
     //UltilFunc.WriteLogActionHistory(_user.UserID, _user.UserFullName, IpAddress(), _ActionsCode, 0, "[Gửi duyệt]", Convert.ToInt32(Request["Menu_ID"]));
     if (Page.Request["Tab"].ToString() != "-1")
     {
         if (Page.Request["Menu_ID"] != null)
         {
             Page.Response.Redirect("~/Anh24h/List_PhotosDexuat.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString());
         }
         else
         {
             return;
         }
     }
     else
     {
         if (Page.Request["Menu_ID"] != null)
         {
             Page.Response.Redirect("~/Anh24h/List_PhotosDexuat.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString());
         }
         else
         {
             return;
         }
     }
 }
Esempio n. 12
0
        protected void linkSave_Click(object sender, EventArgs e)
        {
            try
            {
                T_Photo_EventDAL _DAL = new T_Photo_EventDAL();
                T_Photo_Event    _obj = new T_Photo_Event();

                #region "Duyet danh sach cac doi tuong tren luoi"
                foreach (DataGridItem m_Item in grdListCate.Items)
                {
                    TextBox txt_tienNB = m_Item.FindControl("txt_tienNB") as TextBox;
                    double  _ID        = Convert.ToDouble(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString());
                    _obj = _DAL.GetOneFromT_Photo_EventsByID(_ID);
                    int tien = 0;
                    if (!string.IsNullOrEmpty(txt_tienNB.Text))
                    {
                        try { tien = int.Parse(txt_tienNB.Text.Replace(",", "")); }
                        catch {; }
                    }
                    if (txt_tienNB.Text.Trim().Length > 0)
                    {
                        string sql = "Update T_Photo_Event set TienNB = " + tien + " where Photo_ID = " + _ID;
                        HPCDataProvider.Instance().ExecSql(sql);
                        string _ActionsCode = "[Thời sự qua ảnh] [Xuất bản ảnh thời sự] [Chấm nhuận bút ảnh trong ngày] [Ảnh: " + _obj.Photo_Name + "]";
                        WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Cập nhật]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, _ID, ConstAction.TSAnh);
                    }
                }

                LoadData(this.txtPageIndex.Text.Trim());
                this.litMessages.Text = "Chấm nhuận bút thành công";
                #endregion
            }
            catch (Exception ex)
            {
                HPCServerDataAccess.Lib.ShowAlertMessage(ex.Message.ToString());
            }
        }
Esempio n. 13
0
        private T_Photo_Event setItem(double PhotoID, string urlImage, string PhotoTitle, double LangId, string tacgia, string tienNB, string ghichu, double status)
        {
            T_Photo_Event    _objPoto = new T_Photo_Event();
            T_Photo_EventDAL _DAL     = new T_Photo_EventDAL();
            int       butdanhID       = 0;
            T_Butdanh obj_BD          = new T_Butdanh();

            HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL();
            if (!string.IsNullOrEmpty(tacgia))
            {
                obj_BD.BD_ID   = 0;
                obj_BD.UserID  = _user.UserID;
                obj_BD.BD_Name = tacgia.Trim();
                butdanhID      = obj.Insert_Butdang(obj_BD);
            }
            _objPoto.AuthorID = butdanhID;
            int tien = 0;

            if (!string.IsNullOrEmpty(tienNB))
            {
                try { tien = int.Parse(tienNB.Replace(",", "")); }
                catch {; }
            }
            _objPoto.Photo_ID = PhotoID;
            //_objPoto = _DAL.GetOneFromT_Photo_EventsByID(PhotoID);
            _objPoto.Date_Update  = DateTime.Now;
            _objPoto.Photo_Name   = PhotoTitle;
            _objPoto.Photo_Medium = urlImage;
            _objPoto.Author_Name  = tacgia;
            _objPoto.TienNB       = tien;
            _objPoto.Lang_ID      = LangId;
            _objPoto.Creator      = _user.UserID;
            _objPoto.Photo_Status = status;
            _objPoto.Photo_Desc   = ghichu;
            return(_objPoto);
        }
Esempio n. 14
0
        private T_Photo_Event setItem(int PhotoID, string urlImage, string PhotoTitle, int LangId, string tacgia)
        {
            T_Photo_Event    _objPoto = new T_Photo_Event();
            T_Photo_EventDAL _DAL     = new T_Photo_EventDAL();

            _objPoto.Photo_ID = PhotoID;
            _objPoto          = _DAL.GetOneFromT_Photo_EventsByID(PhotoID);
            if (_objPoto.Photo_Status == 7)
            {
                _objPoto.Date_Update = _objPoto.Date_Update;
            }
            else
            {
                _objPoto.Date_Update = DateTime.Now;
            }
            _objPoto.Photo_Name   = PhotoTitle;
            _objPoto.Photo_Medium = urlImage;
            _objPoto.Author_Name  = tacgia;
            _objPoto.Lang_ID      = LangId;
            _objPoto.Date_Create  = DateTime.Now;
            _objPoto.Creator      = _user.UserID;
            _objPoto.Photo_Status = status;
            return(_objPoto);
        }
Esempio n. 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name);
     if (_user != null)
     {
         if (!IsPostBack)
         {
             try
             {
                 double _ID = 0;
                 if (Request["id"] != null)
                 {
                     _ID = Convert.ToDouble(Request["id"]);
                 }
                 if (_ID > 0)
                 {
                     _obj            = DAL.GetOneFromT_Photo_EventsByID(_ID);
                     Image1.ImageUrl = ConfigurationManager.AppSettings["tinpathbdt"].ToString() + _obj.Photo_Medium;
                 }
             }
             catch { }
         }
     }
 }
Esempio n. 16
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);
     }
 }
Esempio n. 17
0
        private void LoadData(int status)
        {
            string where = " 1=1 ";
            if (status == 5 || status == 7)
            {
                where += " and Creator=" + _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name).UserID + " AND Photo_Status = " + status + " AND Lang_ID IN (SELECT T_Nguoidung_NgonNgu.Ma_Ngonngu FROM T_Nguoidung_NgonNgu WHERE T_Nguoidung_NgonNgu.[Ma_Nguoidung] = " + _user.UserID + ")";
            }
            else
            {
                where += " and Photo_Status = " + status + " AND Lang_ID IN (SELECT DISTINCT(T_Nguoidung_NgonNgu.Ma_Ngonngu) FROM T_Nguoidung_NgonNgu WHERE T_Nguoidung_NgonNgu.[Ma_Nguoidung] = " + _user.UserID + ")";
            }
            where         += " Order by Date_Create DESC";
            pages.PageSize = 50;
            HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL();
            DataSet _ds;

            _ds = _untilDAL.BindGridT_Photo_Events(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)
            {
                _ds = _untilDAL.BindGridT_Photo_Events(pages.PageIndex - 1, pages.PageSize, where);
            }
            grdListCate.DataSource = _ds;
            grdListCate.DataBind(); _ds.Clear();
            if (TotalRecords == 0)
            {
                pages.Visible       = false;
                curentPages.Visible = false;
            }
            pages.TotalRecords     = curentPages.TotalRecords = TotalRecords;
            curentPages.TotalPages = pages.CalculateTotalPages();
            curentPages.PageIndex  = pages.PageIndex;
            if (grdListCate.Items.Count > 0)
            {
                int count = 0;
                foreach (DataGridItem m_Item in grdListCate.Items)
                {
                    T_Photo_EventDAL _DAL       = new T_Photo_EventDAL();
                    T_Photo_Event    _obj       = new T_Photo_Event();
                    ImageButton      btnModify  = m_Item.FindControl("btnModify") as ImageButton;
                    ImageButton      btnSave    = m_Item.FindControl("btnSave") as ImageButton;
                    ImageButton      btnBack    = m_Item.FindControl("btnBack") as ImageButton;
                    Label            lblNgonNgu = m_Item.FindControl("lblNgonNgu") as Label;
                    LinkButton       btnEdit    = m_Item.FindControl("btnEdit") as LinkButton;
                    Label            lblTacGia  = m_Item.FindControl("lblTacGia") as Label;
                    DropDownList     cboNgonNgu = m_Item.FindControl("cboNgonNgu") as DropDownList;
                    TextBox          txtTitle   = m_Item.FindControl("txtTitle") as TextBox;
                    TextBox          txtTacGia  = m_Item.FindControl("txt_tacgia") as TextBox;
                    //Image imgView = m_Item.FindControl("imgView") as Image;
                    //Image imgBrowse = m_Item.FindControl("imgBrowse") as Image;
                    if (txtTitle.Text.Trim().Length > 0)
                    {
                        btnSave.Visible    = false;
                        btnBack.Visible    = false;
                        btnModify.Visible  = true;
                        lblNgonNgu.Visible = true;
                        lblTacGia.Visible  = true;
                        btnEdit.Visible    = true;
                        cboNgonNgu.Visible = false;
                        txtTitle.Visible   = false;
                        txtTacGia.Visible  = false;
                        //imgView.Visible = true;
                        //imgBrowse.Visible = false;
                    }
                    else
                    {
                        btnSave.Visible    = true;
                        btnBack.Visible    = true;
                        btnModify.Visible  = false;
                        lblNgonNgu.Visible = false;
                        lblTacGia.Visible  = false;
                        btnEdit.Visible    = false;
                        cboNgonNgu.Visible = true;
                        txtTitle.Visible   = true;
                        txtTacGia.Visible  = true;
                        //imgView.Visible = false;
                        //imgBrowse.Visible = true;
                        if (count == 0)
                        {
                            txtTitle.Focus();
                        }
                        count++;
                    }
                }
            }
        }
Esempio n. 18
0
        public void grdListCategory_EditCommand(object source, DataGridCommandEventArgs e)
        {
            T_Photo_EventDAL _DAL       = new T_Photo_EventDAL();
            T_Photo_Event    _obj       = new T_Photo_Event();
            ImageButton      btnModify  = e.Item.FindControl("btnModify") as ImageButton;
            ImageButton      btnSave    = e.Item.FindControl("btnSave") as ImageButton;
            ImageButton      btnBack    = e.Item.FindControl("btnBack") as ImageButton;
            Label            lblNgonNgu = e.Item.FindControl("lblNgonNgu") as Label;
            LinkButton       btnEdit    = e.Item.FindControl("btnEdit") as LinkButton;
            Label            lblTacGia  = e.Item.FindControl("lblTacGia") as Label;
            Label            lblUrlPath = e.Item.FindControl("lblUrlPath") as Label;
            DropDownList     cboNgonNgu = e.Item.FindControl("cboNgonNgu") as DropDownList;
            TextBox          txtTitle   = e.Item.FindControl("txtTitle") as TextBox;
            TextBox          txtTacGia  = e.Item.FindControl("txt_tacgia") as TextBox;
            //Image imgView = e.Item.FindControl("imgView") as Image;
            //Image imgBrowse = e.Item.FindControl("imgBrowse") as Image;
            int _ID = Convert.ToInt32(grdListCate.DataKeys[e.Item.ItemIndex].ToString());

            _obj = _DAL.GetOneFromT_Photo_EventsByID(_ID);
            if (e.CommandArgument.ToString().ToLower() == "editphoto")
            {
                btnSave.Visible    = true;
                btnBack.Visible    = true;
                btnModify.Visible  = false;
                lblNgonNgu.Visible = false;
                lblTacGia.Visible  = false;
                btnEdit.Visible    = false;
                cboNgonNgu.Visible = true;
                txtTitle.Visible   = true;
                txtTacGia.Visible  = true;
                //imgView.Visible = false;
                //imgBrowse.Visible = true;
            }
            if (e.CommandArgument.ToString().ToLower() == "savephoto")
            {
                if (txtTitle.Text.Trim().Length > 0)
                {
                    btnSave.Visible    = false;
                    btnBack.Visible    = false;
                    btnModify.Visible  = true;
                    lblNgonNgu.Visible = true;
                    lblTacGia.Visible  = true;
                    btnEdit.Visible    = true;
                    cboNgonNgu.Visible = false;
                    txtTitle.Visible   = false;
                    txtTacGia.Visible  = false;
                    //imgView.Visible = true;
                    //imgBrowse.Visible = false;
                    _obj = setItem(_ID, lblUrlPath.Text, txtTitle.Text, Convert.ToInt32(cboNgonNgu.SelectedValue), txtTacGia.Text);
                    _DAL.InsertT_Photo_Events(_obj);
                }
                else
                {
                    txtTitle.Focus();
                    ScriptManager.RegisterStartupScript(this, GetType(), "myFunction", "alert('Bạn chưa nhập tiêu đề ảnh !');", true);
                }
                LoadData(status);
            }
            if (e.CommandArgument.ToString().ToLower() == "back")
            {
                if (txtTitle.Text.Trim().Length > 0)
                {
                    btnSave.Visible    = false;
                    btnBack.Visible    = false;
                    btnModify.Visible  = true;
                    lblNgonNgu.Visible = true;
                    lblTacGia.Visible  = true;
                    btnEdit.Visible    = true;
                    cboNgonNgu.Visible = false;
                    txtTitle.Visible   = false;
                    txtTacGia.Visible  = false;
                    //imgView.Visible = true;
                    //imgBrowse.Visible = false;
                }
                else
                {
                    txtTitle.Focus();
                    ScriptManager.RegisterStartupScript(this, GetType(), "myFunction", "alert('Bạn chưa nhập tiêu đề ảnh !');", true);
                }
            }
            if (e.CommandArgument.ToString().ToLower() == "edit")
            {
                int tab = 0;
                //if (TabContainer1.ActiveTabIndex == 0)
                //tab = 0;
                int catID = Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString());
                Response.Redirect("~/Anh24h/Edit_PhotoDexuat.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + catID + "&Tab=" + tab);
            }
        }
        protected void LinkDanganh_Click(object sender, EventArgs e)
        {
            //if (!Page.IsValid) return;
            #region SYNC
            T_Photo_EventDAL _untilDAL = new T_Photo_EventDAL();
            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_Photo_Event _Obj    = GetObject();
            int           _return = 0;
            if (Request["id"] == null)
            {
                _return = _untilDAL.InsertT_Photo_Events(_Obj);
                _untilDAL.UpdateStatus_Photo_Events(Convert.ToDouble(_return.ToString()), 3, _user.UserID, DateTime.Now);
            }
            else
            {
                _return = _untilDAL.InsertT_Photo_Events(_Obj);
                _untilDAL.UpdateStatus_Photo_Events(_Obj.Photo_ID, 3, _user.UserID, DateTime.Now);
            }
            #endregion
            // DONG BO ANH
            try
            {
                SynFiles _syncfile = new SynFiles();
                _Obj = _untilDAL.GetOneFromT_Photo_EventsByID(_return);
                if (_Obj.Photo_Medium.Length > 0)
                {
                    _syncfile.SynData_UploadImgOne(_Obj.Photo_Medium, HPCComponents.Global.ImagesService);
                }
            }
            catch (Exception)
            {
                throw;
            }

            //END
            string _ActionsCode = "[Thời sự qua ảnh] [Duyệt ảnh] [Ảnh: " + _Obj.Photo_Name + "]";
            WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Duyệt]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, _return, ConstAction.TSAnh);
            if (Page.Request["Tab"].ToString() != "-1")
            {
                if (Page.Request["Menu_ID"] != null)
                {
                    Page.Response.Redirect("~/Anh24h/List_PhotosChoDuyet.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString());
                }
                else
                {
                    return;
                }
            }
            else
            {
                if (Page.Request["Menu_ID"] != null)
                {
                    Page.Response.Redirect("~/Anh24h/List_PhotosChoDuyet.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString());
                }
                else
                {
                    return;
                }
            }
        }
        private T_Photo_Event GetObject()
        {
            T_Photo_Event    _objPoto = new T_Photo_Event();
            T_Photo_EventDAL _DAL     = new T_Photo_EventDAL();

            if (Page.Request.Params["id"] != null)
            {
                _objPoto.Photo_ID    = int.Parse(Page.Request["id"].ToString());
                _objPoto             = _DAL.GetOneFromT_Photo_EventsByID(double.Parse(Page.Request["id"].ToString()));
                _objPoto.Date_Update = DateTime.Now;
            }
            else
            {
                _objPoto.Photo_ID    = 0;
                _objPoto.Date_Update = DateTime.Now;
            }
            int       butdanhID = 0;
            T_Butdanh obj_BD    = new T_Butdanh();

            HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL();
            if (!string.IsNullOrEmpty(txt_Authod_Name.Text))
            {
                obj_BD.BD_ID   = 0;
                obj_BD.UserID  = _user.UserID;
                obj_BD.BD_Name = txt_Authod_Name.Text.Trim();
                butdanhID      = obj.Insert_Butdang(obj_BD);
            }
            _objPoto.AuthorID     = butdanhID;
            _objPoto.Photo_Name   = txt_Abl_Photo_Name.Text;
            _objPoto.Photo_Medium = UrlPathImage_RemoveUpload(txtThumbnail.Text);
            _objPoto.Author_Name  = txt_Authod_Name.Text;
            int tien = 0;

            if (this.txtTienNhuanBut.Text.Trim().Length > 0)
            {
                tien = int.Parse(txtTienNhuanBut.Text.Replace(",", ""));
                if (tien > 0)
                {
                    _objPoto.TienNB = tien;
                }
                else
                {
                    _objPoto.TienNB = 0;
                }
            }
            _objPoto.Lang_ID     = Convert.ToInt32(cboNgonNgu.SelectedValue);
            _objPoto.Date_Update = DateTime.Now;
            _objPoto.Photo_Desc  = txtGhichu.Text;
            //_objPoto.Photo_Name = txt_Abl_Photo_Name.Text;
            //_objPoto.Photo_Medium = UrlPathImage_RemoveUpload(txtThumbnail.Text);
            //_objPoto.Author_Name = txt_Authod_Name.Text;
            //_objPoto.Lang_ID = Convert.ToInt32(cboNgonNgu.SelectedValue);

            if (Page.Request["Tab"] != null)
            {
                tab = Convert.ToInt32(Page.Request["Tab"].ToString());
            }
            if (tab == 0)
            {
                _objPoto.Photo_Status = 8;
            }
            else if (tab == -1)
            {
                _objPoto.Photo_Status = 8;
            }
            _objPoto.Copy_From = 0;
            return(_objPoto);
        }