📄 serviceproviderform.cs
字号:
this.label17.Size = new System.Drawing.Size(88, 23);
this.label17.TabIndex = 23;
this.label17.Text = "办公地址";
this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label18
//
this.label18.Font = new System.Drawing.Font("宋体", 9F);
this.label18.Location = new System.Drawing.Point(16, 192);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(88, 23);
this.label18.TabIndex = 22;
this.label18.Text = "服务商简介";
this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ServiceProviderForm
//
this.AutoScroll = true;
this.Controls.Add(this.panel1);
this.Name = "ServiceProviderForm";
this.Size = new System.Drawing.Size(864, 448);
this.panel1.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPMapInfo.ResumeLayout(false);
this.panel6.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.axMap1)).EndInit();
this.panel5.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
#region method
#region 初始化数据
private void InitlCmbSctype(){
try{
IList list =m_OtherBLL.getSPType();
OtherInfo oInfo = new OtherInfo();
oInfo.sptid = 0;
oInfo.sptname = "";
list.Add(oInfo);
cmbSctype.DataSource = list;
cmbSctype.ValueMember = "sptid";
cmbSctype.DisplayMember = "sptname";
cmbSctype.SelectedValue=0;
}catch(Exception ex){
Console.WriteLine(ex.Message);
}
}
//服务商明细SPInfo
private void DownLoadSPInfo(ServiceProviderInfo spInfo){
if(spInfo!=null){
this.txtname.Text = spInfo.sname;
this.txtTel.Text=spInfo.stelephone;
this.txtFax.Text=spInfo.sfax;
this.txtAddr.Text=spInfo.saddress;
this.tbDtailSType.Text = spInfo.stname;
this.txtRPerson.Text=spInfo.slinkname;
this.txtEmail.Text=spInfo.semail;
this.tbSDate.Text=spInfo.sdate;
this.txtWeb.Text=spInfo.sweb;
this.txtKeyWords.Text=spInfo.ckeywords;
this.txtGood.Text=spInfo.sgood.ToString();
this.txtBad.Text=spInfo.sbad.ToString();
//简介
this.txtMemo.Text=spInfo.sbrief;
}
}
//检索界面里的SPInfo
private void DownLoadRSPInfo(ServiceProviderInfo SPInfo){
if(SPInfo!=null){
this.tbSName.Text=SPInfo.sname ;
//this.cmbSctype.Text= SPInfo.stype;
this.tbSLinkMan.Text= SPInfo.slinkname;
this.tbKeyWords.Text= SPInfo.ckeywords;
this.tbAddress.Text = SPInfo.saddress;
}
}
//检索
private void UpLoadRSPInfo(ServiceProviderInfo SPInfo){
if(SPInfo!=null){
SPInfo.sname =this.tbSName.Text;
SPInfo.stype = (int)this.cmbSctype.SelectedValue;
SPInfo.slinkname = this.tbSLinkMan.Text;
SPInfo.ckeywords = this.tbKeyWords.Text;
SPInfo.saddress = this.tbAddress.Text;
}
}
private void InitSPListVewCol(){
SPListView.Dock=DockStyle.Fill;
SPListView.InitLV_UserDefined(spInfoCol,DisplayCol);
SPListView.Columns[0].Width = 200;
SPListView.Columns[1].Width = 200;
SPListView.Columns[1].TextAlign = HorizontalAlignment.Left;
this.tabPSPL.Controls.Add(SPListView);
SPListView.SelectedIndexChanged+=new EventHandler(SPListView_SelectedIndexChanged);
//SPListView.Click+=new EventHandler(SPListView_Click);
}
#endregion
#region 通过mpainfo选服务商相关的方法
/// <summary>
/// 双击mapinfo上的地理位置之后调用的方法
/// mapinfo只需调用该方法即可
/// </summary>
/// <param name="position">地理位置</param>
private void DoingMapChoose(int position){
IList list = GetSPListFromMap(position);
if(list!=null){
if(list.Count>1){
DialogResult dlg = new SelectSPForm(this,list).ShowDialog();
if(dlg==DialogResult.OK){
MapSPLChooseOver(MapSPList);
//AddSingleCInfoFromMap(MapSPList);
}
}
else if(list.Count==1){
MapSPLChooseOver(list);
}
else{
MessageBox.Show("没有数据","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
}
private IList GetSPListFromMap(int position){
IList list=null;
try{
list= this.m_SPBLL.getServiceProviderByPosition(position);
return list;
}catch(Exception ex){
MessageBox.Show(ex.Message,"警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return list;
}
}
private void AddSingleCInfoFromMap(IList mapSPList){
if(this.mapSPList.Count>0){
this.m_SPInfo = (ServiceProviderInfo)mapSPList[0];
DownLoadSPInfo(m_SPInfo);
}
}
private void MapSPLChooseOver(IList mapSPList){
//AddCSPListFromMap(mapSPList);
AddSingleCInfoFromMap(mapSPList);
MapSPList.Clear();
}
private void DisplaySpOnMap(string displayArea){
try{
this.axMap1.Layers[displayArea].Selection.ClearSelection();
for(int i=0;i<this.SPList.Count;i++){
ServiceProviderInfo spInfo = (ServiceProviderInfo)SPList[i];
MapXLib.Feature fea = this.axMap1.Layers[displayArea].GetFeatureByKey(spInfo.position.ToString());
if(fea!=null){
this.axMap1.Layers[displayArea].Selection.Add(fea);
}
}
}catch(Exception ex){
MessageBox.Show(ex.Message,"警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
/*
//从mapinfo里选择服务商
private void AddCSPListFromMap(IList mapSPList){
for(int i=0;i<this.mapSPList.Count;i++){
ServiceProviderInfo temp_spInfo = (ServiceProviderInfo)mapSPList[i];
AddCSPList(temp_spInfo);
}
}
**/
#endregion
#region 通过服务商列表选择服务商相关的方法
private IList GetSPList(ServiceProviderInfo SPInfo){
IList list = this.m_SPBLL.queryServiceProvider(SPInfo);
return list;
}
//从服务商列表中选择服务商
private void AddCSPListFromSPLV(){
if(SPListView.SelectedIndices.Count>0){
int itemIndex = SPListView.SelectedIndices[0];
m_SPInfo = (ServiceProviderInfo)SPList[itemIndex];
this.DownLoadSPInfo(m_SPInfo);
//AddCSPList(temp_spInfo);
}
}
#endregion
private bool ValidateInitData(){
m_CustomerInfo = TelCallingControl.CurrentCustomerInfo;
if(m_CustomerInfo!=null){
return true;
}
return false;
}
private bool ValidateData(){
if(m_SPInfo==null){
MessageBox.Show("请选择服务商!","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return false;
}
if(this.tbWBContent.Text.Trim().Length>500){
MessageBox.Show("服务内容的长度不能大于500个字符","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return false;
}
return true;
}
private void Retrieve(){
try{
UpLoadRSPInfo(m_RSPInfo);
SPList = GetSPList(m_RSPInfo);
SPListView.Refresh_UserDefine(SPList,m_RSPInfo,DisplayCol);
DisplaySpOnMap("yuan");
}catch(Exception ex){
MessageBox.Show(ex.Message,"警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
private void UploadSPNInfo(SPServiceNoteInfo spnInfo,int wbid){
if(spnInfo!=null){
//服务商id
spnInfo.sid = m_SPInfo.id;
//工单id
spnInfo.wbid = wbid;
//服务商名称
spnInfo.sname = m_SPInfo.sname;
//满意度,默认0
spnInfo.grade=0;
//服务内容
spnInfo.scontent = this.tbWBContent.Text.Trim();
spnInfo.sdate = DateTime.Now.ToString("yyyy-MM-dd");
}
}
private void UploadWBInfo(WorkBillInfo workBillInfo){
if(workBillInfo!=null){
//客户id
workBillInfo.cid = m_CustomerInfo.id;
//客户
workBillInfo.cname = m_CustomerInfo.cname;
workBillInfo.sid = ShareClass.Operator;
workBillInfo.sname = ShareClass.OperatorChinese;
workBillInfo.ctelnumber = m_CustomerInfo.ctelnumber;
//工单简介
workBillInfo.brief = this.tbWBContent.Text;
//满意度,默认0
workBillInfo.grade = 0;
//处理状态
workBillInfo.state = 10;
}
}
private void Save(){
try{
if(ValidateData()){
int wbid = 0;
UploadWBInfo(m_WorkBillInfo);
wbid = this.m_WorkBillBLL.addWorkBill(m_WorkBillInfo);
UploadSPNInfo(m_SPNInfo,wbid);
this.m_SPServiceNoteBLL.addSPServiceNote(m_SPNInfo);
MessageBox.Show("保存成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}catch(Exception ex){
MessageBox.Show("保存失败,"+ex.Message,"警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
private void Reset(){
this.tbSName.Text="";
this.tbAddress.Text="";
this.cmbSctype.SelectedValue=0;
this.tbKeyWords.Text="";
this.tbSLinkMan.Text="";
}
#region 已经注释掉的方法,更改业务之前的方法,
/*
*
private void InitCSPListViewCol(){
m_CSPListView.Dock=DockStyle.Fill;
//m_CSPListView.CheckBoxes=true;
m_CSPListView.InitLV_UserDefined(spInfoCol,m_CDisplayCol);
//PanelCSP.Controls.Add(m_CSPListView);
m_CSPListView.DoubleClick+=new EventHandler(m_CSPListView_DoubleClick);
}
//SP:ServiceProvider
//CSP:ChooseSPList
private bool CanAddCSPList(int IdCheck){
for(int i=0;i<ChooseSPList.Count;i++){
ServiceProviderInfo temp_spInfo = (ServiceProviderInfo)ChooseSPList[i];
if(temp_spInfo.id==IdCheck){
return false;
}
}
return true;
}
//通用的添加到服务商被选列表里
private void AddCSPList(ServiceProviderInfo tspInfo){
bool canAddList = CanAddCSPList(tspInfo.id);
if(canAddList){
ChooseSPList.Add(tspInfo);
this.m_CSPListView.Refresh_UserDefine(ChooseSPList,m_SPInfo,m_CDisplayCol);
//MessageBox.Show(temp_spInfo.ToString(),ChooseSPList.Count+"");
}
else{
MessageBox.Show("数据--"+tspInfo.sname+"--已经有了,不需要添加了!");
}
}
//清除列表里选中的记录
private void RemoveCSPList(){
if(m_CSPListView.SelectedIndices.Count>0){
int itemIndex = m_CSPListView.SelectedIndices[0];
this.ChooseSPList.RemoveAt(itemIndex);
this.m_CSPListView.Refresh_UserDefine(ChooseSPList,m_SPInfo,m_CDisplayCol);
}
}
private void ClearCSPList(){
if(m_CSPListView.Items.Count>0){
m_CSPListView.Items.Clear();
ChooseSPList.Clear();
}
}
**/
#endregion
#endregion
#region events
//检索
private void btnRetrieve_Click(object sender, System.EventArgs e) {
Retrieve();
// MessageBox.Show("检索完毕!");
}
private void btnReset_Click(object sender, System.EventArgs e) {
Reset();
}
private void btnOk_Click(object sender, System.EventArgs e) {
Save();
}
private void btnTest_Click(object sender, System.EventArgs e) {
DoingMapChoose(123);
}
//以下是地图事件
private void btn_Map_zoomIn_Click(object sender, System.EventArgs e) {
this.axMap1.CurrentTool = MapXLib.ToolConstants.miZoomInTool;
}
private void btn_Map_zoomOut_Click(object sender, System.EventArgs e) {
this.axMap1.CurrentTool = MapXLib.ToolConstants.miZoomOutTool;
}
private void btn_Map_Move_Click(object sender, System.EventArgs e) {
this.axMap1.CurrentTool = MapXLib.ToolConstants.miPanTool;
}
private void btnClear_Click(object sender, System.EventArgs e) {
this.tbWBContent.Text="";
}
/*
private void btnClear_Click(object sender, System.EventArgs e) {
//this.m_CSPListView.Items.Clear();
//this.ChooseSPList.Clear();
}
private void m_CSPListView_DoubleClick(object sender, EventArgs e) {
RemoveCSPList();
}
private void btnClear_Click_1(object sender, System.EventArgs e) {
this.tbWBContent.Text="";
}
**/
#endregion
private void SPListView_SelectedIndexChanged(object sender, EventArgs e) {
AddCSPListFromSPLV();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -