Exemple #1
0
        public override void Save()
        {
            if (Check() == false)
            {
                return;
            }

            _entity = new FishEntity.CallRecordsEntity();
            GetCallRecordFromUI();
            _entity.createman  = FishEntity.Variable.User.username;
            _entity.modifyman  = _entity.createman;
            _entity.createtime = DateTime.Now;
            _entity.modifytime = _entity.createtime;
            _entity.code       = FishBll.Bll.SequenceUtil.GetCallRecordSequence();
            while (_bll.Exists(_entity.code))
            {
                _entity.code = FishBll.Bll.SequenceUtil.GetCallRecordSequence();
            }

            int id = _bll.Add(_entity);

            if (id > 0)
            {
                _entity.id   = id;
                txtCode.Text = _entity.code;
                FishBll.Bll.CompanyBll companyBll = new FishBll.Bll.CompanyBll();
                //更新 往来单位 表的 最近联系时间,下次联系时间
                companyBll.UpdateCompnayLinkDate(_entity.customercode, _entity.weekestimate, _entity.monthestimate, _entity.currentdate.Value, _entity.BuyDate, _entity.nextdate.Value);
                FishBll.Bll.CustomerBll customerBll = new FishBll.Bll.CustomerBll();
                //更新 联系人 表的 当前联系时间,下次联系时间和 通话记录ID字段
                customerBll.UpdateLinkDate(_entity.linkmancode, _entity.currentdate.Value, _entity.id, _entity.nextdate.Value);

                AddDetail(id, true);

                //tmiAdd.Visible = true;
                //tmiModify.Visible = true;
                //tmiDelete.Visible = true;
                //tmiQuery.Visible = true;
                //tmiPrevious.Visible = true;
                //tmiPrevious.Visible = true;
                //tmiSave.Visible = false;
                //tmiCancel.Visible = false;

                ControlButtomRoles();

                MessageBox.Show("添加成功。");

                //System.Diagnostics.Process.Start("FormCallRecordsTable.cs");


                if (RefreshDataEvent != null)
                {
                    RefreshDataEvent(this, EventArgs.Empty);
                }
            }
            else
            {
                MessageBox.Show("添加失败。");
            }
        }
Exemple #2
0
        public override int Modify()
        {
            if (_entity == null)
            {
                MessageBox.Show("请先查询需要修改的记录。");
                return(0);
            }
            if (Check() == false)
            {
                return(0);
            }
            GetCallRecordFromUI();
            _entity.modifytime = DateTime.Now;
            _entity.modifyman  = FishEntity.Variable.User.username;

            bool isok = _bll.Update(_entity);

            if (isok)
            {
                FishBll.Bll.CompanyBll companyBll = new FishBll.Bll.CompanyBll();
                companyBll.UpdateCompnayLinkDate(_entity.customercode, _entity.weekestimate, _entity.monthestimate, _entity.currentdate.Value, _entity.BuyDate, _entity.nextdate.Value);
                FishBll.Bll.CustomerBll customerBll = new FishBll.Bll.CustomerBll();
                customerBll.UpdateLinkDate(_entity.linkmancode, _entity.currentdate.Value, _entity.id, _entity.nextdate.Value);

                AddDetail(_entity.id, false);

                MessageBox.Show("修改成功。");

                if (RefreshDataEvent != null)
                {
                    RefreshDataEvent(this, EventArgs.Empty);
                }
            }
            else
            {
                MessageBox.Show("修改失败。");
            }
            return(1);
        }