/// <summary>
 /// 修改TBL_CTRCONTROL表的数据
 /// </summary>
 /// <param name="whereLambda"> (u=>u.siteId == info.siteId, info) == true </param>
 /// 判断有无siteId
 /// <param name="info"> info是需要修改的信息 </param>
 /// <notice></notice>
 public static Boolean UpdateCtrcontrolInfo(Expression <Func <TBL_CTRCONTROL, bool> > whereLambda, TBL_CTRCONTROL info)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             DbQuery <TBL_CTRCONTROL> dataObject = db.TBL_CTRCONTROL.Where(whereLambda) as DbQuery <TBL_CTRCONTROL>;
             TBL_CTRCONTROL           oldInfo    = dataObject.FirstOrDefault();
             oldInfo.ctrcontrolTimweek      = info.ctrcontrolTimweek;
             oldInfo.ctrcontrolLigweek      = info.ctrcontrolLigweek;
             oldInfo.ctrcontrolTimopetime   = info.ctrcontrolTimopetime;
             oldInfo.ctrcontrolTimclotime   = info.ctrcontrolTimclotime;
             oldInfo.ctrcontrolOpeligvalue  = info.ctrcontrolOpeligvalue;
             oldInfo.ctrcontrolCloligvalue  = info.ctrcontrolCloligvalue;
             oldInfo.ctrcontrolLigvalsource = info.ctrcontrolLigvalsource;
             oldInfo.ctrcontrolSystime      = info.ctrcontrolSystime;
             oldInfo.ctrcontrolSysweek      = info.ctrcontrolSysweek;
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
 /// <summary>
 /// 往集控信息表中插入数据
 /// </summary>
 /// <param name="info">前端页面输入的信息</param>
 /// <returns></returns>
 public static Boolean InsertCtrcontrolInfo(TBL_CTRCONTROL info)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             db.TBL_CTRCONTROL.Add(info);
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 查找集控信息表中符合条件的信息
 /// </summary>
 /// <param name="whereLambda">u => u.siteId == info.siteId, u => u.siteId</param>
 /// <returns>集控信息数组</returns>
 public static TBL_CTRCONTROL[] SelectCtrcontrolInfo <TKey>(Expression <Func <TBL_CTRCONTROL, bool> > whereLambda, Expression <Func <TBL_CTRCONTROL, TKey> > orderBy)
 {
     try
     {
         using (LampNetEntities db = new LampNetEntities())
         {
             DbQuery <TBL_CTRCONTROL> dataObject = db.TBL_CTRCONTROL.Where(whereLambda).OrderBy(orderBy) as DbQuery <TBL_CTRCONTROL>;
             TBL_CTRCONTROL[]         infoList   = dataObject.ToArray();
             return(infoList);
         }
     }
     catch
     {
         TBL_CTRCONTROL[] nullInfo = new TBL_CTRCONTROL[0];
         return(nullInfo);
     }
 }
 public void CenterSettingLightUpdate(TBL_CTRCONTROL ctr)
 {
     try
     {
         if (UpdateTools.UpdateCtrcontrolInfo(u => u.siteId == ctr.siteId, ctr) == true)
         {
             Response.Write("<script language='javascript'>alert('更新成功!');</script>");
             Response.Redirect("/CenterControl/CenterSettingLight");
         }
         else
         {
             Response.Write("<script language='javascript'>alert('更新失败!');</script>");
             Response.Redirect("/CenterControl/CenterSettingLight");
         }
     }
     catch
     {
         Response.Write("<script language='javascript'>alert('更新出错!');</script>");
         Response.Redirect("/CenterControl/CenterSettingLight");
     }
 }
 public void CenterSettingSetTimeUpdate(string opehour, string opeminute, string opesecond, string clohour, string clominute, string closecond, TBL_CTRCONTROL ctr)
 {
     try
     {
         string opetime = opehour + ':' + opeminute + ':' + opesecond;
         string clotime = clohour + ':' + clominute + ':' + closecond;
         if (UpdateTools.UpdateCtrcontrolInfo(u => u.siteId == ctr.siteId, ctr) == true)
         {
             Response.Write("<script language='javascript'>alert('更新成功!');</script>");
             Response.Redirect("/CenterControl/CenterSettingSetTime");
         }
         else
         {
             Response.Write("<script language='javascript'>alert('更新失败!');</script>");
             Response.Redirect("/CenterControl/CenterSettingSetTime");
         }
     }
     catch
     {
         Response.Write("<script language='javascript'>alert('更新出错!');</script>");
         Response.Redirect("/CenterControl/CenterSettingSetTime");
     }
 }
        public ActionResult CenterControlSelect(string siteName, TBL_CTRCONTROL ctr)
        {
            try
            {
                if (ctr.siteId != 0)
                {
                    int sumPage = GetSumPage(30);
                    int nowPage = 1;
                    TBL_CTRCONTROL[] allInfo = GetPagedList(1, 30, u => u.siteId == u.siteId, u => u.siteId);
                    ViewBag.nowPage = nowPage;
                    ViewBag.sumPage = sumPage;
                    TBL_SITE[] info = SelectTools.SelectSiteInfo(u => u.siteId == ctr.siteId, u => u.siteId);
                    if (info == null || info.Length == 0)
                    {
                        return(Content("没有此展示!"));
                    }
                    TBL_SITE[] sitearray = SelectTools.SelectSiteInfo(u => u.siteId == u.siteId, u => u.siteId);
                    if (Request.Cookies["userId"] != null)
                    {
                        string user = Request.Cookies["userId"].Value;//输出全部的值
                        ViewBag.user = user;
                    }
                    ViewBag.sitearray = sitearray;
                    ViewBag.allInfo   = allInfo;
                    ViewBag.info      = info;

                    HttpCookie cookie = Request.Cookies["userId"];
                    if (cookie.Name != null)
                    {
                        ViewBag.user = cookie.Value;
                    }

                    return(View());
                }
                else if (siteName != null)
                {
                    int sumPage = GetSumPage(30);
                    int nowPage = 1;
                    TBL_CTRCONTROL[] allInfo = GetPagedList(1, 30, u => u.siteId == u.siteId, u => u.siteId);
                    ViewBag.nowPage = nowPage;
                    ViewBag.sumPage = sumPage;
                    TBL_SITE[] info = SelectTools.SelectSiteInfo(u => u.siteName == siteName, u => u.siteId);
                    if (info == null || info.Length == 0)
                    {
                        return(Content("没有此展示!"));
                    }
                    TBL_SITE[] sitearray = SelectTools.SelectSiteInfo(u => u.siteId == u.siteId, u => u.siteId);
                    if (Request.Cookies["userId"] != null)
                    {
                        string user = Request.Cookies["userId"].Value;//输出全部的值
                        ViewBag.user = user;
                    }
                    ViewBag.sitearray = sitearray;
                    ViewBag.allInfo   = allInfo;
                    ViewBag.info      = info;

                    HttpCookie cookie = Request.Cookies["userId"];
                    if (cookie.Name != null)
                    {
                        ViewBag.user = cookie.Value;
                    }

                    return(View());
                }
                else
                {
                    return(Content("没有查询内容!"));
                }
            }
            catch
            {
                return(Content("查询失败!(ERROR)"));
            }
        }