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("添加失败。"); } }
public FormSelfMakeDetail(int productId) { InitializeComponent(); ReadColumnConfig(dataGridView1, "Set_SelfMakeDetail"); dataGridView1.BackgroundColor = this.BackColor; _productId = productId; DataSet ds = _bll.GetSelfSaleDetail(_productId); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; dt.Columns.Add("linkman", typeof(string)); FishBll.Bll.CompanyBll companybll = new FishBll.Bll.CompanyBll(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string companycode = ds.Tables[0].Rows[i]["yifangcode"].ToString(); FishEntity.CompanyEntity company = companybll.GetModelByCode(companycode); if (company != null) { dt.Rows[i]["linkman"] = company.linkman; } } } dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = ds.Tables[0]; //SetContractDetail(list); }
public FormCallRecords(int companyid, bool isControlRole) : this() { Add(); this._isControlRole = isControlRole; FishBll.Bll.CompanyBll bll = new FishBll.Bll.CompanyBll(); FishEntity.CompanyEntity model = bll.GetModel(companyid); SetCompanyData(model); }
protected void SetCustomer() { txtCode.Text = _customer.code; txtName.Text = _customer.name; dtpCurrentDate.Value = _customer.currentlinkDate.Value; txtTelephone.Text = _customer.telephone; txtPhone1.Text = _customer.phone1; txtPhone2.Text = _customer.phone2; txtPhone3.Text = _customer.phone3; txtPost.Text = _customer.post; txtdepartment1.Text = Customer.Department1; txtEmail.Text = _customer.email; txtQQ.Text = _customer.qq; cmbValidate.Text = _customer.validate == 1 ? "有效" : "无效"; txtWeixin.Text = _customer.weixin; txtRemark.Text = _customer.remark; if (_customer.nextlinkdate != null) { txtNextLinkDate.Text = _customer.nextlinkdate.Value.ToString("yyyy-MM-dd"); } else { txtNextLinkDate.Text = string.Empty; } FishBll.Bll.CompanyBll bll = new FishBll.Bll.CompanyBll(); if (string.IsNullOrEmpty(_customer.company) == false) { FishEntity.CompanyEntity company = bll.GetModelByCode(_customer.company); if (company != null) { _customer.companyId = company.id; txtCompany.Text = company.fullname; txtCompany.Tag = company; txtCompanyCode.Text = company.code; } } else { txtCompany.Tag = null; txtCompany.Text = string.Empty; txtCompanyCode.Text = string.Empty; } txtHomeAddress.Text = _customer.homeaddress; txtOfficeAddress.Text = _customer.officeaddress; rdbMan.Checked = _customer.sex.Equals("男"); rdbWoman.Checked = _customer.sex.Equals("女"); pictureBox1.Image = GetHeadPicture(_customer.id); txtfox.Text = _customer.fox; }
public override int Query() { int sum = 0; string where = GetQueryCondition(); FishBll.Bll.CompanyBll bll = new FishBll.Bll.CompanyBll(); List <FishEntity.CompanyEntity> list = bll.GetModelList(where); dataGridView1.DataSource = list; sum += int.Parse(this.dataGridView1.RowCount.ToString()); txtnumber.Text = sum.ToString(); return(1); }
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); }
protected void SetCallRecord() { if (_entity == null) { return; } txtCode.Text = _entity.code; txtAddress.Text = _entity.address; txtCompanyCode.Text = _entity.customercode; txtCompanyName.Text = _entity.customer; txtContent.Text = _entity.communicatecontent; txtLevel.Text = _entity.customerlevel; txtLinkMan.Text = _entity.linkman; txtLinkManCode.Text = _entity.linkmancode; txtMobile.Text = _entity.mobile; txtMonth.Text = _entity.monthestimate; txtOfficeTel.Text = _entity.officetel; txtProducts.Text = _entity.products; txtQuality.Text = _entity.requiredquantity; txtWeek.Text = _entity.weekestimate; DateTime temp = DateTime.Now; if (_entity.BuyDate != null && string.IsNullOrEmpty(_entity.BuyDate) != false && _entity.BuyDate.ToString() != "") { DateTime.TryParse(_entity.BuyDate, out temp); } dtpBuyDate.Value = temp; if (_entity.currentdate != null) { dtpCurrentDate.Value = _entity.currentdate.Value; } if (_entity.nextdate != null) { dtpNextLinkDate.Value = _entity.nextdate.Value; } FishBll.Bll.CompanyBll companybll = new FishBll.Bll.CompanyBll(); FishEntity.CompanyEntity company = companybll.GetModelByCode(_entity.customercode); if (company != null) { string requiredproduct = ""; FishEntity.DictEntity dic = FishEntity.Variable.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.RequiredProduct && i.code == company.requiredproduct); }); if (dic != null) { requiredproduct = dic.name; } txtspecifacation.Text = requiredproduct; txtQuality.Text = company.productrequire; string products = ""; dic = FishEntity.Variable.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.Products && i.code == company.products); }); if (dic != null) { products = dic.name; } txtProducts.Text = products; txtcompetitors.Text = company.competitors; txttransportfee.Text = company.freight.ToString("f2"); txtweight.Text = company.tare.ToString("f2"); txtSaleman.Text = company.salesman; string property = ""; dic = FishEntity.Variable.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.CustomerProperty && i.code == company.customerproperty); }); if (dic != null) { property = dic.name; } txtCustomerNature.Text = property; txtWeek.Text = company.currentweekestimate; txtMonth.Text = company.currentmonthestimate; dic = FishEntity.Variable.DictList.Find((i) => { return(i.pcode == FishEntity.Constant.GeneralLevel && i.code == company.generallevel); }); if (dic != null) { txtLevel.Text = dic.name; } } }