/// <summary> /// 获取公司列表 /// </summary> /// <returns></returns> public List <Company> GetCompanyList() { object o = Activator.CreateInstance(t); MethodInfo method = t.GetMethod("GetCompanyList"); object objStr = method.Invoke(o, null); List <Company> list = JsToJson.Deserialize <List <Company> >(objStr.ToString()); return(list); }
/// <summary> /// 根据户号获取燃气用户 /// </summary> /// <param name="userId"></param> /// <param name="companyId"></param> /// <returns></returns> public GasFeeBill GetGasUserBill(string userId, string companyId, string month) { object o = Activator.CreateInstance(t); MethodInfo method = t.GetMethod("GetGasUserBill"); object[] param = { userId, companyId }; string objStr = method.Invoke(o, param).ToString(); GasFeeBill bill = JsToJson.Deserialize <GasFeeBill>(objStr); return(bill); }
/// <summary> /// 根据户号获取燃气用户 /// </summary> /// <param name="userId"></param> /// <param name="companyId"></param> /// <returns></returns> public GasUser GetGasUserByUserId(string userId, string companyId) { object o = Activator.CreateInstance(t); MethodInfo method = t.GetMethod("GetGasUserByUserId"); object [] param = { userId, companyId }; string objStr = method.Invoke(o, param).ToString(); GasUser user = JsToJson.Deserialize <GasUser>(objStr); return(user); }
public String GetGasUserByUserId(string userId, string companyId) { OlbGasUser userInfo = null; WCFServiceProxy <ICommonSearch <View_UserMeter> > proxy = null; try { proxy = new WCFServiceProxy <ICommonSearch <View_UserMeter> >(); SearchCondition sCondition = new SearchCondition() { TBName = "View_UserMeter", TFieldKey = "UserID", TPageSize = 1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = " 1=1 AND CompanyID='" + companyId + "' AND UserID='" + userId + "' " }; List <View_UserMeter> list = proxy.getChannel.getListBySearchCondition(ref sCondition); if (list.Count > 0) { userInfo = new OlbGasUser(); userInfo.UserID = list[0].UserID; userInfo.UserName = list[0].UserName; userInfo.Address = list[0].Address; userInfo.CompanyID = list[0].CompanyID; userInfo.Balance = (decimal)list[0].RemainingAmount; userInfo.MeterNo = list[0].MeterNo; userInfo.MeterType = int.Parse(list[0].MeterType); } } catch (Exception ex) { } finally { if (proxy != null) { proxy.CloseChannel(); } } return(JsToJson.SerializeToJsonString(userInfo)); }
public String GetGasUserBill(string userId, string companyId, string month) { OlbGasFeeBill gasFeeBill = null; WCFServiceProxy <IChaoBiao> proxy = null; try { proxy = new WCFServiceProxy <IChaoBiao>(); View_UserMeterHistory thisRecord = proxy.getChannel.GetMonthLastRecord(userId, companyId, month); string thisMonth = month + "-01"; string lastMonth = Convert.ToDateTime(thisMonth).AddMonths(-1).ToString("yyyy-MM"); View_UserMeterHistory lastRecord = proxy.getChannel.GetMonthLastRecord(userId, companyId, lastMonth); if (thisRecord != null && lastRecord != null) { gasFeeBill = new OlbGasFeeBill(); gasFeeBill.ChaoBiaoTime = (DateTime)thisRecord.ReadDate; gasFeeBill.UserID = thisRecord.UserID; gasFeeBill.UserName = thisRecord.UserName; gasFeeBill.LastNum = (decimal)lastRecord.TotalAmount; gasFeeBill.ThisNum = (decimal)thisRecord.TotalAmount; gasFeeBill.GasNum = (decimal)thisRecord.TotalAmount - (decimal)lastRecord.TotalAmount; gasFeeBill.GasFee = (decimal)lastRecord.RemainingAmount - (decimal)thisRecord.RemainingAmount; } } catch (Exception ex) { } finally { if (proxy != null) { proxy.CloseChannel(); } } return(JsToJson.SerializeToJsonString(gasFeeBill)); }
public String GetCompanyList() { List <OlbCompany> listOlbCompany = null; WCFServiceProxy <ICommonSearch <CompanyInfo> > proxy = null; try { proxy = new WCFServiceProxy <ICommonSearch <CompanyInfo> >(); SearchCondition sCondition = new SearchCondition() { TBName = "S_CompanyInfo", TFieldKey = "CompanyID", TPageSize = 9999, TPageCurrent = 1, TFieldOrder = "CompanyName ASC" }; List <CompanyInfo> list = proxy.getChannel.getListBySearchCondition(ref sCondition); listOlbCompany = new List <OlbCompany>(); foreach (CompanyInfo c in list) { listOlbCompany.Add(new OlbCompany() { Id = c.CompanyID, Name = c.CompanyName }); } } catch (Exception ex) { } finally { if (proxy != null) { proxy.CloseChannel(); } } return(JsToJson.SerializeToJsonString(listOlbCompany)); }
public override void DoLoginedHandlerWork(HttpContext context) { Message jsonMessage; jsonMessage = new Message() { Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。" }; //获取操作类型AType:ADD,EDIT,DELETE string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper(); IoT_User Info; View_UserMeter viewInfo; WCFServiceProxy <IUserManage> proxy = null; try { switch (AjaxType) { //查询用户 case "QUERY": CommonSearch <IoT_User> InfoSearch = new CommonSearch <IoT_User>(); string Where = "1=1 "; Where += "AND CompanyID='" + loginOperator.CompanyID + "' "; if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty) { Where += context.Request.Form["TWhere"].ToString(); } SearchCondition sCondition = new SearchCondition() { TBName = "IoT_User", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where }; List <IoT_User> list = InfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <IoT_User>(list, sCondition.TTotalCount) }; break; //查询用户表具视图 case "QUERYVIEW": CommonSearch <View_UserMeter> InfoSearchView = new CommonSearch <View_UserMeter>(); Where = "1=1 "; Where += "AND CompanyID='" + loginOperator.CompanyID + "' "; if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty) { Where += context.Request.Form["TWhere"].ToString(); } sCondition = new SearchCondition() { TBName = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where }; List <View_UserMeter> listView = InfoSearchView.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_UserMeter>(listView, sCondition.TTotalCount) }; break; //查询临时用户 case "QUERYTEMP": CommonSearch <IoT_UserTemp> InfoSearchTemp = new CommonSearch <IoT_UserTemp>(); Where = "1=1 "; Where += "AND CompanyID='" + loginOperator.CompanyID + "' "; if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty) { Where += context.Request.Form["TWhere"].ToString(); } sCondition = new SearchCondition() { TBName = "IoT_UserTemp", TFieldKey = "MeterNo", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterNo ASC", TWhere = Where }; List <IoT_UserTemp> listTemp = InfoSearchTemp.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <IoT_UserTemp>(listTemp, sCondition.TTotalCount) }; break; case "QUERYALARMPARM": //TODO:查询用户当前设置的报警参数 CommonSearch <Iot_MeterAlarmPara> meterAlarmPara = new CommonSearch <Iot_MeterAlarmPara>(); viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context); if (viewInfo.MeterNo != null && viewInfo.MeterNo.ToString().Trim() != string.Empty) { Where = $"MeterNo = '{viewInfo.MeterNo.ToString().Trim()}'"; sCondition = new SearchCondition() { TBName = "Iot_MeterAlarmPara", TFieldKey = "MeterNo", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterNo ASC", TWhere = Where }; List <Iot_MeterAlarmPara> listMAP = meterAlarmPara.GetList(ref sCondition, context); if (listMAP.Count == 1) { jsonMessage = new Message() { Result = true, TxtMessage = JsToJson.SerializeToJsonString(listMAP[0]) }; } else { jsonMessage = new Message() { Result = false, TxtMessage = "没有找到配置数据。" }; } } break; //单户创建 case "ADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "cjyh_dhcj")) { Info = new CommonModelFactory <IoT_User>().GetModelFromContext(context); Info.CompanyID = base.loginOperator.CompanyID; proxy = new WCFServiceProxy <IUserManage>(); jsonMessage = proxy.getChannel.Add(Info); } break; //编辑用户信息和表信息 case "EDITUSERMETER": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dagl_bjyh")) { viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context); proxy = new WCFServiceProxy <IUserManage>(); jsonMessage = proxy.getChannel.EditUserMeter(viewInfo); } break; //删除用户信息和表信息 case "DELETEUSERMETER": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dagl_scyh")) { viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context); proxy = new WCFServiceProxy <IUserManage>(); jsonMessage = proxy.getChannel.DeleteUserMeter(viewInfo); } break; //批量删除用户 case "BATCHDELETE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dagl_scyh")) { viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context); proxy = new WCFServiceProxy <IUserManage>(); if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty) { string strNo = context.Request.Form["strNo"]; string[] arrNo = strNo.Split(','); for (int i = 0; i < arrNo.Length; i++) { proxy.getChannel.BatchDeleteUserMeter(arrNo[i]); } } jsonMessage = new Message() { Result = true, TxtMessage = "删除用户成功" }; } break; //批量excel导入 case "BATCHIMPORT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "cjyh_dhcj")) { viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context); proxy = new WCFServiceProxy <IUserManage>(); if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty) { string strNo = context.Request.Form["strNo"]; string[] arrNo = strNo.Split(','); for (int i = 0; i < arrNo.Length; i++) { proxy.getChannel.BatchImport(arrNo[i]); } } jsonMessage = new Message() { Result = true, TxtMessage = "导入用户成功" }; } break; //批量添加用户 case "BATCHADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "cjyh_dhcj")) { viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context); proxy = new WCFServiceProxy <IUserManage>(); string street = ""; if (context.Request.Form["Street"] != null && context.Request.Form["Street"].ToString().Trim() != string.Empty) { street = context.Request.Form["Street"].ToString().Trim(); } string community = ""; if (context.Request.Form["Community"] != null && context.Request.Form["Community"].ToString().Trim() != string.Empty) { community = context.Request.Form["Community"].ToString().Trim(); } string meterType = ""; if (context.Request.Form["MeterType"] != null && context.Request.Form["MeterType"].ToString().Trim() != string.Empty) { meterType = context.Request.Form["MeterType"].ToString().Trim(); } if (context.Request.Form["Rows"] != null && context.Request.Form["Rows"].ToString().Trim() != string.Empty) { UserRows rows = JsToJson.Deserialize <UserRows>(context.Request.Form["Rows"].ToString()); List <User> userlist = rows.Rows; int count = 0; string error = ""; Message tempM = null; foreach (User u in userlist) { if (u.MeterNo.Trim() == "") { tempM = new Message() { Result = false, TxtMessage = string.Format("UserID={0}的表号未填写\r", u.UserID) }; } else { IoT_User tempUser = new IoT_User(); tempUser.UserID = u.UserID; tempUser.UserName = u.UserName; tempUser.Address = u.Address; tempUser.Community = community; tempUser.Street = street; tempUser.CompanyID = loginOperator.CompanyID; tempUser.State = '1'; IoT_Meter tempMeter = new IoT_Meter(); tempMeter.MeterType = meterType; tempMeter.MeterNo = u.MeterNo; tempMeter.CompanyID = loginOperator.CompanyID; tempM = proxy.getChannel.BatchAddUserMeter(tempUser, tempMeter); } if (tempM.Result) { count++; } else { error = tempM.TxtMessage; } } if (count > 0) { jsonMessage = new Message() { Result = true, TxtMessage = "批量添加用户" + count + "个成功," + (userlist.Count - count) + "个失败,失败原因:" + error }; } else { jsonMessage = new Message() { Result = false, TxtMessage = "批量添加用户失败" }; } } } break; default: jsonMessage = new Message() { Result = false, TxtMessage = "操作未定义。" }; break; } } catch (Exception ex) { jsonMessage = new Message() { Result = false, TxtMessage = ex.Message }; } finally { if (proxy != null) { proxy.CloseChannel(); } } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }