示例#1
0
        public bool updatemanageHostDao(bean.manageHose mh)
        {
            int    ret = 0;
            String sql = "update lb_managehost_info set hostName='" + mh.hostName + "',hostAddress='" + mh.hostAddress + "',CommunicationType='" + mh.CommunicationType + "',serialPort='" + mh.serialPort + "',portNumber='" + mh.portNumber + "',storeType='" + mh.storeType + "',houseType='" + mh.houseType + "',tcp_ip_Port='" + mh.tcp_ip_Port + "',networkType='" + mh.networkType + "',RecordM='" + mh.RecordM + "',WarningM='" + mh.WarningM + "',PhoneNo='" + mh.PhoneNo + "',State='" + mh.State + "' where measureCode = '" + mh.measureCode + "'";

            ret = DbHelperMySQL.ExecuteSql(sql);
            return(ret == 0 ? false : true);
        }
示例#2
0
        public bool updateDeviceInformationDao(bean.manageHose mh)
        {
            int    ret = 0;
            String sql = "update lb_device_information set house_code='" + mh.houseType + "' where measureCode = '" + mh.measureCode + "'";

            ret = DbHelperMySQL.ExecuteSql(sql);
            return(ret == 0 ? false : true);
        }
示例#3
0
        public bool addmanageHostDao(bean.manageHose mh)
        {
            string time      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string id        = Result.GetNewId();
            int    measureNo = System.Math.Abs(id.GetHashCode());

            measureNo = Int32.Parse(measureNo.ToString().Substring(0, 5));
            int    ret = 0;
            String sql = "insert into lb_managehost_info (id,measureCode,hostName,hostAddress,CommunicationType,serialPort,portNumber,storeType,createTime,houseType,measureNo,tcp_ip_Port,networkType,RecordM,WarningM,PhoneNo,State) values ('" + id + "','" + mh.measureCode + "', '" + mh.hostName + "', '" + mh.hostAddress + "', '" + mh.CommunicationType + "', '" + mh.serialPort + "', '" + mh.portNumber + "', '" + mh.storeType + "', '" + time + "', '" + mh.houseType + "','" + measureNo + "','" + mh.tcp_ip_Port + "','" + mh.networkType + "','" + mh.RecordM + "','" + mh.WarningM + "','" + mh.PhoneNo + "','" + mh.State + "');alter table data_home add partition(PARTITION p" + measureNo + " VALUES in(" + measureNo + "))";

            ret = DbHelperMySQL.ExecuteSql(sql);
            return(ret == 0 ? false : true);
        }
示例#4
0
        public bool updateManageHostCdNum(bean.manageHose mh)
        {
            int    ret = 0;
            int    cd  = 0;
            String sql = "SELECT count(1) FROM lb_device_information where measureCode='" + mh.measureCode + "'";

            ret = DbHelperMySQL.ExecuteSql(sql);
            if (ret > 0)
            {
                string sql1 = "update lb_managehost_info set portNumber='" + ret.ToString() + "',State=1 where measureCode = '" + mh.measureCode + "'";
                cd = DbHelperMySQL.ExecuteSql(sql1);
            }
            return(cd == 0 ? false : true);
        }
 public bool updateManageHostCdNum(bean.manageHose mh)
 {
     return(manageHost.updateManageHostCdNum(mh));
 }
 public bool updateManageHost(bean.manageHose mh)
 {
     return(manageHost.updatemanageHostDao(mh));
 }
 public bool addManageHost(bean.manageHose mh)
 {
     return(manageHost.addmanageHostDao(mh));
 }
示例#8
0
        public bool addDeviceInformationDao(bean.manageHose hm)
        {
            string id;
            string id0;
            int    flag = 0;
            string wd1  = "35.0";
            string wd2  = "0.0";
            string sd1  = "75.0";
            string sd2  = "35.0";
            string cd   = null;
            string m    = null;
            int    ret  = 0;
            String sql  = "insert into lb_device_information (id,measureCode,meterNo,terminalname,house_code,housetype,t_high,t_low,h_high,h_low,powerflag,createtime,State) values ";
            String sql0 = "insert into lb_base_data_home (id,measureCode,meterNo,devtime,temperature,humidity,lng,lat,createDate,warnState,sign,measureMeterCode,warningistrue,carinterval,houseinterval,mcc,measureNo) values ";

            int    num  = Int32.Parse(hm.portNumber);
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            for (int j = 0; j < num; j++)
            {
                if (j < 10)
                {
                    if (hm.CommunicationType == "串口通讯协议" || hm.CommunicationType == "TCP协议" || hm.CommunicationType == "云平台协议-01")
                    {
                        if (j + 1 == 10)
                        {
                            m = (j + 1).ToString();
                        }
                        else
                        {
                            m = "0" + (j + 1).ToString();
                        }
                    }
                    else
                    {
                        if (hm.CommunicationType == "云平台协议-00")
                        {
                            if (num == 1)
                            {
                                m = "00";
                            }
                            else
                            {
                                m = "0" + j.ToString();
                            }
                        }
                    }
                    cd += hm.hostName + "-" + m;
                }
                else
                {
                    if (hm.CommunicationType == "串口通讯协议" || hm.CommunicationType == "TCP协议" || hm.CommunicationType == "云平台协议-01")
                    {
                        m = (j + 1).ToString();
                    }
                    else
                    {
                        m = j.ToString();
                    }
                    cd += hm.hostName + "-" + m;
                }
                id  = Result.GetNewId();
                id0 = Result.GetNewId();
                int measureNo = System.Math.Abs(id.GetHashCode());
                measureNo = Int32.Parse(measureNo.ToString().Substring(0, 5));
                if (j > 0)
                {
                    sql  += " ,('" + id + "','" + hm.measureCode + "', '" + m + "', '" + cd + "','" + hm.houseType + "', '" + 0 + "', '" + wd1 + "', '" + wd2 + "', '" + sd1 + "', '" + sd2 + "', '" + flag + "', '" + time + "', '" + hm.State + "')";
                    sql0 += " , ('" + id0 + "','" + hm.measureCode + "', '" + m + "','" + time + "','0.0','0.0','','','" + time + "','','',CONCAT('" + hm.measureCode + "', '_', '" + m + "'),'','','','0','" + measureNo + "')";
                }
                else
                {
                    sql  += "('" + id + "','" + hm.measureCode + "', '" + m + "', '" + cd + "','" + hm.houseType + "', '" + 0 + "', '" + wd1 + "', '" + wd2 + "', '" + sd1 + "', '" + sd2 + "', '" + flag + "', '" + time + "', '" + hm.State + "')";
                    sql0 += "('" + id0 + "','" + hm.measureCode + "', '" + m + "','" + time + "','0.0','0.0','','','" + time + "','','',CONCAT('" + hm.measureCode + "', '_', '" + m + "'),'','','','0','" + measureNo + "')";
                }
                cd = null;
            }
            ret = DbHelperMySQL.ExecuteSql(sql);
            if (ret > 0)
            {
                ret = DbHelperMySQL.ExecuteSql(sql0);
            }


            return(ret == 0 ? false : true);
        }
 public bool updateDeviceInformation(bean.manageHose hm)
 {
     return(deviceinfo.updateDeviceInformationDao(hm));
 }
 public bool addDeviceInformation(bean.manageHose hm)
 {
     return(deviceinfo.addDeviceInformationDao(hm));
 }