Exemplo n.º 1
0
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="param">删除条件实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult DelInfo(CRM_CompanyContactParam param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            int affect             = 0;

            try
            {
                #region 判断
                if (param.ContactID <= 0)
                {
                    throw new WarnException("请指定联系人ID!");
                }
                #endregion

                WhereClip whereClip           = GetWhereClip(param);
                CRM_CompanyContactResult info = new CRM_CompanyContactResult();
                info.IsDeleted = true;
                affect         = this.Update <CRM_CompanyContactResult>(info, whereClip);
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加和新增修改
        /// </summary>
        /// <param name="param">新增或修改的实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult AddOrUpdate(CRM_CompanyContactResult param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                int affect = 0;
                #region 判断
                if (!string.IsNullOrEmpty(param.ContactName.Trim()))
                {
                    throw new WarnException("请指定联系人!");
                }
                #endregion

                #region 判断重复
                WhereClip whereChk = CRM_CompanyContact._.IsDeleted == false && CRM_CompanyContact._.ContactName == param.ContactName;
                if (param.ContactID > 0)
                {
                    whereChk = whereChk & CRM_CompanyContact._.CompanyID != param.CompanyID;
                }
                int chkNum = this.Count <CRM_CompanyContactResult>(whereChk);
                if (chkNum > 0)
                {
                    throw new WarnException("存在重复的联系人!");
                }
                #endregion
                #region 系统默认值
                if (param.CompanyID > 0)
                {
                    WhereClip where = CRM_CompanyContact._.CompanyID == param.CompanyID;
                    affect          = this.Update <CRM_CompanyContactResult>(param, where);
                }
                else
                {
                    param.GCompanyID = this.SessionInfo.CompanyID;
                    param.IsDeleted  = false;
                    affect           = this.Insert <CRM_CompanyContactResult>(param);
                    param            = this.Select <CRM_CompanyContactResult>(new List <Field>()
                    {
                        CRM_CompanyContactResult._.ContactID
                    }, CRM_CompanyContact._.ContactName == param.ContactName);
                }
                #region 设置返回值
                ret.Key = param.ContactID;
                #endregion
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 3
0
        public CRM_CompanyContactResult GetInfo(CRM_CompanyContactParam param)
        {
            CRM_CompanyContactResult ret = new CRM_CompanyContactResult();
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.CRM.CRM_CompanyContactBLL", "GetInfo", param);
            ret = rst == null ? new CRM_CompanyContactResult() : rst.Result as CRM_CompanyContactResult;
            return(ret);
        }
Exemplo n.º 4
0
        public WCFAddUpdateResult AddOrUpdate(CRM_CompanyContactResult param)
        {
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            ExeResult          rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.CRM.CRM_CompanyContactBLL", "AddOrUpdate", param);
            ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult);
            return(ret);
        }
Exemplo n.º 5
0
 private void btnDelEmp_Click(object sender, EventArgs e)
 {
     if (this.bsContact.Current != null)
     {
         int contactID = 0;
         CRM_CompanyContactResult delResult = this.bsContact.Current as CRM_CompanyContactResult;
         contactID = delResult.ContactID.ToInt32();
         if (contactID > 0)
         {
             delResult.IsDeleted = true;
             delList.Add(delResult);
         }
         bsContact.RemoveCurrent();
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public CRM_CompanyContactResult GetInfo(CRM_CompanyContactParam param)
        {
            this.CheckSession();
            CRM_CompanyContactResult rst = new CRM_CompanyContactResult();

            #region 判断
            if (param.ContactID <= 0)
            {
                throw new WarnException("请指定联系人ID!");
            }
            #endregion
            #region 获取实体

            rst = this.Select <CRM_CompanyContactResult>(GetWhereClip(param));

            #endregion
            return(rst);
        }