예제 #1
0
        public static SiteInDataloggerModel DataLoggerRecord(String ClientID, String SiteId)
        {
            //  List<string> stusection = new List<string>();
            //   stusection = GetSectionList();

            //  SelectList objsection = new SelectList(stusection);
            //  SelectList objcommunication = new SelectList(stusection);

            SelectList objcommunication = new SelectList(BAL.CommunicationModel.CommunicationDropDownList(), "Value", "Text");
            SiteInDataloggerModel _objmodel = new SiteInDataloggerModel();
            _objmodel.loggerList = new List<SiteInDataloggerMapClass>();

               // IEnumerable<DAL.DataLoggerlist> list = DAL.DALDataLogger.DataLoggerRecordList();
            IEnumerable<DAL.SiteInDataLoggerList> list = DAL.DALSite.SiteInDataLoggerRecordList(ClientID, SiteId);
            foreach (var item in list)
            {
                _objmodel.loggerList.Add(new SiteInDataloggerMapClass { Serial = item.SerialNumber, LoggerID = item.LoggerID, SectionMethod = new SelectList(BAL.CommunicationModel.CommunicationDropDownList(), "Value", "Text", item.CommunicationID), IsSelect = Convert.ToBoolean(item.IsSelect), Assign = item.AssignDate, Release = item.ReleaseDate });

            }
            return _objmodel;
        }
예제 #2
0
        public static XmlDocument CreateBatchInterestXml(SiteInDataloggerModel objlogger, String[] checkbox)
        {
            XmlDocument xDoc = new XmlDocument();

            try
            {

                List<SiteInDataloggerMapClass> loggerList = objlogger.loggerList;

                XmlNode nodeRoot = xDoc.CreateNode(XmlNodeType.Element, "ROOT", null);
                xDoc.AppendChild(nodeRoot);

                if (loggerList != null)
                {
                    XmlNode nodeRows = xDoc.CreateNode(XmlNodeType.Element, "ROWS", null);
                    nodeRoot.AppendChild(nodeRows);

                    for (int i = 0; i < loggerList.Count; i++)
                    {
                        SiteInDataloggerMapClass objLogger = loggerList[i];

                        if (Array.IndexOf(checkbox, objLogger.LoggerID) > -1)
                        {

                            XmlNode nodeRow = xDoc.CreateNode(XmlNodeType.Element, "ROW", null);
                            nodeRows.AppendChild(nodeRow);

                            XmlNode nodeLoggerID = xDoc.CreateNode(XmlNodeType.Element, "LoggerID", null);
                            nodeLoggerID.InnerText = Convert.ToString(objLogger.LoggerID);
                            nodeRow.AppendChild(nodeLoggerID);

                            XmlNode nodeCommunicationID = xDoc.CreateNode(XmlNodeType.Element, "CommunicationID", null);
                            nodeCommunicationID.InnerText = Convert.ToString(objLogger.MethodSection);
                            nodeRow.AppendChild(nodeCommunicationID);

                            XmlNode nodeStartDate = xDoc.CreateNode(XmlNodeType.Element, "StartDate", null);
                            nodeStartDate.InnerText = objLogger.Assign !=null ? Common.DateGB(objLogger.Assign).ToString("yyyy/MM/dd"): null;
                            nodeRow.AppendChild(nodeStartDate);

                            XmlNode nodeEnddate = xDoc.CreateNode(XmlNodeType.Element, "Enddate", null);
                            nodeEnddate.InnerText = objLogger.Release != null ?Common.DateGB(objLogger.Release).ToString("yyyy/MM/dd"):null;
                            nodeRow.AppendChild(nodeEnddate);

                        }

                    }
                }

            }
            catch (Exception ex)
            { throw; }

            return xDoc;
        }