Example #1
0
        /// <summary>
        /// 调峰
        /// </summary>
        public void SearchTF_Report()
        {
            string strwhere = "";
            string _Name    = Request["Name"];
            string _State   = Request["State"];
            string _ID      = Request["ID"];

            if (_Name != "" && _Name != null)
            {
                strwhere = strwhere + " and (a.FName like '%" + _Name + "%' or a.FDTUCode like '%" + _Name + "%')";
            }

            if (_ID != "" && _ID != null)
            {
                strwhere = strwhere + " and a.id='" + _ID + "'";
            }

            switch (_State)
            {
            case "0": strwhere = strwhere + " and b.FOnLine='" + _State + "'"; break;                             //离线

            case "1": strwhere = strwhere + " and b.FOnLine='" + _State + "'"; break;                             //在线

            case "2": strwhere = strwhere + @" and isnull((select top 1 1 from Alarm_Timely _c 
                                              where _c.BaseID=a.id and FMarkerType=8 and FStatus=1),0)=1"; break; //报警
            }
            strwhere = strwhere + getPowerConst("tiaofeng");

            int       pageIndex = Convert.ToInt32(Request["pageIndex"]);
            int       pageSize  = Convert.ToInt32(Request["pageSize"]);
            Hashtable result    = BASE_TIAOFENGDal.SearchTF_Report(pageIndex, pageSize, "FCreateDate", "desc", strwhere);
            string    json      = PluSoft.Utils.JSON.Encode(result);

            Response.Write(json);
        }
Example #2
0
        /// <summary>
        /// 调峰历史
        /// </summary>
        public void SearchTF_HisReport()
        {
            string strwhere = "";
            string _Name    = Request["Name"];
            string Start    = Request["StartDate"]; //开始日期
            string End      = Request["EndDate"];   //结束日期
            string _ID      = Request["ID"];
            int    year     = Convert.ToDateTime(Start).Year;

            if (_ID != "" && _ID != null)
            {
                strwhere = strwhere + " and a.id='" + _ID + "'";
            }
            if (_Name != "" && _Name != null)
            {
                strwhere = strwhere + " and (a.FName like '%" + _Name + "%' or a.FDTUCode like '%" + _Name + "%')";
            }
            strwhere = strwhere + " and b.TempTime between '" + Start + "' and '" + End + "'";
            strwhere = strwhere + getPowerConst("tiaofeng");

            int       pageIndex = Convert.ToInt32(Request["pageIndex"]);
            int       pageSize  = Convert.ToInt32(Request["pageSize"]);
            Hashtable result    = BASE_TIAOFENGDal.SearchTF_HisReport(pageIndex, pageSize, "b.BASEID,TempTime", "desc", strwhere, year);
            string    json      = PluSoft.Utils.JSON.Encode(result);

            Response.Write(json);
        }
        public ActionResult Grid1_Delete(JArray selectedRows, JArray Grid1_fields, int gridIndex, int gridPageSize)
        {
            string values = "";

            for (int i = 0; i < selectedRows.Count; i++)
            {
                if (i != selectedRows.Count - 1)
                {
                    values += "'" + selectedRows[i] + "',";
                }
                else
                {
                    values += "'" + selectedRows[i] + "'";
                }
            }

            Hashtable hasData = new Hashtable();

            hasData["id"]        = values;
            hasData["FIsDelete"] = 1;
            hasData["FDelDate"]  = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss"));
            hasData["FDelUser"]  = GetIdentityName();
            BASE_TIAOFENGDal.DeleteList(hasData);
            Bll.Map_MarkerBll.DeleteMarker(8, values);
            UpdateGrid(Grid1_fields, gridIndex, gridPageSize);
            return(UIHelper.Result());
        }
        public ActionResult MyCustomPostBack(string type, JArray gridFields, JObject typeParams, int gridIndex, int gridPageSize)
        {
            var    Grid1     = UIHelper.Grid("Grid1");
            string sql       = string.Empty;
            var    ttbSearch = UIHelper.TwinTriggerBox("ttbSearchMessage");

            if (type == "trigger1")
            {
                ttbSearch.Text(String.Empty);
                ttbSearch.ShowTrigger1(false);
            }
            else if (type == "trigger2")
            {
                ttbSearch.ShowTrigger1(true);
                var triggerValue = typeParams.Value <string>("triggerValue");
                sql = " and FName like '%" + triggerValue + "%'";
            }
            sql = sql + getPowerConst("tiaofeng");
            Hashtable table = BASE_TIAOFENGDal.SearchTF(gridIndex, gridPageSize, "a.FCreateDate", "DESC", sql);

            Grid1.DataSource(table["data"], gridFields);
            Grid1.RecordCount(Int32.Parse(table["total"].ToString()));

            return(UIHelper.Result());
        }
        private void UpdateGrid(JArray Grid1_fields, int gridIndex, int gridPageSize)
        {
            var Grid1 = UIHelper.Grid("Grid1");

            Hashtable table = BASE_TIAOFENGDal.SearchTF(gridIndex, gridPageSize, "a.FCreateDate", "DESC", getPowerConst("tiaofeng"));

            Grid1.DataSource(table["data"], Grid1_fields);
            Grid1.RecordCount(Int32.Parse(table["total"].ToString()));
        }
        public ActionResult Index()
        {
            ViewBag.CoreTiaoFengNew    = CheckPower("CoreTiaoFengNew");
            ViewBag.CoreTiaoFengDelete = CheckPower("CoreTiaoFengDelete");
            ViewBag.CoreTiaoFengEdit   = CheckPower("CoreTiaoFengEdit");
            Hashtable table = BASE_TIAOFENGDal.SearchTF(0, 20, "a.FCreateDate", "DESC", getPowerConst("tiaofeng"));

            ViewBag.Grid1DataSource  = table["data"];
            ViewBag.Grid1RecordCount = Int32.Parse(table["total"].ToString());
            return(View());
        }
Example #7
0
        //导出调峰历史
        public void ReportTF_His()
        {
            string strwhere = "";
            string _Name    = Request["Name"];
            string Start    = Request["StartDate"]; //开始日期
            string End      = Request["EndDate"];   //结束日期
            string _ID      = Request["ID"];
            int    year     = Convert.ToDateTime(Start).Year;

            if (_ID != "" && _ID != null)
            {
                strwhere = strwhere + " and a.id='" + _ID + "'";
            }
            if (_Name != "" && _Name != null)
            {
                strwhere = strwhere + " and (a.FName like '%" + _Name + "%' or a.FDTUCode like '%" + _Name + "%')";
            }
            strwhere = strwhere + " and b.TempTime between '" + Start + "' and '" + End + "'";
            strwhere = strwhere + getPowerConst("tiaofeng");
            DataTable dtresult = BASE_TIAOFENGDal.SearchTF_HisReport(strwhere, year);

            try
            {
                List <TF_runLog> YaLiLog = ModelConvertHelper <TF_runLog> .ConvertToModel(dtresult).ToList();

                var excelExport = _excelExport.CreateWorkbook();
                excelExport.AddSheet(YaLiLog, "");
                string path = System.Web.HttpContext.Current.Server.MapPath("~/DownLoad");
                if (Directory.Exists(path))
                {
                    Directory.Delete(path, true);
                }
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string    pdfname  = "/调峰日志" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xlsx";
                string    pathFile = excelExport.SaveFile(path + pdfname);
                Hashtable result   = new Hashtable();
                result["msg"] = "ok";
                result["Url"] = "/DownLoad" + pdfname;
                string json = PluSoft.Utils.JSON.Encode(result);
                Response.Write(json);
            }
            catch (Exception)
            {
                Hashtable result = new Hashtable();
                result["msg"] = "error";
                string json = PluSoft.Utils.JSON.Encode(result);
                Response.Write(json);
            }
        }
        public ActionResult Grid1_PageIndexChanged(JArray Grid1_fields, int Grid1_pageIndex, int gridPageSize, string searchMessage)
        {
            var Grid1 = UIHelper.Grid("Grid1");

            string sql = string.Empty;

            if (!searchMessage.Equals(""))
            {
                sql = sql + " and FName like '%" + searchMessage + "%'";
            }
            sql = sql + getPowerConst("tiaofeng");
            Hashtable table = BASE_TIAOFENGDal.SearchTF(Grid1_pageIndex, gridPageSize, "a.FCreateDate", "DESC", sql);

            Grid1.DataSource(table["data"], Grid1_fields);
            Grid1.RecordCount(Int32.Parse(table["total"].ToString()));

            return(UIHelper.Result());
        }
        public ActionResult btnBasicEdit_Click()
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (BASE_TIAOFENGDal.Exist(" and FDTUCode='" + Request["tbSelectedDTU"] + "' and FDTUCode<>'" + Request["tbOldDTU"] + "'").Rows.Count == 0)
                    {
                        int       FCustomerID = Convert.ToInt32(Request["tbxCustomerID"]);
                        Hashtable hasData     = new Hashtable();
                        hasData["id"]                 = Request["tbxID"];
                        hasData["FDTUCode"]           = Request["tbSelectedDTU"];
                        hasData["FName"]              = Request["tbxName"];
                        hasData["FCustomerID"]        = FCustomerID;
                        hasData["FLngLat"]            = Request["tbxLngLat"];
                        hasData["FMapAddress"]        = Request["tbSelectedAddress"];
                        hasData["FWell"]              = Request["hidFWell"];
                        hasData["FPipeline"]          = Request["hidFPipeline"];
                        hasData["FEnterValve"]        = Request["hidFEnterValve"];
                        hasData["FExitValve"]         = Request["hidFExitValve"];
                        hasData["FBrand"]             = Request["tbxFBrand"];
                        hasData["FMaterial"]          = Request["ddlFMaterial"];
                        hasData["FCaliber"]           = Request["ddlFCaliber"];
                        hasData["FEQuiType"]          = Request["ddlFEQuiType"];
                        hasData["FInstallMode"]       = Request["ddlFInstallMode"];
                        hasData["FCommunicationMode"] = Request["ddlFCommunicationMode"];
                        hasData["FReadMeterMode"]     = Request["ddlFReadMeterMode"];
                        hasData["FBuriedMode"]        = Request["ddlFBuriedMode"];
                        hasData["FEQuiState"]         = Request["ddlFEQuiState"];
                        hasData["FGroundHeigh"]       = Request["tbxFGroundHeigh"];
                        hasData["FNote"]              = Request["tbxFNote"];
                        hasData["FBYCycle"]           = Request["tbxFBYCycle"];
                        hasData["FGHCycle"]           = Request["tbxFGHCycle"];
                        hasData["FSchemeID"]          = Request["tbxFSchemeID"];
                        hasData["FUpdUser"]           = GetIdentityName();
                        hasData["FUpdDate"]           = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        BASE_TIAOFENGDal.Update(hasData);


                        Hashtable hasData1 = new Hashtable();
                        hasData1["DtuNum"] = Request["tbSelectedDTU"];
                        hasData1["BASEID"] = Request["tbxID"];
                        DATA_TIAOFENGDal.Update(hasData1);

                        if (FCustomerID > 0)
                        {
                            if (Request["tbxFMarkerID"].ToString() != "")
                            {
                                string[]  lnglat = Request["tbxLngLat"].Split(',');
                                Hashtable has1   = new Hashtable();
                                has1["ID"]         = Request["tbxFMarkerID"];
                                has1["FName"]      = Request["tbxName"];
                                has1["FMapTempID"] = Request["tbxFMapTempID"];
                                Bll.Map_MarkerBll.UpdateMarker(has1);
                                Hashtable has2 = new Hashtable();
                                has2["FMarkerID"] = Request["tbxFMarkerID"];
                                has2["FMarker"]   = "[{\"lng\":" + lnglat[0] + ",\"lat\":" + lnglat[1] + "}]";
                                Bll.Map_MarkerBll.UpdateMarkerProperty(has2);
                            }
                        }

                        ShowNotify("成功!");
                        // 关闭本窗体(触发窗体的关闭事件)
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                        return(UIHelper.Result());
                    }
                    else
                    {
                        ShowNotify("调峰编号重复,请更换!");
                    }
                }
            }
            catch
            {
                ShowNotify("失败!");
            }
            return(UIHelper.Result());
        }
        public ActionResult btnBasicCreate_Click()
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (BASE_TIAOFENGDal.Exist(" and FDTUCode='" + Request["tbSelectedDTU"] + "'").Rows.Count == 0)
                    {
                        string    guid        = Guid.NewGuid().ToString();
                        string    tiaofId     = Guid.NewGuid().ToString();
                        int       FCustomerID = Convert.ToInt32(Request["tbxCustomerID"]);
                        Hashtable hasData     = new Hashtable();
                        hasData["id"]                 = tiaofId;
                        hasData["FDTUCode"]           = Request["tbSelectedDTU"];
                        hasData["FName"]              = Request["tbxName"];
                        hasData["FCustomerID"]        = FCustomerID;
                        hasData["FLngLat"]            = Request["tbxLngLat"];
                        hasData["FMapAddress"]        = Request["tbSelectedAddress"];
                        hasData["FWell"]              = Request["hidFWell"];
                        hasData["FPipeline"]          = Request["hidFPipeline"];
                        hasData["FEnterValve"]        = Request["hidFEnterValve"];
                        hasData["FExitValve"]         = Request["hidFExitValve"];
                        hasData["FBrand"]             = Request["tbxFBrand"];
                        hasData["FMaterial"]          = Request["ddlFMaterial"];
                        hasData["FCaliber"]           = Request["ddlFCaliber"];
                        hasData["FEQuiType"]          = Request["ddlFEQuiType"];
                        hasData["FInstallMode"]       = Request["ddlFInstallMode"];
                        hasData["FCommunicationMode"] = Request["ddlFCommunicationMode"];
                        hasData["FReadMeterMode"]     = Request["ddlFReadMeterMode"];
                        hasData["FBuriedMode"]        = Request["ddlFBuriedMode"];
                        hasData["FEQuiState"]         = Request["ddlFEQuiState"];
                        hasData["FGroundHeigh"]       = Request["tbxFGroundHeigh"];
                        hasData["FBYCycle"]           = Request["tbxFBYCycle"];
                        hasData["FGHCycle"]           = Request["tbxFGHCycle"];
                        hasData["FNote"]              = Request["tbxFNote"];
                        hasData["FSchemeID"]          = Request["tbxFSchemeID"];
                        hasData["FCreateUser"]        = GetIdentityName();
                        hasData["FIsDelete"]          = 0;
                        hasData["FMarkerID"]          = guid;
                        BASE_TIAOFENGDal.Insert(hasData);

                        Hashtable hasData1 = new Hashtable();
                        hasData1["id"]     = Guid.NewGuid();
                        hasData1["DtuNum"] = Request["tbSelectedDTU"];
                        hasData1["BASEID"] = tiaofId;
                        DATA_TIAOFENGDal.Insert(hasData1);

                        if (FCustomerID > 0)
                        {
                            string[]  lnglat = Request["tbxLngLat"].Split(',');
                            Hashtable has1   = new Hashtable();
                            Hashtable has2   = new Hashtable();
                            has1["ID"]         = guid;
                            has1["FName"]      = Request["tbxName"];
                            has1["FMapTempID"] = Request["tbxFMapTempID"];
                            has2["FMarkerID"]  = guid;
                            int maxid = Convert.ToInt32(Dal.DBUtil.SelectDataTable("select isnull(max(ID),0) as maxId from Map_MarkerProperty").Rows[0]["maxId"].ToString()) + 1;
                            has2["FAliasName"] = "Marker" + maxid.ToString();
                            has2["FType"]      = "8";
                            has2["FMarker"]    = "[{\"lng\":" + lnglat[0] + ",\"lat\":" + lnglat[1] + "}]";
                            has2["FMID"]       = tiaofId;
                            Bll.Map_MarkerBll.InsertMarker(has1);
                            Bll.Map_MarkerBll.InsertMarkerProperty(has2);
                        }

                        ShowNotify("成功!");
                        string url = Url.Action("TF_Diagram", "BASE_TIAOFENG", new { type = "edit", tiaofId = tiaofId });
                        // 关闭本窗体(触发窗体的关闭事件)'
                        PageContext.RegisterStartupScript("parent.updateLabelResult('" + url + "');");
                    }
                    else
                    {
                        ShowNotify("调峰编号重复,请更换!");
                    }
                }
            }
            catch
            {
                ShowNotify("失败!");
            }
            return(UIHelper.Result());
        }