投诉处理包括新建投诉单,还有对投诉单的一次或二次、三次甚至多次的处理。还可查询投诉单,投诉单未处理就可以修改和删除,已处理或处理中的不能修改和删除。
投诉处理主界面如图(图1)所示:
(图1)投诉处理查询界面如图(图2)所示
(图2)
投诉处理新建投诉单界面如图(图3)所示:
(图3)
投诉处理处理界面如图(图4)、(图5)所示:
(图4) (图5)从界面上可以看到我们这里用到的控件有
控件名称 |
说明 |
(ToolStrip) |
控件可以在工具箱直接拖动至窗体,拖至窗体后右击属性可以修改控件的样式和各种属性,还可以编辑事件。 |
表格(DataGridView) |
|
按钮(toolStripButton) /(Button) |
|
复选框(CheckBox) |
|
下拉框(ComBoBox) |
|
文本框(TextBox) |
|
日期控件(DateTimePicker) |
显示功能实现:
第一步:数据库
1、表和关系
列名 |
数据类型 |
主键/外键 |
说明 |
ComplainBillID |
int |
主键 |
投诉单ID |
ComplainBillNumbers |
nchar (20) |
投诉单号 |
|
BuildBillDate |
datetime |
建单日期 |
|
CarNewsID |
int |
外键 |
车辆信息表,车辆信息ID |
AttributeMinuteID_ComplainLevel |
int |
外键 |
属性明细表,属性明细ID_投诉级别 |
AttributeMinuteID_ComplainType |
int |
外键 |
属性明细表,属性明细ID_投诉类型 |
AttributeMinuteID_PriorLevel |
int |
外键 |
属性明细表,属性明细ID_优先级别 |
ComplainContent |
nchar (100) |
投诉内容 |
|
AttributeMinuteID_ComplainDisposeStatus |
int |
外键 |
属性明细表,属性明细ID_投诉处理状态ID |
StaffID_FirstReceivePerson |
int |
外键 |
员工档案表,员工ID_第一接待人 |
SteerMileage |
decimal (18, 2) |
行驶里程 |
|
ComplainDate |
datetime |
投诉日期 |
|
StaffID_DisposePerson |
nchar (20) |
员工档案表,员工ID_当前处理人 |
|
IfComplainEffective |
bit |
投诉有效否 |
列名 |
数据类型 |
主键/外键 |
说明 |
ComplainDisposeRecordID |
int |
主键 |
投诉处理记录ID |
ComplainBillID |
int |
外键 |
投诉单表,投诉单ID |
StaffID_DisposeDuTyperson |
int |
外键 |
员工档案表,员工ID_处理责任人 |
DisposeTime |
datetime |
处理时间 |
|
ComplainDispose |
nchar (100) |
投诉处理 |
列名 |
数据类型 |
主键/外键 |
说明 |
CarNewsID |
int |
主键 |
车辆信息ID |
CarOwnerNewsID |
int |
外键 |
车主信息ID |
RecordNumber |
nchar (20) |
|
档案号 |
LicensePlateNumber |
nchar (20) |
|
车牌号 |
CarModelsCode |
nchar (20) |
|
车型代码 |
VINCode |
nchar (20) |
|
VIN码 |
MotorModel |
nchar (20) |
|
发动机型号 |
TransmissionType |
nchar (20) |
|
变速箱形式 |
MotorNumber |
nchar (20) |
|
发动机号 |
TransmissionNumber |
nchar (20) |
|
变速箱号码 |
KeyNumber |
nchar (20) |
|
钥匙号 |
ShiftWay |
nchar (20) |
|
换挡方式 |
CarModelsYearFund |
nchar (20) |
|
车型年款 |
Displacement |
nchar (20) |
|
排量 |
EquipmentCode |
nchar (20) |
|
装备代码 |
BodyworkColour |
nchar (10) |
|
车身颜色 |
LeaveFactoryDate |
datetime |
|
出厂日期 |
FuelKind |
nchar (20) |
|
燃料种类 |
BuyCarDate |
datetime |
|
购车日期 |
BuyCarMileage |
decimal (18, 2) |
|
购车里程 |
Purpose |
nchar (20) |
|
用途 |
SellUnit |
nchar (20) |
|
销售单位 |
CarBrand |
nchar (20) |
|
车辆品牌 |
CarModelsSimpleCode |
nchar (20) |
|
车型简码 |
IfInWarranTyperiod |
bit |
|
在保修期内 |
UserManage |
bit |
|
用户管理 |
IfEffective |
bit |
|
有效否 |
表4:车主信息表(BM_CarOwnerNewsList)
用于存放车主录入的信息
列名 |
数据类型 |
主键/外键 |
说明 |
CarOwnerNewsID |
int |
主键 |
车主信息ID |
CarOwnerCode |
nchar (20) |
|
车主代码 |
CarOwnerName |
nchar (20) |
|
车主姓名 |
AttributeMinuteID_ClientTypeOne |
int |
外键 |
属性明细ID_客户类型一 |
AttributeMinuteID_ClientTypeTwo |
int |
外键 |
属性明细ID_客户类型二 |
AttributeMinuteID_Sex |
int |
外键 |
属性明细ID_性别 |
Site |
nchar (100) |
|
地址 |
MobilePhone |
nchar (20) |
|
移动电话 |
HousePhone |
nchar (20) |
|
住宅电话 |
OfficePhone |
nchar (20) |
|
办公电话 |
AddressPostcode |
nchar (20) |
|
住址邮编 |
TheGenusCountiesAndCities |
nchar (50) |
|
所属县市 |
WorkUnit |
nchar (50) |
|
工作单位 |
Job |
nchar (50) |
|
职务 |
AttributeMinuteID_MaritalStatus |
int |
外键 |
属性明细ID_婚姻状况 |
IDCard |
nchar (30) |
|
身份证号码 |
Birthday |
datetime |
|
生日 |
Hobby |
nchar (100) |
|
爱好 |
ChangeSite |
nchar (100) |
|
变更地址 |
Postcode |
nchar (20) |
|
邮编 |
Nationality |
nchar (50) |
|
国籍 |
|
nchar (50) |
|
|
FacilitateTheReturnTime |
datetime |
|
方便回访时间 |
CarOwnerPicture |
nchar (3000) |
|
车主照片 |
Remarks |
nchar (50) |
|
备注 |
IfEffective |
bit |
|
有效否 |
第二步:技术解析
1、处理前提示已处理次数:
第一步:数据库存储过程
IF(@TYPE ='btnSave_Click_Select_ChaXunTouSuChuLiBiaoHangShu')
BEGIN
SELECT COUNT (*)
FROM PW_ComplainDisposeRecordList
WHERE PW_ComplainDisposeRecordList. ComplainBillID=@ComplainBillID
END
第二步:逻辑层(BLL)代码
#region 查询投诉处理单数
[OperationContract]
public DataSet btnSave_Click_Select_ChaXunTouSuChuLiBiaoHangShu(int intComplainBillID)
{
SqlParameter[] mySqlParameters ={
new SqlParameter("@TYPE",SqlDbType.Char),
new SqlParameter("@ComplainBillID",SqlDbType.Int),
};
mySqlParameters[0].Value = "btnSave_Click_Select_ChaXunTouSuChuLiBiaoHangShu";
mySqlParameters[1].Value = intComplainBillID;
DataTable dt = myDALMethod.QueryDataTable("顾客关系_FRM_TouSuChuLi_ChuLi", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
#endregion
第三步:界面层(UIL)代码,写进界面Load事件
//根据投诉单ID查询投诉处理记录行数
DataTable dtCount = myFRM_TouSuChuLi_ChuLiClient.btnSave_Click_Select_ChaXunTouSuChuLiBiaoHangShu(FRM_TouSuChuLi.ComplainBillID).Tables[0];
Count = Convert.ToDecimal(dtCount.Rows[0][0]);
decimal NextCout=0;
if (Count > 0)
{
NextCout =Count+1;
MessageBox.Show(txtComplainOddNumBers.Text + "这投诉单已进行" + Count + "次处理。" + "\n" + "现在进行第" + NextCout+"次处理!");
}
labCount.Text = Convert.ToString(Count + 1);
2、处理功能:
第一步:数据库存储过程
IF(@TYPE ='btnSave_Click_Insert_XinZengTouSuChuLiXinXi')
BEGIN
INSERT PW_ComplainDisposeRecordList(ComplainBillID,StaffID_DisposeDutyPerson,
DisposeTime,ComplainDispose)
VALUES (@ComplainBillID,@StaffID_DisposeDutyPerson,
@DisposeTime,@ComplainDispose)
UPDATE PW_ComplainBillList
SET AttributeMinuteID_ComplainDisposeStatus=@AttributeMinuteID_ComplainDisposeStatus,
IfComplainEffective=@IfComplainEffective
WHERE PW_ComplainBillList.ComplainBillID =@ComplainBillID
END
第二步:逻辑层(BLL)代码
#region 新增投诉处理单
[OperationContract]
public int btnSave_Click_Insert_XinZengTouSuChuLiXinXi(int intComplainBillID, int intStaffID_DisposeDutyPerson,
DateTime dtmDisposeTime, string strComplainDispose, int intAttributeMinuteID_ComplainDisposeStatus,
bool blnIfComplainEffective)
{
SqlParameter[] mySqlParameters ={
new SqlParameter("@TYPE",SqlDbType.Char),
new SqlParameter("@ComplainBillID",SqlDbType.Int),
new SqlParameter("@StaffID_DisposeDutyPerson",SqlDbType.Int),
new SqlParameter("@DisposeTime",SqlDbType.DateTime),
new SqlParameter("@ComplainDispose",SqlDbType.Char),
new SqlParameter("@AttributeMinuteID_ComplainDisposeStatus",SqlDbType.Int),
new SqlParameter("@IfComplainEffective",SqlDbType.Bit),
};
mySqlParameters[0].Value = "btnSave_Click_Insert_XinZengTouSuChuLiXinXi";
mySqlParameters[1].Value = intComplainBillID;
mySqlParameters[2].Value = intStaffID_DisposeDutyPerson;
mySqlParameters[3].Value = dtmDisposeTime;
mySqlParameters[4].Value = strComplainDispose;
mySqlParameters[5].Value = intAttributeMinuteID_ComplainDisposeStatus;
mySqlParameters[6].Value = blnIfComplainEffective;
return myDALMethod.UpdateData("顾客关系_FRM_TouSuChuLi_ChuLi", mySqlParameters);
}
#endregion
第三步:界面层(UIL)代码
///
/// 状态ID=93为已处理,状态ID=91为未处理,状态ID=92为处理中如果状态不是已处理,判断是否为未处理,
///若为未处理就提示应为处理中,然后返回上一步,如果状态不是已处理且不为未处理,则提示是否为成功处理,
///如果选择“是”则提示状态应为已处理且为无效,返回上一步,然后保存呢。如果选择“否”,则检测是否为无效,
///若为无效则返回上一步,若为有效则进行保存;
///
/// 触发者
/// 触发事件
private void btnSave_Click(object sender, EventArgs e)
{
int intComplainBillID = FRM_TouSuChuLi.ComplainBillID;
int intStaffID_DisposeDutyPerson = Convert.ToInt32(cboDisposeDutyPerson.SelectedValue);
DateTime dtmDisposeTime = Convert.ToDateTime(dtpDisposeTime.Text.Trim());
string strComplainDispose = txtComplainDisposeContent.Text.Trim();
int intAttributeMinuteID_ComplainDisposeStatus = Convert.ToInt32(cboComplainDisposeStatus.SelectedValue);
bool blnIfComplainEffective = chkIfComplainEffective.Checked;
if (intAttributeMinuteID_ComplainDisposeStatus != 93)
{
if (intAttributeMinuteID_ComplainDisposeStatus == 91)
{
MessageBox.Show("开始处理的投诉单处理状态应为处理中!");
return;
}
if (MessageBox.Show("此投诉单是否已成功处理?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
MessageBox.Show("投诉处理状态应该为已处理!" + "\n" + "而且已处理的投诉单应设为无效!!");
return;
}
else
{
if (chkIfComplainEffective.Checked == false)
{
MessageBox.Show("处理中的投诉单不能设为无效!!!");
return;
}
else
{
int i = myFRM_TouSuChuLi_ChuLiClient.btnSave_Click_Insert_XinZengTouSuChuLiXinXi(intComplainBillID,
intStaffID_DisposeDutyPerson, dtmDisposeTime, strComplainDispose, intAttributeMinuteID_ComplainDisposeStatus,
blnIfComplainEffective);
BaoCunFou = true;
if (i > 0)
{
MessageBox.Show("第" + labCount.Text + "次处理成功!!!");
this.Dispose();
this.Close();
}
}
}
}
else
{
if (chkIfComplainEffective.Checked == true )
{
MessageBox.Show("已处理的投诉单应为无效!!!");
return;
}
int i = myFRM_TouSuChuLi_ChuLiClient.btnSave_Click_Insert_XinZengTouSuChuLiXinXi(intComplainBillID,
intStaffID_DisposeDutyPerson, dtmDisposeTime, strComplainDispose, intAttributeMinuteID_ComplainDisposeStatus,
blnIfComplainEffective);
BaoCunFou = true;
if (i > 0)
{
MessageBox.Show("第" + labCount.Text + "次处理成功!!!");
this.Dispose();
this.Close();
}
}
}
3、关闭提醒功能:
1、界面层(UIL)代码
///
///
///
/// 触发者
/// 触发事件
private void FRM_TouSuChuLi_ChuLi_FormClosing(object sender, FormClosingEventArgs e)
{
if (BaoCunFou == true)
{
this.Dispose();
this.Close();
e.Cancel = false;
}
else
{
if (MessageBox.Show("数据还没保存,确定退出???", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
this.Dispose();
this.Close();
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
}
4、两个下拉框的级联与自动绑定文本框数据:
第一步:数据库存储过程
IF(@TYPE ='cboCarOwnerName_Select_ChaXunCheZhuXingMing')
BEGIN
SELECT CarOwnerNewsID, RTRIM (LTRIM (CarOwnerName)) AS CarOwnerName
FROM BM_CarOwnerNewsList
END
IF(@TYPE ='txtPhone_Select_IDChaXunLianXiDianHua')
BEGIN
SELECT MobilePhone
FROM BM_CarOwnerNewsList
WHERE BM_CarOwnerNewsList.CarOwnerNewsID=@CarOwnerNewsID
END
IF(@TYPE ='cboLicensePlateNumber_Select_ChaXunChePaiHaoMa')
BEGIN
SELECT BM_CarNewsList.CarNewsID,RTRIM (LTRIM (LicensePlateNumber)) AS LicensePlateNumber
FROM BM_CarNewsList
WHERE BM_CarNewsList.CarOwnerNewsID=@CarOwnerNewsID
END
IF(@TYPE ='txtCheLiangXingHao_Select_IDChaXunCheLiangXinXi')
BEGIN
SELECT CarNewsID, CarModelsCode, BuyCarDate
FROM BM_CarNewsList
WHERE BM_CarNewsList.CarNewsID=@CarNewsID
END
第二步:逻辑层(BLL)代码
#region cbo查询车主姓名
[OperationContract]
public DataSet cboCarOwnerName_Select_ChaXunCheZhuXingMing()
{
SqlParameter[] mySqlParameters ={
new SqlParameter("@TYPE",SqlDbType.Char),
};
mySqlParameters[0].Value = "cboCarOwnerName_Select_ChaXunCheZhuXingMing";
DataTable dt = myDALMethod.QueryDataTable("顾客关系_FRM_TouSuChuLi_JianTouSuDan", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
#endregion
#region ID查询车主联系电话
[OperationContract]
public DataSet txtPhone_Select_IDChaXunLianXiDianHua(int intCarOwnerNewsID)
{
SqlParameter[] mySqlParameters ={
new SqlParameter("@TYPE",SqlDbType.Char),
new SqlParameter("@CarOwnerNewsID",SqlDbType.Int),
};
mySqlParameters[0].Value = "txtPhone_Select_IDChaXunLianXiDianHua";
mySqlParameters[1].Value = intCarOwnerNewsID;
DataTable dt = myDALMethod.QueryDataTable("顾客关系_FRM_TouSuChuLi_JianTouSuDan", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
#endregion
#region cbo查询车牌号
[OperationContract]
public DataSet cboLicensePlateNumber_Select_ChaXunChePaiHaoMa(int intCarOwnerNewsID)
{
SqlParameter[] mySqlParameters ={
new SqlParameter("@TYPE",SqlDbType.Char),
new SqlParameter ("@CarOwnerNewsID",SqlDbType.Int),
};
mySqlParameters[0].Value = "cboLicensePlateNumber_Select_ChaXunChePaiHaoMa";
mySqlParameters[1].Value = intCarOwnerNewsID;
DataTable dt = myDALMethod.QueryDataTable("顾客关系_FRM_TouSuChuLi_JianTouSuDan", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
#endregion
#region ID查询车主联系电话
[OperationContract]
public DataSet txtCheLiangXingHao_Select_IDChaXunCheLiangXinXi(int intCarNewsID)
{
SqlParameter[] mySqlParameters ={
new SqlParameter("@TYPE",SqlDbType.Char),
new SqlParameter("@CarNewsID",SqlDbType.Int),
};
mySqlParameters[0].Value = "txtCheLiangXingHao_Select_IDChaXunCheLiangXinXi";
mySqlParameters[1].Value = intCarNewsID;
DataTable dt = myDALMethod.QueryDataTable("顾客关系_FRM_TouSuChuLi_JianTouSuDan", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
#endregion
第三步:界面层(UIL)代码
先在界面Load事件绑定一个下拉框数据
DataTable dtCarOwnerName = myFRM_TouSuChuLi_JianTouSuDanClient.cboCarOwnerName_Select_ChaXunCheZhuXingMing().Tables[0];
PublicStaticMothd.SetZhiXiaLaKuang(cboCarOwnerName, dtCarOwnerName, "CarOwnerNewsID", "CarOwnerName");
Switch = true;
然后分别在两个下拉框的SelectedValueChanged事件写代码
private void cboCarOwnerName_SelectedValueChanged(object sender, EventArgs e)
{
if (Switch == true)
{
int CarOwnerNewsID = Convert.ToInt32(cboCarOwnerName.SelectedValue);
DataTable dtPhone = myFRM_TouSuChuLi_JianTouSuDanClient.txtPhone_Select_IDChaXunLianXiDianHua(CarOwnerNewsID).Tables[0];
txtPhone.Text = dtPhone.Rows[0]["MobilePhone"].ToString().Trim();
DataTable dtLicensePlateNumber = myFRM_TouSuChuLi_JianTouSuDanClient.cboLicensePlateNumber_Select_ChaXunChePaiHaoMa(CarOwnerNewsID).Tables[0];
PublicStaticMothd.SetZhiXiaLaKuang(cboLicensePlateNumber, dtLicensePlateNumber, "CarNewsID", "LicensePlateNumber");
Switch1 = true;
}
}
private void cboLicensePlateNumber_SelectedValueChanged(object sender, EventArgs e)
{
if (Switch1 == true)
{
int CarNewsID = Convert.ToInt32(cboLicensePlateNumber.SelectedValue);
DataTable dt = myFRM_TouSuChuLi_JianTouSuDanClient.txtCheLiangXingHao_Select_IDChaXunCheLiangXinXi(CarNewsID).Tables[0];
txtCarModelsCode.Text = dt.Rows[0]["CarModelsCode"].ToString().Trim();
txtBuyCarDate.Text = dt.Rows[0]["BuyCarDate"].ToString().Trim();
}
}