public string GetWaterUserHasQuotasById(string loginIdentifer, string waterUserId) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUser", new JavaScriptObject()); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((waterUserId == null) || (waterUserId.Trim() == "")) { obj2["Message"] = "用水户ID不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } WaterUser wui = WaterUserModule.GetWaterUserById(long.Parse(waterUserId)); if (wui == null) { obj2["Message"] = "ID为" + waterUserId + "用水户不存在"; return(JavaScriptConvert.SerializeObject(obj2)); } obj2["Result"] = true; obj2["WaterUser"] = WaterUserModule.WaterUserToJson(wui); } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetWaterUserQuotaById(string loginIdentifer, string waterUserQuotaId) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUserQuota", new JavaScriptObject()); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, false); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } /* * WaterUserQuota waterUserQuotaById = SaleWaterModule.GetWaterUserQuotaById(waterUserQuotaId); * if (waterUserQuotaById == null) * { * obj2["Message"] = "ID为" + waterUserQuotaId + "用水定额不存在"; * return JavaScriptConvert.SerializeObject(obj2); * } * obj2["WaterUser"] = SaleWaterModule.WaterUserQuotaToJson(waterUserQuotaById); * */ obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public static ResMsg DeletePriceInfoById(string priceId) { ResMsg msg = new ResMsg(false, ""); //删除前判断是否有用水户使用 string strSql1 = "delete from 时段水价表 where 水价ID='" + priceId + "'"; string strSql2 = "delete from 水价表 where ID='" + priceId + "'"; int i = DbHelperSQL.ExecuteSqlTran(new List <string> { strSql1, strSql2 }); if (i > 0) { lock (dicPriceInfos) { if (dicPriceInfos.ContainsKey(priceId)) { dicPriceInfos.Remove(priceId); } } msg.Result = true; msg.Message = "删除价格成功"; return(msg); } msg.Message = "删除价格失败,原因:" + msg.Message; return(msg); }
public string GetCardUserById(string loginIdentifer, string cardUserID) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("CardUser", new JavaScriptObject()); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((cardUserID == null) || (cardUserID.Trim() == "")) { obj2["Message"] = "用水户卡ID不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } CardUser cardUser = CardUserModule.GetCardUserById(long.Parse(cardUserID)); if (cardUser == null) { obj2["Message"] = "ID为" + cardUserID + "用水户卡不存在"; return(JavaScriptConvert.SerializeObject(obj2)); } obj2["Result"] = true; obj2["CardUser"] = CardUserModule.CardUserToJson(cardUser); } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
/// <summary> /// 启动服务器,以便它侦听传入的连接请求。 /// </summary> public ResMsg Start() { ResMsg rm = new ResMsg(); if (_isListening) { rm.Result = true; return(rm); } Init(); listenSocket = new Socket(_localEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); try { listenSocket.Bind(_localEndPoint); listenSocket.Listen(_maxConnections); m_maxNumberAcceptedClients = new Semaphore(_maxConnections, _maxConnections); StartAccept(null); _isListening = true; rm.Result = true; } catch (Exception ex) { rm.Message = ex.Message; } return(rm); }
public static ResMsg GetSaleWaterSummaryReportByVillage(string villageId, string startTime, string endTime, ref DataTable dtResult) { List <string> liWaterUserIds = null; ResMsg msg = GetWaterUserIdsByManagerId(villageId, true, ref liWaterUserIds); if (!msg.Result) { return(msg); } if (liWaterUserIds.Count == 0) { if (dtResult == null) { dtResult = new DataTable(); } else { dtResult.Rows.Clear(); dtResult.Columns.Clear(); } dtResult.Columns.Add("应收金额"); dtResult.Columns.Add("售水金额"); dtResult.Columns.Add("售出水量"); dtResult.Columns.Add("售电金额"); dtResult.Columns.Add("售出电量"); dtResult.Rows.Add(new object[] { "0", "0", "0", "0", "0" }); return(new ResMsg(true, "")); } bool flag = true; StringBuilder builder = new StringBuilder(); foreach (string str2 in liWaterUserIds) { if (flag) { builder.Append(str2); flag = false; } else { builder.Append("," + str2); } } if (builder.ToString() == "") { builder.Append("-1"); } string strSql = "select sum(TotalPrice) as 应收金额, sum(WaterPrice) as 售水金额,sum(WaterNum) as 售出水量,sum(ElectricPrice) as 售电金额,sum(ElectricNum) as 售出电量 from CardUserRechargeLog where WateUserId in (" + builder.ToString() + ") and LogTime>='" + startTime + "' and LogTime<'" + endTime + "'"; try { //dtResult = DBManager.Query("select sum(应收金额) as 应收金额, sum(售水金额) as 售水金额,sum(售出水量) as 售出水量,sum(售电金额) as 售电金额,sum(售出电量) as 售出电量 from 售水记录 where 用水户ID in (" + builder.ToString() + ") and 售水时间>='" + startTime + "' and 售水时间<'" + endTime + "'", out strMsg); dtResult = DbHelperSQL.Query(strSql).Tables[0]; } catch (Exception ex) { return(new ResMsg(false, ex.Message)); } return(new ResMsg(true, "")); }
public string ReStartWebApp(string loginIdentifer, string superPassword) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); LoginUser loginUser = GlobalAppModule.GetLoginUser(loginIdentifer); if (loginUser == null) { obj2["Message"] = "未登录"; return(JavaScriptConvert.SerializeObject(obj2)); } if (loginUser.LoginTimeout) { obj2["Message"] = "登录超时"; return(JavaScriptConvert.SerializeObject(obj2)); } loginUser.LastOperateTime = DateTime.Now; CommonUtil.WaitMainLibInit(); if (superPassword != "JSSL2016@2016") { obj2["Message"] = "密码错误"; return(JavaScriptConvert.SerializeObject(obj2)); } ResMsg msg = GlobalAppModule.ReStartWebApp(loginUser.UserId, this.context.Request.UserHostAddress); obj2["Result"] = msg.Result; obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetUnitQuota(string loginIdentifer, string unitQuotaId) { JavaScriptObject obj2 = new JavaScriptObject(); obj2["Result"] = false; obj2["Message"] = ""; try { ResMsg unitQuotaInfoById = CommonUtil.CheckLoginState(loginIdentifer, false); if (!unitQuotaInfoById.Result) { obj2["Message"] = unitQuotaInfoById.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((unitQuotaId == null) || (unitQuotaId.Trim() == "")) { obj2["Message"] = "参数'unitQuotaId'无效"; return(JavaScriptConvert.SerializeObject(obj2)); } Crop crop = CropModule.GetCrop(long.Parse(unitQuotaId)); JavaScriptObject obj3 = this.UnitQuotaInfoToJson(crop); obj2["Result"] = true; obj2["UnitQuota"] = obj3; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { //程序模块权限验证 Authorization clsRighter = new Authorization("0501"); btnSend.Enabled = clsRighter.Modify | clsRighter.Add; DBManager db = DBManager.Instance(); string strSql = "select Id, TemplateName,TemplateContent from SMS_Template"; //获取记录数据 DataTable dt1 = db.GetDataTable(strSql); DataRow df = dt1.NewRow(); df["TemplateName"] = "---自定义---"; dt1.Rows.InsertAt(df, 0); ddlTemp.DataSource = dt1; ddlTemp.DataTextField = "TemplateName"; ddlTemp.DataValueField = "Id"; ddlTemp.DataBind(); res = sms.GetAccount(); if (res.Result == false) { Common.ShowMsg("短信平台连接短信网关失败!请与短信提供商联系!"); } } }
/// <summary> /// 观看者身份验证 /// </summary> /// <param name="data"></param> /// <returns></returns> private ResMsg Authentication(byte[] data) { ResMsg rm = new ResMsg(); if (data == null || data.Length == 0) { return(rm); } List <byte[]> cmds = new List <byte[]>(); int removeCount = 0; Package7E.UnPack(data, ref cmds, ref removeCount); for (int i = 0; i < cmds.Count; i++) { JObject msg = JsonConvert.DeserializeObject <JObject>(Encoding.ASCII.GetString(cmds[i])); if (msg != null && msg.ContainsKey("Password") && msg["Password"].ToString() == txt_Password.Text) { rm.Result = true; rm.Message = msg["UserName"].ToString(); break; } } return(rm); }
public static ResMsg GetUseWaterSummaryReportByVillage(string villageId, string startTime, string endTime, ref DataTable dtResult) { List <string> liWaterUserIds = null; ResMsg msg = GetWaterUserIdsByManagerId(villageId, true, ref liWaterUserIds); if (!msg.Result) { return(msg); } if (liWaterUserIds.Count == 0) { if (dtResult == null) { dtResult = new DataTable(); } else { dtResult.Rows.Clear(); dtResult.Columns.Clear(); } dtResult.Columns.Add("灌溉时长"); dtResult.Columns.Add("用水量"); dtResult.Columns.Add("用电量"); dtResult.Rows.Add(new object[] { "0", "0", "0" }); return(new ResMsg(true, "")); } bool flag = true; StringBuilder builder = new StringBuilder(); foreach (string str2 in liWaterUserIds) { if (flag) { builder.Append(str2); flag = false; } else { builder.Append("," + str2); } } if (builder.ToString() == "") { builder.Append("-1"); } string strSql = "select sum(Duration) as 灌溉时长, sum(WaterUsed) as 用水量,sum(ElectricUsed) as 用电量 from CardUserWaterLog where WateUserId in (" + builder.ToString() + ") and EndTime>='" + startTime + "' and EndTime<'" + endTime + "'"; try { //dtResult = DBManager.Query("select sum(灌溉时长) as 灌溉时长, sum(本次用水量) as 用水量,sum(本次用电量) as 用电量 from 用水记录表 where 用水户ID in (" + builder.ToString() + ") and 关泵时间>='" + startTime + "' and 关泵时间<'" + endTime + "'", out strMsg); dtResult = DbHelperSQL.Query(strSql).Tables[0]; } catch (Exception ex) { return(new ResMsg(false, ex.Message)); } return(new ResMsg(true, "")); }
public string GetCardUsersByVillageId(string loginIdentifer, string villageId, bool isExport) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("CardUsers", array); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((villageId == null) || (villageId.Trim() == "")) { obj2["Message"] = "参数villageId不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } if (DistrictModule.ReturnDistrictInfo(long.Parse(villageId)) == null) { obj2["Message"] = "ID为" + villageId + "的村庄不存在"; return(JavaScriptConvert.SerializeObject(obj2)); } //List<CardUser> liCardUsers = CardUserModule.GetCardUsersByDistrictId(long.Parse(villageId), true); //foreach (CardUser info in liCardUsers) //{ // array.Add(CardUserModule.CardUserToJson(info)); //} List <WaterUser> liWaterUser = WaterUserModule.GetWaterUsersByDistrictId(long.Parse(villageId), true); foreach (WaterUser wui in liWaterUser) { List <CardUser> liCardUsers = CardUserModule.GetCardUsersByWaterUserId(wui.id, true); foreach (CardUser info in liCardUsers) { array.Add(CardUserModule.CardUserToJson(info)); } } obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetAllWaterUsersByVillageId(string loginIdentifer, string villageId) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUsers", array); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((villageId == null) || (villageId.Trim() == "")) { obj2["Message"] = "参数villageId不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } if (DistrictModule.ReturnDistrictInfo(long.Parse(villageId)) == null) { obj2["Message"] = "ID为" + villageId + "的村庄不存在"; return(JavaScriptConvert.SerializeObject(obj2)); } /* * List<WaterUserInfo> liWaterUsers = null; * msg = SaleWaterModule.GetWaterUsersByManagerId(villageId, true, ref liWaterUsers); * if (!msg.Result) * { * obj2["Message"] = msg.Message; * return JavaScriptConvert.SerializeObject(obj2); * } * foreach (WaterUserInfo info in liWaterUsers) * { * array.Add(SaleWaterModule.WaterUserToJson(info)); * } * */ obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string ModifyWaterUserQuota(string loginIdentifer, string waterUserQuotaJson) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } JavaScriptObject obj3 = (JavaScriptObject)JavaScriptConvert.DeserializeObject(waterUserQuotaJson); if (obj3 == null) { obj2["Message"] = "参数jsoWaterUserQuota格式不正确"; return(JavaScriptConvert.SerializeObject(obj2)); } /* * WaterUserQuota wuq = new WaterUserQuota * { * Id = obj3["ID"].ToString(), * WaterUserId = obj3["用水户ID"].ToString(), * Year = obj3["年份"].ToString(), * UnitQuotaId = obj3["单位定额ID"].ToString(), * Acreage = Convert.ToDouble(obj3["面积"].ToString()), * Quota = Convert.ToDouble(obj3["定额"].ToString()) * }; * msg = SaleWaterModule.ModifyWaterUserQuota(wuq); * if (msg.Result) * { * obj2["Result"] = true; * } * else * { * obj2["Message"] = msg.Message; * } * */ } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetWaterUserQuotaByWaterUserId(string loginIdentifer, string waterUserId, string year) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUserQuota", array); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, false); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((waterUserId == null) || (waterUserId.Trim() == "")) { obj2["Message"] = "用水户ID不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } if ((year == null) || (year.Trim() == "")) { obj2["Message"] = "年份不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } /* * List<WaterUserQuota> waterUserQuotaByWaterUserIdAndYear = SaleWaterModule.GetWaterUserQuotaByWaterUserIdAndYear(waterUserId, year); * if (waterUserQuotaByWaterUserIdAndYear == null) * { * obj2["Message"] = "ID为" + waterUserId + "用水户不存在用水定额"; * return JavaScriptConvert.SerializeObject(obj2); * } * foreach (WaterUserQuota quota in waterUserQuotaByWaterUserIdAndYear) * { * array.Add(SaleWaterModule.WaterUserQuotaToJson(quota)); * } * */ obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public static ResMsg AddPriceInfo(PriceInfo pi) { ResMsg msg = new ResMsg(false, ""); PriceInfo info = pi.Copy(); if ((info.Name == null) || (info.Name.Trim() == "")) { msg.Message = "价格名称无效"; return(msg); } if (GetPriceInfoByName(info.Name) != null) { msg.Message = "存在同名价格"; return(msg); } int i = DbHelperSQL.ExecuteSql("insert into 水价表(名称,类型,设置时间) values('" + info.Name + "','" + info.Type + "','" + info.SetTime.ToString("yyyy-MM-dd HH:mm:ss") + "')"); if (i > 0) { DataTable table = DbHelperSQL.Query("select ID From 水价表 where 名称='" + info.Name + "'").Tables[0]; if ((table == null) || (table.Rows.Count == 0)) { DbHelperSQL.ExecuteSql("delete from 水价表 where 名称='" + info.Name + "'"); msg.Message = "未找到所添加的价格!"; return(msg); } string str3 = table.Rows[0]["ID"].ToString(); i = DbHelperSQL.ExecuteSql(string.Concat(new object[] { "insert into 时段水价表(水价ID,阶梯数量,阶梯类型,起始时间,结束时间,一阶水量,一阶价格,二阶水量,二阶价格,三阶水量,三阶价格,四阶水量,四阶价格) values('", str3, "','", info.LaddersCount, "','", info.LadderType.ToString(), "','", info.StartTime, "','", info.EndTime, "','", info.FirstVolume, "','", info.FirstPrice, "','", info.SecondVolume, "','", info.SecondPrice, "','", info.ThirdVolume, "','", info.ThirdPrice, "','", info.FourthVolume, "','", info.FourthPrice, "')" })); if (!(i > 0)) { DbHelperSQL.ExecuteSql("delete from 水价表 where 名称='" + pi.Name + "'"); return(msg); } info.Id = str3; lock (dicPriceInfos) { dicPriceInfos.Add(info.Id, info); } msg.Result = true; msg.Message = "添加价格成功"; } return(msg); }
private void TcpServer_ClientReceiveData(AsyncUserToken userToken, byte[] data) { if (!shareDesktop) { return; } bool isExist = false; lock (rdViewers) { if (rdViewers.ContainsKey(userToken.Identifier)) { isExist = true; } } if (!isExist) { ResMsg rm = Authentication(data); if (rm.Result) { ThreadPool.UnsafeQueueUserWorkItem(new WaitCallback(state => { AsyncUserToken asyncUserToken = (AsyncUserToken)state; asyncUserToken.SendData(Encoding.ASCII.GetBytes("login ok!")); }), userToken); RDViewer viewer = new RDViewer() { UserName = rm.Message, UserToken = userToken }; lock (rdViewers) { rdViewers.Add(userToken.Identifier, viewer); } ShowLog(viewer.UserName + "开始观看,来源:" + userToken.Identifier); } } else { lock (recvBuffer) { recvBuffer.AddRange(data); } } }
public string GetWaterUserQuotaYearByWaterUserId(string loginIdentifer, string waterUserId) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("Years", array); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, false); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((waterUserId == null) || (waterUserId.Trim() == "")) { obj2["Message"] = "用水户ID不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } /* * List<string> waterUserQuotaByWaterUserId = SaleWaterModule.GetWaterUserQuotaByWaterUserId(waterUserId); * if (waterUserQuotaByWaterUserId == null) * { * obj2["Message"] = "ID为" + waterUserId + "用水户不存在用水定额"; * return JavaScriptConvert.SerializeObject(obj2); * } * foreach (string str in waterUserQuotaByWaterUserId) * { * JavaScriptObject item = new JavaScriptObject(); * item.Add("年份", str); * array.Add(item); * } * */ obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetCardUsersByWaterUserIds(string loginIdentifer, string waterUserIds) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("CardUsers", array); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((waterUserIds == null) || (waterUserIds.Trim() == "")) { obj2["Message"] = "用水户ID不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } foreach (string str in waterUserIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { WaterUser wui = WaterUserModule.GetWaterUserById(long.Parse(str)); if (wui == null) { obj2["Message"] = "ID为" + str + "的用水户不存在"; return(JavaScriptConvert.SerializeObject(obj2)); } List <CardUser> liCardUsers = CardUserModule.GetCardUsersByWaterUserId(wui.id, true); foreach (CardUser info in liCardUsers) { array.Add(CardUserModule.CardUserToJson(info)); } } obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetWaterUsersByIds(string loginIdentifer, string waterUserIds) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUsers", array); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((waterUserIds == null) || (waterUserIds.Trim() == "")) { obj2["Message"] = "用水户ID不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } foreach (string str in waterUserIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { /* * WaterUserInfo waterUserById = SaleWaterModule.GetWaterUserById(str); * if (waterUserById == null) * { * obj2["Message"] = "ID为" + str + "的用水户不存在"; * return JavaScriptConvert.SerializeObject(obj2); * } * array.Add(SaleWaterModule.WaterUserToJson(waterUserById)); * */ } obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public static ResMsg ModifyPriceInfo(PriceInfo pi) { ResMsg msg = new ResMsg(false, ""); PriceInfo info = pi.Copy(); if ((info.Name == null) || (info.Name.Trim() == "")) { msg.Message = "价格名称无效"; return(msg); } PriceInfo priceInfoByName = GetPriceInfoByName(info.Name); if ((priceInfoByName != null) && (priceInfoByName.Id != info.Id)) { msg.Message = "存在同名价格"; return(msg); } int i = DbHelperSQL.ExecuteSqlTran(new List <string> { string.Concat(new object[] { "update 水价表 set 名称='", info.Name, "',设置时间='", info.SetTime, "' where ID='", info.Id, "'" }), string.Concat(new object[] { "update 时段水价表 set 阶梯数量='", info.LaddersCount, "',阶梯类型='", info.LadderType, "',起始时间='", info.StartTime, "',结束时间='", info.EndTime, "',一阶水量='", info.FirstVolume, "',一阶价格='", info.FirstPrice, "',二阶水量='", info.SecondVolume, "',二阶价格='", info.SecondPrice, "',三阶水量='", info.ThirdVolume, "',三阶价格='", info.ThirdPrice, "',四阶水量='", info.FourthVolume, "',四阶价格='", info.FourthPrice, "' where 水价ID='", info.Id, "'" }) }); if (i > 0) { lock (dicPriceInfos) { if (dicPriceInfos.ContainsKey(info.Id)) { dicPriceInfos[info.Id] = info; } } msg.Result = true; msg.Message = "更新价格成功"; return(msg); } msg.Message = "更新价格失败,原因:" + msg.Message; return(msg); }
public string GetUserInfosByIds(string loginIdentifer, string ids) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("UserNodes", new JavaScriptObject()); string[] strArray = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } try { for (int i = 0; i < strArray.Length; i++) { SysUser userInfo = SysUserModule.GetUser(long.Parse(((strArray[i] == null) || (strArray[i].Trim() == "")) ? msg.Message : strArray[i])); if (userInfo != null) { array.Add(this.UserInfoToJSON(userInfo)); } } obj2["UserNodes"] = array; obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } } catch (Exception exception2) { obj2["Message"] = exception2.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetCardDevicesByVillageId(string loginIdentifer, string villageId, bool isExport) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("CardDevices", array); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((villageId == null) || (villageId.Trim() == "")) { obj2["Message"] = "参数villageId不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } District dist = DistrictModule.ReturnDistrictInfo(long.Parse(villageId)); if (dist == null) { obj2["Message"] = "ID为" + villageId + "的村庄不存在"; return(JavaScriptConvert.SerializeObject(obj2)); } List <CardDevice> liCardDevices = CardDeviceModule.GetCardDevicesByDistrict(dist); foreach (CardDevice info in liCardDevices) { array.Add(CardDeviceModule.CardDeviceToJson(info)); } obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetCardDeviceByIds(string loginIdentifer, string Ids) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("CardDevices", array); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((Ids == null) || (Ids.Trim() == "")) { obj2["Message"] = "设备卡ID不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } foreach (string str in Ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { CardDevice card = CardDeviceModule.GetCardDeviceById(long.Parse(str)); if (card == null) { obj2["Message"] = "ID为" + str + "的设备卡不存在"; return(JavaScriptConvert.SerializeObject(obj2)); } array.Add(CardDeviceModule.CardDeviceToJson(card)); } obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetWaterUserByUserSerialNumber(string loginIdentifer, string userSerialNumber) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUser", new JavaScriptObject()); try { ResMsg waterUserByUserSerialNumber = CommonUtil.CheckLoginState(loginIdentifer, true); if (!waterUserByUserSerialNumber.Result) { obj2["Message"] = waterUserByUserSerialNumber.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((userSerialNumber == null) || (userSerialNumber.Trim() == "")) { obj2["Message"] = "用户卡号为空"; return(JavaScriptConvert.SerializeObject(obj2)); } /* * WaterUserInfo wui = null; * waterUserByUserSerialNumber = SaleWaterModule.GetWaterUserByUserSerialNumber(userSerialNumber, ref wui); * if (!waterUserByUserSerialNumber.Result) * { * obj2["Message"] = waterUserByUserSerialNumber.Message; * return JavaScriptConvert.SerializeObject(obj2); * } * obj2["Result"] = true; * obj2["WaterUser"] = SaleWaterModule.WaterUserToJson(wui); * */ } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetUnitQuotasByIds(string loginIdentifer, string unitQuotaIds) { JavaScriptObject obj2 = new JavaScriptObject(); JavaScriptArray array = new JavaScriptArray(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("UnitQuotas", array); try { ResMsg unitQuotaInfosByIds = CommonUtil.CheckLoginState(loginIdentifer, false); if (!unitQuotaInfosByIds.Result) { obj2["Message"] = unitQuotaInfosByIds.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((unitQuotaIds == null) || (unitQuotaIds.Trim() == "")) { obj2["Message"] = "参数'unitQuotaId'无效"; return(JavaScriptConvert.SerializeObject(obj2)); } List <Crop> CropList = CropModule.GetCropInfosByIds(unitQuotaIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); if (!unitQuotaInfosByIds.Result) { obj2["Message"] = unitQuotaInfosByIds.Message; return(JavaScriptConvert.SerializeObject(obj2)); } for (int i = 0; i < CropList.Count; i++) { array.Add(this.UnitQuotaInfoToJson(CropList[i])); } obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string DeletePriceInfo(string loginIdentifer, string priceId) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); LoginUser loginUser = GlobalAppModule.GetLoginUser(loginIdentifer); if (loginUser == null) { obj2["Message"] = "未登录"; return(JavaScriptConvert.SerializeObject(obj2)); } if (loginUser.LoginTimeout) { obj2["Message"] = "登录超时"; return(JavaScriptConvert.SerializeObject(obj2)); } loginUser.LastOperateTime = DateTime.Now; CommonUtil.WaitMainLibInit(); ResMsg msg = PriceModule.DeletePriceInfoById(priceId); obj2["Result"] = msg.Result; obj2["Message"] = msg.Message; try { SysLog log = new SysLog(); log.LogUserId = loginUser.UserId; log.LogUserName = loginUser.LoginName; log.LogAddress = ToolsWeb.GetIP(context.Request); log.LogTime = DateTime.Now; log.LogType = "删除价格信息"; log.LogContent = msg + "|" + priceId; SysLogModule.Add(log); } catch { } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetWaterUserByAllCode(string loginIdentifer, string allCode) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUser", new JavaScriptObject()); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((allCode == null) || (allCode.Trim() == "")) { obj2["Message"] = "用水户完整编码为空"; return(JavaScriptConvert.SerializeObject(obj2)); } /* * WaterUserInfo waterUserByAllCode = SaleWaterModule.GetWaterUserByAllCode(allCode); * if (waterUserByAllCode == null) * { * obj2["Message"] = "完整编码为" + allCode + "用水户不存在"; * return JavaScriptConvert.SerializeObject(obj2); * } * obj2["Result"] = true; * obj2["WaterUser"] = SaleWaterModule.WaterUserToJson(waterUserByAllCode); * */ } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
private void btn_Share_Click(object sender, EventArgs e) { if (!shareDesktop) { if (tcpServer != null) { tcpServer.ClientDisConnected -= TcpServer_ClientDisConnected; tcpServer.ClientReceiveData -= TcpServer_ClientReceiveData; } tcpServer = new AsyncTCPServer(IPAddress.Any.ToString(), Convert.ToInt32(txt_Port.Text), 50); tcpServer.ClientDisConnected += TcpServer_ClientDisConnected; tcpServer.ClientReceiveData += TcpServer_ClientReceiveData; ResMsg rm = tcpServer.Start(); if (!rm.Result) { ShowLog("开始分享失败,原因:" + rm.Message); return; } shareDesktop = true; Thread thShare = new Thread(new ThreadStart(ShareDesktop)); thShare.IsBackground = true; thShare.Start(); Thread thParseCmd = new Thread(new ThreadStart(ParseCmds)); thParseCmd.IsBackground = true; thParseCmd.Start(); btn_Share.Text = "停止分享"; ShowLog("开始分享"); } else { shareDesktop = false; tcpServer.Stop(); btn_Share.Text = "开始分享"; ShowLog("停止分享"); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { //程序模块权限验证 Authorization clsRighter = new Authorization("0503"); if (clsRighter.Read) { res = sms.GetAccount(); if (res.Result == false) { Common.ShowMsg("短信平台连接短信网关失败!请与短信提供商联系!"); } else { this.lbLast.Text = res.Message; } } else { Common.ShowMsg("权限不足!"); } } }