private void LoadTextBox()
        {
            int intID = 0;

            if (CommonClass.StringValidator.IsNumber(Request["ID"].ToString().Trim()))
            {
                intID = int.Parse(Request["ID"].ToString().Trim());
            }

            DB.DB_Object.ClassSize objClassData = new DB.DB_Object.ClassSize();
            DataTable dt = objClassData.getDataTrainersAndAdvisors(intID);

            foreach (DataRow dr in dt.Rows)
            {
                txtTrainerID.Text          = dr["ID"].ToString();
                txtNameEL.Text             = dr["NameEL"].ToString();
                txtNameVN.Text             = dr["NameVN"].ToString();
                txtShortDescriptionEL.Text = dr["ShortDescriptionEL"].ToString();
                txtShortDescriptionVN.Text = dr["ShortDescriptionVN"].ToString();
                txtContentEL.Value         = dr["ContentEL"].ToString();
                txtContentVN.Value         = dr["ContentVN"].ToString();
                txtPathImages.Text         = dr["PathImages"].ToString();
                txtIndexOf.Text            = dr["IndexOf"].ToString();
            }

            // Visible cái fileUpload khi không cần thiết
            FileUpload1.Visible    = false;
            txtPathImages.Visible  = true;
            btChangeImages.Visible = true;
        }
Exemple #2
0
        protected void _DeleteButton_Command(object sender, CommandEventArgs e)
        {
            try
            {
                int      i = 0;
                CheckBox cb;
                int      id;
                DB.DB_Object.ClassSize objClassData = new DB.DB_Object.ClassSize();
                foreach (DataGridItem dgi in _grid.Items)
                {
                    cb = (CheckBox)dgi.Cells[0].Controls[1];
                    if (cb.Checked)
                    {
                        // lấy Mã số của record cần xóa...
                        id = (int)_grid.DataKeys[i];
                        // gọi hàm xóa từng record...
                        if (objClassData.DeleteTrainer(id) != true)
                        {
                            CommonClass.MessageBox.Show("Lỗi không thể xóa giáo viên.\nYêu cầu kiểm tra lại!");
                            LoadGrid();
                            return;
                        }
                    }
                    i++;
                }

                LoadGrid();
            }
            catch (Exception ex)
            {
                SetErrorMessage(ex.Message);
            }
        }
        private void LoadGrid(int intProductId)
        {
            DB.DB_Object.ClassSize objClassTrainers = new DB.DB_Object.ClassSize();
            DataTable dt = objClassTrainers.getDataTrainersAdmin(1, intProductId);

            _grid.DataSource = dt;
            _grid.DataBind();
        }
Exemple #4
0
        private void LoadTextBox()
        {
            int intID = 0;

            if (CommonClass.StringValidator.IsNumber(Request["ID"].ToString().Trim()))
            {
                intID = int.Parse(Request["ID"].ToString().Trim());
            }

            DB.DB_Object.ClassSize objClassData = new DB.DB_Object.ClassSize();
            DataTable dt = objClassData.getDataTrainersAndAdvisors(intID);

            foreach (DataRow dr in dt.Rows)
            {
                txtSizeID.Text      = dr["ID"].ToString();
                txtNameSize.Text    = dr["NameSize"].ToString();
                txtPathImages.Text  = dr["ImagesPath1"].ToString();
                txtPathImages1.Text = dr["ImagesPath2"].ToString();
                txtPathImages2.Text = dr["ImagesPath3"].ToString();
                txtPathImages3.Text = dr["ImagesPath4"].ToString();
                txtPathImages4.Text = dr["ImagesPath5"].ToString();
                hdProductId.Value   = dr["ProductId"].ToString();
            }

            // Visible cái fileUpload khi không cần thiết
            FileUpload1.Visible    = false;
            txtPathImages.Visible  = true;
            btChangeImages.Visible = true;

            // Visible cái fileUpload khi không cần thiết
            FileUpload2.Visible     = false;
            txtPathImages1.Visible  = true;
            btChangeImages1.Visible = true;

            // Visible cái fileUpload khi không cần thiết
            FileUpload3.Visible     = false;
            txtPathImages2.Visible  = true;
            btChangeImages2.Visible = true;

            // Visible cái fileUpload khi không cần thiết
            FileUpload4.Visible     = false;
            txtPathImages3.Visible  = true;
            btChangeImages3.Visible = true;

            // Visible cái fileUpload khi không cần thiết
            FileUpload5.Visible     = false;
            txtPathImages4.Visible  = true;
            btChangeImages4.Visible = true;
        }
Exemple #5
0
        private void Insert()
        {
            int    intProductId  = int.Parse(Request["ProductId"]);
            string strNameEL     = CommonClass.StringValidator.GetSafeString(txtNameSize.Text.Trim());
            string strPathImages = "~/Images/ImgNews/defaultimage.GIF";

            if (!string.IsNullOrEmpty(FileUpload1.FileName) && CheckExtention(FileUpload1) == true)
            {
                Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                Upload.StrFileName = FileUpload1.FileName;
                Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                Upload.Upload(FileUpload1);
                strPathImages = "~/Images/ImgNews/" + Upload.StrFileName;
            }

            string strPathImages1 = "~/Images/ImgNews/defaultimage.GIF";

            if (!string.IsNullOrEmpty(FileUpload2.FileName) && CheckExtention(FileUpload2) == true)
            {
                Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                Upload.StrFileName = FileUpload2.FileName;
                Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                Upload.Upload(FileUpload2);
                strPathImages1 = "~/Images/ImgNews/" + Upload.StrFileName;
            }

            string strPathImages2 = "~/Images/ImgNews/defaultimage.GIF";

            if (!string.IsNullOrEmpty(FileUpload3.FileName) && CheckExtention(FileUpload3) == true)
            {
                Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                Upload.StrFileName = FileUpload3.FileName;
                Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                Upload.Upload(FileUpload3);
                strPathImages2 = "~/Images/ImgNews/" + Upload.StrFileName;
            }

            string strPathImages3 = "~/Images/ImgNews/defaultimage.GIF";

            if (!string.IsNullOrEmpty(FileUpload4.FileName) && CheckExtention(FileUpload4) == true)
            {
                Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                Upload.StrFileName = FileUpload4.FileName;
                Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                Upload.Upload(FileUpload4);
                strPathImages3 = "~/Images/ImgNews/" + Upload.StrFileName;
            }

            string strPathImages4 = "~/Images/ImgNews/defaultimage.GIF";

            if (!string.IsNullOrEmpty(FileUpload5.FileName) && CheckExtention(FileUpload5) == true)
            {
                Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                Upload.StrFileName = FileUpload5.FileName;
                Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                Upload.Upload(FileUpload5);
                strPathImages4 = "~/Images/ImgNews/" + Upload.StrFileName;
            }


            DB.DB_Object.ClassSize objClassData = new DB.DB_Object.ClassSize();
            try
            {
                if (objClassData.InsertSize(intProductId, strNameEL, strPathImages, strPathImages1, strPathImages2, strPathImages3, strPathImages4) == true)
                {
                    Response.Redirect("~/Amincp/ManagerSize.aspx?ProductId=" + intProductId);
                }
                else
                {
                    CommonClass.MessageBox.Show("Lỗi kết nối đến Server. Vui lòng kiểm tra hệ thống mạng!");
                }
            }
            catch (Exception ex)
            {
                SetErrorMessage(ex.Message);
            }
        }
Exemple #6
0
        private void Update()
        {
            int    intID         = Convert.ToInt32(txtSizeID.Text.Trim());
            string strNameSize   = CommonClass.StringValidator.GetSafeString(txtNameSize.Text.Trim());
            string strPathImages = txtPathImages.Text.Trim();

            //Khi Admin tiến hành đổi hình ảnh
            if (FileUpload1.Visible == true)
            {
                strPathImages = "~/Images/ImgNews/defaultimage.GIF";
                if (!string.IsNullOrEmpty(FileUpload1.FileName) && CheckExtention(FileUpload1) == true)
                {
                    Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                    Upload.StrFileName = FileUpload1.FileName;
                    Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                    Upload.Upload(FileUpload1);
                    strPathImages = "~/Images/ImgNews/" + Upload.StrFileName;
                }
            }

            string strPathImages1 = txtPathImages1.Text.Trim();

            //Khi Admin tiến hành đổi hình ảnh
            if (FileUpload2.Visible == true)
            {
                strPathImages1 = "~/Images/ImgNews/defaultimage.GIF";
                if (!string.IsNullOrEmpty(FileUpload2.FileName) && CheckExtention(FileUpload2) == true)
                {
                    Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                    Upload.StrFileName = FileUpload2.FileName;
                    Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                    Upload.Upload(FileUpload2);
                    strPathImages1 = "~/Images/ImgNews/" + Upload.StrFileName;
                }
            }

            string strPathImages2 = txtPathImages2.Text.Trim();

            //Khi Admin tiến hành đổi hình ảnh
            if (FileUpload3.Visible == true)
            {
                strPathImages2 = "~/Images/ImgNews/defaultimage.GIF";
                if (!string.IsNullOrEmpty(FileUpload3.FileName) && CheckExtention(FileUpload3) == true)
                {
                    Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                    Upload.StrFileName = FileUpload3.FileName;
                    Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                    Upload.Upload(FileUpload3);
                    strPathImages2 = "~/Images/ImgNews/" + Upload.StrFileName;
                }
            }

            string strPathImages3 = txtPathImages3.Text.Trim();

            //Khi Admin tiến hành đổi hình ảnh
            if (FileUpload4.Visible == true)
            {
                strPathImages3 = "~/Images/ImgNews/defaultimage.GIF";
                if (!string.IsNullOrEmpty(FileUpload4.FileName) && CheckExtention(FileUpload4) == true)
                {
                    Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                    Upload.StrFileName = FileUpload4.FileName;
                    Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                    Upload.Upload(FileUpload4);
                    strPathImages3 = "~/Images/ImgNews/" + Upload.StrFileName;
                }
            }

            string strPathImages4 = txtPathImages3.Text.Trim();

            //Khi Admin tiến hành đổi hình ảnh
            if (FileUpload5.Visible == true)
            {
                strPathImages4 = "~/Images/ImgNews/defaultimage.GIF";
                if (!string.IsNullOrEmpty(FileUpload5.FileName) && CheckExtention(FileUpload5) == true)
                {
                    Sycomore.UploadFile Upload = new Sycomore.UploadFile();
                    Upload.StrFileName = FileUpload5.FileName;
                    Upload.StrFolder   = Server.MapPath("~/Images/ImgNews/");
                    Upload.Upload(FileUpload5);
                    strPathImages4 = "~/Images/ImgNews/" + Upload.StrFileName;
                }
            }

            DB.DB_Object.ClassSize objClassData = new DB.DB_Object.ClassSize();
            try
            {
                if (objClassData.UpdateTrainer(intID, strNameSize, strPathImages, strPathImages1, strPathImages2, strPathImages3, strPathImages4) == true)
                {
                    Response.Redirect("~/Amincp/ManagerSize.aspx?ProductId=" + hdProductId.Value.Trim());
                }
                else
                {
                    CommonClass.MessageBox.Show("Lỗi kết nối đến Server. Vui lòng kiểm tra hệ thống mạng!");
                }
            }
            catch (Exception ex)
            {
                SetErrorMessage(ex.Message);
            }
        }