public SymbologiesDataSource(IDataSourceListener dataSourceListener) { this.DataSourceListener = dataSourceListener; this.Sections = new[] { new Section(new[] { ActionRow.Create( "Enable All", tuple => { SettingsManager.Instance.EnableAllSymbologyies(); this.DataSourceListener.OnDataChange(); } ), ActionRow.Create( "Disable All", tuple => { SettingsManager.Instance.DisableAllSymbologies(); this.DataSourceListener.OnDataChange(); } ) }), new Section(SymbologyExtensions.AllValues.Select(symbology => { return(SymbologyRow.Create( () => SettingsManager.Instance.GetSymbologySettings(symbology), _ => SettingsManager.Instance.SymbologySettingsChanged(), this.DataSourceListener )); }).ToArray()) }; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { String News_ID = Request.QueryString["News_ID"]; ActionRow objActionRow = NewslistHelper.getLastestAction(Convert.ToInt64(News_ID)); txtComment_Title.Text = objActionRow.Comment_Title; txtComment_Content.Text = objActionRow.Content; } }
public static int getLastestStatus(long _news_id) { ActionRow ac = getLastestAction(_news_id); if (ac != null && !ac.IsActionTypeNull) { return(getLastestAction(_news_id).ActionType); } return(0); }
public static int getLastestStatus(long newsID) { ActionRow ac = getLastestAction(newsID); if (!ac.IsActionTypeNull) { return(ac.ActionType); } return(0); }
/// <summary> /// Ham lay Action hien thoi cua tin /// </summary> /// <param name="_news_id">ID cua tin</param> /// <returns></returns> /// public static NewsRow GetNewsByPrimaryKey(long _news_id) { string strcpmode = HttpContext.Current.Request.QueryString["cpmode"].ToString(); NewsRow _newsrow; using (MainDB objDb = new MainDB()) { _newsrow = objDb.NewsCollection.GetByPrimaryKey(_news_id); #region Cập nhập vào bảng Action if (strcpmode.ToLower().IndexOf("editwaitlist") >= 0 || strcpmode.ToLower().IndexOf("approvalwaitlis") >= 0) { ActionRow objArow = new ActionRow(); ActionRow objcurrAction = getLastestAction(_news_id); objArow.CreateDate = DateTime.Now; objArow.News_ID = _newsrow.News_ID; //sender chinh la nguoi cu - tot nhat k nen cho null - lay last action de tim sender objArow.Sender_ID = objcurrAction.Sender_ID; //dat lai receiver chinh la nguoi hien tai thuc hien thao tac voi tin objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; //Co nghia news_status =0,1 hoac 2 if (_newsrow.News_Status == 0) { objArow.ActionType = 0; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Khôi phục từ tin bị xoá"; } if (_newsrow.News_Status == 1) { objArow.ActionType = 1; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Nhận biên tập"; } if (_newsrow.News_Status == 2) { objArow.ActionType = 2; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Nhận duyệt"; } // co the con trang thai tiep theo objDb.ActionCollection.Insert(objArow); } #endregion } return(_newsrow); }
public ActionRow AddActionRow(string ID, string CloseNode, string AllyAction, string AxisAction, string Radius, string Goal, string Group, string Class, string Links, string Prone, string Active, string Entity) { ActionRow rowActionRow = ((ActionRow)(this.NewRow())); rowActionRow.ItemArray = new object[] { ID, CloseNode, AllyAction, AxisAction, Radius, Goal, Group, Class, Links, Prone, Active, Entity }; this.Rows.Add(rowActionRow); return(rowActionRow); }
private void AddRow(ActionBase action) { ActionBase a = action; ActionRow row = new ActionRow(action); row.ShowCancel = false; action.Completed += delegate { Program.Invoke(this, delegate { row.Visible = !a.IsCompleted; row.ShowCancel = false; bool canEnd = true; foreach (ActionRow r in customHistoryContainer1.CustomHistoryPanel.Rows) { if (!r.Action.IsCompleted || r.Action.Exception != null) { canEnd = false; break; } } customHistoryContainer1.Refresh(); if (canEnd) { DialogResult = DialogResult.Ignore; } }); }; action.Changed += (obj => Program.Invoke(this, delegate { row.Visible = !a.IsCompleted; row.ShowCancel = false; customHistoryContainer1.Refresh(); })); customHistoryContainer1.CustomHistoryPanel.AddItem(row); }
public ActionRowChangeEvent(ActionRow row, System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public void RemoveActionRow(ActionRow row) { this.Rows.Remove(row); }
private static void UpdateStatus(long newsID, int newsStatus) { NewsRow objRow; int old_news_status = -1; int _cat_id = -1; MainDB objDb = new MainDB(); objDb.BeginTransaction(); try { objRow = objDb.NewsCollection.GetByPrimaryKey(newsID); old_news_status = objRow.News_Status; _cat_id = objRow.Cat_ID; if (objRow != null) { //thuc hien doi trang thai cua tin - luu thong tin modified thanh ngay gio hien tai. objRow.News_Status = newsStatus; objRow.News_ModifiedDate = DateTime.Now; //thuc hien luu thong tin vao action. ActionRow objArow = new ActionRow(); //Gui len. Neu la xoa tam thi khong luu action if (newsStatus == 1) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gửi bài chờ biên tập"; objArow.ActionType = 1; } if (newsStatus == 2) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gửi bài chờ duyệt"; objArow.ActionType = 2; } NewsPublishedRow objpublishRow = new NewsPublishedRow(); if (newsStatus == 3) { objRow.News_Approver = HttpContext.Current.User.Identity.Name; if (objRow.IsNews_PublishDateNull == false && objRow.News_PublishDate.Year != 9999 && objRow.News_PublishDate.Year != 2000) { objRow.News_PublishDate = DateTime.Now; } objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " xuất bản bài"; objArow.ActionType = 3; //thuc hien chuyen du lieu qua bang newspublished objpublishRow.News_ID = objRow.News_ID; objpublishRow.Cat_ID = objRow.Cat_ID; objpublishRow.News_Subtitle = objRow.News_Subtitle; objpublishRow.News_Title = objRow.News_Title; objpublishRow.News_Image = objRow.News_Image; objpublishRow.News_Source = objRow.News_Source; objpublishRow.News_InitContent = objRow.News_InitialContent; objpublishRow.News_Content = objRow.News_Content; objpublishRow.News_Athor = objRow.News_Author; objpublishRow.News_Approver = objRow.News_Approver; objpublishRow.News_Status = 3; if (objRow.IsNews_PublishDateNull == true || objRow.News_PublishDate.Year == 9999 || objRow.News_PublishDate.Year == 2000) { objRow.News_PublishDate = DateTime.Now; } objpublishRow.News_PublishDate = objRow.News_PublishDate; objpublishRow.News_isFocus = objRow.News_isFocus; objpublishRow.News_Mode = objRow.News_Mode; objpublishRow.isComment = objRow.isComment; objpublishRow.isUserRate = objRow.isUserRate; objpublishRow.Template = objRow.Template; objpublishRow.Icon = objRow.Icon; objpublishRow.News_Relation = objRow.News_Relation; } if (newsStatus == 5) { ActionRow objLastestArow = getLastestAction(Convert.ToInt64(newsID)); objArow.Reciver_ID = objLastestArow.Sender_ID; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " trả lại bài"; objArow.ActionType = getLastestStatus(newsID); } //xoa tam if (newsStatus == 6) { objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " xoá tạm bài"; objArow.ActionType = getLastestStatus(newsID); } //gui bai tu backlist len if (newsStatus == -1) { int intLastStaus = getLastestStatus(newsID); objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gửi bài"; objRow.News_Status = intLastStaus; objArow.ActionType = intLastStaus; } if (newsStatus == 7) { int intLastStaus = getLastestStatus(newsID); objArow.ActionType = intLastStaus; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gỡ bỏ bài"; // Neu la go bo thi go luon o bang NewsPublished //using (MainDB objDb = new MainDB()) //{ objpublishRow = objDb.NewsPublishedCollection.GetByPrimaryKey(newsID); if (objpublishRow != null) { objDb.NewsPublishedCollection.DeleteByPrimaryKey(newsID); } //} } objArow.News_ID = newsID; objArow.Sender_ID = HttpContext.Current.User.Identity.Name; objArow.CreateDate = DateTime.Now; //if (_news_status != 6) objDb.ActionCollection.Insert(objArow); objDb.NewsCollection.Update(objRow); if (newsStatus == 3) { objDb.NewsPublishedCollection.Insert(objpublishRow); } // Commit Transaction objDb.CommitTransaction(); //#region Insert vao bang LogInfo để thống kê //Log objLog = new Log(); //if (old_news_status != -1 && old_news_status != newsStatus && _cat_id != -1) //{ // string strUser_Id = HttpContext.Current.User.Identity.Name; // if (newsStatus == 1) // { // // Đối với bài chờ biên tập // objLog.UpdateLogInfo((int)CountKey.Category_Wait_Edit_Content, _cat_id.ToString()); // objLog.UpdateLogInfo((int)CountKey.User_Wait_Edit_Content, strUser_Id); // } // else if (newsStatus == 2) // { // // Đối với bài chờ duyet // objLog.UpdateLogInfo((int)CountKey.Category_Wait_Approve_Content, _cat_id.ToString()); // objLog.UpdateLogInfo((int)CountKey.User_Wait_Approve_Content, strUser_Id); // } // else if (newsStatus == 3) // { // // Đối với bài đã xuất bản // objLog.UpdateLogInfo((int)CountKey.Category_Approved_Content, _cat_id.ToString()); // objLog.UpdateLogInfo((int)CountKey.User_Approved_Content, strUser_Id); // } //} //#endregion } } catch (Exception ex) { objDb.RollbackTransaction(); } finally { objDb.Close(); } }
public void AddActionRow(ActionRow row) { this.Rows.Add(row); }
public static NewsRow GetNewsInfo_News(long _news_id, bool isUpdateAction) { NewsRow _newsrow = null; using (MainDB objDb = new MainDB()) { //_newsrow = objDb.NewsCollection.GetByPrimaryKey(_news_id); #region Get thong tin chi tiet cua bang News DataTable table = objDb.StoredProcedures.vc_Execute_Sql("SELECT * FROM News WHERE News_ID = " + _news_id); if (table.Rows.Count != 0) { _newsrow = new NewsRow(); _newsrow.Cat_ID = table.Rows[0]["Cat_ID"] == System.DBNull.Value ? 0 : Convert.ToInt32(table.Rows[0]["Cat_ID"].ToString()); _newsrow.IsCat_IDNull = table.Rows[0]["Cat_ID"] == System.DBNull.Value ? true : false; _newsrow.isComment = table.Rows[0]["isComment"] == System.DBNull.Value ? false : Convert.ToBoolean(table.Rows[0]["isComment"]); _newsrow.IsisCommentNull = table.Rows[0]["isComment"] == System.DBNull.Value ? true : false; _newsrow.isUserRate = table.Rows[0]["isUserRate"] == System.DBNull.Value ? true : Convert.ToBoolean(table.Rows[0]["isUserRate"]); _newsrow.IsisUserRateNull = table.Rows[0]["isUserRate"] == System.DBNull.Value ? true : false; _newsrow.News_Approver = table.Rows[0]["News_Approver"] == System.DBNull.Value ? "" : table.Rows[0]["News_Approver"].ToString(); _newsrow.News_Author = table.Rows[0]["News_Author"] == System.DBNull.Value ? "" : table.Rows[0]["News_Author"].ToString(); _newsrow.News_Content = table.Rows[0]["News_Content"] == System.DBNull.Value ? "" : table.Rows[0]["News_Content"].ToString(); _newsrow.News_CreateDate = table.Rows[0]["News_CreateDate"] == System.DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(table.Rows[0]["News_CreateDate"]); _newsrow.IsNews_CreateDateNull = table.Rows[0]["News_CreateDate"] == System.DBNull.Value ? true : false; _newsrow.News_CurrEditor = table.Rows[0]["News_CurrEditor"] == System.DBNull.Value ? "" : table.Rows[0]["News_CurrEditor"].ToString(); _newsrow.News_ID = table.Rows[0]["News_ID"] == System.DBNull.Value ? -1 : Convert.ToInt64(table.Rows[0]["News_ID"]); _newsrow.News_Image = table.Rows[0]["News_Image"] == System.DBNull.Value ? "" : table.Rows[0]["News_Image"].ToString(); _newsrow.News_ImageNote = table.Rows[0]["News_ImageNote"] == System.DBNull.Value ? "" : table.Rows[0]["News_ImageNote"].ToString(); _newsrow.News_InitialContent = table.Rows[0]["News_InitialContent"] == System.DBNull.Value ? "" : table.Rows[0]["News_InitialContent"].ToString(); _newsrow.News_isFocus = table.Rows[0]["News_isFocus"] == System.DBNull.Value ? true : (bool)table.Rows[0]["News_isFocus"]; _newsrow.IsNews_isFocusNull = table.Rows[0]["News_isFocus"] == System.DBNull.Value ? true : false; _newsrow.News_Mode = table.Rows[0]["News_Mode"] == System.DBNull.Value ? -1 : Convert.ToInt32(table.Rows[0]["News_Mode"]); _newsrow.IsNews_ModeNull = table.Rows[0]["News_Mode"] == System.DBNull.Value ? true : false; _newsrow.News_ModifiedDate = table.Rows[0]["News_ModifiedDate"] == System.DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(table.Rows[0]["News_ModifiedDate"]); _newsrow.IsNews_ModifiedDateNull = table.Rows[0]["News_ModifiedDate"] == System.DBNull.Value ? true : false; _newsrow.News_OtherCat = table.Rows[0]["News_OtherCat"] == System.DBNull.Value ? "" : table.Rows[0]["News_OtherCat"].ToString(); _newsrow.News_PublishDate = table.Rows[0]["News_PublishDate"] == System.DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(table.Rows[0]["News_PublishDate"]); _newsrow.IsNews_PublishDateNull = table.Rows[0]["News_PublishDate"] == System.DBNull.Value ? true : false; _newsrow.News_Rate = table.Rows[0]["News_Rate"] == System.DBNull.Value ? -1 : Convert.ToDecimal(table.Rows[0]["News_Rate"]); _newsrow.IsNews_RateNull = table.Rows[0]["News_Rate"] == System.DBNull.Value ? true : false; _newsrow.News_Relation = table.Rows[0]["News_Relation"] == System.DBNull.Value ? "" : table.Rows[0]["News_Relation"].ToString(); _newsrow.News_Source = table.Rows[0]["News_Source"] == System.DBNull.Value ? "" : table.Rows[0]["News_Source"].ToString(); _newsrow.News_Status = table.Rows[0]["News_Status"] == System.DBNull.Value ? -1 : Convert.ToInt32(table.Rows[0]["News_Status"]); _newsrow.IsNews_StatusNull = table.Rows[0]["News_Status"] == System.DBNull.Value ? true : false; _newsrow.News_Subtitle = table.Rows[0]["News_Subtitle"] == System.DBNull.Value ? "" : table.Rows[0]["News_Subtitle"].ToString(); _newsrow.News_SwitchTime = table.Rows[0]["News_SwitchTime"] == System.DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(table.Rows[0]["News_SwitchTime"]); _newsrow.IsNews_SwitchTimeNull = table.Rows[0]["News_SwitchTime"] == System.DBNull.Value ? true : false; _newsrow.News_Title = table.Rows[0]["News_Title"] == System.DBNull.Value ? "" : table.Rows[0]["News_Title"].ToString(); _newsrow.News_ViewNum = table.Rows[0]["News_ViewNum"] == System.DBNull.Value ? -1 : Convert.ToInt32(table.Rows[0]["News_ViewNum"]); _newsrow.IsNews_ViewNumNull = table.Rows[0]["News_ViewNum"] == System.DBNull.Value ? true : false; _newsrow.Icon = table.Rows[0]["Icon"] == System.DBNull.Value ? "" : table.Rows[0]["Icon"].ToString(); _newsrow.Extension1 = table.Rows[0]["Extension1"] == System.DBNull.Value ? "" : table.Rows[0]["Extension1"].ToString(); _newsrow.Extension2 = table.Rows[0]["Extension2"] == System.DBNull.Value ? "" : table.Rows[0]["Extension2"].ToString(); _newsrow.Extension3 = table.Rows[0]["Extension3"] == System.DBNull.Value ? "" : table.Rows[0]["Extension3"].ToString(); _newsrow.Extension4 = table.Rows[0]["Extension4"] == System.DBNull.Value ? -1 : Convert.ToInt32(table.Rows[0]["Extension4"]); } } #endregion #region Cập nhập vào bảng Action if (isUpdateAction == true) { string strcpmode = HttpContext.Current.Request.QueryString["cpmode"].ToString(); if (strcpmode.ToLower().IndexOf("editwaitlist") >= 0 || strcpmode.ToLower().IndexOf("approvalwaitlis") >= 0) { ActionRow objArow = new ActionRow(); ActionRow objcurrAction = getLastestAction(_news_id); objArow.CreateDate = DateTime.Now; objArow.News_ID = _newsrow.News_ID; //sender chinh la nguoi cu - tot nhat k nen cho null - lay last action de tim sender objArow.Sender_ID = objcurrAction.Sender_ID; //dat lai receiver chinh la nguoi hien tai thuc hien thao tac voi tin objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; //Co nghia news_status =0,1 hoac 2 if (_newsrow.News_Status == 0) { objArow.ActionType = 0; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Khôi phục từ tin bị xoá"; } if (_newsrow.News_Status == 1) { objArow.ActionType = 1; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Nhận biên tập"; } if (_newsrow.News_Status == 2) { objArow.ActionType = 2; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Nhận duyệt"; } using (MainDB objDb = new MainDB()) { // co the con trang thai tiep theo objDb.ActionCollection.Insert(objArow); } } } #endregion return(_newsrow); }
public static bool UpdateNews(long _news_id, int _cat_id, string _news_subtitle, string _news_title, string _news_image, string _news_source, string _news_init, string _news_content, bool _news_isfocus, int _news_status, int _news_type, string _related_news, string _other_cat, DateTime _switchtime, bool _isSend, bool _isShowComment, bool _isShowRate, int _template, string _obj_media, string _news_title_image, string _news_icon, string _thread_id) { bool toReturn = false; int old_news_status = -1; MainDB objDb = new MainDB(); objDb.BeginTransaction(); NewsRow objrow; if (_news_init != null) { _news_init = _news_init.Replace(System.Environment.NewLine, "<br/>"); } try { #region Gan Thread vao bai // Gan Thread vao bai Threaddetails objThread = new Threaddetails(); objDb.SelectScalar("Delete ThreadDetail Where News_ID = '" + _news_id + "'"); if (_thread_id != null) { string[] strArThread = _thread_id.Split(','); foreach (string str in strArThread) { objThread.AddnewsThread(_news_id.ToString(), int.Parse(str), objDb); } } #endregion objrow = objDb.NewsCollection.GetByPrimaryKey(_news_id); old_news_status = objrow.News_Status; if (objrow != null) { #region Gan cac gia tri cho bang News objrow.Cat_ID = _cat_id; objrow.News_Subtitle = _news_subtitle; objrow.News_Title = _news_title; objrow.News_Image = _news_image; objrow.News_Source = _news_source; objrow.News_InitialContent = _news_init; objrow.News_Content = _news_content; objrow.WordCount = NewsHelper.WordCount(objrow.News_Content); //objrow.User_ID = _poster; //objrow.News_Author = _news_author; objrow.News_isFocus = _news_isfocus; //Trang thai cua tin tuy thuoc vao nguoi bien tap. if (_news_status != -1) { objrow.News_Status = _news_status; } objrow.News_Mode = _news_type; //tin lien quan objrow.News_Relation = _related_news; //if (_news_imgfocus != "" && _news_imgfocus!=null) //objrow.News_FocusImage = _news_imgfocus; if (_other_cat != "") { objrow.News_OtherCat = _other_cat; } DateTime dtPublish = _switchtime; if (objrow.News_Status == 3) { if (dtPublish.Year != 9999) { // Neu khong phai la news da published ma khong chon ngay Xuat ban thi update lai ngay gio if (dtPublish.Year != 2000) { objrow.News_PublishDate = dtPublish; } else { objrow.News_PublishDate = DateTime.Now; } } } objrow.Template = _template; objrow.News_ImageNote = _news_title_image; objrow.isComment = _isShowComment; objrow.isUserRate = _isShowRate; objrow.Icon = _news_icon; objrow.News_ModifiedDate = DateTime.Now; #endregion #region Gan cac gia tri cho bang Action //thuc hien luu thong tin vao action. ActionRow objArow = new ActionRow(); objArow.Sender_ID = HttpContext.Current.User.Identity.Name; //Gui len. Neu la xoa tam thi khong luu action - Cho nay can phai xem la gui len hay luu lai? string cpMode = HttpContext.Current.Request.QueryString["cpmode"].Replace("add,", string.Empty); switch (objrow.News_Status) { case 1: if (old_news_status != 1) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gửi bài chờ biên tập"; } else { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " nhận biên tập"; objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; ActionRow tem = new ActionRow(); tem = getLastestAction(_news_id); objArow.Sender_ID = tem.Sender_ID; } break; case 2: if (old_news_status != 2) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gửi bài chờ duyệt"; } else { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " nhận duyệt"; objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; ActionRow tem = new ActionRow(); tem = getLastestAction(_news_id); objArow.Sender_ID = tem.Sender_ID; } break; case 3: objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " xuất bản bài"; break; } objArow.ActionType = objrow.News_Status; objArow.News_ID = _news_id; objArow.CreateDate = DateTime.Now; // chỉ khi tin đổi trạng thái // hoặc // không phải tin ở trong danh sách nhận duyệt, nhận biên tập // thì mới lưu action // [bacth, 11:00 AM 5/31/2008] if (old_news_status != objrow.News_Status || (cpMode.ToLower().Equals("approvalwaitlist") || cpMode.ToLower().Equals("editwaitlist"))) { if (objrow.News_Status == 1 || objrow.News_Status == 2 || objrow.News_Status == 3) { objDb.ActionCollection.Insert(objArow); } } #endregion #region Gan cac gia tri cho bang NewsPublished NewsPublishedRow objpublishRow; // Get lai nhung gia tri cua cua News Published objpublishRow = objDb.NewsPublishedCollection.GetByPrimaryKey(_news_id); // Neu khong ton tai news_id trong NewsPUblished thi khoi tao lai if (objpublishRow == null) { objpublishRow = new NewsPublishedRow(); } // Gan cac gia tri cho News Published if (_news_status == 3) { objrow.News_Approver = HttpContext.Current.User.Identity.Name; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " xuất bản bài"; objArow.ActionType = 3; //thuc hien chuyen du lieu qua bang newspublished objpublishRow.Icon = _news_icon; objpublishRow.News_ID = _news_id; objpublishRow.Cat_ID = _cat_id; objpublishRow.News_Subtitle = _news_subtitle; objpublishRow.News_Title = _news_title; if (_news_image != "" && _news_image != null) { objpublishRow.News_Image = _news_image; } else { objpublishRow.News_Image = objrow.News_Image; } objpublishRow.News_Source = _news_source; objpublishRow.News_InitContent = objrow.News_InitialContent; objpublishRow.News_Content = _news_content; objpublishRow.News_Athor = objrow.News_Author; objpublishRow.News_Approver = HttpContext.Current.User.Identity.Name; objpublishRow.News_Status = 3; if (dtPublish.Year != 9999) { // Neu khong phai la news da published ma khong chon ngay Xuat ban thi update lai ngay gio if (dtPublish.Year != 2000) { objpublishRow.News_PublishDate = dtPublish; } else { objpublishRow.News_PublishDate = DateTime.Now; } } objpublishRow.News_isFocus = _news_isfocus; objpublishRow.News_Mode = _news_type; if (_related_news != "" && _related_news != null) { objpublishRow.News_Relation = objrow.News_Relation; } else { objpublishRow.News_Relation = _related_news; } if (_other_cat != "" && _other_cat != null) { objpublishRow.News_OtherCat = objrow.News_OtherCat; } else { objpublishRow.News_OtherCat = _other_cat; } objpublishRow.Template = _template; objpublishRow.isComment = _isShowComment; objpublishRow.isUserRate = _isShowRate; objpublishRow.News_ImageNote = _news_title_image; } #endregion if (!objDb.NewsCollection.Update(objrow)) { throw new Exception("Không cập nhật được bản tin"); } #region Cap nhap vao bang News, Action va NewsPublished NewsPublishedRow objCurrRow; //neu la send thi moi cap nhat Action if (objrow.News_Status == 3) { //thuc hien xoa neu ton tai tin do va chen moi vao bang xuat ban objCurrRow = objDb.NewsPublishedCollection.GetByPrimaryKey(_news_id); if (objCurrRow != null) { objDb.NewsPublishedCollection.DeleteByPrimaryKey(_news_id); } objDb.NewsPublishedCollection.Insert(objpublishRow); } #endregion #region Cap nhap vao bang MediaObject // Xoa tat ca News_Media cu theo NewsID string strObjectId = NewsMediaHelper.Get_ObjectId_By_NewsId(_news_id); if (strObjectId != null && strObjectId != "") { string[] mediaIds = strObjectId.Split(",".ToCharArray()); foreach (string strMediaId in mediaIds) { NewsMediaHelper.Delete_News_Media_ByNewsIdAndObjectId(_news_id, strMediaId, objDb); } } //truong hop co media object if (_obj_media != null && _obj_media != "") { News_MediaRow objMrow = null; string[] mediaIds = _obj_media.Split(",".ToCharArray()); foreach (string strMediaId in mediaIds) { objMrow = new News_MediaRow(); objMrow.News_ID = _news_id; objMrow.Object_ID = int.Parse(strMediaId); objDb.News_MediaCollection.Insert(objMrow); } } #endregion objDb.CommitTransaction(); toReturn = true; } } catch (Exception ex) { throw ex; } finally { if (HttpContext.Current.Session["newsid"] != null) { HttpContext.Current.Session.Remove("newsid"); } objDb.Close(); } return(toReturn);; }
public static bool CreateNews(long _news_id, int _cat_id, string _news_subtitle, string _news_title, string _news_image, string _news_source, string _news_init, string _news_content, string _poster, bool _news_isfocus, int _news_status, int _news_type, string _related_news, string _obj_media, string _other_cat, DateTime _switchtime, bool _isShowComment, bool _isShowRate, int _template, string _news_title_image, string _news_icon, string _thread_id) { bool toReturn = false; MainDB objDb = new MainDB(); objDb.BeginTransaction(); try { #region Gán giá trị cho bảng News NewsRow objrow = new NewsRow(); //strResult = _news_id; objrow.News_ID = _news_id; objrow.Cat_ID = _cat_id; objrow.News_Subtitle = _news_subtitle; objrow.News_Title = _news_title; objrow.News_Image = _news_image; objrow.News_Source = _news_source; objrow.News_InitialContent = _news_init; objrow.News_Content = _news_content; objrow.News_Author = _poster; //objrow.News_Author = _news_author; objrow.News_isFocus = _news_isfocus; objrow.News_Status = _news_status; objrow.News_Mode = _news_type; //Danh sach nhung tin lien quan den tin nay objrow.News_Relation = _related_news; //objrow.News_FocusImage = _news_imgfocus; objrow.News_CreateDate = DateTime.Now; objrow.News_ModifiedDate = DateTime.Now; objrow.isComment = _isShowComment; objrow.isUserRate = _isShowRate; objrow.Template = _template; objrow.News_ImageNote = _news_title_image; objrow.Icon = _news_icon; objrow.WordCount = NewsHelper.WordCount(objrow.News_Content); if (_news_status == 3) { if (_switchtime.Year != 2000) { objrow.News_PublishDate = _switchtime; } else { objrow.News_PublishDate = DateTime.Now; } objrow.News_Approver = HttpContext.Current.User.Identity.Name; } //lay other cat neu co if (_other_cat != null && _other_cat != "" && _other_cat != "0") { objrow.News_OtherCat = _other_cat; } #endregion #region Gán và Insert giá trị cho bảng Action và NewsPublished //Thuc hien cap nhat thong tin vao Action ActionRow objArow = new ActionRow(); objArow.News_ID = objrow.News_ID; objArow.Sender_ID = HttpContext.Current.User.Identity.Name; objArow.ActionType = _news_status; objArow.CreateDate = DateTime.Now; if (_news_status == 0) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Tạo bài viết"; objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; } if (_news_status == 1) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Tạo bài viết và gửi lên chờ biên tập"; objrow.News_SwitchTime = DateTime.Now; } if (_news_status == 2) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Tạo bài viết và gửi lên chờ duyệt"; objrow.News_SwitchTime = DateTime.Now; } NewsPublishedRow objpublishRow = new NewsPublishedRow(); if (_news_status == 3) { // Chỉ có những tin nào xuất bản thì mới Insert vào bảng News Published objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " Tạo bài viết và xuất bản"; //thuc hien xuat ban bai viet objpublishRow.News_ID = _news_id; objpublishRow.Cat_ID = _cat_id; objpublishRow.News_Subtitle = _news_subtitle; objpublishRow.News_Title = _news_title; objpublishRow.News_Image = _news_image; objpublishRow.News_Source = _news_source; objpublishRow.News_InitContent = objrow.News_InitialContent; objpublishRow.News_Content = _news_content; objpublishRow.News_Athor = _poster; objpublishRow.News_Approver = HttpContext.Current.User.Identity.Name; objpublishRow.News_Status = 3; if (_switchtime.Year != 2000) { objpublishRow.News_PublishDate = _switchtime; } else { objpublishRow.News_PublishDate = DateTime.Now; } objpublishRow.News_isFocus = _news_isfocus; objpublishRow.News_Mode = _news_type; objpublishRow.News_Relation = _related_news; objpublishRow.News_OtherCat = _other_cat; objpublishRow.Template = _template; objpublishRow.isComment = _isShowComment; objpublishRow.isUserRate = _isShowRate; objpublishRow.News_ImageNote = _news_title_image; objpublishRow.Icon = _news_icon; objpublishRow.WordCount = objrow.WordCount; } // thu insert 2 lan if (!objDb.NewsCollection.Insert(objrow)) { objrow.News_ID = long.Parse(NewsHelper.GenNewsID()); objpublishRow.News_ID = objrow.News_ID; objArow.News_ID = objrow.News_ID; if (!objDb.NewsCollection.Insert(objrow)) { throw new Exception("Insert khong thanh cong"); } } objDb.ActionCollection.Insert(objArow); if (objrow.News_Status == 3) { objDb.NewsPublishedCollection.Insert(objpublishRow); } #endregion #region Gan Thread vao bai // Gan Thread vao bai if (_thread_id != null && _thread_id != "") { Threaddetails objThread = new Threaddetails(); string[] strArThread = _thread_id.Split(','); foreach (string str in strArThread) { objThread.AddnewsThread(objrow.News_ID.ToString(), Convert.ToInt32(str), objDb); } } #endregion #region Insert vào bảng MediaObject //truong hop co media object if (_obj_media != null && _obj_media != "") { News_MediaRow objMrow = null; string[] mediaIds = _obj_media.Split(",".ToCharArray()); foreach (string strMediaId in mediaIds) { objMrow = new News_MediaRow(); objMrow.News_ID = objrow.News_ID; objMrow.Object_ID = Convert.ToInt32(strMediaId); objDb.News_MediaCollection.Insert(objMrow); } } #endregion objDb.CommitTransaction(); toReturn = true; } catch (Exception ex) { objDb.RollbackTransaction(); toReturn = false; // log to system try { string mes = ""; mes += "NewsId = " + _news_id + Environment.NewLine; mes += "User_Id = " + HttpContext.Current.User.Identity.Name + Environment.NewLine; mes += "_related_news = " + _related_news + Environment.NewLine; mes += "_other_cat = " + _other_cat + Environment.NewLine; mes += "_thread_id = " + _thread_id + Environment.NewLine; mes += ex.ToString(); System.Diagnostics.EventLog.WriteEntry("CreateNews_CMS_LOG", mes); } catch (Exception e) { } } finally { if (HttpContext.Current.Session["newsid"] != null) { HttpContext.Current.Session.Remove("newsid"); } objDb.Close(); } return(toReturn); }
private static void newsupdate(long _news_id, int _news_status) { NewsRow objRow; int old_news_status = -1; int _cat_id = -1; MainDB objDb = new MainDB(); objDb.BeginTransaction(); string strAction = ""; try { objRow = objDb.NewsCollection.GetByPrimaryKey(_news_id); string _news_title = objRow.News_Title.Trim(); old_news_status = objRow.News_Status; _cat_id = objRow.Cat_ID; int type_log_action = LogAction.LogType_BaiViet; if (objRow != null) { //thuc hien doi trang thai cua tin - luu thong tin modified thanh ngay gio hien tai. objRow.News_Status = _news_status; objRow.News_ModifiedDate = DateTime.Now; objRow.News_Approver = HttpContext.Current.User.Identity.Name; //thuc hien luu thong tin vao action. ActionRow objArow = new ActionRow(); //Gui len. Neu la xoa tam thi khong luu action if (_news_status == 1) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gửi bài chờ biên tập"; objArow.ActionType = 1; strAction = "<b>" + _news_title.Replace("'", "") + "</b> " + LogAction.LogAction_GuiChoBT + " bởi " + HttpContext.Current.User.Identity.Name; } if (_news_status == 2) { objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gửi bài chờ duyệt"; objArow.ActionType = 2; strAction = "<b>" + _news_title.Replace("'", "") + "</b> " + LogAction.LogAction_GuiChoBT + " bởi " + HttpContext.Current.User.Identity.Name; } NewsPublishedRow objpublishRow = new NewsPublishedRow(); if (_news_status == 3) { objRow.News_Approver = HttpContext.Current.User.Identity.Name; if (objRow.IsNews_PublishDateNull == false && objRow.News_PublishDate.Year != 9999 && objRow.News_PublishDate.Year != 2000) { objRow.News_PublishDate = DateTime.Now; } objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " xuất bản bài"; objArow.ActionType = 3; strAction = "<b>" + _news_title.Replace("'", "") + "</b> " + LogAction.LogAction_XB + " bởi " + HttpContext.Current.User.Identity.Name; type_log_action = LogAction.LogType_BaiViet_XB; //thuc hien chuyen du lieu qua bang newspublished objpublishRow.News_ID = objRow.News_ID; objpublishRow.Cat_ID = objRow.Cat_ID; objpublishRow.News_Subtitle = objRow.News_Subtitle; objpublishRow.News_Title = objRow.News_Title; objpublishRow.News_Image = objRow.News_Image; objpublishRow.News_Source = objRow.News_Source; objpublishRow.News_InitContent = objRow.News_InitialContent; objpublishRow.News_Content = objRow.News_Content; objpublishRow.News_Athor = objRow.News_Author; objpublishRow.News_Approver = objRow.News_Approver; objpublishRow.News_Status = 3; if (objRow.IsNews_PublishDateNull == true || objRow.News_PublishDate.Year == 9999 || objRow.News_PublishDate.Year == 2000) { objRow.News_PublishDate = DateTime.Now; } objpublishRow.News_PublishDate = objRow.News_PublishDate; objpublishRow.News_isFocus = objRow.News_isFocus; objpublishRow.News_Mode = objRow.News_Mode; objpublishRow.isComment = objRow.isComment; objpublishRow.isUserRate = objRow.isUserRate; objpublishRow.Template = objRow.Template; objpublishRow.Icon = objRow.Icon; //objpublishRow.News_Relation = objRow.News_Relation; } if (_news_status == 5) { ActionRow objLastestArow = NewslistHelper.getLastestAction(Convert.ToInt64(_news_id)); objArow.Reciver_ID = objLastestArow.Sender_ID; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " trả lại bài"; strAction = "<b>" + _news_title.Replace("'", "") + "</b> " + LogAction.LogAction_TraLai + " bởi " + HttpContext.Current.User.Identity.Name; objArow.ActionType = getLastestStatus(_news_id); if (old_news_status == 3) { type_log_action = LogAction.LogType_BaiViet_XB; } } //xoa tam if (_news_status == 6) { objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " xoá tạm bài"; strAction = "<b>" + _news_title.Replace("'", "") + "</b> " + LogAction.LogAction_XoaTam + " bởi " + HttpContext.Current.User.Identity.Name; objArow.ActionType = getLastestStatus(_news_id); } //gui bai tu backlist len if (_news_status == -1) { int intLastStaus = getLastestStatus(_news_id); objArow.Reciver_ID = HttpContext.Current.User.Identity.Name; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gửi bài"; strAction = "<b>" + _news_title.Replace("'", "") + "</b> " + LogAction.LogAction_GuiBai + " bởi " + HttpContext.Current.User.Identity.Name; objRow.News_Status = intLastStaus; objArow.ActionType = intLastStaus; } if (_news_status == 7) { int intLastStaus = getLastestStatus(_news_id); objArow.ActionType = intLastStaus; objArow.Comment_Title = HttpContext.Current.User.Identity.Name + " gỡ bỏ bài"; strAction = "<b>" + _news_title.Replace("'", "") + "</b> " + LogAction.LogAction_GoBai + " bởi " + HttpContext.Current.User.Identity.Name; type_log_action = LogAction.LogType_BaiViet_XB; objpublishRow = objDb.NewsPublishedCollection.GetByPrimaryKey(_news_id); if (objpublishRow != null) { objDb.NewsPublishedCollection.DeleteByPrimaryKey(_news_id); } } objArow.News_ID = _news_id; objArow.Sender_ID = HttpContext.Current.User.Identity.Name; objArow.CreateDate = DateTime.Now; objDb.ActionCollection.Insert(objArow); objDb.NewsCollection.Update(objRow); if (_news_status == 3) { objDb.NewsPublishedCollection.Insert(objpublishRow); } // Commit Transaction objDb.CommitTransaction(); } } catch (Exception ex) { objDb.RollbackTransaction(); } finally { objDb.Close(); } }
public ActionRowWrapper(ActionRow model) : base(model) { }
public static string getSender(long _news_id) { ActionRow _arows = getLastestAction(_news_id); return(_arows != null ? _arows.Sender_ID : ""); }
public ActionRowChangeEvent(ActionRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public void AddActionRow(ActionRow row) { this.Rows.Add(row); }
public void RemoveActionRow(ActionRow row) { this.Rows.Remove(row); }
public ActionRowChangeEvent(ActionRow row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }