Example #1
0
        public void dgrListImages_EditCommand(object source, DataListCommandEventArgs e)
        {
            int _ID = Convert.ToInt32(dgrListImages.DataKeys[e.Item.ItemIndex].ToString());

            UploadFileMulti.FtpClient _Ftp = new ToasoanTTXVN.UploadFileMulti.FtpClient(ftpServer, ftpuser, password, "");
            if (e.CommandArgument.ToString().ToLower() == "delete")
            {
                Label lbFileAttach = e.Item.FindControl("lbFileAttach") as Label;
                try
                {
                    if (_Ftp.IsExistFolder(lbFileAttach.Text.Trim()))
                    {
                        _Ftp.DeleteFile(lbFileAttach.Text.Trim());
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                dal.Sp_DeleteOneFromT_FileQuangCao(_ID);
                string thaotac = "Thao tác xóa ảnh đính kèm: " + lbFileAttach.Text + " tại TT QC: " + txt_tenquangcao.Text.Trim();
                UltilFunc.Log_Action(_user.UserID, _user.UserName, DateTime.Now, int.Parse(Request["Menu_ID"].ToString()), thaotac);
                LoadDataImage();
            }
        }
Example #2
0
        protected void btnXoaAnh_Click(object sender, EventArgs e)
        {
            UploadFileMulti.FtpClient _Ftp = new ToasoanTTXVN.UploadFileMulti.FtpClient(ftpServer, ftpuser, password, "");
            string SqlUpdate = string.Empty;

            foreach (DataListItem m_Item in dgrListImages.Items)
            {
                int _ID = int.Parse(this.dgrListImages.DataKeys[m_Item.ItemIndex].ToString());

                CheckBox chk_Select   = (CheckBox)m_Item.FindControl("optSelect");
                Label    lbFileAttach = m_Item.FindControl("lbFileAttach") as Label;
                if (chk_Select != null && chk_Select.Checked)
                {
                    dal.Sp_DeleteOneFromT_FileQuangCao(_ID);
                    string thaotac = "Thao tác xóa ảnh đính kèm: " + lbFileAttach.Text + " tại TT QC: " + txt_tenquangcao.Text.Trim();
                    UltilFunc.Log_Action(_user.UserID, _user.UserName, DateTime.Now, int.Parse(Request["Menu_ID"].ToString()), thaotac);
                    try
                    {
                        _Ftp.DeleteFile(lbFileAttach.Text.Trim());
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            LoadDataImage();
        }