public override void DoLoginedHandlerWork(HttpContext context) { Message jsonMessage; jsonMessage = new Message() { Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。" }; string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper(); IoT_Meter Info; WCFServiceProxy <IMeterManage> proxyMeter = null; WCFServiceProxy <IDianHuo> proxy = null; try { switch (AjaxType) { //撤销点火 case "REVOKE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dhtq_cx")) { Info = new CommonModelFactory <IoT_Meter>().GetModelFromContext(context); proxy = new WCFServiceProxy <IDianHuo>(); string reslut = proxy.getChannel.Undo(Info); if (reslut != "") { jsonMessage = new Message { Result = false, TxtMessage = reslut }; } else { jsonMessage = new Message { Result = true, TxtMessage = "操作成功" }; } } break; //点火 case "REGISTRATION": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dhtq_dh")) { proxy = new WCFServiceProxy <IDianHuo>(); proxyMeter = new WCFServiceProxy <IMeterManage>(); Int64 PriceType = 0; string EnableMeterOper = string.Empty; List <String> meterNoList = null; List <String> lstUserID = null; DateTime EnableDate = DateTime.Now; string strPriceType = string.Empty; string meterType = context.Request.Form["MType"].ToString(); if (context.Request.Form["PriceType"] != null && context.Request.Form["PriceType"].ToString().Trim() != string.Empty) { PriceType = Int64.Parse(context.Request.Form["PriceType"].ToString().Trim()); strPriceType = context.Request.Form["PriceType"].ToString().Trim(); } if (!string.IsNullOrEmpty(context.Request.Form["MType"]) && context.Request.Form["MType"] == "01" && strPriceType == "") { jsonMessage = new Message() { Result = false, TxtMessage = "请选择价格类型!" }; context.Response.Write(JSon.TToJson <Message>(jsonMessage)); return; } if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty) { string strNo = context.Request.Form["strNo"]; string[] arrNo = strNo.Split(','); meterNoList = arrNo.ToList(); } if (context.Request.Form["UserID"] != null && context.Request.Form["UserID"].ToString().Trim() != string.Empty) { string strNo = context.Request.Form["UserID"]; string[] arrNo = strNo.Split(','); lstUserID = arrNo.ToList(); } if (context.Request.Form["EnableDate"] != null && context.Request.Form["EnableDate"].ToString().Trim() != string.Empty) { EnableDate = Convert.ToDateTime(context.Request.Form["EnableDate"].ToString().Trim()); } EnableMeterOper = string.IsNullOrEmpty(context.Request.Form["EnableOper"]) == true ? "" : context.Request.Form["EnableOper"]; //if (context.Request.Form["EnableOper"] != null && context.Request.Form["EnableOper"].ToString().Trim() != string.Empty) //{ // EnableMeterOper = context.Request.Form["EnableOper"].ToString().Trim(); //} jsonMessage = proxy.getChannel.DianHuo(meterNoList, meterType, PriceType, this.loginOperator.CompanyID, EnableDate, lstUserID, EnableMeterOper); } break; } } catch (Exception ex) { } finally { if (proxy != null) { proxy.CloseChannel(); } } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }
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_PricePar Info; WCFServiceProxy <IPriceParManage> proxy = null; try { switch (AjaxType) { case "QUERY": CommonSearch <IoT_PricePar> InfoSearch = new CommonSearch <IoT_PricePar>(); 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_PricePar", TFieldKey = "ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "ID ASC", TWhere = Where }; List <IoT_PricePar> list = InfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <IoT_PricePar>(list, sCondition.TTotalCount) }; break; case "ADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_tjjg")) { Info = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context); Info.CompanyID = loginOperator.CompanyID; proxy = new WCFServiceProxy <IPriceParManage>(); jsonMessage = proxy.getChannel.Add(Info); } break; case "EDIT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_bjjg")) { Info = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context); proxy = new WCFServiceProxy <IPriceParManage>(); jsonMessage = proxy.getChannel.Edit(Info); } break; case "DELETE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_scjg")) { Info = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context); proxy = new WCFServiceProxy <IPriceParManage>(); jsonMessage = proxy.getChannel.Delete(Info); } 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)); }
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(); WCFServiceProxy <ISetUploadCycle> proxy = null; try { switch (AjaxType) { //查询充值的历史资料 case "QUERY": CommonSearch <View_ChongZhi> InfoSearch = new CommonSearch <View_ChongZhi>(); string Where = "1=1 "; Where += "AND CompanyID='" + loginOperator.CompanyID + "' "; if (context.Request.Form["DateS"] != null && context.Request.Form["DateS"].ToString().Trim() != string.Empty) { Where += " AND convert(char(10),TopUpDate,120)>='" + context.Request.Form["DateS"].ToString() + "'";; } if (context.Request.Form["DateE"] != null && context.Request.Form["DateE"].ToString().Trim() != string.Empty) { Where += " AND convert(char(10),TopUpDate,120)<='" + context.Request.Form["DateE"].ToString() + "'";; } 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 = "View_ChongZhi", TFieldKey = "AID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "TopUpDate DESC", TWhere = Where }; List <View_ChongZhi> list = InfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_ChongZhi>(list, sCondition.TTotalCount) }; break; //执行充值动作 case "CXCHONGZHI": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "CZ_CXCZ")) //营业厅撤销充值 { IoT_MeterTopUp Info; WCFServiceProxy <IChongzhiManage> proxy1 = null; Info = new CommonModelFactory <IoT_MeterTopUp>().GetModelFromContext(context); List <IoT_MeterTopUp> lstIoT_MeterTopUp = new List <IoT_MeterTopUp>(); //表号 string MeterNo = string.IsNullOrEmpty(context.Request["MeterNo"]) == true ? "" : context.Request["MeterNo"].ToString(); //充值金额 string Amount = string.IsNullOrEmpty(context.Request["Amount"]) == true ? "" : context.Request["Amount"].ToString(); //表ID string MeterID = string.IsNullOrEmpty(context.Request["MeterID"]) == true ? "" : context.Request["MeterID"].ToString(); //人员ID string UserID = string.IsNullOrEmpty(context.Request["UserID"]) == true ? "" : context.Request["UserID"].ToString(); //PK string ID = string.IsNullOrEmpty(context.Request["AID"]) == true ? "" : context.Request["AID"].ToString(); //任务编号 string TaskID = string.IsNullOrEmpty(context.Request["TaskID"]) == true ? "" : context.Request["TaskID"].ToString(); string Context = string.IsNullOrEmpty(context.Request["Context"]) == true ? "" : context.Request["Context"].ToString(); Info.Amount = decimal.Parse(Amount); Info.MeterID = int.Parse(MeterID); Info.MeterNo = MeterNo; Info.ID = int.Parse(ID); Info.Context = Context; Info.Oper = base.loginOperator.Name; Info.CompanyID = base.loginOperator.CompanyID; Info.TopUpDate = DateTime.Now; Info.UserID = UserID; Info.TopUpType = '1'; //充值类型目前未知 Info.State = '0'; //等待充值状态 Info.TaskID = TaskID; //等待充值状态 proxy1 = new WCFServiceProxy <IChongzhiManage>(); jsonMessage = proxy1.getChannel.UPD(Info); } 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)); }
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_SetSettlementDay Info; WCFServiceProxy <ISettlement> proxy = null; try { switch (AjaxType) { //查询 case "QUERY": CommonSearch <View_SettlementDayMeterView> InfoSearch = new CommonSearch <View_SettlementDayMeterView>(); string Where = "1=1 "; Where += "AND CompanyID='" + loginOperator.CompanyID + "' "; if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty) { Where += " AND convert(char(10),RegisterDate,120)='" + context.Request.Form["Date1"].ToString() + "'";; } 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 = "View_SettlementDayMeterView", TFieldKey = "DayID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "RegisterDate DESC", TWhere = Where }; List <View_SettlementDayMeterView> list = InfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_SettlementDayMeterView>(list, sCondition.TTotalCount) }; break; //查询失败用户 case "QUERYUSERFILE": CommonSearch <View_SettlementDayMeter> InfoSearch_UserFILE = new CommonSearch <View_SettlementDayMeter>(); Where = "1=1 "; Where += "AND CompanyID='" + loginOperator.CompanyID + "' AND State='3'"; if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty) { Where += context.Request.Form["TWhere"].ToString(); } if (context.Request.Form["DayID"] != null && context.Request.Form["DayID"].ToString().Trim() != string.Empty) { Where += " AND MeterID=" + context.Request.Form["DayID"].ToString().Trim(); } sCondition = new SearchCondition() { TBName = "View_SettlementDayMeter", TFieldKey = "MeterID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterID DESC", TWhere = Where }; List <View_SettlementDayMeter> list_UserFILE = InfoSearch_UserFILE.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_SettlementDayMeter>(list_UserFILE, sCondition.TTotalCount) }; break; //查询所有设定结算日的用户 case "QUERYUSER": CommonSearch <View_SettlementDayMeter> InfoSearch_User = new CommonSearch <View_SettlementDayMeter>(); 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(); } if (context.Request.Form["MeterID"] != null && context.Request.Form["MeterID"].ToString().Trim() != string.Empty) { Where += " AND MeterID=" + context.Request.Form["MeterID"].ToString().Trim(); } sCondition = new SearchCondition() { TBName = "View_SettlementDayMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID DESC", TWhere = Where }; List <View_SettlementDayMeter> list_User = InfoSearch_User.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_SettlementDayMeter>(list_User, sCondition.TTotalCount) }; break; //新增结算日 case "ADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs")) { Info = new CommonModelFactory <IoT_SetSettlementDay>().GetModelFromContext(context); Info.CompanyID = base.loginOperator.CompanyID; Info.Oper = base.loginOperator.Name; Info.RegisterDate = DateTime.Now; List <IoT_SettlementDayMeter> alarmMeter = new List <IoT_SettlementDayMeter>(); string Total = string.IsNullOrEmpty(context.Request.Form["Total"]) == true ? "" : context.Request.Form["Total"].ToString(); string Context = string.IsNullOrEmpty(context.Request.Form["Context"]) == true ? "" : context.Request.Form["Context"].ToString(); string SettlementDay = (string.IsNullOrEmpty(context.Request.Form["strDay"]) == true ? "0" : context.Request.Form["strDay"].ToString()); string SettlementMonth = (string.IsNullOrEmpty(context.Request.Form["strMonth"]) == true ? "0" : context.Request.Form["strMonth"].ToString()); Info.CompanyID = base.loginOperator.CompanyID; Info.Context = Context; //Info.ReportType = ReportType; Info.RegisterDate = DateTime.Now; Info.SettlementDay = int.Parse(SettlementDay); Info.State = '0'; Info.TaskID = "";//目前还不知道任务ID的取值方法 Info.Total = int.Parse(Total); Info.SettlementMonth = int.Parse(SettlementMonth); proxy = new WCFServiceProxy <ISettlement>(); if (!string.IsNullOrEmpty(context.Request.Form["hidType"]) && (context.Request.Form["hidType"].ToString() != "")) { //判断所选用户类型 alarmMeter = new List <IoT_SettlementDayMeter>(); if (context.Request.Form["hidType"].ToString() == "1") { Info.Scope = "所有用户"; //jsonMessage = proxy.getChannel.AddSetAlarmAll(Info); } else if (context.Request.Form["hidType"].ToString() == "2") { Info.Scope = "选择用户"; } else { //Info.Scope = context.Request.Form["hidType"].ToString(); string strNo = context.Request.Form["communityStr"] == null ? "" : context.Request.Form["communityStr"]; string[] arrNo = strNo.Split(','); Info.Scope = context.Request.Form["hidType"].ToString(); //jsonMessage = proxy.getChannel.AddSetAlarmArea(Info, arrNo.ToList()); } 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++) { IoT_SettlementDayMeter meter = new IoT_SettlementDayMeter(); meter.MeterNo = arrNo[i]; alarmMeter.Add(meter); } } jsonMessage = proxy.getChannel.Add(Info, alarmMeter); } } break; //撤销 case "REVOKE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "RVJSR")) { proxy = new WCFServiceProxy <ISettlement>(); string ID = string.Empty; if (context.Request["ID"] != null && context.Request["ID"].ToString().Trim() != string.Empty) { ID = context.Request["ID"].ToString() == "" ? "0" : context.Request["ID"].ToString(); } jsonMessage = proxy.getChannel.revoke(ID, loginOperator.CompanyID); } break; default: jsonMessage = new Message() { Result = false, TxtMessage = "操作未定义。" }; break; //修改 //case "EDIT": // if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs")) // { // Info = new CommonModelFactory<IoT_SetSettlementDay>().GetModelFromContext(context); // proxy = new WCFServiceProxy<ISettlement>(); // jsonMessage = proxy.getChannel.Edit(Info); // } // 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)); }
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_SetAlarm Info; WCFServiceProxy <ISetAlarm> proxy = null; try { switch (AjaxType) { case "QUERY": CommonSearch <IoT_SetAlarm> InfoSearch = new CommonSearch <IoT_SetAlarm>(); string Where = "1=1 "; Where += "AND CompanyID='" + loginOperator.CompanyID + "' "; if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty) { Where += " AND convert(char(10),RegisterDate,120)='" + context.Request.Form["Date1"].ToString() + "'";; } 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_SetAlarm", TFieldKey = "RegisterDate", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "RegisterDate DESC", TWhere = Where }; List <IoT_SetAlarm> list = InfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <IoT_SetAlarm>(list, sCondition.TTotalCount) }; break; case "QUERYUSER": CommonSearch <View_AlarmMeter> InfoSearch_User = new CommonSearch <View_AlarmMeter>(); 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(); } if (context.Request.Form["ID"] != null && context.Request.Form["ID"].ToString().Trim() != string.Empty) { Where += " AND ID=" + context.Request.Form["ID"].ToString().Trim(); } sCondition = new SearchCondition() { TBName = "View_AlarmMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID DESC", TWhere = Where }; List <View_AlarmMeter> list_User = InfoSearch_User.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_AlarmMeter>(list_User, sCondition.TTotalCount) }; break; case "ADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs")) { Info = new CommonModelFactory <IoT_SetAlarm>().GetModelFromContext(context); Info.CompanyID = base.loginOperator.CompanyID; Info.Oper = base.loginOperator.Name; Info.RegisterDate = DateTime.Now; Info.Par4 = Convert.ToInt32(Convert.ToDecimal(Info.Par4) * 100).ToString(); proxy = new WCFServiceProxy <ISetAlarm>(); if (context.Request.Form["Scope"] != null && context.Request.Form["Scope"].ToString().Trim() != string.Empty) { if (context.Request.Form["Scope"].ToString().Trim() == "所有用户") { jsonMessage = proxy.getChannel.AddSetAlarmAll(Info); } else if (context.Request.Form["Scope"].ToString().Trim() == "选择用户") { List <IoT_AlarmMeter> alarmMeter = new List <IoT_AlarmMeter>(); 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++) { IoT_AlarmMeter meter = new IoT_AlarmMeter(); meter.MeterNo = arrNo[i]; alarmMeter.Add(meter); } } jsonMessage = proxy.getChannel.Add(Info, alarmMeter); } //选择区域用户 else { if (context.Request.Form["strArea"] != null && context.Request.Form["strArea"].ToString().Trim() != string.Empty) { string strNo = context.Request.Form["strArea"]; string[] arrNo = strNo.Split(','); jsonMessage = proxy.getChannel.AddSetAlarmArea(Info, arrNo.ToList()); } } } } break; case "EDIT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs")) { Info = new CommonModelFactory <IoT_SetAlarm>().GetModelFromContext(context); proxy = new WCFServiceProxy <ISetAlarm>(); jsonMessage = proxy.getChannel.Edit(Info); } break; case "DELETE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "")) { Info = new CommonModelFactory <IoT_SetAlarm>().GetModelFromContext(context); proxy = new WCFServiceProxy <ISetAlarm>(); jsonMessage = proxy.getChannel.Delete(Info); } break; case "UNDO": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs")) { Info = new CommonModelFactory <IoT_SetAlarm>().GetModelFromContext(context); proxy = new WCFServiceProxy <ISetAlarm>(); jsonMessage = proxy.getChannel.UnSetParamter(Info); } 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)); }
public override void DoLoginedHandlerWork(HttpContext context) { Message jsonMessage; bool isUpdate = false; //检查用户有没有更新报表权限, if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "gxbbmb")) { isUpdate = context.Request.Form["isUpdate"] == null ? false : bool.Parse(context.Request.Form["isUpdate"].ToString()); } string strUploadPath = string.Format("{0}\\ReportTemplate\\{1}\\{2}\\{3}\\", context.Server.MapPath("~"), base.loginOperator.CompanyID, base.loginOperator.OperID, System.DateTime.Now.ToString("yyyyMMdd")); jsonMessage = new Message() { Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。" }; string fileName = string.Empty; //创建路径记录上传者账号信息 if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "drbbmb")) { if (context.Request.Files != null && context.Request.Files.Count == 1) { if (!Directory.Exists(strUploadPath)) { Directory.CreateDirectory(strUploadPath); } HttpPostedFile postedFile = context.Request.Files[0]; fileName = strUploadPath + System.Web.HttpUtility.UrlDecode(Path.GetFileName(postedFile.FileName)); if (fileName != "" && Path.GetExtension(fileName) == ".pkf") { try { postedFile.SaveAs(fileName); FilePacket pft = new FilePacket(fileName); pft.OpenPacket(strUploadPath); pft = null; ImportReport(strUploadPath, isUpdate); string ShowInfo = string.Empty; ShowInfo += string.Format("成功{0}个。<br>", success); int i = 0; foreach (string tmp in successName) { i++; ShowInfo += string.Format("{0}、【{1}】", i, tmp); } if (failed > 0) { ShowInfo += string.Format("<br>失败{0}个。<br>", failed); i = 0; foreach (string tmp in failedReasons) { i++; ShowInfo += string.Format("{0}、【{1}】", i, tmp); } } jsonMessage = new Message() { Result = true, TxtMessage = ShowInfo }; } catch (Exception ex) { jsonMessage = new Message() { Result = false, TxtMessage = ex.Message }; if (File.Exists(fileName)) { File.Delete(fileName); } } } } } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }
public override void DoLoginedHandlerWork(HttpContext context) { Message jsonMessage; //获取操作类型AType:ADD,EDIT,DELETE,QUERY string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper(); ReportTemplate Info; WCFServiceProxy <IOperRightManage> proxy; jsonMessage = new Message() { Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。" }; switch (AjaxType) { case "QUERY": string Where = "1=1 "; if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty) { Where += "AND " + context.Request.Form["TWhere"].ToString(); } CommonSearch <ReportTemplate> userInfoSearch = new CommonSearch <ReportTemplate>(); SearchCondition sCondition = new SearchCondition() { TBName = "ReportTemplate", TFieldShow = "RID,ReportName", TFieldKey = "RID,ReportName", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "RID ASC", TWhere = Where }; List <ReportTemplate> list = userInfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <ReportTemplate>(list, sCondition.TTotalCount) }; break; case "EDITNAME": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "xgbbmc")) { Info = new CommonModelFactory <ReportTemplate>().GetModelFromContext(context); proxy = new WCFServiceProxy <IOperRightManage>(); jsonMessage = proxy.getChannel.EditReportName(Info); } break; case "EXPORT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dcbbmb")) { try { int rID = -1; int.TryParse(context.Request.QueryString["RID"].ToString(), out rID); string rName = context.Request.QueryString["RName"] == null ? "报表模板" : context.Request.QueryString["RName"].ToString(); string strSaveDictory = string.Format("{0}\\ReportTemplateExport\\{1}\\{2}\\{3}\\", context.Server.MapPath("~"), base.loginOperator.CompanyID, base.loginOperator.OperID, System.DateTime.Now.ToString("yyyyMMdd")); string strSavePath = string.Format("{0}\\ReportTemplateExport\\{1}\\{2}\\{3}\\{4}.rpt", context.Server.MapPath("~"), base.loginOperator.CompanyID, base.loginOperator.OperID, System.DateTime.Now.ToString("yyyyMMdd"), rName); string strDownloadUrl = string.Format("{0}/ReportTemplateExport/{1}/{2}/{3}/{4}.rpt", "..", base.loginOperator.CompanyID, base.loginOperator.OperID, System.DateTime.Now.ToString("yyyyMMdd"), rName); ReportDataSourceDs ds = new Reports().ReadReport(rID); if (!Directory.Exists(strSaveDictory)) { Directory.CreateDirectory(strSaveDictory); } ds.WriteXml(strSavePath); jsonMessage = new Message() { Result = true, TxtMessage = strDownloadUrl }; //以字符流的形式下载文件 FileStream fs = new FileStream(strSavePath, FileMode.Open); byte[] bytes = new byte[(int)fs.Length]; fs.Read(bytes, 0, bytes.Length); fs.Close(); context.Response.ContentEncoding = System.Text.Encoding.UTF8; context.Response.ContentType = "application/octet-stream"; //通知浏览器下载文件而不是打开 context.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(rName) + ".rpt"); context.Response.BinaryWrite(bytes); context.Response.Flush(); context.Response.End(); } catch (Exception e) { jsonMessage = new Message() { Result = false, TxtMessage = e.Message }; } } break; case "DELETE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "scbbmb")) { Info = new CommonModelFactory <ReportTemplate>().GetModelFromContext(context); Reports r = new Reports(); string dResult = r.DeleteReportTemplate(Info.RID); jsonMessage = new Message() { Result = dResult == string.Empty ? true : false, TxtMessage = dResult == string.Empty ? "删除成功" : dResult }; } break; case "QUERYCOMPANYREPORT": Where = "1=1 "; if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty) { Where += "AND " + context.Request.Form["TWhere"].ToString(); } CommonSearch <CompanyReport> reportInfoSearch = new CommonSearch <CompanyReport>(); sCondition = new SearchCondition() { TBName = "View_CompanyReport", TFieldKey = "CompanyID,MenuCode", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "RID ASC", TWhere = Where }; List <CompanyReport> reportlist = reportInfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <CompanyReport>(reportlist, sCondition.TTotalCount) }; break; default: jsonMessage = new Message() { Result = false, TxtMessage = "操作未定义。" }; break; } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }
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)); }
public override void DoLoginedHandlerWork(HttpContext context) { Message jsonMessage; //获取操作类型AType:ADD,EDIT,DELETE,QUERY string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper(); DefineRight Info; jsonMessage = new Message() { Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。" }; switch (AjaxType) { case "LOADLEFTMENU": jsonMessage = new Message() { Result = true, TxtMessage = CommonOperRightHelper.MenuListToJson(base.loginOperator) }; break; //新菜单栏加载菜单 case "LOADNEWLEFTMENU": jsonMessage = new Message() { Result = true, TxtMessage = CommonOperRightHelper.GetLeftMenu(base.loginOperator) }; break; case "LOADHIDEMENUCODE": jsonMessage = new Message() { Result = true, TxtMessage = CommonOperRightHelper.GetHidMenuCode(base.loginOperator) }; break; case "LOADCOMPANYRIGHT": List <DefineRight> list = new WCFServiceProxy <IOperRightManage>().getChannel.LoadCompanyDefineRight(base.loginOperator.CompanyID); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <DefineRight>(list, list.Count) }; break; case "LOADCOMPANYMENU": jsonMessage = new Message() { Result = true, TxtMessage = CommonOperRightHelper.CompanyMenuListToJson(base.loginOperator.CompanyID) }; break; //加载两级菜单树(zzcy) case "LOADNEWCOMPANYMENU": jsonMessage = new Message() { Result = true, TxtMessage = CommonOperRightHelper.MenuListToJson(base.loginOperator) }; break; //获取公司菜单 case "LOADMENUBYCOMPANY": string companyId = context.Request.Form["CompanyID"] == null ? string.Empty : context.Request.Form["CompanyID"].ToString().Trim(); jsonMessage = new Message() { Result = true, TxtMessage = CommonOperRightHelper.GetMenuListToJson(companyId) }; break; case "LOADRIGHTMENU": string rightCode = context.Request.Form["rightCode"] == null ? string.Empty : context.Request.Form["rightCode"].ToString().Trim(); jsonMessage = new Message() { Result = true, TxtMessage = CommonOperRightHelper.GetCompanyRightMenuCode(base.loginOperator.CompanyID, rightCode) }; break; case "LOADCOMPANYOPERRIGHT": string operID = context.Request.Form["OperID"] == null ? string.Empty : context.Request.Form["OperID"].ToString(); WCFServiceProxy <IOperRightManage> proxy = new WCFServiceProxy <IOperRightManage>(); try { jsonMessage = new Message() { Result = true, TxtMessage = proxy.getChannel.LoadCompanyOperDefineRight(base.loginOperator.CompanyID, operID) }; } catch { } finally { proxy.CloseChannel(); } break; //编辑公司菜单(分配菜单) case "EDITCOMPANYMENU": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fpqycd")) { companyId = context.Request.Form["CompanyID"] == null ? string.Empty : context.Request.Form["CompanyID"].ToString().Trim(); List <String> List = new List <String>(); string CompanyMenuCode = context.Request.Form["CompanyMenuCode"] == null ? string.Empty : context.Request.Form["CompanyMenuCode"].ToString(); foreach (string menu in CompanyMenuCode.Split(',')) { List.Add(menu); } jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.EditCompanyMenu(companyId, List); } break; case "ADDQXZ": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "tjqxz")) { Info = new CommonModelFactory <DefineRight>().GetModelFromContext(context); Info.CompanyID = base.loginOperator.CompanyID; string RightMenuCode = context.Request.Form["RightMenuCode"] == null ? string.Empty : context.Request.Form["RightMenuCode"].ToString(); List <DefineRightMenu> List = new List <DefineRightMenu>(); foreach (string menu in RightMenuCode.Split(',')) { List.Add(new DefineRightMenu() { CompanyID = base.loginOperator.CompanyID, MenuCode = menu, RightCode = Info.RightCode }); } jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.AddCompanyDefineRight(Info, List.Distinct().ToList()); } break; case "EDITQXZ": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjqxz")) { Info = new CommonModelFactory <DefineRight>().GetModelFromContext(context); Info.CompanyID = base.loginOperator.CompanyID; List <DefineRightMenu> List = new List <DefineRightMenu>(); string RightMenuCode = context.Request.Form["RightMenuCode"] == null ? string.Empty : context.Request.Form["RightMenuCode"].ToString(); foreach (string menu in RightMenuCode.Split(',')) { List.Add(new DefineRightMenu() { CompanyID = base.loginOperator.CompanyID, MenuCode = menu, RightCode = Info.RightCode }); } jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.AddCompanyDefineRight(Info, List.Distinct().ToList()); } break; case "DELETEQXZ": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "scqxz")) { Info = new CommonModelFactory <DefineRight>().GetModelFromContext(context); Info.CompanyID = base.loginOperator.CompanyID; jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.DelCompanyDefineRight(Info); } break; case "EDITOPERRIGHT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fpqxz")) { string OperID = context.Request.Form["OperID"] == null ? string.Empty : context.Request.Form["OperID"].ToString(); string RightCode = context.Request.Form["RightCode"] == null ? string.Empty : context.Request.Form["RightCode"].ToString(); List <DefineRight> lDefineRight = new List <DefineRight>(); foreach (string tmp in RightCode.Split(',')) { lDefineRight.Add(new DefineRight() { CompanyID = base.loginOperator.CompanyID, RightCode = tmp }); } if (OperID == string.Empty) { jsonMessage = new Message() { Result = false, TxtMessage = "请选择您要分配权限组的操作员。" }; } else { jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.EditCompanyOperRight(base.loginOperator.CompanyID, OperID, lDefineRight); } } break; case "REMOVECACHE": jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.RemoveCompanyRightCache(base.loginOperator.CompanyID); break; default: jsonMessage = new Message() { Result = false, TxtMessage = "操作未定义。" }; break; } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }
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_ChangeMeter Info; WCFServiceProxy <IHuanBiao> Iproxy = null; try { switch (AjaxType) { //查询换标记录 case "QUERY": CommonSearch <View_HuanBiao> InfoSearch = new CommonSearch <View_HuanBiao>(); 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 = "View_HuanBiao", TFieldKey = "HID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "FinishedDate DESC", TWhere = Where }; List <View_HuanBiao> list = InfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_HuanBiao>(list, sCondition.TTotalCount) }; break; //查询换标历史记录 case "HISTORYMETER": CommonSearch <View_HistoryUserMeter> InfoSearch1 = new CommonSearch <View_HistoryUserMeter>(); 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_HistoryUserMeter", TFieldKey = "MeterNo", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterNo DESC", TWhere = Where }; List <View_HistoryUserMeter> list1 = InfoSearch1.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_HistoryUserMeter>(list1, sCondition.TTotalCount) }; break; //新增换标申请 case "ADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs")) { Info = new CommonModelFactory <IoT_ChangeMeter>().GetModelFromContext(context); List <IoT_ChangeMeter> lstIoT_ChangeMeter = new List <IoT_ChangeMeter>(); View_UserMeter View_UserMeters = new View_UserMeter(); string MeterNo = string.IsNullOrEmpty(context.Request["MeterNo"]) == true ? "" : context.Request["MeterNo"].ToString(); string UserID = string.IsNullOrEmpty(context.Request["UserID"]) == true ? "" : context.Request["UserID"].ToString(); string Reason = string.IsNullOrEmpty(context.Request["Reason"]) == true ? "" : context.Request["Reason"].ToString(); Iproxy = new WCFServiceProxy <IHuanBiao>(); View_UserMeters = Iproxy.getChannel.getView_UserMeterList(UserID, MeterNo, loginOperator.CompanyID); Info.CompanyID = View_UserMeters.CompanyID; //Info.OldGasSum = View_UserMeters.LastTotal;这里不太清楚 Info.OldMeterNo = View_UserMeters.MeterNo; Info.Reason = Reason; Info.State = '1'; Info.UserID = View_UserMeters.UserID; //Info.ChangeUseSum = View_UserMeters.CompanyID; //Info.ChangeGasSum = View_UserMeters.CompanyID; //Info.p = View_UserMeters.CompanyID; Info.RegisterDate = DateTime.Now; jsonMessage = Iproxy.getChannel.AddShenQing(Info); } break; //修改换标申请 case "EDIT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs")) { Info = new CommonModelFactory <IoT_ChangeMeter>().GetModelFromContext(context); string Reason = string.IsNullOrEmpty(context.Request["Reason"]) == true ? "" : context.Request["Reason"].ToString(); string HID = string.IsNullOrEmpty(context.Request["HID"]) == true ? "" : context.Request["HID"].ToString(); Info.ID = int.Parse(HID); Info.Reason = Reason; Info.CompanyID = loginOperator.CompanyID; Iproxy = new WCFServiceProxy <IHuanBiao>(); jsonMessage = Iproxy.getChannel.Edit(Info); } break; //撤销换表申请 case "REVOKE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "SQREVOKE")) { Iproxy = new WCFServiceProxy <IHuanBiao>(); string ID = string.Empty; if (context.Request["HID"] != null && context.Request["HID"].ToString().Trim() != string.Empty) { ID = context.Request["HID"].ToString() == "" ? "0" : context.Request["HID"].ToString(); } jsonMessage = Iproxy.getChannel.revoke(ID, loginOperator.CompanyID); } break; //换表登记 case "DENGJI": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "DENGJI")) { string dayGas = string.Empty; //上期结算底数 string NewMeterType_DJ = string.Empty; //新表类型 string TotalAmountS = string.Empty; //本期用量 string MeterType_DJ = string.Empty; //原表类型 string Direction_DJ = string.Empty; //原表进气方向 string ID = string.Empty; //原表进气方向 if (context.Request.Form["dayGas"] != null && context.Request.Form["dayGas"].ToString().Trim() != string.Empty) { dayGas = context.Request.Form["dayGas"].ToString() == "" ? "0" : context.Request.Form["dayGas"].ToString(); } if (context.Request.Form["NewMeterType_DJ"] != null && context.Request.Form["dayGas"].ToString().Trim() != string.Empty) { NewMeterType_DJ = context.Request.Form["NewMeterType_DJ"].ToString() == "" ? "" : context.Request.Form["NewMeterType_DJ"].ToString(); } if (context.Request.Form["TotalAmountS"] != null && context.Request.Form["TotalAmountS"].ToString().Trim() != string.Empty) { TotalAmountS = context.Request.Form["TotalAmountS"].ToString() == "" ? "0" : context.Request.Form["TotalAmountS"].ToString(); } if (context.Request.Form["MeterType_DJ"] != null && context.Request.Form["MeterType_DJ"].ToString().Trim() != string.Empty) { MeterType_DJ = context.Request.Form["MeterType_DJ"].ToString() == "" ? "" : context.Request.Form["MeterType_DJ"].ToString(); } if (context.Request.Form["Direction_DJ"] != null && context.Request.Form["Direction_DJ"].ToString().Trim() != string.Empty) { Direction_DJ = context.Request.Form["Direction_DJ"].ToString() == "" ? "" : context.Request.Form["Direction_DJ"].ToString(); } if (context.Request.Form["ID"] != null && context.Request.Form["ID"].ToString().Trim() != string.Empty) { ID = context.Request.Form["ID"].ToString() == "" ? "0" : context.Request.Form["ID"].ToString(); } Info = new CommonModelFactory <IoT_ChangeMeter>().GetModelFromContext(context); Info.CompanyID = loginOperator.CompanyID; Info.State = '2'; Info.ID = int.Parse(ID); Iproxy = new WCFServiceProxy <IHuanBiao>(); if (MeterType_DJ != "01") //不是金额表则将换表时剩余金额改为0 { Info.RemainingAmount = 0; } //注意换表时剩余金额(仅针对金额表) jsonMessage = Iproxy.getChannel.Dengji(Info); } break; default: jsonMessage = new Message() { Result = false, TxtMessage = "操作未定义。" }; break; } } catch (Exception ex) { jsonMessage = new Message() { Result = false, TxtMessage = ex.Message }; } finally { if (Iproxy != null) { Iproxy.CloseChannel(); } } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }
public override void DoLoginedHandlerWork(HttpContext context) { Message jsonMessage; //获取操作类型AType:ADD,EDIT,DELETE,QUERY string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper(); CompanyInfo Info; jsonMessage = new Message() { Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。" }; switch (AjaxType) { case "QUERY": string Where = "1=1 "; if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty) { Where += "AND " + context.Request.Form["TWhere"].ToString(); } CommonSearch <CompanyInfo> userInfoSearch = new CommonSearch <CompanyInfo>(); SearchCondition sCondition = new SearchCondition() { TBName = "S_CompanyInfo", TFieldKey = "CompanyID", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "CompanyName ASC", TWhere = Where }; List <CompanyInfo> list = userInfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <CompanyInfo>(list, sCondition.TTotalCount) }; break; case "ADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "tjzcqy")) { Info = new CommonModelFactory <CompanyInfo>().GetModelFromContext(context); jsonMessage = new WCFServiceProxy <ICompanyManage>().getChannel.AddCompany(Info); } break; case "EDIT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjzcqy")) { Info = new CommonModelFactory <CompanyInfo>().GetModelFromContext(context); jsonMessage = new WCFServiceProxy <ICompanyManage>().getChannel.EditCompany(Info); } break; case "REMOVECACHE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "qcqyqxhc")) { Info = new CommonModelFactory <CompanyInfo>().GetModelFromContext(context); jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.RemoveCompanyRightCache(Info.CompanyID); } break; case "RESETCOMPANYADMIN": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "qyzzhcsh")) { Info = new CommonModelFactory <CompanyInfo>().GetModelFromContext(context); if (Info.CompanyID == base.loginOperator.CompanyID) { jsonMessage = new Message() { Result = false, TxtMessage = string.Format("您没有权限对当前企业管理账户{0}做初始化操作。", base.loginOperator.CompanyID) }; } else { jsonMessage = new WCFServiceProxy <ICompanyManage>().getChannel.ResetCompanyAdmin(Info); } } break; default: jsonMessage = new Message() { Result = false, TxtMessage = "操作未定义。" }; break; } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }
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 <View_UserMeter> InfoSearch = new CommonSearch <View_UserMeter>(); 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 = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where }; List <View_UserMeter> list = InfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_UserMeter>(list, sCondition.TTotalCount) }; break; //实现营业厅充值动作 case "CHONGZHI": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "CHONGZHI")) { IoT_MeterTopUp Info; WCFServiceProxy <IChongzhiManage> proxy1 = null; Info = new CommonModelFactory <IoT_MeterTopUp>().GetModelFromContext(context); List <IoT_MeterTopUp> lstIoT_MeterTopUp = new List <IoT_MeterTopUp>(); string MeterNo = string.IsNullOrEmpty(context.Request["MeterNo"]) == true ? "" : context.Request["MeterNo"].ToString(); string Amount = string.IsNullOrEmpty(context.Request["Amount"]) == true ? "0" : context.Request["Amount"].ToString(); string MeterID = string.IsNullOrEmpty(context.Request["MeterID"]) == true ? "" : context.Request["MeterID"].ToString(); string UserID = string.IsNullOrEmpty(context.Request["UserID"]) == true ? "" : context.Request["UserID"].ToString(); string OperID = string.IsNullOrEmpty(context.Request["OperId"]) ? "" : context.Request["OperId"].ToString(); string OperName = string.IsNullOrEmpty(context.Request["OperName"]) ? "" : context.Request["OperName"].ToString(); string PayType = string.IsNullOrEmpty(context.Request["PayType"]) ? "0" : context.Request["PayType"].ToString(); if (Amount == "0") //后台验证输入的金额是否为空 { jsonMessage = new Message() { Result = false, TxtMessage = "请输入正确的充值金额。" }; context.Response.Write(JSon.TToJson <Message>(jsonMessage)); return; } Info.Amount = decimal.Parse(Amount); //充值金额 Info.MeterID = int.Parse(MeterID); //充值的表ID Info.MeterNo = MeterNo; //充值表号 Info.Oper = base.loginOperator.Name; //操作员 Info.CompanyID = base.loginOperator.CompanyID; //公司 Info.TopUpDate = DateTime.Now; //充值时间,后面会被写到表上的时间覆盖,用来表示写到表上的时间 Info.PayDate = DateTime.Now; //充值时间,用户支付完成的时间 Info.UserID = UserID; //充值户号 Info.TopUpType = '0'; //充值类型为"本地营业厅" Info.State = '0'; //等待充值状态 Info.PayType = Convert.ToChar(PayType); //付款类型:0 现金 1 支付宝 2 微信 Info.SFOperID = OperID; Info.SFOperName = OperName; proxy1 = new WCFServiceProxy <IChongzhiManage>(); jsonMessage = proxy1.getChannel.Add(Info); proxy1.CloseChannel(); } break; case "PRINT": //打印票据(修改打印状态为已打印) WCFServiceProxy <IChongzhiManage> proxy2 = new WCFServiceProxy <IChongzhiManage>(); string id = string.IsNullOrEmpty(context.Request["id"]) ? "" : context.Request["id"].ToString(); if (id == "") { jsonMessage = new Message() { Result = false, TxtMessage = "票据不存在" }; } else { string result = proxy2.getChannel.PrintTicket(id); if (result == "") { jsonMessage = new Message() { Result = true, TxtMessage = "" }; } } proxy2.CloseChannel(); 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)); }
public override void DoLoginedHandlerWork(HttpContext context) { Message jsonMessage; //获取操作类型AType:ADD,EDIT,DELETE,QUERY string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper(); CompanyOperator Info; string webCookie = context.Session.SessionID.ToString(); WCFServiceProxy <ICompanyOperatorManage> proxy; WCFServiceProxy <ILoginerManage> proxyLoginer; string Where = "1=1 "; SearchCondition sCondition; jsonMessage = new Message() { Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。" }; switch (AjaxType) { case "QUERY": CommonSearch <CompanyOperator> CompanyOperatorSearch = new CommonSearch <CompanyOperator>(); Where += "AND CompanyID='" + base.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 = "S_CompanyOperator", TFieldKey = "OperID,CompanyID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "OperID ASC", TWhere = Where }; List <CompanyOperator> list = CompanyOperatorSearch.GetList(ref sCondition, context); //将密码设置为空 list.ForEach(p => p.Pwd = string.Empty); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <CompanyOperator>(list, sCondition.TTotalCount) }; break; case "LOADLOGINER": jsonMessage = new Message() { Result = true, TxtMessage = JSon.TToJson <CompanyOperator>(base.loginOperator) }; break; case "HEARTCOOKIE": //向数据中心更新登录信息 proxyLoginer = new WCFServiceProxy <ILoginerManage>(); try { proxyLoginer.getChannel.RegisterClient(Md5.GetMd5(webCookie), base.loginOperator.OperID, base.loginOperator.CompanyID); jsonMessage = new Message() { Result = true, TxtMessage = Md5.GetMd5(context.Session.SessionID.ToString()) }; } catch { } finally { proxyLoginer.CloseChannel(); } break; case "ADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "tjczy")) { Info = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context); Info.CompanyID = base.loginOperator.CompanyID; Info.Pwd = Md5.GetMd5(base.loginOperator.CompanyID + base.loginOperator.CompanyID); Info.OperType = 0; //0一般操作员:1企业主账号(每个企业仅一个); if (Info.PhoneLogin == true && Info.Phone == string.Empty) { jsonMessage = new Message() { Result = false, TxtMessage = string.Format("添加失败,请输入为操作员{0}绑定的手机号码。", Info.OperID) }; } else { WCFServiceProxy <ICompanyOperatorManage> proxyCompanyOperatorManage = new WCFServiceProxy <ICompanyOperatorManage>(); try { jsonMessage = proxyCompanyOperatorManage.getChannel.AddCompanyOperator(Info); } catch { } finally { proxyCompanyOperatorManage.CloseChannel(); } } } break; case "EDIT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjczy")) { Info = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context); Info.Pwd = null; if (Info.CompanyID != base.loginOperator.CompanyID) { jsonMessage = new Message() { Result = false, TxtMessage = "操作员所属企业与登录账号所属企业不一致,编辑失败。" }; } else { if (Info.PhoneLogin == true && Info.Phone == string.Empty) { jsonMessage = new Message() { Result = false, TxtMessage = string.Format("编辑失败,请输入为操作员{0}绑定的手机号码。", Info.OperID) }; } else { proxy = new WCFServiceProxy <ICompanyOperatorManage>(); try { jsonMessage = proxy.getChannel.EditCompanyOperator(Info); } catch { } finally { proxy.CloseChannel(); } } } } break; //case "EDITOPERAREA": // if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjczy")) // { // Info = new CommonModelFactory<CompanyOperator>().GetModelFromContext(context); // Info.Pwd = null; // if (Info.CompanyID != base.loginOperator.CompanyID) // { // jsonMessage = new Message() // { // Result = false, // TxtMessage = "操作员所属企业与登录账号所属企业不一致,编辑失败。" // }; // } // else // { // proxy = new WCFServiceProxy<ICompanyOperatorManage>(); // try // { // string nodes = context.Request.Form["nodes"].ToString(); // jsonMessage = proxy.getChannel.EditOperatorArea(Info, nodes.Split(',')); // } // catch // { } // finally // { // proxy.CloseChannel(); // } // } // } // break; case "DELETE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "scczy")) { Info = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context); if (Info.CompanyID != base.loginOperator.CompanyID) { jsonMessage = new Message() { Result = false, TxtMessage = "操作员所属企业与登录账号所属企业不一致,删除失败。" }; } else { proxy = new WCFServiceProxy <ICompanyOperatorManage>(); try { jsonMessage = proxy.getChannel.DeleteCompanyOperator(Info); } catch { } finally { proxy.CloseChannel(); } } } break; case "RESETPWD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "czmm")) { Info = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context); if (Info.CompanyID != base.loginOperator.CompanyID) { jsonMessage = new Message() { Result = false, TxtMessage = "操作员所属企业与登录账号所属企业不一致,删除失败。" }; } else { CompanyOperator infoEditPwd = new CompanyOperator() { OperID = Info.OperID, CompanyID = Info.CompanyID, Pwd = Md5.GetMd5(Info.CompanyID + Info.CompanyID) }; proxy = new WCFServiceProxy <ICompanyOperatorManage>(); try { jsonMessage = proxy.getChannel.EditCompanyOperator(infoEditPwd); if (jsonMessage.Result) { jsonMessage.TxtMessage = "操作员密码已重置为初始密码:" + Info.CompanyID; } } catch { } finally { proxy.CloseChannel(); } } } break; case "EDITPWD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "xgmm")) { Info = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context); if (Info.CompanyID != base.loginOperator.CompanyID) { jsonMessage = new Message() { Result = false, TxtMessage = "操作员所属企业与登录账号所属企业不一致,修改失败。" }; } else if (Info.OperID != base.loginOperator.OperID) { jsonMessage = new Message() { Result = false, TxtMessage = "当前登录者与您修改的账号不一致,修改失败。" }; } else { //验证输入旧密码 CommonSearch <CompanyOperator> userInfoSearch = new CommonSearch <CompanyOperator>(); Where = " OperID='" + Info.OperID + "' AND CompanyID='" + Info.CompanyID + "'"; sCondition = new SearchCondition() { TBName = "S_CompanyOperator", TFieldKey = "OperID", TTotalCount = -1, TWhere = Where }; CompanyOperator dbInfo = userInfoSearch.GetFirstTModel(ref sCondition); string OldPwd = context.Request.Form["OldPwd"] == null ? string.Empty : context.Request.Form["OldPwd"].ToString(); if (sCondition.TTotalCount == -1 || dbInfo == null) { jsonMessage = new Message() { Result = false, TxtMessage = "数据中心未返回信息,请稍候再试。" }; } else if (Md5.GetMd5(dbInfo.CompanyID + OldPwd.Trim()) != dbInfo.Pwd) { jsonMessage = new Message() { Result = false, TxtMessage = "原密码验证失败。" }; } else { CompanyOperator infoEditPwd = new CompanyOperator() { OperID = dbInfo.OperID, CompanyID = dbInfo.CompanyID, Pwd = Md5.GetMd5(dbInfo.CompanyID + Info.Pwd) }; proxy = new WCFServiceProxy <ICompanyOperatorManage>(); try { jsonMessage = proxy.getChannel.EditCompanyOperator(infoEditPwd); } catch { } finally { proxy.CloseChannel(); } } } } break; //case "LOADAREATREE": // string operID = context.Request.Form["OperID"].ToString(); // jsonMessage = new Message() { Result = true, TxtMessage = CreateAreaTreeToJson(base.loginOperator.CompanyID, operID) }; // break; default: jsonMessage = new Message() { Result = false, TxtMessage = "操作未定义。" }; break; } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }
public override void DoLoginedHandlerWork(HttpContext context) { Message jsonMessage; //获取操作类型AType:ADD,EDIT,DELETE,QUERY string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper(); MenuInfo Info; jsonMessage = new Message() { Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。" }; switch (AjaxType) { case "QUERY": string Where = "1=1 "; if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty) { Where += "AND " + context.Request.Form["TWhere"].ToString(); } if (context.Request.QueryString["Code"] != null && context.Request.QueryString["Code"].ToString().Trim() != string.Empty) { Where += "AND FatherCode= '" + context.Request.QueryString["Code"].ToString() + "'"; } else { Where += "AND ( Type= '00' or Type= '01' or Type= '03' )"; } CommonSearch <MenuInfo> userInfoSearch = new CommonSearch <MenuInfo>(); SearchCondition sCondition = new SearchCondition() { TBName = "S_DefineMenu", TFieldKey = "MenuCode", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "Type,FatherCode,OrderNum ASC", TWhere = Where }; List <MenuInfo> list = userInfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <MenuInfo>(list, sCondition.TTotalCount) }; break; case "ADD": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "tjcd")) { Info = new CommonModelFactory <MenuInfo>().GetModelFromContext(context); jsonMessage = new WCFServiceProxy <IMenuManage>().getChannel.AddMenu(Info); if (jsonMessage.Result) { new WCFServiceProxy <IMenuManage>().getChannel.ReSetCompany(base.loginOperator.CompanyID); } } break; case "EDIT": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjcd")) { Info = new CommonModelFactory <MenuInfo>().GetModelFromContext(context); jsonMessage = new WCFServiceProxy <IMenuManage>().getChannel.EditMenu(Info); if (jsonMessage.Result) { new WCFServiceProxy <IMenuManage>().getChannel.ReSetCompany(base.loginOperator.CompanyID); } } break; case "DELETE": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "sccd")) { Info = new CommonModelFactory <MenuInfo>().GetModelFromContext(context); jsonMessage = new WCFServiceProxy <IMenuManage>().getChannel.DeleteMenu(Info); if (jsonMessage.Result) { new WCFServiceProxy <IMenuManage>().getChannel.ReSetCompany(base.loginOperator.CompanyID); } } break; case "QUERYFATHER": Where = "1=1 "; if (context.Request.QueryString["MenuType"] != null && context.Request.QueryString["MenuType"].ToString().Trim() != string.Empty) { string MenuType = context.Request.QueryString["MenuType"].ToString(); Where += "AND Type= '" + MenuType + "'"; } userInfoSearch = new CommonSearch <MenuInfo>(); sCondition = new SearchCondition() { TBName = "S_DefineMenu", TFieldKey = "MenuCode", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "Type,FatherCode,OrderNum ASC", TWhere = Where }; list = userInfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <MenuInfo>(list, sCondition.TTotalCount) }; break; default: jsonMessage = new Message() { Result = false, TxtMessage = "操作未定义。" }; break; } context.Response.Write(JSon.TToJson <Message>(jsonMessage)); }
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(); View_ValveControl Info; WCFServiceProxy <IValveControl> proxy = null; WCFServiceProxy <IMeterManage> proxyMeter = null; try { switch (AjaxType) { case "QUERY": CommonSearch <View_ValveControl> InfoSearch = new CommonSearch <View_ValveControl>(); 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 = "View_ValveControl", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "RegisterDate Desc", TWhere = Where }; List <View_ValveControl> list = InfoSearch.GetList(ref sCondition, context); jsonMessage = new Message() { Result = true, TxtMessage = JSon.ListToJson <View_ValveControl>(list, sCondition.TTotalCount) }; break; //开阀 case "KAIFA": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fmcz_kf")) { proxyMeter = new WCFServiceProxy <IMeterManage>(); proxy = new WCFServiceProxy <IValveControl>(); string reason = ""; if (context.Request.Form["Reason"] != null && context.Request.Form["Reason"].ToString().Trim() != string.Empty) { reason = context.Request.Form["Reason"].ToString().Trim(); } 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++) { IoT_Meter meter = proxyMeter.getChannel.GetMeterByNo(arrNo[i]); proxy.getChannel.TurnOn(meter, reason, loginOperator.Name); } } jsonMessage = new Message() { Result = true, TxtMessage = "操作成功" }; } break; //关阀 case "GUANFA": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fmcz_gf")) { proxyMeter = new WCFServiceProxy <IMeterManage>(); proxy = new WCFServiceProxy <IValveControl>(); string reason = ""; if (context.Request.Form["Reason"] != null && context.Request.Form["Reason"].ToString().Trim() != string.Empty) { reason = context.Request.Form["Reason"].ToString().Trim(); } 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++) { IoT_Meter meter = proxyMeter.getChannel.GetMeterByNo(arrNo[i]); proxy.getChannel.TurnOff(meter, reason, loginOperator.Name); } } jsonMessage = new Message() { Result = true, TxtMessage = "操作成功" }; } break; case "UNDO": if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fmcz_cx")) { Info = new CommonModelFactory <View_ValveControl>().GetModelFromContext(context); proxy = new WCFServiceProxy <IValveControl>(); proxy.getChannel.Undo(Info.TaskID, Info.Context); jsonMessage = new Message() { Result = true, 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)); }