Beispiel #1
0
        public Universal[] Get(params Universal[] vbinds)
        {
            SnmpBER mess = new SnmpBER(SnmpType.Sequence,
                                       new Universal(0), // version-1
                                       new Universal(agentCommunity),
                                       PDU(SnmpType.GetRequestPDU, vbinds));
            MemoryStream m = new MemoryStream();

            mess.Send(m);
            byte[] bytes = m.ToArray();
            udp.Send(bytes, bytes.Length, agent);
            IPEndPoint   from   = new IPEndPoint(IPAddress.Any, 0);
            IAsyncResult result = udp.BeginReceive(null, this);

            result.AsyncWaitHandle.WaitOne(100, false);
            if (!result.IsCompleted)
            {
                return(null);
            }
            bytes = udp.EndReceive(result, ref from);
            m     = new MemoryStream(bytes, false);
            mess  = new SnmpBER(m);
            Universal pdu       = mess[2];
            Universal vbindlist = pdu[3];

            return((Universal[])vbindlist.Value);
        }
Beispiel #2
0
        //testing APIs
        public bool ReceiveFile(byte[] imageArray)
        {
            Image img = Universal.ByteArrayToImage(imageArray);

            Output.ShowImage(img);
            return(true);
        }
Beispiel #3
0
        public static void Test()
        {
            double val = 123.456;

            Universal.printf($"{val} compounded monthly over 10 years at 4.5% per annum:");
            Universal.printf(Convert.ToString(
                                 val.CompoundInterest(4.5,
                                                      10,
                                                      Constants.CompoundFrequency.Monthly)));
            val = 100.00;
            Universal.printf($"{val} compounded annually over 10 years at 5% per annum:");
            Universal.printf(Convert.ToString(
                                 val.CompoundInterest(5,
                                                      10,
                                                      Constants.CompoundFrequency.Yearly)));
            Universal.printf($"{val} compounded monthly over 10 years at 5% per annum:");
            Universal.printf(Convert.ToString(
                                 val.CompoundInterest(5,
                                                      10,
                                                      Constants.CompoundFrequency.Monthly)));
            val = 100000.00;
            Universal.printf(Convert.ToString(
                                 val.CompoundInterest(0.018,
                                                      30,
                                                      Constants.CompoundFrequency.Monthly)));
            Universal.printf(Convert.ToString(
                                 val.CompoundInterest(0.041,
                                                      30,
                                                      Constants.CompoundFrequency.Monthly)));
        }
Beispiel #4
0
            public static byte ToRawByte(Universal uOption)
            {
                if (BluetoothService.Instance.ActiveModel == Model.Buds)
                {
                    foreach (int i in Enum.GetValues(typeof(OptionsBuds)))
                    {
                        String name = Enum.GetName(typeof(OptionsBuds), i);
                        if (name == uOption.ToString())
                        {
                            return((byte)i);
                        }
                    }
                }
                else
                {
                    foreach (int i in Enum.GetValues(typeof(OptionsBudsPlus)))
                    {
                        String name = Enum.GetName(typeof(OptionsBudsPlus), i);
                        if (name == uOption.ToString())
                        {
                            return((byte)i);
                        }
                    }
                }

                Console.WriteLine("Warning: TouchOption not translatable");
                return(0);
            }
Beispiel #5
0
        public static long?SendContentedNuntias(Nuntias newNuntias)
        {
            JObject nuntiasJsonData = newNuntias.ToJson();

            nuntiasJsonData["sender_mac_address"] = Universal.SystemMACAddress;
            long?  nuntiasId = null;
            string filePath  = LocalDataFileAccess.GetFilePathInLocalData(newNuntias.ContentFileId);

            if (filePath == null)
            {
                return(null);
            }
            byte[] fileByte = Universal.FileToByteArray(filePath);
            KeyValuePair <JObject, byte[]> nuntiasData = new KeyValuePair <JObject, byte[]>(nuntiasJsonData, fileByte);

            ServerHub.WorkingInstance.ServerHubProxy.Invoke <long>("SendContentedNuntias", nuntiasData).ContinueWith(task =>
            {
                if (!task.IsFaulted)
                {
                    nuntiasId = task.Result;
                }
                else
                {
                    Console.WriteLine(task.IsFaulted);
                }
            }).Wait();
            return(nuntiasId);
        }
Beispiel #6
0
        public void Draw(SpriteBatch spriteBatch, Camera camera, bool isMain)
        {
            base.Draw(spriteBatch);
            Vector2 fontSize = Client.font.MeasureString(Nickname);

            spriteBatch.Draw(pixel.Texture, new Rectangle((int)(X + 13 - fontSize.X / 2), IntY + sprite.Texture.Height + 2, (int)(fontSize.X + 6), (int)(fontSize.Y)), new Rectangle(1, 1, 1, 1), PlayerTeam.TeamColor * 0.5f);
            //Universal.DrawRectangleOutline(spriteBatch, new Rectangle((int)(X + 13 - fontSize.X / 2), IntY + sprite.Texture.Height + 2, (int)(fontSize.X + 6), (int)(fontSize.Y)), PlayerTeam.TeamColor);
            spriteBatch.DrawString(Client.font, Nickname, new Vector2(X + 16 - fontSize.X / 2, Y + sprite.Texture.Height + 2), Color.White);
            if (HPBarInterval.IsRunning)
            {
                spriteBatch.Draw(pixel.Texture, new Rectangle(IntX + 16 - MaxHP / 2, IntY - 2, HP, 4), new Rectangle(1, 1, 1, 1), Color.LimeGreen * 0.75f);
                Universal.DrawRectangleOutline(spriteBatch, new Rectangle(IntX + 16 - MaxHP / 2, IntY - 2, MaxHP, 4), Color.DarkGreen);
            }
            if (FlagIndex == 1)
            {
                spriteBatch.Draw(redFlag.Texture, new Vector2(IntX, IntY - 24), Color.White);
            }
            else if (FlagIndex == 2)
            {
                spriteBatch.Draw(blueFlag.Texture, new Vector2(IntX, IntY - 24), Color.White);
            }
            if (chatInterval.IsRunning)
            {
                fontSize = Client.font.MeasureString(chatMessage);
                spriteBatch.Draw(pixel.Texture, new Rectangle((int)(X + 13 - fontSize.X / 2), IntY - 12, (int)(fontSize.X + 6), (int)(fontSize.Y)), new Rectangle(1, 1, 1, 1), Color.Black * 0.5f);
                spriteBatch.DrawString(Client.font, chatMessage, new Vector2(X + 16 - fontSize.X / 2, Y - 12), Color.White);
            }
        }
Beispiel #7
0
 public static string ChangeProfileImage(Image gotImg)
 {
     using (Bitmap roundedBmp = new Bitmap(GraphicsStudio.ClipToCircle(gotImg), new Size(200, 200)))
     {
         JObject profileImgIdJson = null;
         byte[]  imgByteArray     = Universal.ImageToByteArray(roundedBmp, gotImg.RawFormat);
         ServerHub.WorkingInstance.ServerHubProxy.Invoke <JObject>("ChangeProfileImage", Consumer.LoggedIn.Id, imgByteArray).ContinueWith(task =>
         {
             if (!task.IsFaulted)
             {
                 profileImgIdJson = task.Result;
             }
         }).Wait();
         if (profileImgIdJson == null)
         {
             return(null);
         }
         try
         {
             string oldProfileImgId = profileImgIdJson["old_image_id"].ToString();
             if (oldProfileImgId != null && oldProfileImgId.Length > 5)
             {
                 LocalDataFileAccess.EraseOldProfileImageFromLocalData(oldProfileImgId);
             }
             string newImgId = profileImgIdJson["new_image_id"].ToString();
             LocalDataFileAccess.SaveProfileImageToLocal(roundedBmp, newImgId);
             return(newImgId);
         }
         catch (Exception e)
         {
             Console.WriteLine("Error occured in ChangeProfileImage() => " + e.Message);
             return(null);
         }
     }
 }
        public static bool DeleteNuntias(long ownerId, long nuntiasId, bool forBoth)
        {
            if (nuntiasId <= 0)
            {
                NuntiasRepository.Instance.DeleteTmpNuntias(nuntiasId);
                return(true);
            }
            JObject nuntiasDeleteRequestJson = new JObject();

            nuntiasDeleteRequestJson["owner_id"]   = ownerId;
            nuntiasDeleteRequestJson["nuntias_id"] = nuntiasId;
            nuntiasDeleteRequestJson["for_both"]   = forBoth;

            bool?success = null;

            ServerHub.WorkingInstance.ServerHubProxy.Invoke <bool>("DeleteNuntias", nuntiasDeleteRequestJson).ContinueWith(task =>
            {
                if (!task.IsFaulted)
                {
                    success = task.Result;
                }
            }).Wait();

            if (success == null)
            {
                Universal.ShowErrorMessage("Server connection failed", "Message deletion failed");
                return(false);
            }

            if (!forBoth)
            {
                NuntiasRepository.Instance.Delete(nuntiasId);
            }
            return(true);
        }
Beispiel #9
0
        private IType ConnectAllFreeVariables(IType type, Dictionary <SingleType, IType> context)
        {
            var freeVariables = new HashSet <SingleType>();

            foreach (var expr in context.Keys)
            {
                var hs = GetFreeVariables(expr, new HashSet <SingleType>());
                foreach (var v in hs)
                {
                    freeVariables.Add(v);
                }
            }

            var typeFreeVariables = GetFreeVariables(type, new HashSet <SingleType>());

            foreach (var fv in freeVariables)
            {
                typeFreeVariables.Remove(fv);
            }

            var result = type;

            foreach (var v in typeFreeVariables)
            {
                result = new Universal(v, result);
            }
            return(result);
        }
Beispiel #10
0
        public VRCAPIClient(string username, string password)
        {
            Auth          = new Auth(username, password);
            Avatars       = new Avatars();
            Config        = new Config();
            Friends       = new Friends();
            Moderations   = new Moderations();
            Users         = new Users();
            Worlds        = new Worlds();
            Favorites     = new Favorites();
            Universal     = new Universal();
            Notifications = new Notifications();

            if (httpClient == null)
            {
                httpClient             = new HttpClient();
                httpClient.BaseAddress = new Uri(baseAddress);
            }

            string base64Auth = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{Auth.Username}:{Auth.Password}"));

            var header = httpClient.DefaultRequestHeaders;

            if (header.Contains("Authorization"))
            {
                header.Remove("Authorization");
            }
            header.Add("Authorization", $"Basic {base64Auth}");
        }
Beispiel #11
0
        private void DrawTeamInfo(SpriteBatch spriteBatch, Team currentTeam, List <Player> teamList, ref int entryCount, ref int lastTeamY)
        {
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 280, lastTeamY, 560, (teamList.Count + 1) * 16), new Color(currentTeam.TeamColor, 64));
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 280, lastTeamY, 560, 1), Color.Black);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 105, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, "Kills", new Vector2(camera.IntX - 70, lastTeamY), Color.White, Align.Center, true);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 35, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, "Assists", new Vector2(camera.IntX, lastTeamY), Color.White, Align.Center, true);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX + 35, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, "Deaths", new Vector2(camera.IntX + 70, lastTeamY), Color.White, Align.Center, true);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX + 105, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX + 240, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, "Ping", new Vector2(camera.IntX + 276, lastTeamY), Color.White, Align.Right, true);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 280, lastTeamY + 16, 560, 1), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, currentTeam.Name, new Vector2(camera.IntX - 276, lastTeamY), Color.White, Align.Left, true);

            entryCount++;
            foreach (Player teamPlayer in teamList)
            {
                DrawPlayerInfo(spriteBatch, teamPlayer, entryCount);
                entryCount++;
            }
            lastTeamY += entryCount * 16;
            teamList.Clear();
        }
Beispiel #12
0
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            Client.arEvent.WaitOne();
            foreach (KeyValuePair <int, Player> entry in playerIndex.ToArray())
            {
                entry.Value.Draw(spriteBatch, camera, entry.Value == world.MainPlayer);
            }
            foreach (KeyValuePair <int, Mob> entry in mobIndex.ToArray())
            {
                entry.Value.Draw(spriteBatch);
            }
            foreach (KeyValuePair <int, ItemDrop> entry in dropIndex.ToArray())
            {
                entry.Value.Draw(spriteBatch, Client.font);
            }
            world.DrawObjects(spriteBatch);
            string timeString = String.Format("{0}:{1}", timeRemaining / 60, (timeRemaining % 60).ToString("00"));

            Universal.DrawStringMore(spriteBatch, Client.font, timeString, new Vector2(camera.CX + Universal.SCREEN_WIDTH / 2, camera.CY + 10), Color.White, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0, Align.Center, true);
            if (world.ServerMode == GameMode.TeamDeathmatch || world.ServerMode == GameMode.CaptureTheFlag)
            {
                redTent.Draw(spriteBatch, Client.font);
                blueTent.Draw(spriteBatch, Client.font);
                Universal.DrawStringMore(spriteBatch, Client.font, Convert.ToString(redTickets), new Vector2(camera.CX + Universal.SCREEN_WIDTH / 2 - 100, camera.CY + 10), Color.Red, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0, Align.Center, true);
                Universal.DrawStringMore(spriteBatch, Client.font, Convert.ToString(blueTickets), new Vector2(camera.CX + Universal.SCREEN_WIDTH / 2 + 100, camera.CY + 10), Color.Blue, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0, Align.Center, true);
            }
            if (gameEnded)
            {
                Universal.DrawStringMore(spriteBatch, Client.font, gameEndMessage, new Vector2(camera.X, camera.Y - 36), Color.White, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0, Align.Center, true);
            }
            chat.Draw(spriteBatch, camera, gameTime);

            Client.arEvent.Set();
        }
Beispiel #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            Universal universal = db.Universals.Find(id);

            db.Universals.Remove(universal);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #14
0
 private void DrawPlayerInfo(SpriteBatch spriteBatch, Player player, int entryCount)
 {
     Universal.DrawStringMore(spriteBatch, font, player.Nickname, new Vector2(camera.IntX - 276, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Left, true);
     Universal.DrawStringMore(spriteBatch, font, Convert.ToString(player.Kills), new Vector2(camera.IntX - 70, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Center, true);
     Universal.DrawStringMore(spriteBatch, font, Convert.ToString(player.Assists), new Vector2(camera.IntX, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Center, true);
     Universal.DrawStringMore(spriteBatch, font, Convert.ToString(player.Deaths), new Vector2(camera.IntX + 70, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Center, true);
     Universal.DrawStringMore(spriteBatch, font, Convert.ToString(player.Ping), new Vector2(camera.IntX + 276, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Right, true);
 }
        public string AssignEmailVerificationCode(long userId, string purpose)
        {
            string generatedCode = Universal.RandomNumericString(6);
            string sql           = " DELETE FROM Verification_Codes WHERE Times_Checked >= 5 OR DATEDIFF(minute, Assigned_Time, SYSDATETIME()) > 60; ";

            sql += " IF((SELECT COUNT(Verification_Code) FROM Verification_Codes WHERE user_Id = " + userId + " AND Purpose = '" + purpose + "') = 0) BEGIN INSERT INTO Verification_Codes (User_Id, Purpose, Verification_Code) VALUES (" + userId + ", '" + purpose + "', '" + generatedCode + "'); END \n";
            sql += " SELECT Verification_Code FROM Verification_Codes WHERE user_Id = " + userId + ";";
            return(this.ExecuteSqlScalar(sql));
        }
Beispiel #16
0
        /// <summary>
        /// Adds a timespan to this instance of DateTime
        /// </summary>
        /// <param name="timeSpan"></param>
        /// <returns></returns>
        public DateTime Add(TimeSpan timeSpan)
        {
            DateTime result = new DateTime(Universal.Add(timeSpan.ToSystemTimeSpan()), m_nanosecond,
                                           Type.TimeZone.UTC, true);

            result = result.AddMicrosecondsInternal(timeSpan.Microseconds);
            result = result.AddNanosecondsInternal(timeSpan.Nanoseconds);

            return(result.ToTimeZone(TimeZone));
        }
Beispiel #17
0
        public string convertDate(string oldDate)
        {
            string newDate = oldDate;

            if (oldDate != null)
            {
                newDate = Convert.ToDateTime(Universal.ConvertToUniversalDate(oldDate)).ToString("yyyy-MM-dd'T'hh:mm:ss.00Z");
            }
            return(newDate);
        }
Beispiel #18
0
 public ActionResult Edit([Bind(Include = "ID,Name,Description,UploadDate,Category,Status,UserID")] Universal universal)
 {
     if (ModelState.IsValid)
     {
         db.Entry(universal).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID = new SelectList(db.Users, "ID", "Name", universal.UserID);
     return(View(universal));
 }
Beispiel #19
0
 public static ShipViewModel GetShip()
 {
     return(new ShipViewModel(new Position()
     {
         X = Universal.RandomInt(500), Y = Universal.RandomInt(500)
     }, Direction.Directions[0])
     {
         ShipID = Universal.RandomInt(99).ToString(),
         Colour = Brushes.Black
     });
 }
Beispiel #20
0
 private void UniversalCHeck_CheckedChanged(object sender, EventArgs e)
 {
     if (UniversalCHeck.Checked)
     {
         Universal.ReadOnly = false;
     }
     else
     {
         Universal.Clear();
         Universal.ReadOnly = true;
     }
 }
Beispiel #21
0
        private List <WFF> IdentityDecompose(Identity i, Universal f)
        {
            List <WFF> stuff  = IdentityDecompose(i, f.scope);
            List <WFF> result = new List <WFF>();

            foreach (WFF a in stuff)
            {
                result.Add(new Universal(f.variable, a));
            }

            return(result);
        }
    //Hit detection for the fireball
    private void OnCollisionEnter(Collision collision)
    {
        GameObject opponent = collision.gameObject;

        Universal opponentHealth = opponent.GetComponent <Universal>();

        if (opponent.name == "Opponent")
        {
            opponentHealth.calculateCombo(opponentHealth.getHitStun(), onHit);
            opponentHealth.calculateDamage(damage);
            Destroy(gameObject);
        }
    }
Beispiel #23
0
        public EnterPage()
        {
            Universal u = new Universal();


            InitializeComponent();

            LogInType.SelectedItem = "دانشجو";


            //Master mst = Universal.instance.firstMst;
            ////Console.WriteLine(mst.info.lessons[0].info.students.Count);
        }
Beispiel #24
0
        public bool UniversalQuantifierRule(ref DerivationStep s)
        {
            List <Node> temp = s.GetFormulas().ToList();

            foreach (var n in s.GetFormulas())
            {
                if (n is Universal u)
                {
                    Universal newUniversal = FunctionHelper.DeepClone <Universal>(u);
                    if (newUniversal.ReplaceChecked() == true)
                    {
                        continue;
                    }
                    DerivationStep newStep = new DerivationStep(s.GetActiveVariables());
                    newUniversal.SetSubtitution();
                    foreach (var v in newStep.GetActiveVariables())
                    {
                        Node addNode = FunctionHelper.DeepClone <Node>(newUniversal.RightNode);
                        this.ChangeVarHelperUni(addNode, v);
                        newStep.AddFormulas(addNode);
                    }
                    newStep.AddFormulas(newUniversal);
                    newStep.Merge(temp);
                    s.RightNode = newStep;
                    this._branchingPoint.Push(s.RightNode);
                    return(true);
                }
                else if (n is Negation && n.RightNode is Existential e)
                {
                    Existential newExist = FunctionHelper.DeepClone <Existential>(e);
                    if (newExist.ReplaceChecked() == true)
                    {
                        continue;
                    }
                    DerivationStep newStep = new DerivationStep(s.GetActiveVariables());
                    newExist.SetSubtitution();
                    foreach (var v in newStep.GetActiveVariables())
                    {
                        Node addNode = FunctionHelper.DeepClone <Node>(newExist.RightNode);
                        this.ChangeVarHelperUni(addNode, v);
                        newStep.AddFormulas(new Negation("~", addNode));
                    }
                    newStep.AddFormulas(new Negation("~", newExist));
                    newStep.Merge(temp);
                    s.RightNode = newStep;
                    this._branchingPoint.Push(s.RightNode);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #25
0
        // GET: Universals/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Universal universal = db.Universals.Find(id);

            if (universal == null)
            {
                return(HttpNotFound());
            }
            return(View(universal));
        }
        private void SendTypedNuntias()
        {
            string           rawText      = this.nuntiasTextBox.Text;
            BackgroundWorker loaderWorker = new BackgroundWorker();
            Nuntias          newNuntias   = null;

            loaderWorker.DoWork += (s, e) =>
            {
                try
                {
                    string processedText = Universal.ProcessValidMessageText(rawText);
                    if (processedText == null)
                    {
                        return;
                    }
                    if (this.TheConversation == null)
                    {
                        long?conversationId = ServerRequest.GetDuetConversationId(User.LoggedIn, this.receiver);
                        if (conversationId == null)
                        {
                            MessageBox.Show("Server connection failed!\r\nPlease retry.");
                            return;
                        }
                        this.TheConversation = new DuetConversation(Consumer.LoggedIn, this.receiver);
                        this.TheConversation.ConversationID = (long)conversationId;
                    }
                    newNuntias = new Nuntias(processedText, User.LoggedIn.Id, Time.CurrentTime, this.theConversation.ConversationID);
                    long?nuntiasTmpID = NuntiasRepository.Instance.StoreTmpNuntias(newNuntias);
                    if (nuntiasTmpID == null)
                    {
                        return;
                    }
                    newNuntias.Id = nuntiasTmpID ?? 0;
                    SyncAssets.NuntiasSortedList[(long)nuntiasTmpID] = newNuntias;
                    this.Invoke(new Action(() =>
                    {
                        this.nuntiasTextBox.Clear();
                    }));
                    this.ShowNuntias(newNuntias, true);
                    BackendManager.SendPendingNuntii();
                }
                catch (Exception ex) { Console.WriteLine("Exception in SendTypedNuntias() => " + ex.Message); }
            };
            loaderWorker.RunWorkerAsync();
            loaderWorker.RunWorkerCompleted += (s, e) => { loaderWorker.Dispose(); };
            if (ConversationListPanel.MyConversationListPanel != null)
            {
                ConversationListPanel.MyConversationListPanel.RefreshConversationList();
            }
        }
Beispiel #27
0
        private object GetData(PagerQuery <PagerInfo, CriteriaNuclearButton, IEnumerable <NuclearButtonListModel> > pagerQuery = null)
        {
            var pageInfo = new PagerInfo(this.HttpContext);

            if (pagerQuery == null)
            {
                pagerQuery = new PagerQuery <PagerInfo, CriteriaNuclearButton, IEnumerable <NuclearButtonListModel> >(pageInfo, new CriteriaNuclearButton(), null);
                pagerQuery.Search.WayOutStartTime = DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd");
                pagerQuery.Search.WayOutEndTime   = DateTime.Now.ToString("yyyy-MM-dd");
            }
            else
            {
                int recordCount = 0;
                int TotalPages  = 0;
                var resultMsg   = string.Empty;
                if (string.IsNullOrWhiteSpace(pagerQuery.Search.CustomerName) && this.CurrentUser.Userid != "0505")
                {
                    pagerQuery.Search.CustomerName = this.CurrentUser.Userid;
                }
                if (!string.IsNullOrWhiteSpace(pagerQuery.Search.WayOutStartTime))
                {
                    pagerQuery.Search.WayOutStartTime += " 00:00:00";
                }
                if (!string.IsNullOrWhiteSpace(pagerQuery.Search.WayOutEndTime))
                {
                    pagerQuery.Search.WayOutEndTime += " 23:59:59";
                }
                if (!string.IsNullOrWhiteSpace(pagerQuery.Search.CargoType))
                {
                    pagerQuery.Search.CargoTypeTest = Universal.GetStatusName(_Dictionary.CargoType, pagerQuery.Search.CargoType);
                }
                if (!string.IsNullOrWhiteSpace(pagerQuery.Search.ApprovalStatus))
                {
                    decimal status = Convert.ToDecimal(pagerQuery.Search.ApprovalStatus);
                    pagerQuery.Search.ApprovalStatus = ((int)status).ToString();
                }
                var data = this.facadeVHk.QueryV_HKListPager(out resultMsg, out recordCount, out TotalPages, pagerQuery.Search, pageInfo.PageSize, pageInfo.CurrentPageIndex).ToList <NuclearButtonListModel>();
                pageInfo.RecordCount        = recordCount;
                pagerQuery.Pager            = pageInfo;
                pagerQuery.Pager.TotalPages = TotalPages;
                pagerQuery.DataList         = data;
            }
            pagerQuery.Search.CargoTypeList      = DropDownListFor.GetCargoTypeSelect(null, true);
            pagerQuery.Search.CustomerNameList   = DropDownListFor.GetCustomerNameSelect(this.CurrentUser.Userid, pagerQuery.Search.CargoType, null, true);
            pagerQuery.Search.WayOutList         = DropDownListFor.GetWayOutSelect(null, true);
            pagerQuery.Search.LockStatusList     = DropDownListFor.GetLockingStatusSelect(null, false);
            pagerQuery.Search.ApprovalStatusList = DropDownListFor.GetApprovalStatusSelect(null, true);
            return(pagerQuery);
        }
Beispiel #28
0
        // GET: Universals/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Universal universal = db.Universals.Find(id);

            if (universal == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserID = new SelectList(db.Users, "ID", "Name", universal.UserID);
            return(View(universal));
        }
Beispiel #29
0
        public ActionResult Create([Bind(Include = "ID,Name,Description,UploadDate,Category,Status,UserID")] Universal universal)
        {
            if (ModelState.IsValid)
            {
                universal.UploadDate = DateTime.Now;
                universal.UserID     = db.Users.First(u => u.Name == "buronahodok").ID;

                db.Universals.Add(universal);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UserID = new SelectList(db.Users, "ID", "Name", universal.UserID);
            return(View(universal));
        }
Beispiel #30
0
        private Decomposition DecomposeWFF(Universal f)
        {
            List <WFF> dec = new List <WFF>();

            if (terms.Count == 0)
            {
                terms.Add(new FreeConstant());
            }
            foreach (Term t in terms)
            {
                dec.Add(f.scope.Rename(f.variable, t));
            }

            return(new Decomposition(f, dec));
        }