Ejemplo n.º 1
0
        private static void GetRainMeasurements()
        {
            var timeBetweenMeasurements = new TimeSpan(0, 0, 1, 0);
            var publicDataService       = new PublicDataService(_authenticationToken, new HttpWrapper());

            var boundry = GetLocationBoundry();

            Console.WriteLine("Count\tWith gauge\tWith Rain\tAverage\tMin\tMax\t");
            do
            {
                if (_authenticationToken.IsCloseToExpiry())
                {
                    RefreshToken();
                }

                // Get the public data
                PublicData publicData = publicDataService.Get(boundry).Result;

                // The total number of stations returned in the geographic area.
                int totalNumberOfStations = publicData.Stations.Count();
                Trace.WriteLine("Total number of stations: " + totalNumberOfStations);

                // The stations that have a rain gauge.
                var rainStations = GetStationsWithRainSensors(publicData);
                int numberOfStationsWithRainGauge = rainStations.Count();
                Trace.WriteLine("Number of stations with rain gauge: " + numberOfStationsWithRainGauge);

                // Stations where the rain gauge is reporting a level above the threshold.
                var stationsWithRain = rainStations.Where(x => x.Value > RainingThreshold).ToList();

                ShowComputedStatistics(totalNumberOfStations, numberOfStationsWithRainGauge, stationsWithRain);

                WaitForNextMeasurementTime(timeBetweenMeasurements);
            } while (!CancellationToken.IsCancellationRequested);
        }
Ejemplo n.º 2
0
        private static void GetRainMeasurements()
        {
            var timeBetweenMeasurements = new TimeSpan(0, 0, 1, 0);
            var publicDataService       = new PublicDataService(_authenticationToken);

            double latitute  = Convert.ToDouble(ConfigurationManager.AppSettings["Latitude"]);
            double longitude = Convert.ToDouble(ConfigurationManager.AppSettings["Longitude"]);

            var             center  = new LatLongPoint(latitute, longitude);
            LocationBoundry boundry = LocationBoundry.ComputeBoundry(center);

            Console.WriteLine("Count\tWith gauge\tWith Rain\tAverage\tMin\tMax\t");
            do
            {
                // Get the public data
                PublicData publicData = publicDataService.Get(boundry);

                // The total number of stations returned in the geographic area.
                int totalNumberOfStations = publicData.Stations.Count();

                // The stations that have a rain gauge.
                var rainStations = GetStationsWithRainSensors(publicData);
                int numberOfStationsWithRainGauge = rainStations.Count();

                // Stations where the rain gauge is reporting a level above the threshold.
                var stationsWithRain = rainStations.Where(x => x.Value > RainingThreshold).ToList();

                ShowComputedStatistics(totalNumberOfStations, numberOfStationsWithRainGauge, stationsWithRain);

                WaitForNextMeasurementTime(timeBetweenMeasurements);
            } while (!CancellationToken.IsCancellationRequested);
        }
Ejemplo n.º 3
0
    void Paint()
    {
        Transform CurrentSelect = Selection.activeTransform;
        //MeshFilter temp = CurrentSelect.GetComponent<MeshFilter>();//获取当前模型的MeshFilter
        Terrain temp             = CurrentSelect.GetComponent <Terrain>();
        float   orthographicSize = (brushSize * CurrentSelect.localScale.x) * (temp.terrainData.size.x / 200); //笔刷在模型上的正交大小
        bool    ToggleF          = false;
        Event   e = Event.current;                                                                             //检测输入

        HandleUtility.AddDefaultControl(0);
        RaycastHit raycastHit = new RaycastHit();
        Ray        terrain    = HandleUtility.GUIPointToWorldRay(e.mousePosition);                           //从鼠标位置发射一条射线

        if (Physics.Raycast(terrain, out raycastHit, Mathf.Infinity, 1 << LayerMask.NameToLayer("terrain"))) //射线检测名为"terrain"的层
        {
            Handles.color = new Color(0.3f, 1f, 0.1f, 0.02f);                                                //颜色
            Handles.DrawSolidDisc(raycastHit.point, raycastHit.normal, orthographicSize);
            //鼠标点击或按下并拖动进行绘制
            if ((e.type == EventType.mouseDrag && e.alt == false && e.control == false && e.shift == false && e.button == 0) || (e.type == EventType.MouseDown && e.shift == false && e.alt == false && e.control == false && e.button == 0 && ToggleF == false))
            {
                Vector2 RowColum = PublicData.GetRowAndColumn(raycastHit.point);
                PublicData.AddTrees(raycastHit.point, TreeType);
                //Undo.RegisterCompleteObjectUndo(MaskTex, "meshPaint");//保存历史记录以便撤销
                ToggleF = true;
            }
            else if (e.type == EventType.mouseUp && e.alt == false && e.button == 0 && ToggleF == true)
            {
                ToggleF = false;
            }
        }
    }
        public override int GetHashCode()
        {
            int hash = 1;

            if (PlayerId.Length != 0)
            {
                hash ^= PlayerId.GetHashCode();
            }
            if (Codename.Length != 0)
            {
                hash ^= Codename.GetHashCode();
            }
            if (PublicData.Length != 0)
            {
                hash ^= PublicData.GetHashCode();
            }
            if (Team.Length != 0)
            {
                hash ^= Team.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 5
0
        // GET: Public
        public ActionResult Index()
        {
            PublicData data = new PublicData();

            data.subj    = db.Subjects.ToList();
            data.pg      = db.Pages.ToList();
            data.content = db.Contents.ToList();

            return(View(data));
        }
Ejemplo n.º 6
0
 public GameHouse()
 {
     HostPublicData    = new PublicData();
     HostPrivateData   = new PrivateData();
     HostDispatcher    = new Dispatcher();
     ClientDatas       = new List <PrivateData>(2);
     ClientDispatchers = new List <Dispatcher>(2);
     Host = new GameHost(new HostData(HostPublicData, HostPrivateData, ClientDatas),
                         new HostDispatcher(HostDispatcher, ClientDispatchers));
     Clients   = new List <GameClient>(2);
     Observers = new List <GameObserver>();
 }
Ejemplo n.º 7
0
        private static IList <SensorMeasurement> GetStationsWithRainSensors(PublicData publicData)
        {
            IList <SensorMeasurement> rainStations = new List <SensorMeasurement>();

            foreach (var station in publicData.Stations)
            {
                var rainMeasurement = station.Measurements.FirstOrDefault(y => y is RainMeasurement);
                if (rainMeasurement != null)
                {
                    rainStations.Add(rainMeasurement);
                }
            }
            return(rainStations);
        }
Ejemplo n.º 8
0
        public List <PublicData> GetPublicData()
        {
            var datas      = _dbContext.PublicDatas.ToList();
            var dataResalt = new List <PublicData>();

            foreach (var data in datas)
            {
                var mapedData = new PublicData {
                    Data = data.Data
                };
                dataResalt.Add(mapedData);
            }

            return(dataResalt);
        }
Ejemplo n.º 9
0
        [TestCase(49.281974, -123.117857)] // Vancouver, BC, Canada
        public void DifferentLocations(double latitute, double longitude)
        {
            // Arrange
            var publicDataService = new PublicDataService(_authenticationToken, new HttpWrapper());

            var             center  = new LatLongPoint(latitute, longitude);
            LocationBoundry boundry = LocationBoundry.ComputeBoundry(center, 10);

            // Act
            PublicData publicData = publicDataService.Get(boundry).Result;

            // Assert
            Assert.IsNotNull(publicData);

            ShowStationInfo(publicData.Stations, center);
            ShowRainInfo(publicData);
        }
Ejemplo n.º 10
0
    void Update()
    {
        if (AudioManager.Instance.IsAudioHost)
        {
            return;
        }
        if (PublicData.ActiveInstancePID == Snapper.PID)
        {
        }

        var currentStage = PublicData.GameStage;

        if (!sceneLoaded)
        {
            var others    = SharedMemory.Others.Select(page => page.ReadInt32(GameDataAddr.PID)).ToList();
            var stageData = GameStages[currentStage];
            for (int i = 0; i < stageData.Scenes.Count; i++)
            {
                var scenePID = PublicData.GetScenePID(i);
                if (!others.Any(pid => pid == scenePID))
                {
                    SceneManager.LoadScene(stageData.Scenes[i], LoadSceneMode.Single);
                    PublicData.SetScenePID(i, Snapper.PID);
                    PublicData.Flush();
                    break;
                }
            }
            sceneLoaded = true;
        }
        else if (PublicData.ActiveInstancePID == Snapper.PID)
        {
            var pos  = GameSystem.Instance.Player.transform.position.ToVector2Int().ToVector3Int();
            var tile = GameMap.Instance.RuntimeMap.GetTile(pos);
            if (tile is GemTile)
            {
                GameMap.Instance.SetBaseTileAt(pos.x, pos.y, null);
                GameMap.Instance.RuntimeMap.SetTile(pos, null);
                AudioManager.Instance.GetGem();

                Debug.LogError("Level complete.");
                PublicData.GameStage++;
                PublicData.Flush();
            }
        }
    }
Ejemplo n.º 11
0
        public KrakenExchange(KrakenConfig config, TranslatedSignalsRepository translatedSignalsRepository, IHandler <TickPrice> tickPriceHandler, IHandler <ExecutionReport> tradeHandler, ILog log) :
            base(Name, config, translatedSignalsRepository, log)
        {
            this.config       = config;
            _tickPriceHandler = tickPriceHandler;
            _tradeHandler     = tradeHandler;

            var httpClient = new HttpClient()
            {
                Timeout = TimeSpan.FromSeconds(3)
            };                                                                       // TODO: HttpClient have to be Singleton

            publicData  = new PublicData(new ApiClient(httpClient, log));
            privateData = new PrivateData(new ApiClient(new HttpClient()
            {
                Timeout = TimeSpan.FromSeconds(30)
            }, log), config.ApiKey, config.PrivateKey,
                                          new NonceProvider(), Config.SupportedCurrencySymbols);
        }
Ejemplo n.º 12
0
        private void ShowRainInfo(PublicData publicData)
        {
            IList <SensorMeasurement> rainStations = new List <SensorMeasurement>();

            foreach (var station in publicData.Stations)
            {
                var rainMeasurement = station.Measurements.FirstOrDefault(y => y is RainMeasurement);
                if (rainMeasurement != null)
                {
                    rainStations.Add(rainMeasurement);
                }
            }

            Trace.WriteLine("All Stations: ");
            ShowComputedStatistics(rainStations);

            Trace.WriteLine("Stations with Rain: ");
            var stationsWithRain = rainStations.Where(x => x.Value > 0.1M).ToList();

            ShowComputedStatistics(stationsWithRain);
        }
Ejemplo n.º 13
0
        public void GetPublicData()
        {
            // Arrange
            var publicDataService = new PublicDataService(_authenticationToken, new HttpWrapper());

            // home
            double latitute  = Convert.ToDouble(ConfigurationManager.AppSettings["Latitude"]);
            double longitude = Convert.ToDouble(ConfigurationManager.AppSettings["Longitude"]);

            var             center  = new LatLongPoint(latitute, longitude);
            LocationBoundry boundry = LocationBoundry.ComputeBoundry(center, 10);

            // Act
            PublicData publicData = publicDataService.Get(boundry).Result;

            // Assert
            Assert.IsNotNull(publicData);

            ShowStationInfo(publicData.Stations, center);

            ShowRainInfo(publicData);
        }
Ejemplo n.º 14
0
        public ActionResult SubjectPage(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Page page = db.Pages.Find(id);

            if (page == null)
            {
                return(HttpNotFound());
            }

            PublicData data = new PublicData();

            data.subj    = db.Subjects.ToList();
            data.pg      = db.Pages.ToList();
            data.pageObj = page;
            data.content = db.Contents.ToList();


            return(View(data));
        }
Ejemplo n.º 15
0
    protected override void Awake()
    {
        Snapper.SnapWhileMoving = false;

        // Setup logger callbacks
        WindowSnap.Logger.LogError     = msg => Debug.LogError(msg);
        WindowSnap.Logger.LogWarn      = msg => Debug.LogWarning(msg);
        WindowSnap.Logger.LogInfo      = msg => Debug.Log(msg);
        WindowSnap.Logger.LogException = ex => Debug.LogException(ex);
        WindowSnap.Logger.Ready();

        WindowSnap.Snapper.SnapWhileMoving = false;


        if (SharedMemory.Others.Count == 0)
        {
            PublicData.GameStage         = 0;
            PublicData.ActiveInstancePID = Snapper.PID;
            PublicData.Flush();
        }

        Debug.Log($"PID = {Snapper.PID}");
    }
Ejemplo n.º 16
0
        public void GetPublicData()
        {
            // Arrange
            var publicDataService = new PublicDataService(_authenticationToken);

            double latitute  = Convert.ToDouble(ConfigurationManager.AppSettings["Latitude"]);
            double longitude = Convert.ToDouble(ConfigurationManager.AppSettings["Longitude"]);

            var             center  = new LatLongPoint(latitute, longitude);
            LocationBoundry boundry = LocationBoundry.ComputeBoundry(center);

            // Act
            PublicData publicData = publicDataService.Get(boundry);

            // Assert
            Assert.IsNotNull(publicData);


            IList <SensorMeasurement> rainStations = new List <SensorMeasurement>();

            foreach (var station in publicData.Stations)
            {
                var rainMeasurement = station.Measurements.FirstOrDefault(y => y is RainMeasurement);
                if (rainMeasurement != null)
                {
                    rainStations.Add(rainMeasurement);
                }
            }

            Trace.WriteLine("All Stations: ");
            ShowComputedStatistics(rainStations);

            Trace.WriteLine("Stations with Rain: ");
            var stationsWithRain = rainStations.Where(x => x.Value > 0.1M).ToList();

            ShowComputedStatistics(stationsWithRain);
        }
Ejemplo n.º 17
0
 private static List <PublicDataStation> GetStationsWithWindSensors(PublicData publicData)
 {
     return(publicData.Stations.Where(x => x.HasWindGauge()).ToList());
 }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            var d = new PublicData();

            d.PublicItem = 1000;
        }
Ejemplo n.º 19
0
 internal ClientData(PublicData pubdata, PrivateData pridata)
 {
     PublicData  = pubdata;
     PrivateData = pridata;
 }
 public string this[PublicData index]
 {
     get { return(_inner[(int)index]); }
     set { _inner[(int)index] = value; }
 }
 public static int Val(this PublicData en)
 {
     return((int)en);
 }
Ejemplo n.º 22
0
 public IdexRestApi()
 {
     publicData = new PublicData(this);
 }
Ejemplo n.º 23
0
 internal ObserverData(PublicData publicData)
 {
     PublicData = publicData;
 }
Ejemplo n.º 24
0
 public HitBtcRestApi()
 {
     PublicData = new PublicData(this);
     Trade      = new Trade(this);
     Account    = new Account(this);
 }
Ejemplo n.º 25
0
    public void GetList(HtmlGenericControl thead1, HtmlGenericControl con1, string tablename, DataTable dts, int type)
    {
        PublicClass pc    = new PublicClass();
        string      ctext = pc.GetLanguageColumn();
        string      h     = "";
        PublicData  pd    = new PublicData();

        sSQL = "select * from  _TableColInfo where  TABLE_NAME in ('" + tablename + "') and (COLUMN_Text<>'' or ShowCol<>'') and VisibleIndex is not null order by VisibleIndex";
        DataTable    dt     = clsSQLCommond.ExecQuery(sSQL);
        HtmlTableRow twbody = new HtmlTableRow();

        h = "<tr>";
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string coltext = "";
            if (dt.Rows[i]["ShowCol"].ToString().Trim() != "")
            {
                coltext = dt.Rows[i]["ShowCol"].ToString();
            }
            else
            {
                coltext = dt.Rows[i]["COLUMN_Text"].ToString();
            }
            h = h + "<th>" + coltext + "</th>";
        }
        if (tablename == "Inventory")
        {
            h = h + "<th>库存</th>";
        }
        if (type == 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string ColLink = dt.Rows[i]["ColLink"].ToString();
                if (ColLink != "")
                {
                    string[] spl = ColLink.Split('/');
                    for (int j = 0; j < spl.Length; j++)
                    {
                        h = h + "<th></th>";
                    }
                }
            }
        }

        h = h + "</tr>";

        Literal hc = new Literal();

        hc.Text = h;
        thead1.Controls.Add(hc);
        string l = "";

        for (int i = 0; i < dts.Rows.Count; i++)
        {
            string linkl = "";
            l = l + "<tr>";
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                string value = "";
                value = dts.Rows[i][dt.Rows[j]["COLUMN_NAME"].ToString()].ToString();
                switch (dt.Rows[j]["ColType"].ToString())
                {
                case "":
                    switch (dt.Rows[j]["UpdateType"].ToString().Trim())
                    {
                    case "date":
                        if (value != "")
                        {
                            value = DateTime.Parse(value).ToString("yyyy-MM-dd");
                        }
                        break;

                    case "date2":
                        if (value != "")
                        {
                            value = DateTime.Parse(value).ToString("yyyy-MM-dd HH:mm");
                        }
                        break;

                    case "select":
                        switch (dt.Rows[j]["ColSel"].ToString())
                        {
                        case "LookUpData":
                            string iType = dt.Rows[j]["ColSelFlag"].ToString();
                            if (iType != "")
                            {
                                value = pd.GetLookUpData(iType, value);
                            }
                            break;

                        case "LookUpType":
                            value = pd.GetLookUpType(value);
                            break;

                        default:
                            value = "";
                            break;
                        }
                        break;

                    default:
                        break;
                    }
                    l = l + "<td>" + value + "</td>";
                    break;

                case "a":
                    l = l + "<td>" + value + "</td>";
                    break;

                default:
                    l = l + "<td>" + value + "</td>";
                    break;
                }
            }
            if (tablename == "Inventory")
            {
                l = l + "<td>" + dts.Rows[i]["库存"].ToString() + "</td>";
            }
            if (type == 0)
            {
                for (int p = 0; p < dt.Rows.Count; p++)
                {
                    string ColLink     = dt.Rows[p]["ColLink"].ToString();
                    string ColLinkID   = dt.Rows[p]["ColLinkID"].ToString();
                    string ColLinkText = dt.Rows[p]["ColLinkText"].ToString();
                    if (ColLink != "")
                    {
                        string[] spl     = ColLink.Split('/');
                        string[] splid   = ColLinkID.Split('/');
                        string[] spltext = ColLinkText.Split('/');

                        for (int q = 0; q < spl.Length; q++)
                        {
                            linkl = linkl + "<td><a  href='";
                            string[] spls   = spl[q].Split(',');
                            string[] splids = splid[q].Split(',');
                            for (int w = 0; w < spls.Length; w++)
                            {
                                if (w != 0)
                                {
                                    linkl = linkl + "&";
                                }
                                linkl = linkl + spls[w] + "=" + dts.Rows[i][splids[w]].ToString();
                            }
                            linkl = linkl + "'>" + spltext[q] + "</a></td>";
                        }
                    }
                }
            }



            l = l + linkl + "</tr>";
        }

        Literal lc = new Literal();

        lc.Text = l;
        con1.Controls.Add(lc);
    }
Ejemplo n.º 26
0
    private void LateUpdate()
    {
        if (!EnableSnap)
        {
            return;
        }

        if (SelfData.IsActiveInstance)
        {
            if (!isPreviousActive)
            {
                var player = GameSystem.Instance.Player;
                player.gameObject.SetActive(true);
                player.EnableControl      = true;
                player.transform.position = player.transform.position + Vector3.up * 0.005f;
                isPreviousActive          = true;
            }

            var viewportRect      = CameraManager.Instance.ViewportTileRect;
            var pos               = GameSystem.Instance.Player.transform.position.ToVector2();
            var viewportTilePos   = GameSystem.Instance.Player.transform.position - viewportRect.min.ToVector3();
            var largeViewportRect = viewportRect;
            largeViewportRect.min = viewportRect.min - Vector2Int.one;
            largeViewportRect.max = viewportRect.max + Vector2Int.one;
            if (!largeViewportRect.Contains(pos))
            {
                var relativePos = pos - viewportRect.min;

                var nextActive = AttachedInstances
                                 .Select(p => AttachedData[p])
                                 .Where(attachedData => attachedData.RelativeTileRect.Contains(relativePos))
                                 .FirstOrDefault();

                if (nextActive is null)
                {
                    Debug.LogError($"Missing attached instance contains {pos}");
                }
                else
                {
                    var instanceData = GetGameData(nextActive.PID);

                    instanceData.IsActiveInstance = true;
                    instanceData.Flush();

                    PublicData.ActiveInstancePID = nextActive.PID;
                    PublicData.Flush();

                    SelfData.IsActiveInstance = false;
                    SelfData.Flush();
                }
            }
        }
        else if (SelfData.ConnectActiveThrough != 0)
        {
            isPreviousActive = false;
            GameSystem.Instance.Player.gameObject.SetActive(true);
            GameSystem.Instance.Player.EnableControl = false;

            var activePID      = PublicData.ActiveInstancePID;
            var activeInstance = GetGameData(activePID);

            var pos      = activeInstance.PlayerPosition;
            var velocity = activeInstance.PlayerVelocity;

            pos -= activeInstance.ViewRect.min;
            pos -= SelfData.TileOffsetToActiveInstance;
            pos += CameraManager.Instance.ViewportTileRect.min;

            SelfData.PlayerPosition = pos;
            SelfData.PlayerVelocity = velocity;
            SelfData.Flush();

            GameSystem.Instance.Player.SetPositionVelocity(pos, velocity);

            //Debug.LogError($"Sync from active instance {activePID}");
        }
        else
        {
            isPreviousActive = false;
            GameSystem.Instance.Player.gameObject.SetActive(false);
            GameSystem.Instance.Player.EnableControl = false;
        }
    }
Ejemplo n.º 27
0
 public BistoxRestApi()
 {
     PublicData = new PublicData(this);
 }
Ejemplo n.º 28
0
    public void GetUpdate(HtmlTable TableUpdate1, string tablename, DataTable dts, string bCol, bool bRed, bool bNew)
    {
        PublicClass   pc    = new PublicClass();
        string        ctext = pc.GetLanguageColumn();
        string        h     = "";
        PublicData    pd    = new PublicData();
        ControlsClass cc    = new ControlsClass();

        sSQL = "select * from  _TableColInfo where  TABLE_NAME in ('" + tablename + "')  order by UpdateVisibleIndex";
        DataTable dt = clsSQLCommond.ExecQuery(sSQL);
        bool      b  = true;

        if (dts == null || dts.Rows.Count == 0)
        {
            b = false;
        }
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (Session["uID"].ToString() == "游客" && tablename == "CW" && (dt.Rows[i]["COLUMN_NAME"].ToString() == "Date2" || dt.Rows[i]["COLUMN_NAME"].ToString() == "Date3" || dt.Rows[i]["COLUMN_NAME"].ToString() == "S6"))
            {
                continue;
            }
            HtmlTableRow tw = new HtmlTableRow();
            if (dt.Rows[i]["UpdateVisibleIndex"].ToString().Trim() == "")
            {
                tw.Style.Add("display", "none");
            }
            string coltext = "";
            if (dt.Rows[i]["ShowCol"].ToString().Trim() != "")
            {
                coltext = dt.Rows[i]["ShowCol"].ToString();
            }
            else
            {
                coltext = dt.Rows[i]["COLUMN_Text"].ToString();
            }
            if (dt.Rows[i]["IsInput"].ToString() == "*")
            {
                coltext = "<label id='lbltitle_" + dt.Rows[i]["COLUMN_NAME"].ToString() + "'>" + coltext + "</label><label id='lblisinput_" + dt.Rows[i]["COLUMN_NAME"].ToString() + "'>*</label>";
            }
            else
            {
                coltext = "<label id='lbltitle_" + dt.Rows[i]["COLUMN_NAME"].ToString() + "'>" + coltext + "</label>";
            }
            HtmlTableCell tclabel = new HtmlTableCell();
            tclabel.Style.Add("font-weight", "bold");
            tclabel.InnerHtml = coltext;
            HtmlTableCell tc    = new HtmlTableCell();
            string        value = "";
            if (dts != null && dts.Rows.Count > 0)
            {
                value = dts.Rows[0][dt.Rows[i]["COLUMN_NAME"].ToString()].ToString();
            }
            string col = dt.Rows[i]["COLUMN_NAME"].ToString();
            switch (dt.Rows[i]["UpdateType"].ToString())
            {
            case "textbox":

                TextBox input = new TextBox();
                input.ID       = "text" + dt.Rows[i]["COLUMN_NAME"].ToString();
                input.CssClass = "form-control";
                if (b)
                {
                    input.Text = value;
                }
                tc.Controls.Add(input);
                if (col == bCol && bRed == true)
                {
                    input.ReadOnly = true;
                }
                break;

            case "label":
                Label label = new Label();
                label.ID = "label" + dt.Rows[i]["COLUMN_NAME"].ToString();
                if (b)
                {
                    label.Text = value;
                }
                label.CssClass = "form-control";
                tc.Controls.Add(label);
                break;

            case "select":
                DropDownList ddl = new DropDownList();
                ddl.CssClass = "form-control";
                ddl.ID       = "ddl" + dt.Rows[i]["COLUMN_NAME"].ToString();
                switch (dt.Rows[i]["ColSel"].ToString().Trim())
                {
                case "LookUpData":
                    ddl.DataSource     = pd.GetLookUpData(dt.Rows[i]["ColSelFlag"].ToString());
                    ddl.DataValueField = "iID";
                    ddl.DataTextField  = "iText";
                    ddl.DataBind();
                    break;

                case "LookUpType":
                    ddl.DataSource     = pd.GetLookUpType();
                    ddl.DataValueField = "iID";
                    ddl.DataTextField  = "iText";
                    ddl.DataBind();
                    break;
                }

                if (b)
                {
                    cc.Select(ddl, value);
                }
                if (col == bCol && bRed == true)
                {
                }
                tc.Controls.Add(ddl);
                break;

            case "date":
                UserControl userControl = (UserControl)LoadControl("_Controls/_Calendar.ascx");
                userControl.ID = "Date" + dt.Rows[i]["COLUMN_NAME"].ToString();
                TextBox text = ((TextBox)userControl.FindControl("datetimepicker"));
                if (b)
                {
                    if (value != "")
                    {
                        value = DateTime.Parse(value).ToString("yyyy-MM-dd");
                    }
                    text.Text = value;
                }
                tc.Controls.Add(userControl);
                break;

            case "date2":

                UserControl userControl2 = (UserControl)LoadControl("_Controls/_Calendar2.ascx");
                userControl2.ID = "Date" + dt.Rows[i]["COLUMN_NAME"].ToString();
                TextBox text2 = ((TextBox)userControl2.FindControl("datetimepicker"));
                if (b)
                {
                    if (value != "")
                    {
                        value      = DateTime.Parse(value).ToString();
                        text2.Text = DateTime.Parse(value).ToString("yyyy-MM-dd");
                    }
                }
                DropDownList ddld1 = ((DropDownList)userControl2.FindControl("ddlH"));

                if (value != "")
                {
                    string valueh = DateTime.Parse(value).ToString("HH");
                    if (ddld1.Items.Count == 0)
                    {
                        for (int s = 0; s < 24; s++)
                        {
                            string str = "";
                            if (s.ToString().Length < 2)
                            {
                                str = "0" + s.ToString();
                            }
                            else
                            {
                                str = s.ToString();
                            }
                            ListItem it = new ListItem();
                            it.Text  = str;
                            it.Value = str;
                            ddld1.Items.Add(it);
                        }
                    }
                    for (int j = 0; j < ddld1.Items.Count; j++)
                    {
                        if (ddld1.Items[j].Value == valueh)
                        {
                            ddld1.Items[j].Selected = true;
                        }
                    }

                    DropDownList ddld2  = ((DropDownList)userControl2.FindControl("ddlM"));
                    string       valuem = DateTime.Parse(value).ToString("mm");
                    if (ddld2.Items.Count == 0)
                    {
                        for (int s = 0; s < 60; s++)
                        {
                            string str = "";
                            if (s.ToString().Length < 2)
                            {
                                str = "0" + s.ToString();
                            }
                            else
                            {
                                str = s.ToString();
                            }
                            ListItem it = new ListItem();
                            it.Text  = str;
                            it.Value = str;
                            ddld2.Items.Add(it);
                        }
                    }
                    for (int j = 0; j < ddld2.Items.Count; j++)
                    {
                        if (ddld2.Items[j].Value == valuem)
                        {
                            ddld2.Items[j].Selected = true;
                        }
                    }
                }
                tc.Controls.Add(userControl2);

                break;
            }
            tw.Cells.Add(tclabel);
            tw.Cells.Add(tc);
            TableUpdate1.Controls.Add(tw);
        }
    }
 public static int Val(this PublicData en)
 {
     return((int)Enum.Parse(typeof(PublicData), en.ToString()));
 }
Ejemplo n.º 30
0
 public void Add(PublicData publicdata)
 {
     publicdatas.Add(JsonUtility.ToJson(publicdata));
 }