Пример #1
0
 protected void btnComment_Click(object sender, EventArgs e)
 {
     if (txtComment.Text.Trim() != null && hidID.Value != "0")
     {
         var entity = new CRMActionComment();
         entity.ACTID      = int.Parse(hidID.Value);
         entity.CreateDate = DateTime.Now;
         entity.CreateUser = base.LoginUserID;
         entity.Comment    = txtComment.Text.Trim();
         svr.Save(entity);
         BindComment();
     }
 }
Пример #2
0
 protected void btnComment_Click(object sender, EventArgs e)
 {
     if( txtComment.Text.Trim()!=null && hidID.Value!="0")
     {
         var entity = new CRMActionComment();
         entity.ACTID = int.Parse(hidID.Value);
         entity.CreateDate = DateTime.Now;
         entity.CreateUser = base.LoginUserID;
         entity.Comment = txtComment.Text.Trim();
         svr.Save(entity);
         BindComment();
     }
 }
Пример #3
0
        //---------------保存CRMActionComments---------------------------
        public CRMActionComment Save(CRMActionComment entity)
        {
            if (this.dataCtx.Connection != null)
            {
                if (this.dataCtx.Connection.State == ConnectionState.Closed)
                {
                    this.dataCtx.Connection.Open();
                }
            }
            DbTransaction tran = this.dataCtx.Connection.BeginTransaction();

            dataCtx.Transaction = tran;

            try
            {
                var qry = from t in CRMActionComments
                          where t.ID == entity.ID
                          select t;
                var obj = qry.SingleOrDefault();
                if (obj != null)
                {
                    this.CopyEntity(obj, entity);
                }
                else
                {
                    this.CRMActionComments.InsertOnSubmit(entity);
                }

                this.dataCtx.SubmitChanges();
                tran.Commit();
                return(entity);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
            finally
            {
                dataCtx.Connection.Close();
            }
        }
Пример #4
0
        //---------------保存CRMActionComments---------------------------
        public CRMActionComment Save(CRMActionComment entity)
        {
            if (this.dataCtx.Connection != null)
                if (this.dataCtx.Connection.State == ConnectionState.Closed)
                    this.dataCtx.Connection.Open();
            DbTransaction tran = this.dataCtx.Connection.BeginTransaction();
            dataCtx.Transaction = tran;

            try
            {
                var qry = from t in CRMActionComments
                          where t.ID == entity.ID
                          select t;
                var obj = qry.SingleOrDefault();
                if (obj != null)
                    this.CopyEntity(obj, entity);
                else
                    this.CRMActionComments.InsertOnSubmit(entity);

                this.dataCtx.SubmitChanges();
                tran.Commit();
                return entity;
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
            finally
            {
                dataCtx.Connection.Close();
            }
        }