コード例 #1
0
        public void LoadDataApprovied()
        {
            string where = " 1=1 ";
            if (!String.IsNullOrEmpty(this.txt_tenanh.Text.Trim()))
            {
                where += " AND " + string.Format(" Ten_Logo like N'%{0}%'", UltilFunc.SqlFormatText(this.txt_tenanh.Text.Trim()));
            }
            where += " ORDER BY Ma_Logo DESC ";
            HPCBusinessLogic.DAL.T_LogoDAL _DAL = new HPCBusinessLogic.DAL.T_LogoDAL();
            DataSet _ds;

            pageappro.PageSize = 5;
            _ds = _DAL.BindGridT_Logo(pageappro.PageIndex, pageappro.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 = _DAL.BindGridT_Logo(pageappro.PageIndex - 1, pageappro.PageSize, where);
            }
            dgrListAppro.DataSource = _ds;
            dgrListAppro.DataBind();
            pageappro.TotalRecords  = CurrentPage1.TotalRecords = TotalRecords;
            CurrentPage1.TotalPages = pageappro.CalculateTotalPages();
            CurrentPage1.PageIndex  = pageappro.PageIndex;
            Session["CurrentPage"]  = pageappro.PageIndex;
        }
コード例 #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ArrayList ar = new ArrayList();

            foreach (DataGridItem m_Item in dgrListAppro.Items)
            {
                CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect");
                if (chk_Select != null && chk_Select.Checked)
                {
                    ar.Add(double.Parse(dgrListAppro.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()));
                }
            }
            if (ar.Count > 0)
            {
                for (int i = 0; i < ar.Count; i++)
                {
                    int _ID = int.Parse(ar[i].ToString());
                    HPCBusinessLogic.DAL.T_LogoDAL _DAL = new HPCBusinessLogic.DAL.T_LogoDAL();
                    _DAL.DeleteFromT_Logo(_ID);
                }
            }
            else
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Chưa chọn ảnh muốn xóa.!!')", true);
                return;
            }
            LoadDataApprovied();
        }
コード例 #3
0
 public void dgrListAppro_EditCommand(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandArgument.ToString().ToLower() == "edit")
     {
         dgrListAppro.EditItemIndex = e.Item.ItemIndex;
         LoadDataApprovied();
     }
     if (e.CommandArgument.ToString().ToLower() == "delete")
     {
         HPCBusinessLogic.DAL.T_LogoDAL _DAL = new HPCBusinessLogic.DAL.T_LogoDAL();
         int _ID = Convert.ToInt32(dgrListAppro.DataKeys[e.Item.ItemIndex].ToString());
         _DAL.DeleteFromT_Logo(_ID);
         LoadDataApprovied();
     }
 }
コード例 #4
0
        public void dgrListAppro_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            HPCBusinessLogic.DAL.T_LogoDAL _DAL = new HPCBusinessLogic.DAL.T_LogoDAL();
            int     _ID       = Convert.ToInt32(dgrListAppro.DataKeys[e.Item.ItemIndex].ToString());
            TextBox txtTieude = e.Item.FindControl("txtTieude") as TextBox;

            string _tieude = "";

            if (txtTieude != null)
            {
                if (!String.IsNullOrEmpty(txtTieude.Text.Trim()))
                {
                    _tieude = txtTieude.Text;
                }
            }

            _DAL.UpdateT_Logo(_ID, _tieude);

            dgrListAppro_CancelCommand(source, e);
        }
コード例 #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write("Hello World");

            HttpPostedFile postedFile = context.Request.Files["Filedata"];

            string tempPath = System.Configuration.ConfigurationManager.AppSettings["FolderLogo"].ToString() + "/" + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/";

            //Create forder
            CreateFolderByUserName(tempPath);
            string savepath = context.Server.MapPath("~" + tempPath);
            string filename = postedFile.FileName;

            string[] sArrTenfile = null;
            char[]   cat         = { '.' };
            sArrTenfile = filename.ToString().Trim().Split(cat);
            string _extenfile  = sArrTenfile[1].ToString();
            string _tenfile    = GetDateTimeStringUnique() + "." + _extenfile.ToString();
            string _tenfilegoc = UltilFunc.RemoveSign4VietnameseString(Path.GetFileNameWithoutExtension(filename)) + "." + _extenfile.ToString();

            string fiName = _tenfile.Replace(" ", "");

            postedFile.SaveAs(savepath + @"\" + fiName);
            //Luu vao CSDL

            string _savePath = tempPath + "" + fiName;

            HPCBusinessLogic.DAL.T_LogoDAL _DAL = new HPCBusinessLogic.DAL.T_LogoDAL();
            T_Logo _obj = new T_Logo();

            _obj = SetItem(_savePath, _tenfilegoc);
            int _IDreturn = _DAL.InsertUpdateT_Logo(_obj);

            //end

            context.Response.Write(tempPath + "/" + filename);
            context.Response.StatusCode = 200;
        }