Example #1
0
        /// <summary>
        /// 编辑当前数据项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEditEnter_Click(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.Button btn = (System.Web.UI.WebControls.Button)sender;
            int index = ((GridViewRow)(btn.Parent.Parent)).RowIndex;
            int id    = int.Parse(this.gvColumns.DataKeys[index].Value.ToString());

            //
            Song.Entities.GuideColumns col = Business.Do <IGuide>().ColumnsSingle(id);
            if (col != null)
            {
                //名称
                TextBox tb = (TextBox)gvColumns.Rows[index].FindControl("tbTitle");
                col.Gc_Title = tb.Text.Trim();
                //父级
                DropDownTree tree = (DropDownTree)gvColumns.Rows[index].FindControl("ddlColTree");
                col.Gc_PID = Convert.ToInt32(tree.SelectedValue);
                //是否可用
                CheckBox cb = (CheckBox)gvColumns.Rows[index].FindControl("cbIsUse");
                col.Gc_IsUse = cb.Checked;
                //简介
                TextBox tbintro = (TextBox)gvColumns.Rows[index].FindControl("tbIntro");
                col.Gc_Intro = tbintro.Text.Trim();
                //
                Business.Do <IGuide>().ColumnsSave(col);
            }
            gvColumns.EditIndex = -1;
            BindData(null, null);
        }
Example #2
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="entity">业务实体</param>
 public void ColumnsSave(GuideColumns entity)
 {
     Song.Entities.GuideColumns old = this.ColumnsSingle(entity.Gc_ID);
     if (old.Gc_PID != entity.Gc_PID)
     {
         object obj = Gateway.Default.Max <GuideColumns>(GuideColumns._.Gc_Tax, GuideColumns._.Cou_ID == entity.Cou_ID && GuideColumns._.Gc_PID == entity.Gc_PID);
         entity.Gc_Tax = obj is int?(int)obj + 1 : 0;
     }
     using (DbTrans trans = Gateway.Default.BeginTrans())
     {
         try
         {
             trans.Save <GuideColumns>(entity);
             trans.Update <GuideColumns>(new Field[] { Guide._.Gc_Title }, new object[] { entity.Gc_Title, }, GuideColumns._.Gc_ID == entity.Gc_ID);
             trans.Commit();
         }
         catch (Exception ex)
         {
             trans.Rollback();
             throw ex;
         }
         finally
         {
             trans.Close();
         }
     }
 }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.Form.DefaultButton = this.btnSear.UniqueID;
     org = Business.Do <IOrganization>().OrganCurrent();
     if (!this.IsPostBack)
     {
         if (state == "add" || state == "edit")
         {
             plEditArea.Visible = true;
             plListArea.Visible = false;
         }
         else
         {
             plEditArea.Visible = false;
             plListArea.Visible = true;
         }
         //栏目名称
         spanColName.Visible = gcid != 0;
         if (gcid != 0)
         {
             Song.Entities.GuideColumns col = Business.Do <IGuide>().ColumnsSingle(gcid);
             if (col != null)
             {
                 lbColunms.Text = col.Gc_Title;
             }
         }
         BindData(null, null);
     }
 }
Example #4
0
        /// 修改是否使用的状态
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void sbUse_Click(object sender, EventArgs e)
        {
            StateButton ub    = (StateButton)sender;
            int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
            int         id    = int.Parse(this.gvColumns.DataKeys[index].Value.ToString());

            //
            Song.Entities.GuideColumns entity = Business.Do <IGuide>().ColumnsSingle(id);
            entity.Gc_IsUse = !entity.Gc_IsUse;
            Business.Do <IGuide>().ColumnsSave(entity);
            BindData(null, null);
        }
Example #5
0
 /// <summary>
 /// 新增按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnAddEnter_Click(object sender, EventArgs e)
 {
     Song.Entities.GuideColumns col = new Song.Entities.GuideColumns();
     col.Gc_Title = tbTitle.Text.Trim();
     col.Gc_PID   = Convert.ToInt32(ddlTree.SelectedValue);
     col.Cou_ID   = couid;
     col.Gc_Intro = tbIntro.Text.Trim();
     col.Gc_IsUse = cbIsUse.Checked;
     Business.Do <IGuide>().ColumnsAdd(col);
     BindData(null, null);
     gvColumns.EditIndex = -1;
     btnAddBack_Click(null, null);
 }
Example #6
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="entity">业务实体</param>
 public void GuideSave(Guide entity)
 {
     //最后编辑时间
     entity.Gu_LastTime = DateTime.Now;
     if (entity.Gu_PushTime < DateTime.Now.AddYears(-100))
     {
         entity.Gu_PushTime = entity.Gu_CrtTime;
     }
     //所在机构
     Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
     if (org != null)
     {
         entity.Org_ID   = org.Org_ID;
         entity.Org_Name = org.Org_Name;
     }
     //所属栏目
     Song.Entities.GuideColumns nc = this.ColumnsSingle((int)entity.Gc_ID);
     if (nc != null)
     {
         entity.Gc_Title = nc.Gc_Title;
     }
     Gateway.Default.Save <Guide>(entity);
 }
Example #7
0
 /// <summary>
 /// 删除,按主键ID;
 /// </summary>
 /// <param name="identify">实体的主键</param>
 public void ColumnsDelete(int identify)
 {
     Song.Entities.GuideColumns col = ColumnsSingle(identify);
     ColumnsDelete(col);
 }