?? serviceproviderform.cs
字號(hào):
SPListView.Columns[0].Width = 200;
SPListView.Columns[1].Width = 200;
SPListView.Columns[1].TextAlign = HorizontalAlignment.Left;
SPListView.BackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
this.tabPage1.Controls.Add(SPListView);
SPListView.SelectedIndexChanged+=new EventHandler(SPListView_SelectedIndexChanged);
//this.tabPSPL.Controls.Add(SPListView);
//SPListView.Click+=new EventHandler(SPListView_Click);
}
#endregion
#region 通過(guò)mpainfo選服務(wù)商相關(guān)的方法
/// <summary>
/// 雙擊mapinfo上的地理位置之后調(diào)用的方法
/// mapinfo只需調(diào)用該方法即可
/// </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("沒(méi)有數(shù)據(jù)","警告",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)
// {
//
// this.axMap1.Layers[displayArea].Selection.ClearSelection();
// for(int i=0;i<SPList.Count;i++)
// {
// try
// {
// 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里選擇服務(wù)商
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 通過(guò)服務(wù)商列表選擇服務(wù)商相關(guān)的方法
private IList GetSPList(ServiceProviderInfo SPInfo){
IList list = this.m_SPBLL.queryServiceProvider(SPInfo);
return list;
}
//從服務(wù)商列表中選擇服務(wù)商
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
//校驗(yàn)是否可以保存
private bool ValidateData(){
if(TelCallingControl.CurrentCustomerInfo==null)
{
MessageBox.Show("請(qǐng)選擇客戶!","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return false;
}
if(m_SPInfo==null){
MessageBox.Show("請(qǐng)選擇服務(wù)商!","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return false;
}
if(this.tbWBContent.Text.Trim().Length>500){
MessageBox.Show("服務(wù)內(nèi)容的長(zhǎng)度不能大于500個(gè)字符","警告",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){
//服務(wù)商id
spnInfo.sid = m_SPInfo.id;
//工單id
spnInfo.wbid = wbid;
//服務(wù)商名稱
spnInfo.sname = m_SPInfo.sname;
//客戶id
spnInfo.cid = TelCallingControl.CurrentCustomerInfo.id;
//客戶姓名
spnInfo.cname = TelCallingControl.CurrentCustomerInfo.cname;
//滿意度,默認(rèn)0
spnInfo.grade=0;
//服務(wù)內(nèi)容
spnInfo.scontent = this.tbWBContent.Text.Trim();
//服務(wù)日期
spnInfo.sdate = DateTime.Now.ToString("yyyy-MM-dd");
}
}
private void UploadWBInfo(WorkBillInfo workBillInfo){
if(workBillInfo!=null){
//客戶id
workBillInfo.cid = TelCallingControl.CurrentCustomerInfo.id;
//客戶
workBillInfo.cname = TelCallingControl.CurrentCustomerInfo.cname;
//操作員id
workBillInfo.sid = ShareClass.Operator;
//操作員名稱
workBillInfo.sname = ShareClass.OperatorChinese;
//來(lái)電號(hào)碼
workBillInfo.ctelnumber = TelCallingControl.CurrentCustomerInfo.ctelnumber;
//工單簡(jiǎn)介
workBillInfo.brief = this.tbWBContent.Text;
//滿意度,默認(rèn)0
workBillInfo.grade = 0;
//處理狀態(tài)
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 已經(jīng)注釋掉的方法,更改業(yè)務(wù)之前的方法,
/*
*
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;
}
//通用的添加到服務(wù)商被選列表里
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("數(shù)據(jù)--"+tspInfo.sname+"--已經(jīng)有了,不需要添加了!");
}
}
//清除列表里選中的記錄
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 SPListView_SelectedIndexChanged(object sender, EventArgs e) {
AddCSPListFromSPLV();
}
private void tbSName_TextChanged(object sender, EventArgs e) {
this.Retrieve();
}
// private void btCancel_Click(object sender, System.EventArgs e)
// {
// this.axMap1.CurrentTool=MapXLib.ToolConstants.miArrowTool;
// }
// private void axMap1_DblClick(object sender, System.EventArgs e)
// {
// if(ShareClass.winstate=="close")
// {
// ShareClass.winstate="open";
// MapDisplay BigMap=new MapDisplay(this.axMap1);
// BigMap.Show();
// }
//
// }
/*
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
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -