private void OPR_SendData(object sender, PublishType pt, bool isLogin, string Msg, object oResult) { if (pt == PublishType.Login) { MessageBox.Show(Msg.ToString()); } else if (pt == PublishType.LoginOver) { MessageBox.Show(Msg.ToString()); } else if (pt == PublishType.GetClassListOver) { //加入分类 List <ModelClassItem> ListModelClassItem = (List <ModelClassItem>)oResult; int WebSiteID = StringHelper.Instance.SetNumber(this.txtID.Text); DALWebSiteClassList dal = new DALWebSiteClassList(); foreach (ModelClassItem item in ListModelClassItem) { dal.InsertClassList(WebSiteID.ToString(), item.ClassID, item.ClassName, string.Empty); } this.Bind_ClassList(); } }
private void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtKeywordList.Text)) { MessageBox.Show("关键词列表不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DALWebSiteClassList model = new DALWebSiteClassList(); int ID = StringHelper.Instance.SetNumber(this.txtID.Text); string KeywordList = this.txtKeywordList.Text; model.ID = ID; model.KeywordList = KeywordList; if (ID == 0) { model.Add(); if (OO != null) { OO(this, "添加成功!", Common.Option.add); } } else if (ID > 0) { model.Update(); if (OO != null) { OO(this, "修改成功!", Common.Option.edit); } } this.Close(); this.Dispose(); }
/// <summary> /// 分类删除 /// </summary> private void ToolStripMenuItem_WebSiteClassDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("你确定要删除吗?", "警告!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { int ID = Get_DataViewID(); DALWebSiteClassList dal = new DALWebSiteClassList(); dal.Delete(ID); this.Bind_ClassList(); } }
/// <summary> /// 绑定数据源分类 /// </summary> private void Bind_FileSourceClassList() { this.cmbFileSourceClassIDList.Items.Clear(); this.cmbFileSourceClassIDList.Items.Add(new ListItem("0", "请选择")); DALWebSiteClassList dalWebSiteClassList = new DALWebSiteClassList(); DataSet ds = dalWebSiteClassList.GetClassList(this.txtID.Text); foreach (DataRow dr in ds.Tables[0].Rows) { this.cmbFileSourceClassIDList.Items.Add(new ListItem(dr["ClassID"].ToString(), dr["ClassName"].ToString())); } this.cmbFileSourceClassIDList.SelectedIndex = 0; }
/// <summary> /// 加载分类 /// </summary> private void Bind_ClassList() { DALWebSiteClassList dal = new DALWebSiteClassList(); int WebSiteID = StringHelper.Instance.SetNumber(this.txtID.Text); DataSet ds = dal.GetClassList(WebSiteID.ToString()); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; this.dataGridView_ClassList.AutoGenerateColumns = false; this.dataGridView_ClassList.AllowUserToAddRows = false; this.dataGridView_ClassList.DataSource = dt.DefaultView; } }
/// <summary> /// 加载分类 /// </summary> private void Bind_WebSiteClassList(int WebSiteID) { this.cmbClassList.Items.Clear(); this.cmbClassList.Items.Add(new ListItem("0", "请选择")); DALWebSiteClassList dal = new DALWebSiteClassList(); DataSet ds = dal.GetClassList(WebSiteID.ToString()); if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { this.cmbClassList.Items.Add(new ListItem(dr["ClassID"].ToString(), dr["ClassName"].ToString())); } } this.cmbClassList.SelectedIndex = 0; }
private void frmWebSiteClassEdit_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.OldValue) && this.OldValue != "0") { DALWebSiteClassList model = new DALWebSiteClassList().GetModel(StringHelper.Instance.SetNumber( this.OldValue )); if (model != null) { this.txtID.Text = model.ID.ToString(); this.txtClassName.Text = model.ClassName; this.txtKeywordList.Text = model.KeywordList; } } }
/// <summary> /// 分类发布数据 /// </summary> private void SendArticleContentClassList(int DataSourceType) { DataSet dsClassList = new DALWebSiteClassList().GetClassList(ModelWebSite.ID.ToString()); if (dsClassList != null && dsClassList.Tables[0].Rows.Count > 0) { if (DataSourceType == 4) { this.SendArticleContentByNetWork(dsClassList.Tables[0]); return; } if (DataSourceType == 3) { this.SendArticleContentByFileDir(); } } foreach (DataRow drClass in dsClassList.Tables[0].Rows) { ClassID = drClass["ClassID"].ToString(); ClassName = drClass["ClassName"].ToString(); Keywords = drClass["KeywordList"].ToString(); switch (DataSourceType) { case 1: this.SendArticleContentByDataBase(); break; case 2: break; case 3: this.SendArticleContentByFileDir(); break; case 4: break; } } }