public static int UpdateImage(int ImageId, string Title, string Summary, string ImageFile, string Avatar, bool IsUrlWeb, string Content, DateTime CreatedDate, DateTime ExpiredDate, DateTime DisplayDate, DateTime UpdatedDate, int UserId, bool IsHot, int HotPeriod, int PortalId, bool IsExpired, int Order, string strCategories, string addInfo1, string addInfo2, string addInfo3, string addInfo4, string addInfo5) { int result = -1; result = IG_UpdateImage(ImageId, Title, Summary, ImageFile, Avatar, IsUrlWeb, Content, CreatedDate, ExpiredDate, DisplayDate, UpdatedDate, UserId, IsHot, HotPeriod, PortalId, IsExpired, Order, addInfo1, addInfo2, addInfo3, addInfo4, addInfo5); CategoryProvider.AttachItemToManyCategories(ImageId, strCategories, TypeId, Title); return(result); }
public static int InsertImage(string Title, string Summary, string ImageFile, string Avatar, bool IsUrlWeb, string Content, DateTime CreatedDate, DateTime ExpiredDate, DateTime DisplayDate, DateTime UpdatedDate, int UserId, bool IsHot, int HotPeriod, int PortalId, bool IsExpired, int Order, string strCategories, string addInfo1, string addInfo2, string addInfo3, string addInfo4, string addInfo5, string addRichInfo1, string addRichInfo2, string addRichInfo3) { int newId = -1; newId = SV_InsertService(Title, Summary, ImageFile, Avatar, IsUrlWeb, Content, CreatedDate, ExpiredDate, DisplayDate, UpdatedDate, UserId, IsHot, HotPeriod, PortalId, IsExpired, Order, addInfo1, addInfo2, addInfo3, addInfo4, addInfo5, addRichInfo1, addRichInfo2, addRichInfo3); CategoryProvider.AttachItemToManyCategories(newId, strCategories, TypeId, Title); return(newId); }
public static int UpdateProduct(int ProductId, string ProductName, string Lead, string Summary, string Smallimage, string Largeimage, double Weight, DateTime CreatedDate, DateTime ExpiredDate, DateTime UpdatedDate, DateTime ProducedDate, bool IsProducedDate, bool IsExpired, bool IsHot, int HotPeriod, int UserId, int PortalId, bool IsDeleted, int Price, int PriceOld, string StatusProduct, int Order, string ExtendedSettings, string strCategories, string strCode, string strAddImage1, string strAddImage2, string strAddImage3, DateTime dtDisplayDate, string strAddInfo1, string strAddInfo2, string strAddInfo3, string strAddInfo4, string strAddInfo5, string strAddInfo6, string strAddRichInfo1, string strAddRichInfo2, string strAddRichInfo3, string strTags, int TagGroupId) { int result = -1; result = PD_UpdateProduct(ProductId, ProductName, Lead, Summary, Smallimage, Largeimage, Weight, CreatedDate, ExpiredDate, UpdatedDate, ProducedDate, IsProducedDate, IsExpired, IsHot, HotPeriod, UserId, PortalId, IsDeleted, Price, PriceOld, StatusProduct, Order, ExtendedSettings, strCode, strAddImage1, strAddImage2, strAddImage3, dtDisplayDate, strAddInfo1, strAddInfo2, strAddInfo3, strAddRichInfo1, strAddRichInfo2, strAddRichInfo3, strAddInfo4, strAddInfo5, strAddInfo6); CategoryProvider.AttachItemToManyCategories(ProductId, strCategories, TypeId, ProductName); TagProvider.AttachItemToManyTags(ProductId, strTags, TypeId, TagGroupId); return(result); }
/// <summary> /// Thêm một log vào hệ thống cho nhiều items trong trường hợp không biết category của item. /// </summary> /// <param name="strItems">Chuỗi batchstring chứa id của các item</param> /// <param name="typeId">Loại của item</param> /// <param name="portalId">Mã Id của Portal</param> /// <param name="actionId">Loại hành động</param> /// <param name="actionOwner">Người thực hiện hành động</param> /// <param name="actionOwnerId">Mã người thực hiện hành động</param> /// <param name="actionValue">Giá trị của hành động</param> /// <param name="isChangeName">Hành động có thay đổi tên không</param> public static void InsertManyLogAction(string strItems, int typeId, int portalId, int actionId, string actionOwner, int actionOwnerId, string actionValue, bool isChangeName) { string[] items = DataProcessingProvider.GetBatchStringItems(strItems, ","); int itemId; string categories; foreach (string item in items) { itemId = int.Parse(item); categories = CategoryProvider.CM_GetItemCategoryString(itemId, typeId); LogProvider.InsertLogAction(itemId, typeId, "", portalId, actionId, actionOwner, actionOwnerId, actionValue, false, categories); } }
protected void BindCboExcludedCategories(int TypeId) { try { this.cbCategories.Items.Clear(); this.cbCategories.DataSource = DataProcessingProvider.ProcessDataTable(CategoryProvider.GetExcludedCategories(this.PortalId, m_intCategoryId, TypeId), 1, 2); this.cbCategories.DataValueField = "CategoryId"; this.cbCategories.DataTextField = "Name"; this.cbCategories.DataBind(); this.cbCategories.Items.Insert(0, Localization.GetString("mssNoParent.Text", this.LocalResourceFile)); this.cbCategories.Items[0].Value = "-1"; } catch (Exception ex) { lblError.Text = ex.Message; this.lblError.Visible = true; } }
protected void UpdateData() { try { //Detect Empty Text if (this.txtTitle.Text == "") { this.lblError.Text = Localization.GetString("errEmptyName.Text", this.LocalResourceFile); this.lblError.Visible = true; return; } //string strSummary = txtSummary.Text; string strSummary = DataProcessingProvider.RemoveTags(this.txtSummary.Text); string strContent = DataProcessingProvider.RemoveTags(this.htmlContent.Text); string strAddRichInfo1 = DataProcessingProvider.RemoveTags(this.txtAddRichInfo1.Text); string strAddRichInfo2 = DataProcessingProvider.RemoveTags(this.txtAddRichInfo2.Text); string strAddRichInfo3 = DataProcessingProvider.RemoveTags(this.txtAddRichInfo3.Text); bool blIsOpenNewTab = chIsUrlWeb.Checked; //Detect Role if (!((m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.Create) && m_Serviced == -1) || ((m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.EditAfter) || m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.EditAll)) && m_Serviced != -1))) { this.lblError.Text = Localization.GetString("errNoRole.Text", this.LocalResourceFile); //this.lblError.Text = m_objRole.HasRole((int)THCore.CoreRole.Create).ToString(); this.lblError.Visible = true; return; } string strImageFile = ""; string strAvatar = ""; string strFolderName = m_strCategories; strFolderName = CategoryProvider.GetDefaultFolderPath(UIProvider.GetListBoxSelectedItems(",", chkCategoryList), this.PortalId); if (strFolderName == "" || strFolderName == null || strFolderName.Length == 0) { strFolderName = "Folder"; } string strFolderPath = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName); if (!System.IO.Directory.Exists(strFolderPath)) { strFolderName = m_strFolderName; } /* * if (txtImageFile.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked * { * string strFileName = txtImageFile.PostedFile.FileName.Substring(txtImageFile.PostedFile.FileName.LastIndexOf(@"\") + 1); * strImageFile = string.Format("{0}{1}", strFolderName, strFileName); * string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName); * FileProvider.Upload(this.PortalId, strFolderName, strFileName, * txtImageFile.PostedFile.InputStream); * //FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtImageFile.PostedFile, false); * }*/ strImageFile = DNNRelatedProvider.GetFilePath(urlImageFile.Url, this.PortalId); if (strImageFile == "") { strImageFile = txtImageFileOld.Text; } /* * if (txtAvatar.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked * { * string strFileName = txtAvatar.PostedFile.FileName.Substring(txtAvatar.PostedFile.FileName.LastIndexOf(@"\") + 1); * strAvatar = string.Format("{0}{1}", strFolderName, strFileName); * string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName); * FileProvider.Upload(this.PortalId, strFolderName, strFileName, * txtAvatar.PostedFile.InputStream); * // FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtAvatar.PostedFile, false); * }*/ strAvatar = DNNRelatedProvider.GetFilePath(urlAvatar.Url, this.PortalId); if (strAvatar == "") { strAvatar = txtAvatarOld.Text; } int iOrder = -1; string strOrder = txtOrder.Text; if (!int.TryParse(strOrder, out iOrder)) { this.lblError.Text = Localization.GetString("errFormatOrder.Text", this.LocalResourceFile); this.lblError.Visible = true; return; } DateTime ExpiredDate; ExpiredDate = DateTime.ParseExact(txtExpiredDate.Text, "dd/MM/yyyy", null); DateTime DisplayDate; if (txtDisplayDate.Text == "") { DisplayDate = DateTime.Today; } else { DisplayDate = DateTime.ParseExact(txtDisplayDate.Text, "dd/MM/yyyy", null); } DisplayDate.AddHours(DateTime.Now.Hour); DisplayDate.AddMinutes(DateTime.Now.Minute); DisplayDate.AddSeconds(DateTime.Now.Second); // Get Hot Period int intPeriod; if (!int.TryParse(this.txtHotPeriod.Text, out intPeriod)) { intPeriod = 0; } m_strCategories = UIProvider.GetListBoxSelectedItems(",", chkCategoryList); if (m_strCategories.Equals("")) { this.lblError.Text = "Chưa chọn chuyên mục"; this.lblError.Visible = true; return; } string strAddInfo1 = txtAddInfo1.Text; string strAddInfo2 = txtAddInfo2.Text; string strAddInfo3 = txtAddInfo3.Text; string strAddInfo4 = txtAddInfo4.Text; string strAddInfo5 = txtAddInfo5.Text; //Going into action. int result = 1; if (m_Serviced == -1) { string realTitle = ""; realTitle = DataProcessingProvider.RemoveTags(this.txtTitle.Text); result = ServiceProvider.InsertImage(realTitle, strSummary, strImageFile, strAvatar, blIsOpenNewTab, strContent, DateTime.Now, ExpiredDate, DisplayDate, DateTime.Now, this.UserId, chkIsHot.Checked, intPeriod, this.PortalId, false, iOrder, m_strCategories, strAddInfo1, strAddInfo2, strAddInfo3, strAddInfo4, strAddInfo5, strAddRichInfo1, strAddRichInfo2, strAddRichInfo3); if (result > 0) { LogProvider.InsertLogAction(result, ServiceProvider.TypeId, "", this.PortalId, (int)Connection.UtilsProvider.LogAction.Create, this.UserInfo.Username, this.UserId, realTitle, true, m_strCategories); } } else { string realTitle = ""; realTitle = DataProcessingProvider.RemoveTags(this.txtTitle.Text); DateTime CreateDate = DateTime.Parse(txtCreatedDateOld.Text); //ServiceProvider.UpdateImage(m_Serviced, txtTitleOld.Text, strSummary, strImageFile, strAvatar, blIsOpenNewTab, strContent, CreateDate, ExpiredDate, DisplayDate, DateTime.Now, this.UserId, chkIsHot.Checked, intPeriod, this.PortalId, false, iOrder, TH.Utils.UIProvider.GetListBoxSelectedItems(",", chkCategoryList)); ServiceProvider.UpdateImage(m_Serviced, realTitle, strSummary, strImageFile, strAvatar, blIsOpenNewTab, strContent, CreateDate, ExpiredDate, DisplayDate, DateTime.Now, this.UserId, chkIsHot.Checked, intPeriod, this.PortalId, false, iOrder, m_strCategories, strAddInfo1, strAddInfo2, strAddInfo3, strAddInfo4, strAddInfo5, strAddRichInfo1, strAddRichInfo2, strAddRichInfo3); result = m_Serviced; if (result > 0) { LogProvider.InsertLogAction(result, ServiceProvider.TypeId, "", this.PortalId, (int)Connection.UtilsProvider.LogAction.Update, this.UserInfo.Username, this.UserId, this.txtTitleOld.Text, true, m_strCategories); } } if (result == -2) { this.lblError.Text = Localization.GetString("errSameName.Text", this.LocalResourceFile); this.lblError.Visible = true; } else if (result <= 0) { this.lblError.Text = Localization.GetString("errSomeError.Text", this.LocalResourceFile); this.lblError.Visible = true; } else { JumpBack(false, result); } } catch (Exception ex) { this.lblError.Text = ex.GetType().ToString(); this.lblError.Visible = true; } }
override protected void OnInit(EventArgs e) { InitializeComponent(); base.OnInit(e); #region Request m_Serviced = DataProcessingProvider.GetProcessedInt(Request.QueryString["ServiceId"]); m_preTabId = DataProcessingProvider.GetProcessedInt(Request.QueryString["PreTabId"]); if (m_Serviced == -1) { m_strCategories = DataProcessingProvider.GetProcessedString(Request.QueryString["Categories"]); if (m_strCategories == "") { m_strCategories = ",-1,"; } else { m_strCategories = DataProcessingProvider.GetProcessedBatchString(m_strCategories); } } else { m_strCategories = CategoryProvider.GetItemCategoryString(m_Serviced, ServiceProvider.TypeId); } #endregion #region Settings //Load Folder m_strFolderName = CategoryProvider.GetDefaultFolderPath(m_strCategories, this.PortalId); if (m_strFolderName == "") { m_strFolderName = (string)Settings[ServiceInsertSettings.FOLDER_IMAGE_KEY]; if (m_strFolderName == null || m_strFolderName.Length == 0) { m_strFolderName = ServiceInsertSettings.FOLDER_IMAGE_DEFAULT; } } string strFolderPath = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, m_strFolderName); if (!System.IO.Directory.Exists(strFolderPath)) { m_strFolderName = ServiceInsertSettings.FOLDER_IMAGE_DEFAULT; } m_strExtension = LoadStringSetting(ServiceInsertSettings.EXTENSTION_KEY, ServiceInsertSettings.EXTENSTION_VALUE_DEFAULT); m_linkUpload = LoadStringSetting(ServiceInsertSettings.LINKUPLOAD_KEY, ServiceInsertSettings.LINKUPLOAD_VALUE_DEFAULT); #endregion #region Datetime lnkExpiredDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtExpiredDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy"); //Điền dữ liệu vào các control imgExpiredDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath); lnkDisplayDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtDisplayDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy"); //Điền dữ liệu vào các control imgDisplayDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath); #endregion #region Register DotNetNuke.UI.Skins.Skin objParentSkin = DotNetNuke.UI.Skins.Skin.GetParentSkin(this); if (objParentSkin != null) { objParentSkin.RegisterModuleActionEvent(this.ModuleId, new ActionEventHandler(ModuleAction_Click)); } if (m_Serviced == -1) { m_objRole = new Role(this.UserId, GetSuperMode(), this.PortalId, ServiceProvider.TypeId); } else { m_objRole = new Role(this.UserId, m_Serviced, GetSuperMode(), this.PortalId, ServiceProvider.TypeId); } #endregion }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (m_isPassOnce) { return; } aLinkUpload.HRef = m_linkUpload; //Set DisplayDate to Today, Set ExpiredDate to ten years after. this.txtDisplayDate.Text = DateTime.Now.ToString("dd/MM/yyyy"); this.txtExpiredDate.Text = DateTime.Now.AddYears(10).ToString("dd/MM/yyyy"); //Load Categories //if (m_Serviced == -1) //{ this.chkCategoryList.DataSource = DataProcessingProvider.ProcessDataTable(CategoryProvider.GetExcludedCategories(this.PortalId, -1, ServiceProvider.TypeId), 1, 2); this.chkCategoryList.DataTextField = "Name"; this.chkCategoryList.DataValueField = "CategoryId"; this.chkCategoryList.DataBind(); UIProvider.BindListBox(chkCategoryList, m_strCategories); //} //else //{ // TH.Core.Providers.Utilities.UIProvider.PopulateCategories(this.chkCategoryList, m_strCategories, ServiceProvider.TypeId, this.UserId, GetSuperMode(), true, m_Serviced); //} //Bind Data if (m_Serviced != -1) { ImageBinding(); } m_isPassOnce = true; } } catch (Exception ex) { lblError.Text = ex.Message; this.lblError.Visible = true; } }
override protected void OnInit(EventArgs e) { InitializeComponent(); base.OnInit(e); #region Request m_ProductId = DataProcessingProvider.GetProcessedInt(Request.QueryString["ProductId"]); m_preTabId = DataProcessingProvider.GetProcessedInt(Request.QueryString["PreTabId"]); m_strTags = ","; if (m_ProductId == -1) { m_strCategories = DataProcessingProvider.GetProcessedString(Request.QueryString["Categories"]); if (m_strCategories == "") { m_strCategories = ",-1,"; } else { m_strCategories = DataProcessingProvider.GetProcessedBatchString(m_strCategories); } } else { DataTable dtTags = DotNetNuke.Data.DataProvider.Instance().ExecuteDataSet("THCore_CM_GetItemTags", m_ProductId, ProductProvider.TypeId).Tables[0]; if (dtTags.Rows.Count > 0) { for (int i = 0; i < dtTags.Rows.Count; i++) { m_strTags = m_strTags + dtTags.Rows[i][0].ToString() + ","; } } m_strCategories = CategoryProvider.GetItemCategoryString(m_ProductId, ProductProvider.TypeId); } //Dynamic Form string[] arrCategories = m_strCategories.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); int iCategory = -1; int.TryParse(arrCategories[0].Trim(), out iCategory); m_strExtension = LoadStringSetting(ProductInsertSettings.EXTENSTION_KEY, ProductInsertSettings.EXTENSTION_VALUE_DEFAULT); //string strExtendedSettings = CategoryProvider.GetExtendedSettings(iCategory); string strExtendedSettings = m_strExtension; dtConfig = new DataTable(); dtConfig = XMLProvider.XmlString2DataTable(strExtendedSettings); try { if (dtConfig != null && dtConfig.Rows.Count > 0) { CreateDynamicForm(dtConfig); } } catch (Exception ex) { lblError.Text = ex.Message; this.lblError.Visible = true; } #endregion #region Settings //Load Folder m_strFolderName = CategoryProvider.GetDefaultFolderPath(m_strCategories, this.PortalId); if (m_strFolderName == "") { m_strFolderName = (string)Settings[ProductInsertSettings.FOLDER_IMAGE_KEY]; if (m_strFolderName == null || m_strFolderName.Length == 0) { m_strFolderName = ProductInsertSettings.FOLDER_IMAGE_DEFAULT; } } string strFolderPath = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, m_strFolderName); if (!System.IO.Directory.Exists(strFolderPath)) { m_strFolderName = ProductInsertSettings.FOLDER_IMAGE_DEFAULT; } #endregion #region Datetime lnkExpiredDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtExpiredDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy"); //Điền dữ liệu vào các control imgExpiredDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath); lnkProducedDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtProducedDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy"); //Điền dữ liệu vào các control imgProducedDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath); lnkDisplayDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtDisplayDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy"); //Điền dữ liệu vào các control imgDisplayDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath); #endregion #region Register DotNetNuke.UI.Skins.Skin objParentSkin = DotNetNuke.UI.Skins.Skin.GetParentSkin(this); if (objParentSkin != null) { objParentSkin.RegisterModuleActionEvent(this.ModuleId, new ActionEventHandler(ModuleAction_Click)); } if (m_ProductId == -1) { m_objRole = new Role(this.UserId, GetSuperMode(), this.PortalId, ProductProvider.TypeId); } else { m_objRole = new Role(this.UserId, m_ProductId, GetSuperMode(), this.PortalId, ProductProvider.TypeId); } #endregion }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (m_isPassOnce) { return; } //Set DisplayDate to Today, Set ExpiredDate to ten years after. this.txtDisplayDate.Text = DateTime.Now.ToString("dd/MM/yyyy"); this.txtExpiredDate.Text = DateTime.Now.AddYears(10).ToString("dd/MM/yyyy"); this.txtProducedDate.Text = DateTime.Now.AddYears(10).ToString("dd/MM/yyyy"); txtWeight.Text = "0"; txtPrice.Text = "0"; txtPriceOld.Text = "0"; txtOrder.Text = "100"; //Load Categories //if (m_ProductId == -1) //{ this.chkCategoryList.DataSource = DataProcessingProvider.ProcessDataTable(CategoryProvider.GetExcludedCategories(this.PortalId, -1, ProductProvider.TypeId), 1, 2); this.chkCategoryList.DataTextField = "Name"; this.chkCategoryList.DataValueField = "CategoryId"; this.chkCategoryList.DataBind(); UIProvider.BindListBox(chkCategoryList, m_strCategories); //Tag this.chkTags.DataSource = DotNetNuke.Data.DataProvider.Instance().ExecuteDataSet("THCore_CM_GetTags", this.PortalId, 3).Tables[0]; this.chkTags.DataTextField = "Name"; this.chkTags.DataValueField = "TagID"; this.chkTags.DataBind(); UIProvider.BindListBox(chkTags, m_strTags); //} //else //{ // TH.Core.Providers.Utilities.UIProvider.PopulateCategories(this.chkCategoryList, m_strCategories, ProductProvider.TypeId, this.UserId, GetSuperMode(), true, m_ProductId); //} //Bind Data if (m_ProductId != -1) { ProductBinding(); } m_isPassOnce = true; } } catch (Exception ex) { lblError.Text = ex.Message; this.lblError.Visible = true; } }