public string SaveTemp(object Ma_Tinbai1, object column1, object width1, object height1, object fontFamilyTitle1, object fontSizeTitle1, object ScaleTitle1, object fontWeightTitle1, object widthTitle1, object lineHeightTitle1, object fontFamilySapo1, object lineHeightSapo1, object fontSizeSapo1, object fontFamily1, object fontSize1, object lineHeightContent1, object TempIsImage1, object TempImageWidth1, object TempImageHeight1, object SapoWidth1, object SapoFontWeight1) { Prev_Template obj_Prev = new Prev_Template(); PreviewTemplateDAL _DAL = new PreviewTemplateDAL(); string LineHtitle = lineHeightTitle1.ToString(); string LineHContent = lineHeightContent1.ToString(); string LineHsapo = lineHeightSapo1.ToString(); if (LineHtitle == "") { LineHtitle = "Normal"; } if (LineHContent == "") { LineHContent = "Normal"; } if (LineHsapo == "") { LineHsapo = "Normal"; } try { obj_Prev.TempID = 0; obj_Prev.Ma_Tinbai = Convert.ToInt32(Ma_Tinbai1); obj_Prev.TempName = "Template news"; obj_Prev.TempColumn = column1.ToString(); obj_Prev.TempWidth = width1.ToString(); obj_Prev.TempHeight = height1.ToString(); obj_Prev.Temp_FontFamily_Title = fontFamilyTitle1.ToString(); obj_Prev.Temp_FontSize_Title = fontSizeTitle1.ToString(); obj_Prev.Temp_Scale_Title = ScaleTitle1.ToString(); obj_Prev.Temp_FontWeight_Title = fontWeightTitle1.ToString(); obj_Prev.Temp_Title_Width = Convert.ToInt32(widthTitle1.ToString()); obj_Prev.Temp_LineHeight_Title = LineHtitle; obj_Prev.Temp_Sapo_FontWeight = SapoFontWeight1.ToString(); obj_Prev.Temp_Sapo_Width = Convert.ToInt32(SapoWidth1.ToString()); obj_Prev.Temp_FontFamily_Sapo = fontFamilySapo1.ToString(); obj_Prev.Temp_FontSize_Sapo = fontSizeSapo1.ToString(); obj_Prev.Temp_LineHeight_Sapo = LineHsapo; obj_Prev.Temp_FontFamily = fontFamily1.ToString(); obj_Prev.Temp_FontSize = fontSize1.ToString(); obj_Prev.Temp_LineHeight_Content = LineHContent; obj_Prev.Temp_IsImage = bool.Parse(TempIsImage1.ToString()); obj_Prev.Temp_Image_Width = Convert.ToInt32(TempImageWidth1.ToString()); obj_Prev.Temp_Image_Height = Convert.ToInt32(TempImageHeight1.ToString()); obj_Prev.TempType = 1; _DAL.InsertT_PrevTemplateForNews(obj_Prev); } catch { return("0"); } return("1"); }
public ListData GetTemplateValue(object TempID, object Ma_Tinbai, object TempType) { var data = new ListData(); DataSet _objSet = new DataSet(); PreviewTemplateDAL _DAL = new PreviewTemplateDAL(); try { _objSet = _DAL.GetOneFromT_PrevTemplateCommon(int.Parse(TempID.ToString()), int.Parse(Ma_Tinbai.ToString()), int.Parse(TempType.ToString())); data.TempWidth = _objSet.Tables[0].Rows[0]["TempWidth"].ToString(); data.TempHeight = _objSet.Tables[0].Rows[0]["TempHeight"].ToString(); data.TempFontfamily = _objSet.Tables[0].Rows[0]["Temp_FontFamily"].ToString(); data.TempFontfamilyTitle = _objSet.Tables[0].Rows[0]["Temp_FontFamily_Title"].ToString(); data.TempFontfamilySapo = _objSet.Tables[0].Rows[0]["Temp_FontFamily_Sapo"].ToString(); data.TempColumns = _objSet.Tables[0].Rows[0]["TempColumn"].ToString(); data.TempFontsize = _objSet.Tables[0].Rows[0]["Temp_FontSize"].ToString(); data.TempFontsizeTitle = _objSet.Tables[0].Rows[0]["Temp_FontSize_Title"].ToString(); data.TempFontsizeSapo = _objSet.Tables[0].Rows[0]["Temp_FontSize_Sapo"].ToString(); data.TempTitleWidth = _objSet.Tables[0].Rows[0]["Temp_Title_Width"].ToString(); data.TempLineHeightTitle = _objSet.Tables[0].Rows[0]["Temp_LineHeight_Title"].ToString(); data.TempLineHeightSapo = _objSet.Tables[0].Rows[0]["Temp_LineHeight_Sapo"].ToString(); data.TempLineHeightContent = _objSet.Tables[0].Rows[0]["Temp_LineHeight_Content"].ToString(); data.TempScaleTitle = _objSet.Tables[0].Rows[0]["Temp_Scale_Title"].ToString(); data.TempFontWeightTitle = _objSet.Tables[0].Rows[0]["Temp_FontWeight_Title"].ToString(); data.TempSapoWidth = _objSet.Tables[0].Rows[0]["Temp_Sapo_Width"].ToString(); data.TempSapoFontWeight = _objSet.Tables[0].Rows[0]["Temp_Sapo_FontWeight"].ToString(); data.TempIsImage = _objSet.Tables[0].Rows[0]["Temp_IsImage"].ToString(); if (_objSet.Tables[0].Rows[0]["Temp_Image_Width"].ToString() != "") { data.TempImageWidth = _objSet.Tables[0].Rows[0]["Temp_Image_Width"].ToString(); } else { data.TempImageWidth = "0"; } if (_objSet.Tables[0].Rows[0]["Temp_Image_Height"].ToString() != "") { data.TempImageHeight = _objSet.Tables[0].Rows[0]["Temp_Image_Height"].ToString(); } else { data.TempImageHeight = "0"; } data.TempLogo = _objSet.Tables[0].Rows[0]["TempLogo"].ToString(); data.Ma_Tinbai = _objSet.Tables[0].Rows[0]["Ma_Tinbai"].ToString(); } catch { } return(data); }
protected void btnSave_Click(object sender, EventArgs e) { if (txtName.Text == "") { FuncAlert.AlertJS(this, "Bạn chưa nhập tên mẫu"); return; } if (Page.IsValid) { PreviewTemplateDAL _PrevDAL = new PreviewTemplateDAL(); Prev_Template _PrevObj = SetItem(); int _return = _PrevDAL.InsertT_PrevTemplate(_PrevObj); FuncAlert.AlertJS(this, "Cập nhật thành công"); LoadData(); Reset(); } }
public void grdListTemplate_EditCommand(object source, DataGridCommandEventArgs e) { PreviewTemplateDAL PrevDAL = new PreviewTemplateDAL(); if (e.CommandArgument.ToString().ToLower() == "edit") { int TID = Convert.ToInt32(this.grdListTemplate.DataKeys[e.Item.ItemIndex].ToString()); GeDataByID(TID); } if (e.CommandArgument.ToString().ToLower() == "delete") { PrevDAL.DeleteOneFromT_PrevTemplate(Convert.ToInt32(this.grdListTemplate.DataKeys[e.Item.ItemIndex].ToString())); string ActionsCode = "[Thao tác xóa Tempalte][ID:" + this.grdListTemplate.DataKeys[e.Item.ItemIndex].ToString() + " ]"; UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), ActionsCode); this.LoadData(); } }
private void BindListTemplate() { PreviewTemplateDAL _PrevDAL = new PreviewTemplateDAL(); DataSet _ds = null; try { _ds = _PrevDAL.BindList_PrevTemplate(0); if (_ds != null) { if (_ds.Tables[0].Rows.Count > 0) { rptTemplate.DataSource = _ds.Tables[0].DefaultView; rptTemplate.DataBind(); } } } catch { } }
private void GeDataByID(int IDQ) { Prev_Template _objSet = new Prev_Template(); PreviewTemplateDAL _DAL = new PreviewTemplateDAL(); _objSet = _DAL.GetOneFromT_PrevTemplateByID(IDQ); this.txtIDs.Text = _objSet.TempID.ToString(); this.txtName.Text = _objSet.TempName; this.txtWidth.Text = _objSet.TempWidth; this.txtHeight.Text = _objSet.TempHeight; this.selColumn.Value = _objSet.TempColumn.ToString(); this.txtFontFamily.Text = _objSet.Temp_FontFamily; this.txtFontFamilyTitle.Text = _objSet.Temp_FontFamily_Title; this.txtFontFamilySapo.Text = _objSet.Temp_FontFamily_Sapo; this.txtFontSizeContent.Text = _objSet.Temp_FontSize; this.txtFontSizeTitle.Text = _objSet.Temp_FontSize_Title; this.txtfontsizeSapo.Text = _objSet.Temp_FontSize_Sapo; this.selWidthtitle.Value = _objSet.Temp_Title_Width.ToString(); this.selSapowidth.Value = _objSet.Temp_Sapo_Width.ToString(); this.txtLineheightitle.Text = _objSet.Temp_LineHeight_Title; this.txtLineheighSapo.Text = _objSet.Temp_LineHeight_Sapo; this.txtLineheighContent.Text = _objSet.Temp_LineHeight_Content; this.txtScaleTitle.Text = _objSet.Temp_Scale_Title; this.selFontweightTitle.Value = _objSet.Temp_FontWeight_Title; this.selSapoFontWeight.Value = _objSet.Temp_Sapo_FontWeight; this.chkIsImage.Checked = _objSet.Temp_IsImage; this.txtImagewidth.Text = _objSet.Temp_Image_Width.ToString(); this.txtImageHeight.Text = _objSet.Temp_Image_Height.ToString(); this.txtThum.Text = _objSet.TempLogo; if (_objSet.TempLogo.ToString().Length > 0) { this.ImgTemp.Src = HPCComponents.Global.UploadPathBDT + _objSet.TempLogo; this.ImgTemp.Attributes.CssStyle.Add("display", "inline"); } else { this.ImgTemp.Attributes.CssStyle.Add("display", "none"); } }
protected void btnLinkDelete_Click(object sender, EventArgs e) { ArrayList ar = new ArrayList(); foreach (DataGridItem m_Item in grdListTemplate.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { ar.Add(int.Parse(grdListTemplate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); } } LoadData(); for (int i = 0; i < ar.Count; i++) { int _IDs = int.Parse(ar[i].ToString()); PreviewTemplateDAL PrevDAL = new PreviewTemplateDAL(); PrevDAL.DeleteOneFromT_PrevTemplate(_IDs); string ActionsCode = "[Thao tác xóa Tempalte][ID:" + int.Parse(_IDs.ToString()) + ""; UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), ActionsCode); } LoadData(); }
public void LoadData() { string where = " 1=1 "; where += " AND TempType = 0 "; where += " Order by TempID DESC"; pages.PageSize = Global.MembersPerPage; PreviewTemplateDAL _PrevDAL = new PreviewTemplateDAL(); DataSet _ds; _ds = _PrevDAL.BindGridT_PrevTemplate(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 = _PrevDAL.BindGridT_PrevTemplate(pages.PageIndex - 1, pages.PageSize, where); } grdListTemplate.DataSource = _ds; grdListTemplate.DataBind(); pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; Session["PageIndex"] = pages.PageIndex; }