/// <summary> /// 保存车单接口 /// </summary> /// <param name="sheetID">车单编号</param> /// <param name="employeeNum">员工编号</param> /// <param name="employeeName">员工姓名</param> /// <param name="telPhone">手机号</param> /// <param name="department">部门名称</param> /// <param name="carPlate">车牌号(多个车牌号以逗号分开)</param> /// <param name="status">状态(=0 无效,=1 有效)</param> /// <param name="activationDate">生效日期(格式yyyy-MM-dd)</param> /// <param name="places">停车地点</param> /// <returns>=0 成功,=其他 错误代码</returns> public int SaveSheet(string sheetID, string employeeNum, string employeeName, string telPhone, string department, string carPlate, byte status, string activationDate, string places, bool enableLimitation, double limitation) { try { InterfaceReturnCode result = _SaveSheet(sheetID, employeeNum, employeeName, telPhone, department, carPlate, status, activationDate, places, enableLimitation, limitation); return((int)result); } catch (Exception) { return((int)InterfaceReturnCode.InterfaceException);//接口执行期间发生错误 } }
/// <summary> /// 车单状态接口 /// </summary> /// <param name="userID">车单编号(不能为空)</param> /// <param name="status">状态(=0 无效,=1 有效)</param> /// <param name="activationDate">生效日期(为空时不修改,格式yyyy-MM-dd)</param> /// <returns>=0 成功,=其他 错误代码</returns> public int SheetStatus(string userID, byte status, string activationDate) { try { if ((status != 0 && status != 1) || string.IsNullOrEmpty(userID)) { return((int)InterfaceReturnCode.ParameterError); } //卡片状态 = 1 Enabled 已发行, = 3 Disabled 禁用, byte cardStatus = (byte)(status == 0 ? 3 : 1); SQLHelperProvider sqlHelper = new SQLHelperProvider(AppConifg.Current.ParkingConnection); string cmdstr; if (!string.IsNullOrEmpty(activationDate)) { cmdstr = @"update Card set Status=@status,ActivationDate=@activationDate where CardID=@cardID"; } else { cmdstr = @"update Card set Status=@status where CardID=@cardID"; } SqlCommand cmd = new SqlCommand(); cmd.CommandText = cmdstr; cmd.Parameters.AddWithValue("@status", cardStatus); if (!string.IsNullOrEmpty(activationDate)) { cmd.Parameters.AddWithValue("@activationDate", activationDate); } cmd.Parameters.AddWithValue("@cardID", userID); SQLQueryResult <int> result = sqlHelper.SQLExecuteNonQuery(cmd); InterfaceReturnCode code = CreateInterfaceReturnCode(result.Result); if (code == InterfaceReturnCode.Success && result.QueryObject == 0) { //返回更新行数为0时,标识为无记录 code = InterfaceReturnCode.DatabaseNoRecord; } return((int)code); } catch (Exception) { return((int)InterfaceReturnCode.InterfaceException);//接口执行期间发生错误 } }
/// <summary> /// 通过员工编号删除员工记录接口 /// </summary> /// <param name="employeeNum"></param> /// <returns></returns> public int DeleteEmployee(string employeeNum) { try { if (string.IsNullOrEmpty(employeeNum)) { return((int)InterfaceReturnCode.ParameterError); } SQLHelperProvider sqlHelper = new SQLHelperProvider(AppConifg.Current.ParkingConnection); string cmdstr = @"delete from Card where CardID=@cardID"; SqlCommand cmd = new SqlCommand(); cmd.CommandText = cmdstr; cmd.Parameters.AddWithValue("@cardID", employeeNum); SQLResultCode code = sqlHelper.SQLExecuteNonQuery(cmd).Result; InterfaceReturnCode result = CreateInterfaceReturnCode(code); return((int)result); } catch (Exception) { return((int)InterfaceReturnCode.InterfaceException);//接口执行期间发生错误 } }