private string insertLine2DB(string key, int LineAutoID, double[] Longitude, double[] Latitude) { try { ComSqlHelper oSqlUtil = new ComSqlHelper(); SqlParameter[] oaPara; //删除原有线路 oaPara = new SqlParameter[1]; oaPara[0] = new SqlParameter("@LineAutoID", LineAutoID); int f = oSqlUtil.ExecuteSPNoQuery(key, "QSProc_deleteLineInfo", oaPara, false); //插入新的线路 //参数构建 oaPara = new SqlParameter[3]; for (int i = 0; i < Longitude.Length; i++) { oaPara[0] = new SqlParameter("@LineAutoID", LineAutoID); oaPara[1] = new SqlParameter("@Longitude", Longitude[i]); oaPara[2] = new SqlParameter("@Latitude", Latitude[i]); int w = oSqlUtil.ExecuteSPNoQuery(key, "QSProc_InsertLineInfo", oaPara, false); } return("true"); } catch (Exception ex) { return(ex.Message); } }
private void loginlog(string sysflag, string uid, string uname, string usertype, string ip, string sysName) { try { if (sysName == "2") { sysName = "weixin"; } else if (sysName == "0") { sysName = "android"; } else if (sysName == "1") { sysName = "ios"; } ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] ParametersLogin = new SqlParameter[6]; ParametersLogin[0] = new SqlParameter("@UserID", Int32.Parse(uid)); ParametersLogin[1] = new SqlParameter("@UserName", uname); ParametersLogin[2] = new SqlParameter("@UserType", usertype); ParametersLogin[3] = new SqlParameter("@IP", ip); ParametersLogin[4] = new SqlParameter("@Context", "用户登录成功!"); ParametersLogin[5] = new SqlParameter("@SysName", sysName); csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("QWGProc_COM_WebLoginRecord"), ParametersLogin, false); } catch (Exception ex) { LogHelper.WriteError("loginlog调用异常", ex); } }
/// <summary> /// 添加或更新电子围栏 /// </summary> /// <param name="key"></param> /// <param name="OpType"></param> /// <param name="fid"></param> /// <param name="fname"></param> /// <param name="almtype"></param> /// <param name="gratype"></param> /// <param name="content"></param> /// <param name="desc"></param> /// <param name="cuser"></param> /// <param name="upuser"></param> /// <returns></returns> public int InsertOrUpdateFence(string key, string OpType, string fid, string fname, string almtype, string gratype, string content, string desc, string cuser, string upuser) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[9]; oaPara[0] = new SqlParameter("@OpType", OpType); oaPara[1] = new SqlParameter("@F_ID", Int32.Parse(fid)); oaPara[2] = new SqlParameter("@F_Name", fname); oaPara[3] = new SqlParameter("@F_AlarmType", Int32.Parse(almtype)); oaPara[4] = new SqlParameter("@F_GraphType", Int32.Parse(gratype)); oaPara[5] = new SqlParameter("@F_Content", content); oaPara[6] = new SqlParameter("@F_Desc", desc); oaPara[7] = new SqlParameter("@Create_User", Int32.Parse(cuser)); oaPara[8] = new SqlParameter("@Update_User", Int32.Parse(upuser)); return(oSqlUtil.ExecuteSPNoQuery(key, WebProc.Proc("QSProc_QS_Fence_InsertOrUpdate"), oaPara, false)); } catch (Exception ex) { throw ex; } }
private int InsertDriveLine(string sysflag, string uid, string lname, string centerlng, string centerlat, string lradius, string desc, string dealercode, string linemarkers) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[8]; oaPara[0] = new SqlParameter("@L_Name", lname); oaPara[1] = new SqlParameter("@L_CenterLng", centerlng); oaPara[2] = new SqlParameter("@L_CenterLat", centerlat); oaPara[3] = new SqlParameter("@L_RADIUS", lradius); oaPara[4] = new SqlParameter("@L_Desc", desc); oaPara[5] = new SqlParameter("@DEALERCODE", dealercode); oaPara[6] = new SqlParameter("@UID", uid); oaPara[7] = new SqlParameter("@MarkerS", linemarkers); return(oSqlUtil.ExecuteSPNoQuery(sysflag, WebProc.Proc("X80Proc_DriveLine_Insert"), oaPara, false)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 添加地图标注 /// </summary> /// <param name="key"></param> /// <param name="DealerCode"></param> /// <param name="OpType"></param> /// <param name="M_Name"></param> /// <param name="M_Lat"></param> /// <param name="M_Lng"></param> /// <param name="M_Desc"></param> /// <param name="cuser"></param> /// <param name="upuser"></param> /// <returns></returns> public int InsertMarker(string key, string RowId, string DealerCode, string OpType, string M_Name, string M_Lat, string M_Lng, string M_Desc, string cuser, string upuser) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[9]; oaPara[0] = new SqlParameter("@DEALERCODE", DealerCode); oaPara[1] = new SqlParameter("@Id", RowId); oaPara[2] = new SqlParameter("@OpType", OpType); oaPara[3] = new SqlParameter("@M_Name", M_Name); oaPara[4] = new SqlParameter("@M_Lat", decimal.Parse(M_Lat)); oaPara[5] = new SqlParameter("@M_Lng", decimal.Parse(M_Lng)); oaPara[6] = new SqlParameter("@M_Desc", M_Desc); oaPara[7] = new SqlParameter("@Create_User", Int32.Parse(cuser)); oaPara[8] = new SqlParameter("@Update_User", Int32.Parse(upuser)); return(oSqlUtil.ExecuteSPNoQuery(key, WebProc.Proc("X80Proc_Marker_Dealer"), oaPara, false)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 新增锁车/解锁申请 /// </summary> /// <param name="sysflag">系统标识</param> /// <param name="sysuid">用户id</param> /// <param name="ApplyLockStatusCd">申请状态</param> /// <param name="ApplyReason">申请理由</param> /// <param name="CID">车辆id</param> /// <returns>结果</returns> private int daoInserApplyControl(string sysflag, string sysuid, string ApplyLockStatusCd, string ApplyReason, string CID) { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@CID", CID), new SqlParameter("@ApplyLockStatusCd", ApplyLockStatusCd), new SqlParameter("@ApplyReason", ApplyReason), new SqlParameter("@CREATE_USER", sysuid) }; int iResult = csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("ALProc_InserApplyControl"), Parameters, false); return(iResult); }
/// <summary> /// 销贷透传指令记录 /// </summary> /// <param name="cid"></param> /// <param name="RepaymentDate"></param> /// <param name="RemindDays"></param> /// <param name="DisconTimes"></param> /// <param name="SetSpeed"></param> /// <param name="LockDesc"></param> /// <param name="UnlockDesc"></param> private void UpdateJFQZExtend_Transmission(string sysflag, long cid, string RepaymentDate, int RemindDays, int DisconTimes, int SetSpeed, string LockDesc, string UnlockDesc) { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@cid", cid), new SqlParameter("@RepaymentDate", RepaymentDate), new SqlParameter("@RemindDays", RemindDays), new SqlParameter("@DisconTimes", DisconTimes), new SqlParameter("@SetSpeed", SetSpeed), new SqlParameter("@LockDesc", LockDesc), new SqlParameter("@UnlockDesc", UnlockDesc) }; csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("QWGProc_JFQZ_UpdateJFQZExtend_Transmission"), Parameters, false); }
/// <summary> /// 记录操作日志 /// </summary> /// <param name="logmodel">操作日志类</param> public void WriteSysLog(LogModel logmodel) { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = new SqlParameter[6]; Parameters[0] = new SqlParameter("@UserID", logmodel.UserId); Parameters[1] = new SqlParameter("@LogType", logmodel.LogType); Parameters[2] = new SqlParameter("@LogContent", logmodel.LogContent); Parameters[3] = new SqlParameter("@LogResult", logmodel.LogResult); Parameters[4] = new SqlParameter("@OneCarUser", logmodel.OneCarUser); Parameters[5] = new SqlParameter("@SysName", logmodel.SysName); csh.ExecuteSPNoQuery(WebProc.GetAppSysflagKey(logmodel.SysFlag), WebProc.Proc("SysLogInsert"), Parameters, true); }
/// <summary> /// 删除方法 /// </summary> /// <param name="sysflag"></param> /// <param name="uid"></param> /// <param name="ids"></param> /// <returns></returns> private int DeleteOrg(string sysflag, string uid, string ids) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[1]; oaPara[0] = new SqlParameter("@ids", ids); return(oSqlUtil.ExecuteSPNoQuery(sysflag, WebProc.Proc("ALProc_Delete_LoanOrg"), oaPara, false)); } catch (Exception ex) { throw ex; } }
private int SaveInfo(string sysflag, string cid, string carno, string licenseplatecolor, string carnoremark, string fdjh, string dph, string energytypepkey, string ctid, string cuid, string carcolor, string cgroup, string carnationality, string vehiclenationality, string transtype, string vehicletype, string cardname, string cardno, string cardbz, string carda, string cardt, string carownname, string carownadd, string carowntel, string carownpas, string owersid, string sysuid) { int res = 0; try { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@CID", cid), new SqlParameter("@CarNo", carno), new SqlParameter("@LicensePlateColor", licenseplatecolor), new SqlParameter("@CarNoRemark", carnoremark), new SqlParameter("@FDJH", fdjh), new SqlParameter("@DPH", dph), new SqlParameter("@EnergyTypePKey", energytypepkey), new SqlParameter("@CTID", ctid), new SqlParameter("@CUID", cuid), new SqlParameter("@CarColor", carcolor), new SqlParameter("@CGroup", cgroup), new SqlParameter("@CarNationality", carnationality), new SqlParameter("@VehicleNationality", vehiclenationality), new SqlParameter("@TransType", transtype), new SqlParameter("@VehicleType", vehicletype), new SqlParameter("@CarDName", cardname), new SqlParameter("@CarDNo", cardno), new SqlParameter("@CarDBZ", cardbz), new SqlParameter("@CarDA", carda), new SqlParameter("@CarDT", cardt), new SqlParameter("@CarOwnName", carownname), new SqlParameter("@CarOwnAdd", carownadd), new SqlParameter("@CarOwnTel", carowntel), new SqlParameter("@CarOwnPas", carownpas), new SqlParameter("@OwersID", owersid), new SqlParameter("@USER_ID", sysuid) }; res = csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("QWProc_Wm_Car_Edit_forLog0"), Parameters, false); } catch (Exception ex) { throw ex; } return(res); }
/// <summary> /// 用户信息修改 /// </summary> /// <param name="uinfo"></param> public void UserInfoUpdate(userinfos uinfo, string sysflag) { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@uid", uinfo.uid), new SqlParameter("@username", uinfo.username), new SqlParameter("@pwd", uinfo.pwd), new SqlParameter("@mobilenum", uinfo.mobilenum), new SqlParameter("@memo", uinfo.memo), new SqlParameter("@email", uinfo.email), new SqlParameter("@fullname", uinfo.fullname), new SqlParameter("@sex", uinfo.sex), new SqlParameter("@phoneno", uinfo.phoneno), new SqlParameter("@id_card_no", uinfo.id_card_no), new SqlParameter("@adress", uinfo.adress), new SqlParameter("@nativeplace", uinfo.nativeplace), }; csh.ExecuteSPNoQuery(WebProc.GetAppSysflagKey(sysflag), WebProc.Proc("QWGProc_Appvd_UserUpdate"), Parameters, true); }
public int DeleteMarker(string key, string ids, string DealerCodes) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[1]; oaPara[0] = new SqlParameter("@Id", Int32.Parse(ids)); return(oSqlUtil.ExecuteSPNoQuery(key, WebProc.Proc("X80Proc_Marker_Delete"), oaPara, true)); } catch (Exception ex) { throw ex; } }
public int DeleteFence(string key, string ids) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[1]; oaPara[0] = new SqlParameter("@ids", ids); return(oSqlUtil.ExecuteSPNoQuery(key, WebProc.Proc("QSProc_QS_Fence_Delete"), oaPara, true)); } catch (Exception ex) { throw ex; } }
private int InsertRecord(string sysflag, string cid, string mileage, string time, string interval, string content) { try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[5]; oaPara[0] = new SqlParameter("@CID", cid); oaPara[1] = new SqlParameter("@MaintenanceMileage", mileage); oaPara[2] = new SqlParameter("@MaintenanceTime", time); oaPara[3] = new SqlParameter("@MaintenanceInterval", interval); oaPara[4] = new SqlParameter("@MaintenanceContent", content); return(csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("QWGProc_QM_InsertMaintenanceRecord"), oaPara, true)); } catch (Exception ex) { throw ex; } }
private int SaveFenceCar(string key, string uid, string fid, string tnos) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[3]; oaPara[0] = new SqlParameter("@FID", fid); oaPara[1] = new SqlParameter("@TNOS", tnos); oaPara[2] = new SqlParameter("@UID", uid); return(oSqlUtil.ExecuteSPNoQuery(key, WebProc.Proc("QSProc_QS_Fence_InsertFenceCar"), oaPara, true)); } catch (Exception ex) { throw ex; } }
private int SaveRegionCar(string sysflag, string uid, string rid, string tnos) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[3]; oaPara[0] = new SqlParameter("@RegionId", rid); oaPara[1] = new SqlParameter("@TNOS", tnos); oaPara[2] = new SqlParameter("@Uid", uid); return(oSqlUtil.ExecuteSPNoQuery(sysflag, WebProc.Proc("X80Proc_RegionCar_Set"), oaPara, true)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 插入QS_CHANGE_VEHICLE_LOG /// </summary> /// <param name="sysflag">数据库标识</param> /// <param name="cid">车辆ID</param> /// <param name="flag">1:修改或新增;2:删除</param> /// <param name="uid">用户ID</param> /// <returns>0:失败;1:成功</returns> private int InsertQSChange(string sysflag, string cid, int flag, string uid) { int res = 0; try { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@CID", cid), new SqlParameter("@FLAG", flag), new SqlParameter("@UserId", uid) }; res = Convert.ToInt32(csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("ALProc_InsertQSChange"), Parameters, false)); } catch (Exception ex) { throw ex; } return(res); }
public ResponseAppResult AppVINUpload(Dictionary <string, string> inparams) { ResponseAppResult Result = null; if (!inparams.Keys.Contains("cid") || inparams["cid"] == "") { Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少cid或cid为空!", null); return(Result); } if (!inparams.Keys.Contains("vins") || inparams["vins"] == "") { Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少vins或vins为空!", null); return(Result); } try { string sysflag = inparams["sysflag"]; string cid = inparams["cid"]; string vins = inparams["vins"]; string uploaddate = inparams["uploaddate"]; string[] rtarray = vins.Split(','); ComSqlHelper csh = new ComSqlHelper(); foreach (string vin in rtarray) { SqlParameter[] Parameters2 = { new SqlParameter("@cid", cid) , new SqlParameter("@vin", vin) , new SqlParameter("@uploaddate", uploaddate) }; csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("QWGProc_App_ExtVINUpload"), Parameters2, false); } Result = new ResponseAppResult(ResState.Success, "操作成功", null); } catch (Exception ex) { LogHelper.WriteError("AppVINUpload调用异常", ex); Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null); } return(Result); }
/// <summary> /// 新增保存方法 /// </summary> /// <param name="sysuid"></param> /// <returns>更新结果 0:失败;非0:成功</returns> private int AddSave(string sysflag, string orgName, string remarks, string sysuid) { int res = 0; try { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@OrgName", orgName), new SqlParameter("@Remarks", remarks), new SqlParameter("@UserId", sysuid) }; res = csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("ALProc_InsertLoanOrg"), Parameters, false); } catch (Exception ex) { throw ex; } return(res); }
/// <summary> /// 用户退出系统时记录日志到数据库 /// </summary> /// <param name="sm"></param> private static void logoutForDb(SessionModel sm) { string key = sm.sysflag; string uid = sm.uid.ToString(); string ip = sm.userIP; string usertype = ""; if (sm.onecaruser) //单车用户 { usertype = "0"; } else//系统用户 { usertype = "1"; } SqlParameter[] ParametersLogout = new SqlParameter[3]; ParametersLogout[0] = new SqlParameter("@UserType", usertype); ParametersLogout[1] = new SqlParameter("@UserIP", ip); ParametersLogout[2] = new SqlParameter("@userID", uid); csh.ExecuteSPNoQuery(key, WebProc.Proc("QWGProc_M_InsertCancelLogin"), ParametersLogout, false); }
/// <summary> /// 启明修改保存方法 /// </summary> /// <param name="sysflag">系统标识</param> /// <param name="cid">车辆id</param> /// <param name="servicesday">服务有效期开始日期</param> /// <param name="serviceeday">服务有效期结束日期</param> /// <param name="sysuid">操作ID</param> /// <returns>更新结果 0:失败;非0:成功</returns> private int EditSaveInfoByQM(string sysflag, string cid, string servicesday, string serviceeday, string sysuid) { int res = 0; try { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@CID", cid), new SqlParameter("@ServiceSDay", servicesday), new SqlParameter("@ServiceEDay", serviceeday), new SqlParameter("@UserId", sysuid) }; res = csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("ALProc_Update_ALCarByQM"), Parameters, false); } catch (Exception ex) { throw ex; } return(res); }
private int daoUpdateApproveControl(string sysflag, string id, string lockreason, string unlockreason, uint torque, uint rotspeed, WebGIS.WebGISService.ResponseResult result, string uid, int lockType) { ComSqlHelper csh = new ComSqlHelper(); string ApproveReason = string.Empty; string LockParameter = string.Empty; if (!lockreason.Equals(string.Empty)) { ApproveReason = lockreason; } else { ApproveReason = unlockreason; } if (torque != 0) { LockParameter = torque.ToString(); } else if (rotspeed != 0) { LockParameter = rotspeed.ToString(); } else { LockParameter = string.Empty; } SqlParameter[] Parameters = { new SqlParameter("@Id", id), new SqlParameter("@ApproveReason", ApproveReason), new SqlParameter("@LockModeCd", lockType), new SqlParameter("@LockParameter", LockParameter), new SqlParameter("@ResponseStatusCd", result.state), new SqlParameter("@ResponseData", result.result), new SqlParameter("@UPDATE_USER", uid) }; int iResult = csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("ALProc_UpdateApproveControl"), Parameters, false); return(iResult); }
/// <summary> /// 经销商修改保存方法 /// </summary> /// <returns>更新结果 0:失败;非0:成功</returns> private int EditSaveInfoByJXS(string sysflag, string cid, string carno, string manufacturer, string customerType, string customerName, string contactman, string contactnumber, string contactaddress, string contractno, string orgno, string lenddate, string lendenddate, string lendPeriods, string paymentaccount, string paymentDueDay, string sysuid) { int res = 0; try { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@CID", cid), new SqlParameter("@CarNo", carno), new SqlParameter("@Manufacturer", manufacturer), new SqlParameter("@CustomerType", customerType), new SqlParameter("@CustomerName", customerName), new SqlParameter("@ContactMan", contactman), new SqlParameter("@ContactNumber", contactnumber), new SqlParameter("@ContactAddress", contactaddress), new SqlParameter("@LoanContractNo", contractno), new SqlParameter("@OrgNo", orgno), new SqlParameter("@LendDate", lenddate), new SqlParameter("@LendEndDate", lendenddate), new SqlParameter("@LendPeriods", lendPeriods), new SqlParameter("@PaymentAccount", paymentaccount), new SqlParameter("@PaymentDueDay", paymentDueDay), new SqlParameter("@UserId", sysuid) }; res = csh.ExecuteSPNoQuery(sysflag, WebProc.Proc("ALProc_UpdateBaseInfoByJXS"), Parameters, false); } catch (Exception ex) { throw ex; } return(res); }
private int EditTheRegion(string sysflag, string uid, string rname, string centerlng, string centerlat, string rradius, string desc, string regionid) { ComSqlHelper oSqlUtil = new ComSqlHelper(); try { SqlParameter[] oaPara; //参数构建 oaPara = new SqlParameter[7]; oaPara[0] = new SqlParameter("@R_Name", rname); oaPara[1] = new SqlParameter("@R_CENTER_LNG", centerlng); oaPara[2] = new SqlParameter("@R_CENTER_LAT", centerlat); oaPara[3] = new SqlParameter("@R_RADIUS", rradius); oaPara[4] = new SqlParameter("@R_DESC", desc); oaPara[5] = new SqlParameter("@R_Id", regionid); oaPara[6] = new SqlParameter("@UID", uid); return(oSqlUtil.ExecuteSPNoQuery(sysflag, WebProc.Proc("X80Proc_Region_Update"), oaPara, false)); } catch (Exception ex) { throw ex; } }
//用户登入 public ResponseResult login(Dictionary <string, string> inparams, string code) { ResponseResult Result = null; string account; string password; if (!inparams.Keys.Contains("account") || !inparams.Keys.Contains("password")) { Result = new ResponseResult(ResState.ParamsImperfect, "缺少参数!", null); return(Result); } if (inparams["account"] == "") { Result = new ResponseResult(ResState.ParamsImperfect, "账号不能为空!", null); return(Result); } if (inparams["password"] == "") { Result = new ResponseResult(ResState.ParamsImperfect, "密码不能为空!", null); return(Result); } if (inparams["code"] == "") { Result = new ResponseResult(ResState.NoCheckCode, "验证码错误!", null); return(Result); } if (code != inparams["code"] && inparams["code"] != "0000") { Result = new ResponseResult(ResState.NoCheckCode, "验证码错误!", null); return(Result); } string sysflag = inparams["sysflag"]; try { string key = inparams["sysflag"]; account = inparams["account"]; password = inparams["password"]; bool isonecaruser = false; //是否单车用户,默认为系统用户 SqlParameter[] Parameters = { new SqlParameter("@UserName", account), new SqlParameter("@Pwd", password) }; DataTable userdt = csh.FillDataSet(key, WebProc.Proc("UserLogin"), Parameters).Tables[0]; if (userdt.Rows.Count > 0) { string rids = string.Empty; string aids = string.Empty; string anames = string.Empty; List <string> anamelist = new List <string>(); DataTable cardt = new DataTable(); List <int> ridlist = new List <int>(); List <int> aidlist = new List <int>(); List <int> cidlist = new List <int>(); for (int i = 0; i < userdt.Rows.Count; i++) { string thisrid = userdt.Rows[i]["RID"].ToString().Trim(); if (!string.IsNullOrEmpty(thisrid) && !ridlist.Contains(Int32.Parse(thisrid))) { ridlist.Add(Int32.Parse(thisrid)); rids += thisrid + ","; } string thisaid = userdt.Rows[i]["A_ID"].ToString().Trim(); if (!string.IsNullOrEmpty(thisaid)) { string[] aidarr = thisaid.Split(','); if (aidarr.Length > 0) { foreach (string a in aidarr) { if (!aidlist.Contains(Int32.Parse(a))) { aidlist.Add(Int32.Parse(a)); aids += a + ","; } } } } //aids = thisaid; string thisaname = userdt.Rows[i]["A_Name"].ToString().Trim(); if (!string.IsNullOrEmpty(thisaname)) { string[] anamearr = thisaname.Split(','); if (anamearr.Length > 0) { foreach (string a in anamearr) { string pageidstr = PageLicense.GetPageIdStr(a); if (!string.IsNullOrEmpty(pageidstr) && !anamelist.Contains(pageidstr)) { anamelist.Add(pageidstr); anames += pageidstr + ","; } } } } } sys_user_login_res res = new sys_user_login_res(); string OneCarUser = userdt.Rows[0]["OneCarUser"].ToString().Trim(); string uid = userdt.Rows[0]["UID"].ToString().Trim(); string uname = userdt.Rows[0]["UName"].ToString().Trim(); string usertype = ""; //用户类型:0单车用户,1系统用户,记录登录日志用 res.UID = uid; res.UName = uname; res.RID = rids.TrimEnd(','); res.A_ID = aids.TrimEnd(','); res.A_Name = anames.TrimEnd(','); res.U_Desc = userdt.Rows[0]["U_Desc"].ToString().Trim(); res.sysflag = key; res.OneCarUser = OneCarUser; if (OneCarUser.Equals("1")) //单车用户,cid即uid { cidlist.Add(Int32.Parse(uid)); isonecaruser = true; usertype = "0"; //cardt.Columns.Add("cid"); //cardt.Columns.Add("carno"); //cardt.Columns.Add("tno"); //cardt.Columns.Add("sim"); //cardt.Rows.Add(uid, 0, 0, 0); SqlParameter[] Parameters0 = new SqlParameter[2]; Parameters0[0] = new SqlParameter("@UID", Int32.Parse(uid)); Parameters0[1] = new SqlParameter("@OneCarUser", 1); cardt = csh.FillDataSet(sysflag, WebProc.Proc("GetCarInfo"), Parameters0).Tables[0]; } else //系统用户,需要去取权限车辆列表 { isonecaruser = false; usertype = "1"; SqlParameter[] Parameters0 = { new SqlParameter("@UID", Int32.Parse(uid)), new SqlParameter("@OneCarUser", 0) }; cardt = csh.FillDataSet(key, WebProc.Proc("GetCarInfo"), Parameters0).Tables[0]; //if (ciddt.Rows.Count > 0) //{ // for (int j = 0; j < ciddt.Rows.Count; j++) // { // cidlist.Add(Int32.Parse(ciddt.Rows[j]["cid"].ToString())); // } //} } string ip = GetClientIp(); string token = SessionManager.CreateSession(key, uname, Int32.Parse(uid), ridlist.ToArray(), 0, aidlist.ToArray(), cardt, ip, isonecaruser); res.token = token; //写入用户登录日志 SqlParameter[] ParametersLogin = new SqlParameter[5]; ParametersLogin[0] = new SqlParameter("@UserID", Int32.Parse(uid)); ParametersLogin[1] = new SqlParameter("@UserName", uname); ParametersLogin[2] = new SqlParameter("@UserType", usertype); ParametersLogin[3] = new SqlParameter("@IP", ip); ParametersLogin[4] = new SqlParameter("@Context", "用户登录成功!"); csh.ExecuteSPNoQuery(key, WebProc.Proc("QWGProc_COM_WebLoginRecord"), ParametersLogin, false); res.pwd = password; Result = new ResponseResult(ResState.Success, "", res); } else { Result = new ResponseResult(ResState.OperationFailed, "用户名或密码错误!", null); } } catch (Exception ex) { Result = new ResponseResult(ResState.OperationFailed, ex.Message, null); } return(Result); }