示例#1
0
        public ActionResult DeleteOrderInfo(string orderid)
        {
            string result = "OK";

            try
            {
                //删除文件
                List <t_cm_files> list = fm.FileList("order", orderid);
                string            id = "", filepath = "";
                if (list.Count > 0)
                {
                    foreach (t_cm_files file in list)
                    {
                        id = id + file.ID + ",";
                        //删除文件
                        filepath = Server.MapPath(file.FilePath);
                        DirectoryUtil.DeleteFile(filepath);
                    }
                    id = id.TrimEnd(',');
                    //删除资料表信息
                    fm.DeleteFile(id);
                }
                //删除工单
                string strsql  = "delete from t_PM_Order where OrderID in (" + orderid + ")";
                int    docount = bll.ExecuteStoreCommand(strsql, null);
                Common.InsertLog("工单管理", CurrentUser.UserName, "删除工单信息[" + orderid + "]");//log
            }
            catch (Exception ex)
            {
                result = "删除失败!";
            }
            return(Content(result));
        }
示例#2
0
        //保存测点对照表
        public ActionResult SavePointmapdts(t_cm_pointmapdts model)
        {
            string result = "OK";

            //新增
            try
            {
                List <t_cm_pointmapdts> list = bll.t_cm_pointmapdts.Where(p => p.tagid == model.tagid).ToList();
                if (list.Count > 0)//修改
                {
                    string strsql = "update t_cm_pointmapdts set dname='" + model.dname + "',channelsinfoid=" + model.channelsinfoid + ",cname='" + model.cname + "',zonename='" + model.zonename + "',zoneno=" + model.zoneno + " where tagid=" + model.tagid;
                    bll.ExecuteStoreCommand(strsql, null);
                    Common.InsertLog("光纤分区对照管理", CurrentUser.UserName, "修改光纤分区对照[测点ID:" + model.tagid + "]");
                }
                else
                {
                    bll.t_cm_pointmapdts.AddObject(model);
                    bll.SaveChanges();
                    Common.InsertLog("光纤分区对照管理", CurrentUser.UserName, "新增光纤分区对照[定位点ID:" + model.tagid + "]");
                }
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            return(Content(result));
        }
示例#3
0
 public ActionResult MonthBoll(int?Month, int PID, int DID, int CID)
 {
     if (Month != null)
     {
         for (int j = 1; j < 31; j++)
         {
             string sSql = "exec proc_ee_insertrandom '2017-" + Month + "-" + j + " 00:00:00','t_EE_PowerQualityMonthly','" + PID + "','" + DID + "','" + CID + "'";
             bll.ExecuteStoreCommand(sSql);
         }
     }
     return(Content("OK"));
 }
示例#4
0
 //操作数据库门禁开关;
 public ActionResult changeDoorStatus(int doorId)
 {
     try
     {
         string strJson = "";
         string pdrlist = HomeController.GetPID(CurrentUser.UNITList);
         //string pdrlist = CurrentUser.PDRList;
         if (pdrlist == null)
         {
             return(Content(""));
         }
         List <t_CM_Door> listDoors = bll.ExecuteStoreQuery <t_CM_Door>("SELECT * FROM t_CM_Door WHERE DoorId=" + doorId).ToList();
         if (listDoors != null && listDoors.Count > 0)
         {
             int goToStatus = listDoors[0].DoorStatus == 0?1:0;
             bll.ExecuteStoreCommand("UPDATE t_CM_Door SET GoToStatus=" + goToStatus + " WHERE DoorId=" + doorId);
             strJson = "{\"resultCode\": 0,\"doorId\": " + doorId + ",\"DoorStatus\": " + bll.ExecuteStoreQuery <t_CM_Door>("SELECT * FROM t_CM_Door WHERE DoorId=" + doorId).ToList()[0].DoorStatus + "}";
         }
         return(Content(strJson));
     }
     catch
     {
         return(Content("{\"resultCode\": 1,\"doorId\": " + doorId + ",\"DoorStatus\": 0}"));
     }
 }
示例#5
0
        //保存测点对照表
        public ActionResult SavePointmapdts(t_cm_pointmapdts model)
        {
            string result = "OK", strsql = "";

            //新增
            try
            {
                List <t_cm_pointmapdts> list2 = bll.t_cm_pointmapdts.Where(p => p.devicesinfoid == model.devicesinfoid && p.channelsinfoid == model.channelsinfoid && p.zoneno == model.zoneno && p.parentid == 0).ToList();
                if (list2.Count == 0 || list2[0].tagid == model.tagid)//判断纤分区已分配是否已经分配
                {
                    List <t_cm_pointmapdts> list = bll.t_cm_pointmapdts.Where(p => p.tagid == model.tagid).ToList();
                    if (list.Count > 0)//修改
                    {
                        strsql = " select beginIndex id,endIndex  text from t_dts_bi_channelzone where zoneno=" + model.zoneno + " and channelsinfoid=" + model.channelsinfoid + " and devicesinfoid=" + model.devicesinfoid;
                        List <DDLValue> listzone = SQLtoDataSet.GetMySqlList(strsql);
                        int             startPt = 0, endPt = 0;
                        if (listzone.Count > 0)
                        {
                            startPt = listzone[0].id;
                            endPt   = Convert.ToInt32(listzone[0].text);
                        }

                        strsql = "update t_cm_pointmapdts set startPt=" + startPt + ",endPt=" + endPt + ",devicesinfoid=" + model.devicesinfoid + ", dname='" + model.dname + "',channelsinfoid=" + model.channelsinfoid + ",cname='" + model.cname + "',zonename='" + model.zonename + "',zoneno=" + model.zoneno + " where tagid=" + model.tagid;
                        bll.ExecuteStoreCommand(strsql, null);
                        Common.InsertLog("光纤分区对照管理", CurrentUser.UserName, "修改光纤分区对照[测点ID:" + model.tagid + "]");
                    }
                    else
                    {
                        strsql = "insert into t_cm_pointmapdts values(" + model.pid + "," + model.did + "," + model.tagid + "," + model.devicesinfoid + ",'" + model.dname + "'," + model.channelsinfoid + ",'" + model.cname + "'," + model.zoneno + ",'" + model.zonename + "')";
                        bll.ExecuteStoreCommand(strsql, null);
                        Common.InsertLog("光纤分区对照管理", CurrentUser.UserName, "新增光纤分区对照[定位点ID:" + model.tagid + "]");
                    }
                }
                else
                {
                    result = "该光纤分区已分配,请从新分配!";
                }
            }
            catch (Exception ex)
            {
                result = strsql;
            }
            return(Content(result));
        }
示例#6
0
        //[Login]
        public ActionResult Upload(HttpPostedFileBase fileData, string folder, int pid, int channelid, string channelname, string positionName, string maxtemp, string mintemp, int iNewnCCDW, int iNewnIRW, int iNewnIRH)
        {
            if (fileData != null)
            {
                try
                {
                    ControllerContext.HttpContext.Request.ContentEncoding  = Encoding.GetEncoding("UTF-8");
                    ControllerContext.HttpContext.Response.ContentEncoding = Encoding.GetEncoding("UTF-8");
                    ControllerContext.HttpContext.Response.Charset         = "UTF-8";

                    // 文件上传后的保存路径
                    string url      = "~/UploadFiles/" + folder + "/" + DateTime.Now.ToString("yyyyMM") + "/";
                    string filePath = Server.MapPath(url);
                    DirectoryUtil.CreateDirectory(filePath);

                    string fileName      = Path.GetFileName(fileData.FileName); //原始文件名称
                    string fileExtension = Path.GetExtension(fileName);         //文件扩展名
                    //string saveName = Guid.NewGuid().ToString() + fileExtension; //保存文件名称
                    string saveName = DateTime.Now.Ticks + fileExtension;
                    fileData.SaveAs(filePath + saveName);
                    byte[] FileData   = ReadFileBytes(fileData);
                    double fileSize   = FileData.Length;
                    double fileSizeKB = fileSize / 1024;
                    fileSizeKB = Math.Round(fileSizeKB, 2);
                    string fSize = fileSizeKB + "KB";
                    string fullurl = url + saveName;
                    string imgpath = "", reportpath = "", filetype = "doc";
                    if (fileExtension.Contains("doc"))
                    {
                        reportpath = fullurl;
                        imgpath    = "";
                        filetype   = "doc";
                    }
                    else
                    {
                        reportpath = "";
                        imgpath    = fullurl;
                        filetype   = "image";
                    }
                    string strsql = "INSERT INTO t_SM_InfraredPic(PID,ChannelID,ChannelName,PositionName,ImgPath,ImgNameOld,FileSize,MaxTemp,MinTemp,ReportPath,CommitTime,NewnCCDW,NewnIRW,NewnIRH)VALUES(" + pid + "," + channelid + ",'" + channelname + "','" + positionName + "','" + imgpath + "','" + fileName + "','" + fSize + "'," + maxtemp + "," + mintemp + ",'" + reportpath + "',getdate()," + iNewnCCDW + "," + iNewnIRW + "," + iNewnIRH + ");";
                    strsql = strsql + "INSERT INTO t_cm_files([FileName],FilePath,FileType,FileSize,FileExtension,Modules,Fk_ID,FSource,MaxTemp,MinTemp,Remark,CommitUser,CommitTime)VALUES('" + fileName + "','" + fullurl + "','" + filetype + "','" + fSize + "','" + fileExtension + "','shuangshi',0,'pc'," + maxtemp + "," + mintemp + ",'双视上传','双视桌面版',getdate());";
                    bll.ExecuteStoreCommand(strsql, null);
                    return(Content("success"));
                }
                catch (Exception ex)
                {
                    //return Content(ex.ToString());
                    return(Content("false"));;
                }
            }
            else
            {
                return(Content("false"));
            }
        }
示例#7
0
        //确认所有配电房的报警
        public ActionResult DelAllPAlarm()
        {
            try
            {
                string PDRList = HomeController.GetPID(CurrentUser.UNITList);
                // string PDRList = CurrentUser.PDRList;
                if (!PDRList.Equals(""))
                {
                    string sSql = "update [t_AlarmTable_en] set AlarmState = 0,AlarmConfirm='已确认',UserName='******',ConfirmDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "' where PID in (" + PDRList + ") and AlarmConfirm='未确认' and AlarmState>0";
                    bll.ExecuteStoreCommand(sSql);

                    return(Content("报警已全部确认!"));
                }
                else
                {
                    return(Content("没有权限,报警未确认!"));
                }
            }
            catch (Exception ex)
            {
                string error = ex.ToString();
                return(Content("报警确认失败!"));
            }
        }
示例#8
0
        public ActionResult DeleteSupplierInfo(string supplierid)
        {
            string result = "OK";

            try
            {
                string strsql = "delete  from t_CM_SupplierInfo  where supplierid in (" + supplierid + ")";
                bll.ExecuteStoreCommand(strsql, null);
                Common.InsertLog("供应商管理", CurrentUser.UserName, "删除供应商信息[" + supplierid + "]");
            }
            catch (Exception ex)
            {
                result = "删除失败!";
            }
            return(Content(result));
        }
示例#9
0
        public ActionResult DeleteSparePartInfo(string sparepartid)
        {
            string result = "OK";

            try
            {
                string strsql = "delete  from t_CM_SparePartInfo  where SparePartID in (" + sparepartid + ")";
                bll.ExecuteStoreCommand(strsql, null);
                Common.InsertLog("备件管理", CurrentUser.UserName, "删除备件信息[" + sparepartid + "]");
            }
            catch (Exception ex)
            {
                result = "删除失败!";
            }
            return(Content(result));
        }
示例#10
0
文件: Global.asax.cs 项目: 123356/123
        private void sendAlarm(IDAO.Models.t_AlarmTable_en alarm)
        {
            int pid = (int)alarm.PID;
            //List<t_CM_UserInfo> userList = bll.ExecuteStoreQuery<t_CM_UserInfo>("SELECT * FROM t_CM_UserInfo WHERE (PDRList LIKE '" + pid + ",%' OR PDRList = '%," + pid + "' OR PDRList LIKE '%," + pid + ",%' OR PDRList = '" + pid + "')").ToList();

            IList <IDAO.Models.t_CM_Unit> unitlist = UnitDAL.getInstance().GetUnitListByPID(pid);

            if (unitlist.Count() > 0)
            {
                string uids = string.Empty;
                foreach (var item in unitlist)
                {
                    uids += item.UnitID + ",";
                }
                if (!string.IsNullOrEmpty(uids))
                {
                    uids = uids.Substring(0, uids.Length - 1);
                    IList <IDAO.Models.t_CM_UserInfo> userList = UserInfoDAL.getInstance().GetUsersByUnits(uids);
                    if (userList == null || userList.Count <= 0)
                    {
                        return;
                    }
                    for (int i = 0; i < userList.Count; i++)
                    {
                        if (userList[i].OpenAlarmMsg == 1)
                        {
                            //根据手机号查询该报警是否发过短信;
                            List <t_Alarm_SMS> sendedList = bll.ExecuteStoreQuery <t_Alarm_SMS>("SELECT * FROM t_Alarm_SMS WHERE mobilephone='" + userList[i].Mobilephone + "' AND alarmId=" + alarm.AlarmID).ToList();
                            if (sendedList == null || sendedList.Count <= 0)
                            {
                                UtilsSms.smsAlarm(userList[i].Mobilephone, alarm);
                                //INSERT INTO t_Alarm_SMS (alarmTime,alarmId,sendTime,mobilephone) VALUES ('2018-03-20 16:53:11',1522,'2018-03-20 16:53:11','15210091230')
                                string insert = "INSERT INTO t_Alarm_SMS (alarmTime,alarmId,sendTime,mobilephone) VALUES ('" + alarm.AlarmDateTime + "'," + alarm.AlarmID + ",'" + DateTime.Now.ToString() + "','" + userList[i].Mobilephone + "')";
                                bll.ExecuteStoreCommand(insert);
                            }
                        }
                    }
                }
            }
            //Debug.WriteLine(DateTime.Now.ToString() + ",alarm.PID=" + alarm.PID);//c#打印输出信息
        }
示例#11
0
文件: ExportExcel.cs 项目: 123356/123
        public static string doImport2003(DataSet tDS, int Mode)
        {
            StringBuilder Result     = new StringBuilder();
            string        TagIDs     = "";
            int           errorCount = 0;

            try
            {
                pdermsWebEntities bll = new pdermsWebEntities();

                //检验excel表格中的数据是否符合格式
                //检查列数是否与数据库一致
                if (tDS.Tables[0].Columns.Count == 42)
                {
                    for (int i = 0; i < tDS.Tables[0].Rows.Count; i++)
                    {
                        string MDate = tDS.Tables[0].Rows[i][1].ToString();
                        string Val   = tDS.Tables[0].Rows[i][2].ToString();
                        for (int j = 0; j < tDS.Tables[0].Columns.Count; j++)
                        {
                            //检查TagID
                            if (tDS.Tables[0].Rows[i][0].ToString() == "")
                            {
                                Result.Append("错误:第" + i + "列,缺少TagID。<br>");
                                errorCount++;
                            }
                            else
                            {
                                TagIDs += tDS.Tables[0].Rows[i][0].ToString() + ",";
                            }
                            //检查DID
                            if (tDS.Tables[0].Rows[i][2].ToString() == "")
                            {
                                Result.Append("错误:第" + i + "列,缺少DID。<br>");
                                errorCount++;
                            }

                            //检查实时库索引
                            if (tDS.Tables[0].Rows[i][14].ToString() == "")
                            {
                                Result.Append("错误:第" + i + "列,缺少实时库索引。<br>");
                                errorCount++;
                            }

                            //检查PID
                            if (tDS.Tables[0].Rows[i][15].ToString() == "")
                            {
                                Result.Append("错误:第" + i + "列,缺少PID。<br>");
                                errorCount++;
                            }
                        }
                    }
                }
                else
                {
                    Result.Append("错误:列数错误。\r");
                    errorCount++;
                }
                string pointSQL             = "SELECT * FROM t_CM_PointsInfo WHERE TagID in (" + TagIDs.TrimEnd(',') + ")";
                List <t_CM_PointsInfo> list = bll.ExecuteStoreQuery <t_CM_PointsInfo>(pointSQL).ToList();
                if (list.Count > 0)
                {
                    //覆盖模式下删除重复数据
                    if (Mode > 0)
                    {
                        list.ForEach(i =>
                        {
                            bll.AttachTo("t_CM_PointsInfo", i);
                            bll.t_CM_PointsInfo.DeleteObject(i);
                        });
                        bll.SaveChanges();
                    }
                    else
                    {
                        foreach (t_CM_PointsInfo p in list)
                        {
                            Result.Append("错误:数据库中已经存在 TagID = " + p.TagID + "的行。<br>");
                            errorCount++;
                        }
                    }
                }
                StringBuilder strSQL = new StringBuilder();
                if (errorCount < 1)
                {
                    //关闭标识
                    strSQL.Append("set IDENTITY_INSERT t_CM_PointsInfo ON ");
                    //插入数据库
                    for (int i = 0; i < tDS.Tables[0].Rows.Count; i++)
                    {
                        strSQL.Append("insert into t_CM_PointsInfo (TagID,TagName,DID,DataTypeID,Position,MPID,UseState,PIOID,ABCID,Remarks,数据类型,设备点名,中文描述,站内点号,实时库索引,PID,通信地址,例外报告死区,工程下限,工程上限,码值下限,码值上限,远动数据类型,报警下限1,报警上限1,报警定义,置0说明,置1说明,单位,分组,最大间隔时间,小信号切除值,报警下限2,报警上限2,报警下限3,报警上限3,报警死区,报警级别,报警方式,速率报警限制,初始值,传感器SN编码) ");
                        strSQL.Append("values ("
                                      + "" + tDS.Tables[0].Rows[i][0] + ","
                                      + "'" + tDS.Tables[0].Rows[i][1] + "',"
                                      + "" + tDS.Tables[0].Rows[i][2] + ","
                                      + "" + tDS.Tables[0].Rows[i][3] + ","
                                      + "'" + tDS.Tables[0].Rows[i][4] + "',"
                                      + "" + tDS.Tables[0].Rows[i][5] + ","
                                      + "" + tDS.Tables[0].Rows[i][6] + ","
                                      + "" + tDS.Tables[0].Rows[i][7] + ","
                                      + "" + tDS.Tables[0].Rows[i][8] + ","
                                      + "'" + tDS.Tables[0].Rows[i][9] + "',"
                                      + "'" + tDS.Tables[0].Rows[i][10] + "',"
                                      + "'" + tDS.Tables[0].Rows[i][11] + "',"
                                      + "'" + tDS.Tables[0].Rows[i][12] + "',"
                                      + "'" + tDS.Tables[0].Rows[i][13] + "',"
                                      + "" + tDS.Tables[0].Rows[i][14] + ","
                                      + "" + tDS.Tables[0].Rows[i][15] + ","
                                      + "" + tDS.Tables[0].Rows[i][16] + ","
                                      + "" + tDS.Tables[0].Rows[i][17] + ","
                                      + "" + tDS.Tables[0].Rows[i][18] + ","
                                      + "" + tDS.Tables[0].Rows[i][19] + ","
                                      + "" + tDS.Tables[0].Rows[i][20] + ","
                                      + "" + tDS.Tables[0].Rows[i][21] + ","
                                      + "'" + tDS.Tables[0].Rows[i][22] + "',"
                                      + "" + tDS.Tables[0].Rows[i][23] + ","
                                      + "" + tDS.Tables[0].Rows[i][24] + ","
                                      + "" + tDS.Tables[0].Rows[i][25] + ","
                                      + "'" + tDS.Tables[0].Rows[i][26] + "',"
                                      + "'" + tDS.Tables[0].Rows[i][27] + "',"
                                      + "'" + tDS.Tables[0].Rows[i][28] + "',"
                                      + "" + tDS.Tables[0].Rows[i][29] + ","
                                      + "" + tDS.Tables[0].Rows[i][30] + ","
                                      + "" + tDS.Tables[0].Rows[i][31] + ","
                                      + "" + tDS.Tables[0].Rows[i][32] + ","
                                      + "" + tDS.Tables[0].Rows[i][33] + ","
                                      + "" + tDS.Tables[0].Rows[i][34] + ","
                                      + "" + tDS.Tables[0].Rows[i][35] + ","
                                      + "" + tDS.Tables[0].Rows[i][36] + ","
                                      + "" + tDS.Tables[0].Rows[i][37] + ","
                                      + "" + tDS.Tables[0].Rows[i][38] + ","
                                      + "" + tDS.Tables[0].Rows[i][39] + ","
                                      + "" + tDS.Tables[0].Rows[i][40] + ","
                                      + "'" + tDS.Tables[0].Rows[i][41] + "')");
                    }
                    strSQL.Append("set IDENTITY_INSERT t_CM_PointsInfo OFF");
                    bll.ExecuteStoreCommand(strSQL.ToString());
                    Result.Append("OK");
                }
                return(Result.ToString());
            }
            catch (Exception e)
            {
                string a = e.ToString();
                return(a);
            }
        }
示例#12
0
 /// <summary>
 /// 删除文件
 /// </summary>
 /// <param name="id">文件主键列表</param>
 public void DeleteFile(string id)
 {
     string strsql  = "delete from t_cm_files where ID in (" + id + ")";
     int    docount = bll.ExecuteStoreCommand(strsql, null);
 }