// Insert mới thông tin một TypeNews... private void Insert() { 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 strNameTypeNewsEL = CommonClass.StringValidator.GetSafeString(txtTypeNewsEL.Text.Trim()); string strNameTypeNewsVN = CommonClass.StringValidator.GetSafeString(txtTypeNewsVN.Text.Trim()); int intTypeDisPlay = int.Parse(chkTypeDisplay.SelectedValue); int intPositionDisPlay = int.Parse(rdoPositionDisplay.SelectedValue); int intNKey = Convert.ToInt32(cboMenuParent.SelectedValue); int intOrderNo = int.Parse(txtOrder.Text.Trim()); string strPageLink = txtPageLink.Text.Trim(); DB.DB_Object.ClassTypeNews objClassData = new DB.DB_Object.ClassTypeNews(); try { objClassData.InsertTypeNews(strNameTypeNewsEL, strNameTypeNewsVN, intNKey, intTypeDisPlay, intPositionDisPlay, strPathImages, intOrderNo, strPageLink); Response.Redirect("~/Amincp/ManagerTopFicList.aspx"); } catch (Exception ex) { SetErrorMessage(ex.Message); } }
// Update mới thông tin một News... private void Update() { try { int intSubjectID = int.Parse(txtTypeNewsID.Text.Trim()); string strTitleSubjectEL = CommonClass.StringValidator.GetSafeString(txtTitleNewsEL.Text.Trim()); string strTitleSubjectVN = CommonClass.StringValidator.GetSafeString(txtTitleNewsVN.Text.Trim()); string strShortDescriptionEL = CommonClass.StringValidator.GetSafeString(txtShortDescriptionEL.Text.Trim()); string strShortDescriptionVN = CommonClass.StringValidator.GetSafeString(txtShortDescriptionVN.Text.Trim()); string strContentEL = objClassCommon.FilterSQLParamater(txtContentEL.Value.Trim()); string strContentVN = objClassCommon.FilterSQLParamater(txtContentVN.Value.Trim()); string strPathImages = txtPathImages.Text.Trim(); int intReadTimes = 0; int intTypeNewsID = 1; int intIndexof = 0; if (txtReadTimes.Text.Trim().Length > 0) { intReadTimes = int.Parse(txtReadTimes.Text.Trim()); } if (txtIndexof.Text.Trim().Length > 0) { intIndexof = int.Parse(txtIndexof.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; } } DB.DB_Object.ClassSubject objClassData = new DB.DB_Object.ClassSubject(); if (objClassData.UpdateSubject(intSubjectID, strTitleSubjectEL, strTitleSubjectVN, intTypeNewsID, strShortDescriptionEL, strShortDescriptionVN, strContentEL, strContentVN, strPathImages, intReadTimes, intIndexof) == true) { Response.Redirect("~/Amincp/AdminManagerSubject.aspx"); } 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 e) { SetErrorMessage(e.Message); } }
// Insert mới thông tin một News... private void Insert() { try { int TypeProduct = int.Parse(CboTypeProduct.SelectedValue); string NameProduct = CommonClass.StringValidator.GetSafeString(txtNameProduct.Text.Trim()); string NameProductEL = CommonClass.StringValidator.GetSafeString(txtNameProductEL.Text.Trim()); string ShortDescription = txtShortDescription.Text.Trim(); string ShortDescriptionEL = txtShortDescriptionEL.Text.Trim(); string Description = txtContent.Text; int intPrice = int.Parse(txtPrice.Text.Trim()); int intPriceNew = int.Parse(txtPriceNew.Text.Trim()); string strCodeProduct = txtCodeProduct.Text.Trim(); string strStatus = txtStatus.Text.Trim(); string strStatusEL = txtStatusEL.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); strPathImages = "~/Images/ImgNews/" + Upload.StrFileName; } DB.DB_Object.ClassProduct objClassData = new DB.DB_Object.ClassProduct(); if (objClassData.InsertProduct(TypeProduct, NameProduct, ShortDescription, Description, strPathImages, intPrice, intPriceNew, strCodeProduct, strStatus, strPathImages1, NameProductEL, ShortDescriptionEL, strStatusEL) == true) { Response.Redirect("~/Amincp/ManagerProduct.aspx"); } 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 e) { SetErrorMessage(e.Message); } }
// Insert mới thông tin một News... private void Insert() { try { 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 strTypeName = CommonClass.StringValidator.GetSafeString(txtName.Text.Trim()); string strNameEL = txtNameEL.Text.Trim(); DB.DB_Object.ClassTypeProduct objClassData = new DB.DB_Object.ClassTypeProduct(); if (objClassData.InsertTypeProduct(strTypeName, strPathImages, strPathImages1, strNameEL, strPathImages2) == true) { Response.Redirect("~/Amincp/ManagerTypeProduct.aspx"); } 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 e) { SetErrorMessage(e.Message); } }
private void Update() { int intID = Convert.ToInt32(txtTrainerID.Text.Trim()); string strNameEL = CommonClass.StringValidator.GetSafeString(txtNameEL.Text.Trim()); string strNameVN = CommonClass.StringValidator.GetSafeString(txtNameVN.Text.Trim()); string strShortDescriptionEL = CommonClass.StringValidator.GetSafeString(txtShortDescriptionEL.Text.Trim()); string strShortDescriptionVN = CommonClass.StringValidator.GetSafeString(txtShortDescriptionVN.Text.Trim()); string strContentEL = objClassCommon.FilterSQLParamater(txtContentEL.Value); string strContentVN = objClassCommon.FilterSQLParamater(txtContentVN.Value); string strPathImages = txtPathImages.Text.Trim(); int intIndexof = int.Parse(txtIndexOf.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; } } DB.DB_Object.ClassAdvisors objClassData = new DB.DB_Object.ClassAdvisors(); try { if (objClassData.UpdateTrainer(intID, strNameEL, strNameVN, strShortDescriptionEL, strShortDescriptionVN, strContentEL, strContentVN, strPathImages, intIndexof) == true) { Response.Redirect("~/Amincp/ManagerAdvisors.aspx"); } 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); } }
// Insert mới thông tin một News... private void Insert() { try { string strTitleNewsEL = CommonClass.StringValidator.GetSafeString(txtTitleNewsEL.Text.Trim()); string strTitleNewsVN = CommonClass.StringValidator.GetSafeString(txtTitleNewsVN.Text.Trim()); int intTypeNewsID = int.Parse(cboNameNewsVN.SelectedValue); string strShortDescriptionEL = CommonClass.StringValidator.GetSafeString(txtShortDescriptionEL.Text.Trim()); string strShortDescriptionVN = CommonClass.StringValidator.GetSafeString(txtShortDescriptionVN.Text.Trim()); string strContentEL = objClassCommon.FilterSQLParamater(txtContentEL.Value); string strContentVN = objClassCommon.FilterSQLParamater(txtContentVN.Value); string strPathImages = "~/Images/ImgNews/defaultimage.GIF"; int intTypeDisplay = int.Parse(chkTypeDisplay.SelectedValue); 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; } DB.DB_Object.ClassNews objClassData = new DB.DB_Object.ClassNews(); if (objClassData.InsertNews(strTitleNewsEL, strTitleNewsVN, intTypeNewsID, strShortDescriptionEL, strShortDescriptionVN, strContentEL, strContentVN, strPathImages, intTypeDisplay) == true) { Response.Redirect("~/Amincp/ManagerNews.aspx"); } 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 e) { SetErrorMessage(e.Message); } }
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); } }
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); } }