protected void BindData() { try { CategoryEx item = new CategoryEx(m_intCategoryId); this.txtName.Text = item.Name; this.txtToolTip.Text = item.ToolTip; this.htmlDescription.Text = item.Description; if (item.ParentId == -1) { this.cbCategories.SelectedIndex = 0; } else { //ListItem lst = new ListItem(CategoryProvider.GetCategoryName(item.ParentId), item.ParentId.ToString()); //if (cbCategories.Items.Contains(lst)) //{ this.cbCategories.SelectedValue = item.ParentId.ToString(); //} //else //{ // this.cbCategories.SelectedIndex = 0; //} } m_typeId = item.TypeId; this.cboType.SelectedValue = m_typeId.ToString(); this.cbDefaultFolder.SelectedValue = item.DefaultFolder; this.urlIcon.Url = item.Icon; this.urlXslFile.Url = item.XSLFile; this.chkIsDefaultXSL.Checked = item.IsDefaultXSL; this.chkIsNeedApprove.Checked = item.IsNeedApprove; this.chkIsNeedPublic.Checked = item.IsNeedPublic; this.txtExtended.Text = item.ExtendedSettings; this.txtOrder.Text = item.Order.ToString(); this.chbDip1.Checked = item.Dip1; this.chbDip2.Checked = item.Dip2; this.chbDip3.Checked = item.Dip3; this.chbDip4.Checked = item.Dip4; this.chbDip5.Checked = item.Dip5; this.txtAddInfo1.Text = item.AddInfo1; this.txtAddInfo2.Text = item.AddInfo2; this.txtAddInfo3.Text = item.AddInfo3; this.txtAddInfo4.Text = item.AddInfo4; this.txtAddInfo5.Text = item.AddInfo5; //this.lblError.Visible = false; } catch (Exception ex) { lblError.Text = ex.Message; this.lblError.Visible = true; } }
private void UpdateData() { try { int portalId; portalId = this.PortalId; if (txtName.Text == "") { lblError.Text = Localization.GetString("errEmptyName.text", this.LocalResourceFile); lblError.Visible = true; return; } m_typeId = int.Parse(cboType.SelectedValue); int iLanguageId = DotNetNuke.Services.Localization.LocaleController.Instance.GetCurrentLocale(this.PortalId).LanguageId; string strCutureCode = DotNetNuke.Services.Localization.LocaleController.Instance.GetCurrentLocale(this.PortalId).Code; CategoryEx ObjItem = new CategoryEx(m_intCategoryId, this.txtName.Text, this.htmlDescription.Text, this.txtToolTip.Text, int.Parse(this.cbCategories.SelectedValue), portalId, false, this.cbDefaultFolder.SelectedValue, this.chkIsDefaultXSL.Checked, DNNRelatedProvider.GetFilePath(this.urlXslFile.Url, this.PortalId), DNNRelatedProvider.GetFilePath(this.urlIcon.Url, this.PortalId), m_typeId, this.chkIsNeedApprove.Checked, this.chkIsNeedPublic.Checked, this.txtExtended.Text, int.Parse(this.txtOrder.Text), iLanguageId, strCutureCode, this.chbDip1.Checked, this.chbDip2.Checked, this.chbDip3.Checked, this.chbDip4.Checked, this.chbDip5.Checked, this.txtAddInfo1.Text, this.txtAddInfo2.Text, this.txtAddInfo3.Text, this.txtAddInfo4.Text, this.txtAddInfo5.Text); int result; if (m_intCategoryId == -1) { result = ObjItem.Insert(this.UserId); if (result > 0) { JumpBack(); } else if (result == -1) { this.lblError.Text = Localization.GetString("errExistedName.text", this.LocalResourceFile); this.lblError.Visible = true; } else if (result == -2) { this.lblError.Text = Localization.GetString("errParentNotFound.text", this.LocalResourceFile); this.lblError.Visible = true; } } else { result = ObjItem.Update(this.UserId); if (result > 0) { #region danh dau them moi try { File.WriteAllText(Server.MapPath("/DesktopModules/TH.NUCE.Utils/Configuration/ResetCache.txt"), "1"); File.WriteAllText(Server.MapPath("/DesktopModules/TH.NUCE.Utils/Configuration/ResetCache_" + this.PortalId + ".txt"), "1"); } catch (Exception ex) { } #endregion JumpBack(); } else if (result == -1) { this.lblError.Text = Localization.GetString("errCategoryNotFound.text", this.LocalResourceFile); this.lblError.Visible = true; } else if (result == -2) { this.lblError.Text = Localization.GetString("errExistedName.text", this.LocalResourceFile); this.lblError.Visible = true; } else if (result == -3) { this.lblError.Text = Localization.GetString("errParentNotFound.text", this.LocalResourceFile); this.lblError.Visible = true; } } } catch (Exception ex) { this.lblError.Text = ex.Message; this.lblError.Visible = true; } }