Exemplo n.º 1
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="incomingCallEntity">实体</param>
        /// <param name="statusCode">状态码</param>
        /// <returns>影响行数</returns>
        public int Update(IncomingCallEntity incomingCallEntity, out string statusCode)
        {
            int returnValue = 0;

            returnValue = this.UpdateEntity(incomingCallEntity);
            statusCode  = returnValue == 0 ? StatusCode.ErrorDeleted.ToString() : StatusCode.OKUpdate.ToString();

            return(returnValue);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder"></param>
 /// <param name="incomingCallEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, IncomingCallEntity incomingCallEntity)
 {
     sqlBuilder.SetValue(IncomingCallTable.FieldCustomerId, incomingCallEntity.CustomerId);
     sqlBuilder.SetValue(IncomingCallTable.FieldCustomerName, incomingCallEntity.CustomerName);
     sqlBuilder.SetValue(IncomingCallTable.FieldCallType, incomingCallEntity.CallType);
     sqlBuilder.SetValue(IncomingCallTable.FieldCallRecord, incomingCallEntity.CallRecord);
     sqlBuilder.SetValue(IncomingCallTable.FieldCallNumber, incomingCallEntity.CallNumber);
     sqlBuilder.SetValue(IncomingCallTable.FieldCallDate, incomingCallEntity.CallDate);
     sqlBuilder.SetValue(IncomingCallTable.FieldHandled, incomingCallEntity.Handled);
     sqlBuilder.SetValue(IncomingCallTable.FieldDescription, incomingCallEntity.Description);
     sqlBuilder.SetValue(IncomingCallTable.FieldDeleteMark, incomingCallEntity.DeleteMark);
     sqlBuilder.SetValue(IncomingCallTable.FieldEnabled, incomingCallEntity.Enabled);
     sqlBuilder.SetValue(IncomingCallTable.FieldSortCode, incomingCallEntity.SortCode);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="incomingCallEntity">实体</param>
        public int UpdateEntity(IncomingCallEntity incomingCallEntity)
        {
            SQLBuilder sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, incomingCallEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(IncomingCallTable.FieldModifiedBy, UserInfo.RealName);
                sqlBuilder.SetValue(IncomingCallTable.FieldModifiedUserId, UserInfo.Id);
            }
            sqlBuilder.SetDBNow(IncomingCallTable.FieldModifiedOn);
            sqlBuilder.SetWhere(IncomingCallTable.FieldId, incomingCallEntity.Id);
            return(sqlBuilder.EndUpdate());
        }
Exemplo n.º 4
0
        /// <summary>
        ///  绑定修改的数据
        /// </summary>
        private void BindEditData()
        {
            if (!string.IsNullOrEmpty(this.EntityId))
            {
                currentIncomingCallEntity = incomingCallService.GetEntity(base.UserInfo, this.EntityId);
                if (currentIncomingCallEntity == null)
                {
                    return;
                }
                this.txtCallRecord.Text            = currentIncomingCallEntity.CallRecord;
                this.txtCallNumber.Text            = currentIncomingCallEntity.CallNumber;
                this.txtCustomerName.Text          = currentIncomingCallEntity.CustomerName;
                this.txtCustomerName.SelectedValue = currentIncomingCallEntity.CustomerId;
                if (!string.IsNullOrEmpty(currentIncomingCallEntity.CallType.Trim()))
                {
                    switch (currentIncomingCallEntity.CallType.Trim())
                    {
                    case "销售机会":
                        rbCallType1.Checked = true;
                        break;

                    case "售后服务":
                        rbCallType2.Checked = true;
                        break;

                    case "投诉":
                        rbCallType3.Checked = true;
                        break;

                    case "合作":
                        rbCallType4.Checked = true;
                        break;

                    case "其他":
                        rbCallType5.Checked = true;
                        break;
                    }
                }
                rbNotHandled.Checked = true;
                if (BusinessLogic.ConvertIntToBoolean(currentIncomingCallEntity.Handled))
                {
                    rbHandled.Checked = true;
                }
                this.dtCallDate.Text     = BusinessLogic.ConvertToDateToString(currentIncomingCallEntity.CallDate == null ? string.Empty : currentIncomingCallEntity.CallDate.ToString());
                this.txtDescription.Text = currentIncomingCallEntity.Description;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">实体</param>
        /// <param name="statusCode">返回状态码</param>
        /// <param name="statusMessage">返回状态信息</param>
        /// <returns>影响行数</returns>
        public int Update(UserInfo userInfo, IncomingCallEntity entity, out string statusCode, out string statusMessage)
        {
            int returnValue = 0;

            statusCode = string.Empty;

            using (IDbProvider rdiDbProvider = DbFactoryProvider.GetProvider(SystemInfo.RDIFrameworkDbType))
            {
                try
                {
                    rdiDbProvider.Open(RDIFrameworkDbConection);
                    LogManager.Instance.Add(rdiDbProvider, userInfo, this.serviceName, "更新实体", MethodBase.GetCurrentMethod());

                    using (IDbProvider dbProvider = DbFactoryProvider.GetProvider(BusinessDbType))
                    {
                        try
                        {
                            dbProvider.Open(BusinessDbConnection);
                            IncomingCallManager manager = new IncomingCallManager(dbProvider, userInfo);
                            returnValue   = manager.Update(entity, out statusCode);
                            statusMessage = manager.GetStateMessage(statusCode);
                        }
                        catch (Exception ex)
                        {
                            CiExceptionManager.LogException(rdiDbProvider, userInfo, ex);
                            throw ex;
                        }
                        finally
                        {
                            dbProvider.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    CiExceptionManager.LogException(rdiDbProvider, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    rdiDbProvider.Close();
                }
            }
            return(returnValue);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 新增实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">实体</param>
        /// <returns>主鍵</returns>
        public string Add(UserInfo userInfo, IncomingCallEntity entity)
        {
            string returnValue = string.Empty;

            using (IDbProvider rdiDbProvider = DbFactoryProvider.GetProvider(SystemInfo.RDIFrameworkDbType))
            {
                try
                {
                    rdiDbProvider.Open(RDIFrameworkDbConection);
                    LogManager.Instance.Add(rdiDbProvider, userInfo, this.serviceName, "新增实体", MethodBase.GetCurrentMethod());

                    using (IDbProvider dbProvider = DbFactoryProvider.GetProvider(BusinessDbType))
                    {
                        try
                        {
                            dbProvider.Open(BusinessDbConnection);
                            IncomingCallManager manager = new IncomingCallManager(dbProvider, userInfo);
                            returnValue = manager.AddEntity(entity);
                        }
                        catch (Exception ex)
                        {
                            CiExceptionManager.LogException(rdiDbProvider, userInfo, ex);
                            throw ex;
                        }
                        finally
                        {
                            dbProvider.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    CiExceptionManager.LogException(rdiDbProvider, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    rdiDbProvider.Close();
                }
            }

            return(returnValue);
        }
Exemplo n.º 7
0
        public override bool SaveEntity()
        {
            IncomingCallEntity entity = new IncomingCallEntity
            {
                CallRecord   = this.txtCallRecord.Text.Trim(),
                CallNumber   = this.txtCallNumber.Text.Trim(),
                CustomerName = this.txtCustomerName.Text.Trim(),
                CustomerId   = BusinessLogic.ConvertToInt32(this.txtCustomerName.SelectedValue)
            };
            string callType = string.Empty;

            callType        = rbCallType1.Checked ? rbCallType1.Text : callType;
            callType        = rbCallType2.Checked ? rbCallType2.Text : callType;
            callType        = rbCallType3.Checked ? rbCallType3.Text : callType;
            callType        = rbCallType4.Checked ? rbCallType4.Text : callType;
            callType        = rbCallType5.Checked ? rbCallType5.Text : callType;
            entity.CallType = callType;
            entity.Handled  = 0;
            if (rbHandled.Checked)
            {
                entity.Handled = 1;
            }
            entity.CallDate    = BusinessLogic.ConvertToDateTime(dtCallDate.Text);
            entity.Description = this.txtDescription.Text.Trim();
            string objectId = incomingCallService.Add(base.UserInfo, entity);

            if (objectId.Length > 0)
            {
                this.Changed = true;
                if (SystemInfo.ShowSuccessMsg)
                {
                    MessageBoxHelper.ShowSuccessMsg("新增成功!");
                    return(true);
                }
            }
            else
            {
                MessageBoxHelper.ShowErrorMsg("新增失败!");
                return(false);
            }
            return(true);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 取得实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主鍵</param>
        /// <returns>实体</returns>
        public IncomingCallEntity GetEntity(UserInfo userInfo, string id)
        {
            IncomingCallEntity entity = null;

            using (IDbProvider dbProvider = DbFactoryProvider.GetProvider(BusinessDbType))
            {
                try
                {
                    dbProvider.Open(BusinessDbConnection);
                    IncomingCallManager manager = new IncomingCallManager(dbProvider, userInfo);
                    entity = manager.GetEntity(id);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    dbProvider.Close();
                }
            }
            return(entity);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="incomingCallEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(IncomingCallEntity incomingCallEntity)
 {
     return(this.AddEntity(incomingCallEntity));
 }
Exemplo n.º 10
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="incomingCallEntity">实体</param>
        public string AddEntity(IncomingCallEntity incomingCallEntity)
        {
            string sequence = string.Empty;

            if (incomingCallEntity.SortCode == null || incomingCallEntity.SortCode == 0)
            {
                CiSequenceManager sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                incomingCallEntity.SortCode = int.Parse(sequence);
            }
            SQLBuilder sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, IncomingCallTable.FieldId);
            if (!this.Identity)
            {
                sqlBuilder.SetValue(IncomingCallTable.FieldId, incomingCallEntity.Id);
            }
            else
            {
                if (!this.ReturnId && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DBProvider.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(IncomingCallTable.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DBProvider.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(IncomingCallTable.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (incomingCallEntity.Id == null)
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                CiSequenceManager sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                            }
                            incomingCallEntity.Id = int.Parse(sequence);
                        }
                        sqlBuilder.SetValue(IncomingCallTable.FieldId, incomingCallEntity.Id);
                    }
                }
            }
            this.SetEntity(sqlBuilder, incomingCallEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(IncomingCallTable.FieldCreateUserId, UserInfo.Id);
                sqlBuilder.SetValue(IncomingCallTable.FieldCreateBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(IncomingCallTable.FieldCreateOn);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(IncomingCallTable.FieldModifiedBy, UserInfo.RealName);
                sqlBuilder.SetValue(IncomingCallTable.FieldModifiedUserId, UserInfo.Id);
            }
            sqlBuilder.SetDBNow(IncomingCallTable.FieldModifiedOn);
            if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.SqlServer || DBProvider.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
Exemplo n.º 11
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="incomingCallEntity">实体</param>
 public int Update(IncomingCallEntity incomingCallEntity)
 {
     return(this.UpdateEntity(incomingCallEntity));
 }
Exemplo n.º 12
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="incomingCallEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(IncomingCallEntity incomingCallEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(incomingCallEntity));
 }