Esempio n. 1
1
 public override bool OnBlockPlaced(World world, Vector3 position, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
 {
     Metadata = (byte)MathHelper.DirectionByRotationFlat(usedBy);
     switch ((Direction)Metadata)
     {
         case Direction.North:
             Metadata = (byte)StairDirections.North;
             break;
         case Direction.South:
             Metadata = (byte)StairDirections.South;
             break;
         case Direction.West:
             Metadata = (byte)StairDirections.West;
             break;
         case Direction.East:
             Metadata = (byte)StairDirections.East;
             break;
     }
     if (clickedSide == Vector3.Down)
         Metadata |= 4;
     else if (clickedSide != Vector3.Up)
     {
         if (cursorPosition.Y >= 8)
             Metadata |= 4;
     }
     return true;
 }
Esempio n. 2
0
        /// <summary>
        /// Delete Bảng
        /// </summary>
        public bool Delete(Entities.PhieuTTCuaKH pttckh)
        {
            try
            {
                bool kt = false;
                pt = new Constants.PhieuTTCuaKH();
                Sql = new Constants.Sql();
                string sql = Sql.DeletePhieuTTCuaKH;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(pt.HanhDong, SqlDbType.NVarChar, 20).Value = pttckh.HanhDong;
                cmd.Parameters.Add(pt.PhieuTTCuaKHID, SqlDbType.Int).Value = pttckh.PhieuTTCuaKHID;

                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                    kt = true;
                else
                    kt = false;
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return kt;
            }
            catch
            {
                return false;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Join a game
        /// </summary>
        /// <param name="gameID">The game to join</param>
        /// <param name="user">The current user</param>
        /// <param name="playerType">Type of player joining</param>
        /// <returns>If the user was able to join the game</returns>
        public Boolean Execute(Entities.Game game, Entities.User user, Entities.Enums.GamePlayerType playerType)
        {
            Entities.GamePlayer player = new Entities.GamePlayer();
            player.GameID = game.GameID;
            player.Points = 0;
            player.User = user;
            player.PlayerType = playerType;

            Boolean successful = _insertGamePlayer.Execute(player) != -1;

            if(successful)
            {
                if (playerType == Entities.Enums.GamePlayerType.Player)
                {
                    game.Players.Add(player);
                    game.PlayerCount++;
                }
                else if(playerType == Entities.Enums.GamePlayerType.Spectator)
                {
                    game.Spectators.Add(player);
                    game.SpectatorCount++;
                }
            }

            return successful;
        }
Esempio n. 4
0
 public void AddDescription(Entities.AuxEntities.language Language)
 {
     lock (this.description)
     {
         this.description.Add(Language);
     }
 }
Esempio n. 5
0
 //delete
 public int Delete(Entities.KhoHang kh1)
 {
     int tra = 0;
     try
     {
         kh = new Constants.KhoHang();
         Entities.KhoHang khohang = new Entities.KhoHang();
         Sql = new Constants.Sql();
         string sql = Sql.DeleteKhoHang;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
         cmd.Parameters.Add(kh.KhoHangID, SqlDbType.Int).Value = kh1.KhoHangID;
         tra = cmd.ExecuteNonQuery();
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
         cn = null;
         conn = null;
     }
     catch (Exception ex)
     { string s = ex.Message; tra = 0; }
     return tra;
 }
Esempio n. 6
0
 public void AddMetaTitle(Entities.AuxEntities.language Language)
 {
     lock (this.meta_title)
     {
         this.meta_title.Add(Language);
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Handling the Court action of the interaction packet.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="interact">The interaction packet.</param>
        public static void Handle(Entities.GameClient client, InteractionPacket interact)
        {
            //uint marryUID = interact.TargetUID;

            //Entities.GameClient marrytarget;
            Maps.IMapObject obj;
            if (client.Map.MapObjects.TryGetValue(interact.TargetUID, out obj))
            {
                Entities.GameClient targ = obj as Entities.GameClient;
                if (client.SpouseDatabaseUID > 0)
                {
                    using (var fmsg = Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.MARRIAGE_SELF_SPOUSE))
                        client.Send(fmsg);
                    return;
                }
                if (targ.SpouseDatabaseUID > 0)
                {
                    using (var fmsg = Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.MARRIAGE_TARGET_SPOUSE))
                        client.Send(fmsg);
                    return;
                }

                targ.Send(interact);
            }
        }
        /// <summary>
        ///  xử lý giá trị truyền tới
        /// </summary>
        /// <param name="hdbh"></param>
        public frmXuLyPhieuTTNCC(Entities.HoaDonNhap[] hdbh)
        {
            try
            {
                InitializeComponent();
                dateserver = DateServer.Date();
                sochungtu = txtsochungtu.Text = ProID("PhieuTTNCC");
                SelectHoaDonNhap();
                SelectNCC();
                LayTenTT();
                this.Text = "Quản Lý Thanh Toán Của Nhà Cung Cấp - Thêm Phiếu Thanh Toán";
                txtmancc.Text = hdbh[0].MaNhaCungCap;
                txtnohienthoi.Text = LaySoDuNo(txtmancc.Text);

                cbbtientetygia.SelectedIndex = 0;
                Entities.HDThanhToanKH[] hd = new Entities.HDThanhToanKH[1];
                Double tongtien = Convert.ToDouble(hdbh[0].TongTien);
                string thanhtoanngay = hdbh[0].ThanhToanNgay;
                thanhtoansaukhilapphieu = hdbh[0].ThanhToanSauKhiLapPhieu;
                Double sono = Convert.ToDouble(tongtien) - Convert.ToDouble(thanhtoanngay) - Convert.ToDouble(thanhtoansaukhilapphieu);
                hd[0] = new Entities.HDThanhToanKH(hdbh[0].MaHoaDonNhap,  new Common.Utilities().FormatMoney(tongtien), new Common.Utilities().FormatMoney(sono), new Common.Utilities().FormatMoney(sono),thanhtoansaukhilapphieu);
                dtgvNCC.DataSource = hd;
                mskngaychungtu.Text = new Common.Utilities().XuLy(2,dateserver.ToShortDateString());
                txttongthanhtoan.Text = new Common.Utilities().FormatMoney(TinhTien());
                fix();
            }
            catch (Exception ex)
            {

            }
        }
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            List<Point3d> points = new List<Point3d>()
                {
                    new Point3d(lowX/2+highX/2,lowY/2+highY/2,Depth),
                    new Point3d(lowX,lowY/2+highY/2,Depth),
                    new Point3d(lowX,highY,Depth),
                    new Point3d(highX,highY,Depth),
                    new Point3d(highX,lowY,Depth),
                    new Point3d(lowX,lowY,Depth),
                    new Point3d(lowX,lowY+highY/4-lowY/4,Depth),
                };
            List<double> bulges = new List<double>() { 0, 0, 0, 0, 0, 0, 0 };
            Machinings.Routing route = new Machinings.Routing();
            route.Bulges = bulges;
            route.Points = points;
            route.ToolComp = ToolComp.Left;
            route.Part = this.Part;
            route.OnFace5 = this.OnFace5;
            route.ToolName = this.ToolName;

            Part.Routings.Add(route);

            //TODO:不知道刀的大小,如何生成Pocket的路径?
            //可能需要在分析时再来生成路径,晕死
            if (IsPocket)
            {
                PocketMachining(toolFile);
            }
        }
 public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     CultureInfo ci = formatProvider;
     if (strPropertyName.ToLower() == CultureDropDownTypes.EnglishName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.EnglishName), strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.Lcid.ToString().ToLowerInvariant())
     {
         return ci.LCID.ToString();
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.Name.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.Name, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.NativeName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.NativeName), strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.TwoLetterIsoCode.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.TwoLetterISOLanguageName, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.ThreeLetterIsoCode.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.ThreeLetterISOLanguageName, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.DisplayName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.DisplayName, strFormat);
     }
     PropertyNotFound = true;
     return string.Empty;
 }
Esempio n. 11
0
        public ActionResult ConfirmToken(string username, string token)
        {
            if (WebSecurity.ConfirmAccount(username, token))
            {
                ViewBag.Authenticated = true;

                Entities db = new Entities();
                int UserId = db.webpages_Membership.Single(ent => ent.ConfirmationToken == token).UserId;
                UserProfile profile = db.UserProfiles.Single(ent => ent.UserId == UserId);

                Group newGroup = new Group()
                {
                    CreatedBy = profile.UserId,
                    Name = profile.UserName,
                    JoinLink = Guid.NewGuid().ToString()
                };

                profile.GroupsIn.Add(newGroup);
                db.SaveChanges();

                newGroup.FileDirectory = Server.MapPath("/Groups/" + newGroup.GroupId);
                System.IO.Directory.CreateDirectory(newGroup.FileDirectory);
                System.IO.Directory.CreateDirectory(newGroup.FileDirectory + "/Reports");
                System.IO.Directory.CreateDirectory(newGroup.FileDirectory + "/Plugins");
                System.IO.Directory.CreateDirectory(newGroup.FileDirectory + "/Scans");

                db.SaveChanges();
            }
            else
            {
                ViewBag.Authenticated = false;
            }
            return View();
        }
Esempio n. 12
0
 public override void OnItemUsedOnBlock(World world, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
 {
     var block = new MelonStemBlock();
     if (block.OnBlockPlaced(world, clickedBlock + clickedSide, clickedBlock, clickedSide, cursorPosition, usedBy))
         world.SetBlock(clickedBlock + clickedSide, block);
     base.OnItemUsedOnBlock(world, clickedBlock, clickedSide, cursorPosition, usedBy);
 }
Esempio n. 13
0
        void AddNewRow(Entities.ProductionEntity production, Table table)
        {
            var row = new TableRow();
            row.ID = "rId_" + production.ProductionCode;
            row.Cells.Add(new TableCell { Text = production.ProductionCode.ToString() });
            row.Cells.Add(new TableCell { Text = production.NameProduction.ToString() });
            row.Cells.Add(new TableCell { Text = production.DesignationProduction.ToString() });

            //
            // Раскоментить или удалить, уточнить
            //
            //if (production.CountProduction==null)
            //    row.Cells.Add(new TableCell { Text = "0" });
            //else
            //    row.Cells.Add(new TableCell { Text = production.CountProduction.ToString() });

            //if (production.UnitName == null)
            //    row.Cells.Add(new TableCell { Text = "-" });
            //else
            //    row.Cells.Add(new TableCell { Text = production.UnitName.ToString() });

            row.Cells.Add(new TableCell { Text = production.TypeName.ToString() });
            row.Cells.Add(new TableCell { Text = production.SortName.ToString() });
            row.Cells.Add(new TableCell { Text = production.SignName.ToString() });
            row.Cells.Add(new TableCell { Text = "<a href=\"/DeleteView/DeleteProduction.aspx?IdProduction=" + production.ProductionCode.ToString() + "\">удалить</a>" });
            row.Cells.Add(new TableCell { Text = "<a href=\"/EditingForms/ProductionEdit.aspx?IdProduction=" + production.ProductionCode.ToString() + "\">изменить</a>" });
            row.CssClass = "activeRow";
            table.Rows.Add(row);
        }
        private static GenericResponse UpdatePack(PackInformation pkinfo)
        {
            try
            {
                var response = new GenericResponse();
                using (var context = new Entities())
                {
                    var yd = (from yard in context.Yards
                        where yard.Id == pkinfo.YardId
                        select yard.CustomerNumberPrefix).First() ?? string.Empty;
                    pkinfo.NumberPrefix = yd;
                    pkinfo.InternalPackNumber = yd.Trim() + pkinfo.TagNumber;

                    var pack = (from pk in context.Packs
                        where pk.Id == pkinfo.Id
                        select pk).FirstOrDefault();
                    if (pack == null)
                    {
                        var pk = new Pack();
                        Mapper.Map(pkinfo, pk);
                        context.Packs.AddObject(pk);
                    }
                    else Mapper.Map(pkinfo, pack);
                    context.SaveChanges();
                }
                response.Success = true;
                return response;
            }
            catch (Exception ex)
            {
                LoggingMediator.Log("UpdatePack");
                LoggingMediator.Log(ex);
                return new GenericResponse {Success = false, FailureInformation = "Error in PAPService:UpdatePack"};
            }
        }
Esempio n. 15
0
        public void Delete(Entities.TKNganHang tk1)
        {
            try
            {
                TKNH = new Constants.TKNganHang();
                Entities.TKNganHang TKNganHang = new Entities.TKNganHang();
                Sql = new Constants.Sql();
                string sql = Sql.DeleteTKNganHang;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(TKNH.HanhDong, SqlDbType.NVarChar, 20).Value = tk1.HanhDong;
                cmd.Parameters.Add(TKNH.TKNganHangID, SqlDbType.Int).Value = tk1.TKNganHangID;

                cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
        }
Esempio n. 16
0
        public int InsertUpdate(Entities.TKNganHang tk1)
        {
            TKNH = new Constants.TKNganHang();
            Sql = new Constants.Sql();
            string sql = Sql.InsertUpdateTKNganHang;
            Connection conn = new Connection();
            SqlConnection cn = conn.openConnection();
            SqlCommand cmd = new SqlCommand(sql, cn);
            cmd.Parameters.Add(TKNH.HanhDong, SqlDbType.NVarChar, 20).Value = tk1.HanhDong;
            cmd.Parameters.Add(TKNH.TKNganHangID, SqlDbType.Int).Value = tk1.TKNganHangID;
            cmd.Parameters.Add(TKNH.MaTKNganHang, SqlDbType.NVarChar, 20).Value = tk1.MaTKNganHang;
            cmd.Parameters.Add(TKNH.SoTK, SqlDbType.NVarChar, 20).Value = tk1.SoTK;
            cmd.Parameters.Add(TKNH.MaTienTe, SqlDbType.NVarChar, 200).Value = tk1.MaTienTe;
            cmd.Parameters.Add(TKNH.SoDu, SqlDbType.Int).Value = tk1.SoDu;
            cmd.Parameters.Add(TKNH.SoSecKeTiep, SqlDbType.NVarChar, 20).Value = tk1.SoSecKeTiep;
            cmd.Parameters.Add(TKNH.NguoiLienHe, SqlDbType.NVarChar, 200).Value = tk1.NguoiLienHe;
            cmd.Parameters.Add(TKNH.DiaChi, SqlDbType.NVarChar, 200).Value = tk1.DiaChi;
            cmd.Parameters.Add(TKNH.DienThoai, SqlDbType.NVarChar, 20).Value = tk1.DienThoai;
            cmd.Parameters.Add(TKNH.Email, SqlDbType.NVarChar, 20).Value = tk1.Email;
            cmd.Parameters.Add(TKNH.Website, SqlDbType.NVarChar, 20).Value = tk1.Website;
            cmd.Parameters.Add(TKNH.GhiChu, SqlDbType.NVarChar, 200).Value = tk1.Ghichu;
            cmd.Parameters.Add(TKNH.Laisuat, SqlDbType.Float).Value = tk1.Laisuat;
            cmd.Parameters.Add(TKNH.Deleted, SqlDbType.Bit).Value = tk1.Deleted;

            int i = cmd.ExecuteNonQuery();
            cmd.Connection.Dispose();
            cn.Close();
            conn.closeConnection();
            cn = null;
            conn = null;
            return i;
        }
 public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     if (dr == null)
         return string.Empty;
     object valueObject = dr[strPropertyName];
     string OutputFormat = strFormat;
     if (string.IsNullOrEmpty(strFormat))
         OutputFormat = "g";
     if (valueObject != null)
     {
         switch (valueObject.GetType().Name)
         {
             case "String":
                 return PropertyAccess.PropertyAccess.FormatString(Convert.ToString(valueObject), strFormat);
             case "Boolean":
                 return (PropertyAccess.PropertyAccess.Boolean2LocalizedYesNo(Convert.ToBoolean(valueObject), formatProvider));
             case "DateTime":
             case "Double":
             case "Single":
             case "Int32":
             case "Int64":
                 return (((IFormattable)valueObject).ToString(OutputFormat, formatProvider));
             default:
                 return PropertyAccess.PropertyAccess.FormatString(valueObject.ToString(), strFormat);
         }
     }
     else
     {
         PropertyNotFound = true;
         return string.Empty;
     }
 }
Esempio n. 18
0
        public ActionResult Callback(Entities.Request.PostModel postModel)
        {
            //此处的URL格式类型为:http://weixin.senparc.com/Open/Callback/$APPID$, 在RouteConfig中进行了配置,你也可以用自己的格式,只要和开放平台设置的一致。

            //处理微信普通消息,可以直接使用公众号的MessageHandler。此处的URL也可以直接填写公众号普通的URL,如本Demo中的/Weixin访问地址。

            var logPath = Server.MapPath(string.Format("~/App_Data/Open/{0}/", DateTime.Now.ToString("yyyy-MM-dd")));
            if (!Directory.Exists(logPath))
            {
                Directory.CreateDirectory(logPath);
            }

            postModel.Token = component_Token;
            postModel.EncodingAESKey = component_EncodingAESKey;//根据自己后台的设置保持一致
            postModel.AppId = component_AppId;//根据自己后台的设置保持一致

            var messageHandler = new OpenCheckMessageHandler(Request.InputStream,
                postModel, 10);

            messageHandler.RequestDocument.Save(Path.Combine(logPath, string.Format("{0}_Request_{1}.txt", DateTime.Now.Ticks, messageHandler.RequestMessage.FromUserName)));

            messageHandler.Execute();//执行

            if (messageHandler.ResponseDocument != null)
            {
                messageHandler.ResponseDocument.Save(Path.Combine(logPath, string.Format("{0}_Response_{1}.txt", DateTime.Now.Ticks, messageHandler.RequestMessage.FromUserName)));
            }

            return new FixWeixinBugWeixinResult(messageHandler);
        }
Esempio n. 19
0
        public Entities.AutoMerge Execute(Entities.AutoMerge autoMerge)
        {
            StringBuilder query = new StringBuilder();

            query.AppendLine("IF NOT EXISTS(SELECT [Id] FROM [dbo].[AutoMerge] AM WHERE AM.[SourceId] = @SourceId AND AM.[TargetId] = @TargetId AND AM.[Frequency] = @Frequency)");
            query.AppendLine("BEGIN");
            query.AppendLine("  INSERT INTO [dbo].[AutoMerge]");
            query.AppendLine("  (");
            query.AppendLine("      [SourceId],");
            query.AppendLine("      [TargetId],");
            query.AppendLine("      [Frequency],");
            query.AppendLine("      [ScheduledJobId]");
            query.AppendLine("  )");
            query.AppendLine("  VALUES");
            query.AppendLine("  (");
            query.AppendLine("      @SourceId,");
            query.AppendLine("      @TargetId,");
            query.AppendLine("      @Frequency,");
            query.AppendLine("      NULL");
            query.AppendLine("  )");
            query.AppendLine("END");
            query.AppendLine("SELECT [Id] FROM [dbo].[AutoMerge] AM WHERE AM.[SourceId] = @SourceId AND AM.[TargetId] = @TargetId AND AM.[Frequency] = @Frequency");

            using (IDbConnection connection = database.CreateConnection())
            {
                autoMerge.Id = connection.ExecuteScalar<int>(query.ToString(), new
                {
                    SourceId = autoMerge.SourceId,
                    TargetId = autoMerge.TargetId,
                    Frequency = (int)autoMerge.Frequency
                });
            }

            return autoMerge;
        }
Esempio n. 20
0
        public static void Create(Entities.GameClient client, Packets.TeamActionPacket packet)
        {
            if (packet.EntityUID != client.EntityUID)
                return;
            if (client.Team != null)
                return;

            client.Team = new Team();
            client.Team.Leader = client.EntityUID;
            if (client.Team.Members.TryAdd(client.EntityUID, client))
            {
                using (var create = new Packets.TeamActionPacket())
                {
                    create.EntityUID = client.EntityUID;
                    create.Action = Enums.TeamAction.Leader;
                    client.Send(create);
                    create.Action = Enums.TeamAction.Create;
                    client.Send(create);
                }
                client.AddStatusEffect1(Enums.Effect1.TeamLeader, 0);
            }
            else
            {
                client.Team = null;
            }
        }
Esempio n. 21
0
        public static void Handle(Entities.GameClient client, DataPacket packet)
        {
            /*using (var watch = new ArenaWatchPacket(packet))
            {
                Entities.GameClient Fighter;
                if (Core.Kernel.Clients.TrySelect(watch.EntityUID, out Fighter))
                {
                    if (Fighter.Battle == null)
                        return;
                    if (!(Fighter.Battle is Data.ArenaMatch))
                        return;
                    Data.ArenaMatch Match = Fighter.Battle as Data.ArenaMatch;

                    switch (watch.Type)
                    {
                        case 0:
                            {
                                Match.JoinAsWatcher(client);
                                //client.Send(packet);
                                break;
                            }
                        case 1:
                            {
                                Match.LeaveWatcher(client);
                                break;
                            }
                    }
                }
            }*/
        }
        public string Check(Entities.PhieuDieuChuyenKhoNoiBo pdck)
        {
            string gt = "ok";
            string ngaychungtunew = xulyNgay(pdck.NgayDieuChuyen);

            if (ngaychungtu != ngaychungtunew)
            {
                ngaychungtu = makNgaychungtu.Text = ngaychungtunew;
                gt = "ko";
            }

            if (tukho != pdck.TuKho)
            {
                tukho = cbxTukho.Text = pdck.TuKho;
                gt = "ko";
            }
            if (denkho != pdck.DenKho)
            {
                denkho = cbxDenkho.Text = pdck.DenKho;
                gt = "ko";
            }
            if (ghichu != pdck.GhiChu)
            {
                ghichu = txtDiengiai.Text = pdck.GhiChu;
                gt = "ko";
            }

            if (gt == "ko")
            {
                MessageBox.Show("Dữ liệu đã có thay đổi trước, ấn ok để cập nhật lại.");
            }

            return gt;
        }
Esempio n. 23
0
 public void Create(Entities.CTB_CONTR Model)
 {
     try
     {
         db.CTB_CONTR.Add(Model);
         db.SaveChanges();
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
     {
         Exception raise = dbEx;
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 string message = string.Format("{0}:{1}",
                     validationErrors.Entry.Entity.ToString(),
                     validationError.ErrorMessage);
                 // raise a new exception nesting
                 // the current instance as InnerException
                 raise = new InvalidOperationException(message, raise);
             }
         }
         throw raise;
     }
 }
Esempio n. 24
0
        public void Add(Entities entityType, int value, IOwner owner)
        {
            if(!entities.ContainsKey(entityType))
                entities.Add(entityType, ids);

            ids.ObjectIds.Add(value, owner);
        }
        public ActionResult SummaryForApprove(int id, FormCollection form)
        {
            var campaign = OperationContext.ServiceSession.EM_CampaignsService.Get(c => c.CampaignID == id).FirstOrDefault();
            if (campaign != null)
            {
                campaign.Approved = true;
                campaign.ApprovedBy = OperationContext.CurrentUser.employeeLoginName;
                campaign.ApprovedDate=DateTime.Now;
                OperationContext.ServiceSession.SaveChange();

                //invoke stored procedure, populate data to campaignInstance.
                Entities entity = new Entities();
                var emailInstanceId =
                    OperationContext.ServiceSession.EM_EmailInstancesService.Get(e => e.CampaignID == id)
                        .FirstOrDefault()
                        .EmailInstanceID;
                entity.EM_CampaignInstances_INSERT(emailInstanceId);

                return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, "", "", null);
            }
            else
            {
                return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "campaign is not found", "",
                    null);
            }
        }
Esempio n. 26
0
 public override void OnItemUsed(World world, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
 {
     var block = world.GetBlock(clickedBlock);
     if (block is DirtBlock || block is GrassBlock)
         world.SetBlock(clickedBlock, new FarmlandBlock());
     base.OnItemUsed(world, clickedBlock, clickedSide, cursorPosition, usedBy);
 }
Esempio n. 27
0
        /// <summary>
        /// lay bang cong ty
        /// </summary>
        /// <param name="ct"></param>
        /// <returns></returns>
        public Entities.ThongTinCongTy sp_ThongTinCongTy(Entities.TruyenGiaTri ct)
        {
            Entities.ThongTinCongTy banghi = new Entities.ThongTinCongTy();
            try
            {
                string sql = "exec sp_ThongTinCongTy @MaCongTy";
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add("MaCongTy", SqlDbType.VarChar, 20).Value = ct.Giatritruyen;
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                ArrayList arr = new ArrayList();
                while (dr.Read())
                {

                    banghi.MaCongTy = dr[0].ToString();
                    banghi.TenCongTy = dr[1].ToString();
                    banghi.DiaChi = dr[2].ToString();
                    banghi.SoDienThoai = dr[3].ToString();
                    banghi.Email = dr[4].ToString();
                    banghi.Website = dr[5].ToString();
                    banghi.Fax = dr[6].ToString();
                }
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); banghi = null; }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return banghi;
        }
Esempio n. 28
0
 //insert update
 public Entities.KhoHang InsertUpdate(Entities.KhoHang kh1)
 {
     Entities.KhoHang k = new Entities.KhoHang();
     try
     {
         kh = new Constants.KhoHang();
         Sql = new Constants.Sql();
         string sql = Sql.InsertUpdateKhoHang;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
         cmd.Parameters.Add(kh.KhoHangID, SqlDbType.Int).Value = kh1.KhoHangID;
         cmd.Parameters.Add(kh.MaKho, SqlDbType.VarChar, 20).Value = kh1.MaKho;
         cmd.Parameters.Add(kh.TenKho, SqlDbType.NVarChar, 200).Value = kh1.TenKho;
         cmd.Parameters.Add(kh.DiaChi, SqlDbType.NVarChar, 200).Value = kh1.DiaChi;
         cmd.Parameters.Add(kh.DienThoai, SqlDbType.NVarChar, 200).Value = kh1.DienThoai;
         cmd.Parameters.Add(kh.MaNhanVien, SqlDbType.NVarChar, 200).Value = kh1.MaNhanVien;
         cmd.Parameters.Add(kh.GhiChu, SqlDbType.NVarChar, 100).Value = kh1.GhiChu;
         cmd.Parameters.Add(kh.Deleted, SqlDbType.Bit).Value = kh1.Deleted;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             k.GhiChu = dr[0].ToString();
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); k.GhiChu = null; }
     return k;
 }
Esempio n. 29
0
 public static void Handle(Entities.GameClient client, ItemPacket packet)
 {
     if (client.Booth != null)
         return;
     packet.Data1 = client.WarehouseMoney;
     client.Send(packet);
 }
Esempio n. 30
0
        public void AddUser(Entities.User u)
        {
            try
              {
            var db = new CapstoneDbContext();
            db.Users.Add(u);

                db.SaveChanges();
              }
              catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) //Catches errors in creating the db User table for the first time
              {
              Exception raise = dbEx;
              foreach (var validationErrors in dbEx.EntityValidationErrors)
              {
                  foreach (var validationError in validationErrors.ValidationErrors)
                  {
                      string message = string.Format("{0}:{1}",
                          validationErrors.Entry.Entity.ToString(),
                          validationError.ErrorMessage);
                      // raise a new exception nesting
                      // the current instance as InnerException
                      raise = new InvalidOperationException(message, raise);
                  }
              }
              throw raise;
              }
        }
Esempio n. 31
0
 /// <summary>
 /// get item by project id
 /// </summary>
 /// <param name="subProjectId">project id</param>
 /// <returns></returns>
 public async Task <Bill> GetBySubProjectIdAsync(int subProjectId)
 {
     return(await Entities.SingleOrDefaultAsync(x => x.SubProjectId == subProjectId));
 }
Esempio n. 32
0
        public static List <Product> getClothing()
        {
            Entities db = new Entities();

            return(db.Products.Where(x => x.Category == "Clothing").ToList());
        }
 public TinhRepository(Entities context)
     : base(context)
 {
 }
Esempio n. 34
0
 public override async Task <PostEditDto> HandleAsync(PostByIdQuery query, CancellationToken token)
 {
     return(await ProjectTo <PostEditDto>(Entities.Where(p => p.Id == query.Id)).FirstOrDefaultAsync(token));
 }
Esempio n. 35
0
        /// <summary>
        /// Create a new Attribute from an unencoded key and a HTML attribute encoded value.
        /// </summary>
        /// <param name="unencodedKey">
        /// assumes the key is not encoded, as can be only run of simple \w chars.
        /// </param>
        /// <param name="encodedValue">HTML attribute encoded value</param>
        /// <returns>attribute</returns>
        internal static Attribute CreateFromEncoded(string unencodedKey, string encodedValue)
        {
            string value = Entities.Unescape(encodedValue, true);

            return(new Supremes.Nodes.Attribute(unencodedKey, value));
        }
Esempio n. 36
0
        public WorkLoadEdit()
        {
            InitializeComponent();
            this.Tab    = null;
            this.Window = null;
            //this.SubdetailsGrid.Items.Clear();
            this.MainParametersChoose    = new MainComplexEdit.MainParametersChoose();
            this.ParametersFrame.Content = this.MainParametersChoose;
            Action <Type, System.Windows.Controls.ItemsControl> UpdateAssing = ((App)Application.Current).AssignRefresh;
            SelectionChangedEventHandler selectionChanged = new SelectionChangedEventHandler((object obj, SelectionChangedEventArgs args) => this.PreparePlan());

            this.MainParametersChoose.EduFormsList.SelectionChanged   += selectionChanged;
            this.MainParametersChoose.EduTypesList.SelectionChanged   += selectionChanged;
            this.MainParametersChoose.CourseChoose.SelectionChanged   += selectionChanged;
            this.MainParametersChoose.SemesterChoose.SelectionChanged += selectionChanged;
            try
            {
                this.MainContext.MAIN_TBL.Local.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler((object obj, NotifyCollectionChangedEventArgs args) => this.PreparePlan());
                this.MainContext.MAIN_TBL.Load();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to load plans.\nError: " + ex.Message + ".\n" + ex.StackTrace);
            }

            this.MainsGrid.SelectionChanged += new SelectionChangedEventHandler((object obj, SelectionChangedEventArgs arg) =>
            {
                this.UpdateDetails();
                this.MainsGrid.Focus();
            });
            this.MainContext.DETAILS_TBL.Local.CollectionChanged += new NotifyCollectionChangedEventHandler((object obj, NotifyCollectionChangedEventArgs args) =>
            {
                DETAILS_TBL detail = (DETAILS_TBL)this.DetailsGrid.SelectedItem;
                this.UpdateDetails();
                if (detail != null)
                {
                    this.DetailsGrid.SelectedItem = this.DetailsGrid.Items.OfType <DETAILS_TBL>().FirstOrDefault(p => p.DETAIL_ID == detail.DETAIL_ID);
                }
            });
            try
            {
                this.MainContext.DETAILS_TBL.Load();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to load plans details.\nError: " + ex.Message + "\n" + ex.StackTrace);
            }

            this.MainContext.SUBDETAILS_TBL.Local.CollectionChanged += new NotifyCollectionChangedEventHandler((object obj, NotifyCollectionChangedEventArgs args) =>
            {
                DETAILS_TBL detail = (DETAILS_TBL)this.DetailsGrid.SelectedItem;
                if (detail != null)
                {
                    if (args.Action == NotifyCollectionChangedAction.Reset)
                    {
                        try
                        { this.SubDetailCol.Clear(); }
                        catch { }
                    }
                    switch (args.Action)
                    {
                    case NotifyCollectionChangedAction.Reset:
                    case NotifyCollectionChangedAction.Replace:
                    case NotifyCollectionChangedAction.Add:
                        foreach (SUBDETAILS_TBL subdetail in args.NewItems)
                        {
                            if (subdetail.DETAIL_ID == detail.DETAIL_ID && !this.SubDetailCol.Any(p => p.SUBDETAIL_ID == subdetail.SUBDETAIL_ID))
                            {
                                this.SubDetailCol.Add(this.MainContext.SUBDETAILS_TBL.Where(p => p.SUBDETAIL_ID == subdetail.SUBDETAIL_ID).AsNoTracking().FirstOrDefault());
                            }
                        }
                        this.SubdetailsGrid.IsEnabled = true;
                        this.UserAbleAdd();
                        break;

                    case NotifyCollectionChangedAction.Remove:
                        foreach (SUBDETAILS_TBL subdetail in args.OldItems)
                        {
                            if (subdetail.DETAIL_ID == detail.DETAIL_ID && !this.SubDetailCol.Any(p => p.SUBDETAIL_ID == subdetail.SUBDETAIL_ID))
                            {
                                SUBDETAILS_TBL s = this.SubDetailCol.FirstOrDefault(p => p.SUBDETAIL_ID == subdetail.SUBDETAIL_ID);
                                if (s != null)
                                {
                                    this.SubDetailCol.Remove(s);
                                }
                            }
                        }
                        break;
                    }
                }
                else
                {
                    this.SubdetailsGrid.IsEnabled = false;
                }
            });

            this.DetailsGrid.SelectionChanged += new SelectionChangedEventHandler((object obj, SelectionChangedEventArgs arg) =>
            {
                try
                {
                    DETAILS_TBL detail = (DETAILS_TBL)this.DetailsGrid.SelectedItem;
                    try
                    { this.SubDetailCol.Clear(); }
                    catch { }
                    if (detail != null)
                    {
                        foreach (SUBDETAILS_TBL subdetail in this.MainContext.SUBDETAILS_TBL.Where(p => p.DETAIL_ID == detail.DETAIL_ID).AsNoTracking())
                        {
                            this.SubDetailCol.Add(subdetail);
                        }
                        this.SubdetailsGrid.IsEnabled = true;
                    }
                    else
                    {
                        this.SubdetailsGrid.IsEnabled = false;
                    }
                    this.UserAbleAdd();
                    this.DetailsGrid.Focus();
                }
                catch (Exception ex)
                { MessageBox.Show("Unable to load loads details while switchiing selection of plan details.\nError: " + ex.Message + "\n" + ex.StackTrace); }
            });
            this.MainContext.SUBDETAILS_TBL.Load();

            this.SubDetailCol = new ObservableCollection <SUBDETAILS_TBL>();
            this.SubDetailCol.CollectionChanged += new NotifyCollectionChangedEventHandler((object sender, NotifyCollectionChangedEventArgs args) =>
            {
                if (args.Action == NotifyCollectionChangedAction.Remove)
                {
                    foreach (SUBDETAILS_TBL subdetail in args.OldItems)
                    {
                        try
                        {
                            if (((DETAILS_TBL)this.DetailsGrid.SelectedItem).SUBDETAILS_TBL.Any(p => p.SUBDETAIL_ID == subdetail.SUBDETAIL_ID))
                            {
                                using (Entities context = new Entities())
                                {
                                    SUBDETAILS_TBL _subdetail = context.SUBDETAILS_TBL.Find(subdetail.SUBDETAIL_ID);
                                    if (_subdetail != null)
                                    {
                                        context.SUBDETAILS_TBL.Remove(_subdetail);
                                        SUBDETAILS_TBL local = this.MainContext.SUBDETAILS_TBL.Local.FirstOrDefault(p => p.SUBDETAIL_ID == subdetail.SUBDETAIL_ID);
                                        if (local != null)
                                        {
                                            this.MainContext.SUBDETAILS_TBL.Local.Remove(local);
                                        }
                                        context.SaveChanges();
                                        context.Database.Connection.Open();
                                        DbCommand command   = context.Database.Connection.CreateCommand();
                                        command.CommandText = "DELETE FROM GPRELATIONS_TBL WHERE SUBDETAIL_ID=" + _subdetail.SUBDETAIL_ID.ToString();
                                        command.ExecuteNonQuery();
                                        context.Database.Connection.Close();
                                        this.MainContext.SUBDETAILS_TBL.Load();
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Unable to delete load detail.\nError: " + ex.Message + "\n" + ex.StackTrace);
                        }
                    }
                }
                this.UserAbleAdd();
                this.DetailsGrid.Items.Refresh();
            });
            this.SubdetailsGrid.Items.Clear();
            this.SubdetailsGrid.ItemsSource = this.SubDetailCol;

            UpdateAssing(typeof(MAIN_TBL), this.MainsGrid);
            UpdateAssing(typeof(SUBDETAILS_TBL), this.SubdetailsGrid);
            UpdateAssing(typeof(DETAILS_TBL), this.DetailsGrid);
            UpdateAssing(typeof(TEACHERS_TBL), this.AvaliebleTutors);
            UpdateAssing(typeof(SUBDETAILS_TBL), this.AvaliebleTutors);

            RoutedEventHandler HourCellLostFocusHandler = new RoutedEventHandler((object sender, RoutedEventArgs args) => this.SubdetailsGrid.Items.Refresh());

            this.SubdetailsGrid.CellEditEnding += new EventHandler <DataGridCellEditEndingEventArgs>((object sender, DataGridCellEditEndingEventArgs args) =>
            {
                Validation.ClearInvalid(((TextBox)args.EditingElement).GetBindingExpression(TextBox.TextProperty));
                if (args.EditAction == DataGridEditAction.Cancel)
                {
                    return;
                }
                try
                {
                    SUBDETAILS_TBL subdetail = (SUBDETAILS_TBL)args.Row.DataContext;
                    if (args.Column == this.SubHourCol && this.DetailsGrid.SelectedItem != null)
                    {
                        decimal
                        detailHours         = ((DETAILS_TBL)DetailsGrid.SelectedItem).HOURS,
                        newHours            = (decimal)0.0;
                        System.String error = System.String.Empty;
                        if (!decimal.TryParse(((TextBox)args.EditingElement).Text ?? System.String.Empty, out newHours))
                        {
                            error = "На жаль, неможливо розпізнати введений текст як число.\nБудь ласка, переконайтеся що введені вами дані не містять постороніх символів (усе окрім цифр та коми).";
                        }
                        else if (newHours <= (decimal)0.0)
                        {
                            error = "На жаль, кількість годин не може бути від'ємною.";
                        }
                        else if (newHours > (decimal)999.99)
                        {
                            error = "На жаль, кількість годин не може бути більше ніж 999,99.";
                        }
                        else if (detailHours < newHours + this.SubDetailCol.DefaultIfEmpty(new SUBDETAILS_TBL()).Select(p => p.HOURS).Sum() - (this.SubdetailsGrid.SelectedItem != null && (this.SubdetailsGrid.SelectedItem ?? new object()).GetType().Name.Contains("SUBDETAILS_TBL") ? ((SUBDETAILS_TBL)this.SubdetailsGrid.SelectedItem).HOURS : (decimal)0.0))
                        {
                            error = "На жаль така кількість годин наразі недоступна.";
                        }
                        else
                        {
                            subdetail.HOURS = newHours;
                            this.UpdateLoad();
                            this.SubdetailsGrid.ItemsSource = null;
                            this.SubdetailsGrid.ItemsSource = this.SubDetailCol;
                            this.UserAbleAdd();
                        }
                        if (error != System.String.Empty)
                        {
                            ValidationError validationError = new ValidationError(new DataErrorValidationRule(), ((TextBox)args.EditingElement).GetBindingExpression(TextBox.TextProperty));
                            validationError.ErrorContent    = error;
                            Validation.MarkInvalid(((TextBox)args.EditingElement).GetBindingExpression(TextBox.TextProperty), validationError);
                            args.Cancel = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unable to edit the record.\nError: " + ex.Message + ".\n" + ex.StackTrace);
                }
            });

            this.SubdetailsGrid.InitializingNewItem += new InitializingNewItemEventHandler((object sender, InitializingNewItemEventArgs args) => ((SUBDETAILS_TBL)args.NewItem).DETAIL_ID = ((DETAILS_TBL)this.DetailsGrid.SelectedItem).DETAIL_ID);

            this.GroupSelectPage          = new LoadComplexEdit.GroupSelect();
            this.GroupSelectFrame.Content = this.GroupSelectPage;
            //this.GroupSelectPage.CloseBut.Click += new RoutedEventHandler((object obj, RoutedEventArgs args) => this.GroupSelectPopup.IsOpen = false);
            SubdetailsGrid.SelectionChanged += new SelectionChangedEventHandler((object sender, SelectionChangedEventArgs args) =>
            {
                if (this.SubdetailsGrid.SelectedItem == null)
                {
                    this.AvaliebleTutors.IsEnabled  = false;
                    this.GroupSelectFrame.IsEnabled = false;
                }
                else
                {
                    try
                    {
                        this.AvaliebleTutors.IsEnabled  = true;
                        this.GroupSelectFrame.IsEnabled = true;
                        this.SkipUpdateLoad             = true;
                        SUBDETAILS_TBL subdetail        = this.SubdetailsGrid.SelectedItem.GetType().Name.Contains("SUBDETAILS_TBL") ? ((SUBDETAILS_TBL)this.SubdetailsGrid.SelectedItem) : new SUBDETAILS_TBL()
                        {
                            DETAIL_ID  = ((DETAILS_TBL)this.DetailsGrid.SelectedItem).DETAIL_ID,
                            TEACHER_ID = 0
                        };
                        this.AvaliebleTutors.ItemsSource = this.MainContext.TEACHERS_TBL.ToList()
                                                           .Where(p => (this.SubdetailsGrid.SelectedItem.GetType().Name.Contains("SUBDETAILS_TBL") ? ((SUBDETAILS_TBL)this.SubdetailsGrid.SelectedItem).TEACHER_ID == p.TEACHER_ID : false) || !this.SubDetailCol.Any(g => g.TEACHER_ID == p.TEACHER_ID));



                        this.GroupSelectPage.AvGroups = this.MainContext.GROUPS_TBL.ToList().Where(p =>
                                                                                                   p.COURSE_NO == ((DETAILS_TBL)this.DetailsGrid.SelectedItem).MAIN_TBL.COURSE_NO &&
                                                                                                   p.EDUFORM_ID == ((DETAILS_TBL)this.DetailsGrid.SelectedItem).MAIN_TBL.EDUFORM_ID)
                                                        .ToList();
                        this.GroupSelectPage.SubDetail    = subdetail;
                        this.AvaliebleTutors.SelectedItem = this.AvaliebleTutors.Items.OfType <TEACHERS_TBL>().FirstOrDefault(p => this.SubdetailsGrid.SelectedItem.GetType().Name.Contains("SUBDETAILS_TBL") ? ((SUBDETAILS_TBL)this.SubdetailsGrid.SelectedItem).TEACHER_ID == p.TEACHER_ID : false);
                        this.SkipUpdateLoad = false;
                    }
                    catch (Exception ex)
                    { MessageBox.Show("Unable to fill edit fields while switching selection of load plan.\nError: " + ex.Message + ".\n" + ex.StackTrace); }
                    this.SubdetailsGrid.Focus();
                }
            });

            this.AvaliebleTutors.SelectionChanged += new SelectionChangedEventHandler((object sender, SelectionChangedEventArgs args) =>
            {
                try
                {
                    bool goToNextRow = !(this.SubdetailsGrid.SelectedItem?.GetType() ?? typeof(SUBDETAILS_TBL)).Name.Contains("SUBDETAILS_TBL") && this.SubdetailsGrid.SelectedItem != null && this.AvaliebleTutors.SelectedItem != null;

                    if (this.AvaliebleTutors.SelectedItem != null)
                    {
                        this.AddSubdetail(new Action <SUBDETAILS_TBL>((SUBDETAILS_TBL subdetail) =>
                        {
                            subdetail.TEACHERS_TBL = (TEACHERS_TBL)this.AvaliebleTutors.SelectedItem;
                            subdetail.TEACHER_ID   = ((TEACHERS_TBL)this.AvaliebleTutors.SelectedItem).TEACHER_ID;
                        }));
                    }
                    if ((this.SubdetailsGrid.SelectedItem?.GetType() ?? typeof(object)).Name.Contains("SUBDETAILS_TBL") && this.SubdetailsGrid.SelectedItem != null && this.AvaliebleTutors.SelectedItem != null)
                    {
                        ((SUBDETAILS_TBL)this.SubdetailsGrid.SelectedItem).TEACHERS_TBL = (TEACHERS_TBL)this.AvaliebleTutors.SelectedItem;
                        ((SUBDETAILS_TBL)this.SubdetailsGrid.SelectedItem).TEACHER_ID   = ((TEACHERS_TBL)this.AvaliebleTutors.SelectedItem).TEACHER_ID;
                    }

                    this.SubdetailsGrid.Items.Refresh();
                    this.UpdateLoad();
                    this.AvaliebleTutors.Items.Refresh();

                    if (goToNextRow && this.SubdetailsGrid.CanUserAddRows)
                    {
                        this.SubdetailsGrid.SelectedIndex = this.SubdetailsGrid.Items.Count - 1;
                        this.SubdetailsGrid.Focus();
                    }
                    else
                    {
                        this.AvaliebleTutors.Focus();
                    }
                }
                catch (Exception ex)
                { MessageBox.Show("Unable to change selection of tutor.\nError: " + ex.Message + ".\n" + ex.StackTrace); }
            });

            this.GroupSelectPage.GroupsInColl.CollectionChanged += new NotifyCollectionChangedEventHandler((object sender, NotifyCollectionChangedEventArgs args) =>
            {
                if (args.Action == NotifyCollectionChangedAction.Add || args.Action == NotifyCollectionChangedAction.Remove)
                {
                    try
                    {
                        if (this.GroupSelectPage.GroupsInColl.Count > 0)
                        {
                            this.AddSubdetail(new Action <SUBDETAILS_TBL>((SUBDETAILS_TBL subdetail) =>
                            {
                                foreach (GROUPS_TBL group in args.NewItems)
                                {
                                    subdetail.GROUPS_TBL.Add(group);
                                }
                            }));
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Unable to update group affiliating.\nError: " + ex.Message + ".\n" + ex.StackTrace);
                    }
                    this.SubdetailsGrid.Items.Refresh();
                    this.UpdateLoad();
                }
            });

            this.MainContext.TEACHERS_TBL.Local.CollectionChanged += new NotifyCollectionChangedEventHandler((object sender, NotifyCollectionChangedEventArgs args) =>
            {
                try
                {
                    this.SubdetailsGrid.Items.Refresh();
                    if (this.AvaliebleTutors.IsEnabled && this.SubdetailsGrid.SelectedItem != null)
                    {
                        this.AvaliebleTutors.ItemsSource = this.MainContext.TEACHERS_TBL.ToList()
                                                           .Where(p => (this.SubdetailsGrid.SelectedItem.GetType().Name.Contains("SUBDETAILS_TBL") ? ((SUBDETAILS_TBL)this.SubdetailsGrid.SelectedItem).TEACHER_ID == p.TEACHER_ID : false) || !this.SubDetailCol.Any(g => g.TEACHER_ID == p.TEACHER_ID));
                        this.AvaliebleTutors.Items.Refresh();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Неможливо оновити список доступних викладачів.\nПричина:\n" + ex.Message + "\n" + ex.StackTrace);
                }
            });

            this.Loaded += new RoutedEventHandler((object sender, RoutedEventArgs args) => PreparePlan());
        }
Esempio n. 37
0
        public static List <Product> getProduct(int id)
        {
            Entities db = new Entities();

            return(db.Products.Where(x => x.ProductId == id).ToList());
        }
Esempio n. 38
0
        public static List <Product> getAccessories()
        {
            Entities db = new Entities();

            return(db.Products.Where(x => x.Category == "Accessories").ToList());
        }
Esempio n. 39
0
        public static List <Product> get()
        {
            Entities db = new Entities();

            return(db.Products.ToList());
        }
Esempio n. 40
0
        public static List <Product> getBike()
        {
            Entities db = new Entities();

            return(db.Products.Where(x => x.Category == "Bike").ToList());
        }
 /// <summary>
 /// Constructor del controlador de Roles_Permisos
 /// </summary>
 /// <returns>Pagina de Index</returns>
 public Roles_PermisosController()
 {
     context   = new ApplicationDbContext();
     baseDatos = new Entities();
 }
Esempio n. 42
0
    protected override void OnUpdate()
    {
        Entities.WithNone <SendRpcCommandRequestComponent>().ForEach((Entity reqEnt, ref GoInGameRequest req, ref ReceiveRpcCommandRequestComponent reqSrc) =>
        {
            PostUpdateCommands.AddComponent <NetworkStreamInGame>(reqSrc.SourceConnection);
            UnityEngine.Debug.Log(String.Format("Server setting connection {0} to in game", EntityManager.GetComponentData <NetworkIdComponent>(reqSrc.SourceConnection).Value));
            var ghostCollection = GetSingleton <GhostPrefabCollectionComponent>();


            //var serverPrefabs = EntityManager.GetBuffer<GhostPrefabBuffer>(ghostCollection.serverPrefabs);
            //for (int ghostId = 0; ghostId < serverPrefabs.Length; ++ghostId)
            //{
            //    if (EntityManager.HasComponent<MovableCubeComponent>(serverPrefabs[ghostId].Value))
            //        prefab = serverPrefabs[ghostId].Value;
            //}



            // old implementation, was deprecated annoyingly
            //var ghostId = NetAgentGhostSerializerCollection.FindGhostType<AgentSnapshotData>();
            var ghostId = 0;
            var prefab  = EntityManager.GetBuffer <GhostPrefabBuffer>(ghostCollection.serverPrefabs)[ghostId].Value;
            var player  = EntityManager.Instantiate(prefab);

            Entity sword  = SwordSystem.AddAbility(player, EntityManager, ghostCollection);
            Entity shield = ShieldSystem.AddAbility(player, EntityManager, ghostCollection);


            ghostId     = 4;
            prefab      = EntityManager.GetBuffer <GhostPrefabBuffer>(ghostCollection.serverPrefabs)[ghostId].Value;
            var hurtbox = EntityManager.Instantiate(prefab);
            EntityManager.SetComponentData(hurtbox, new OwningPlayer {
                Value = player
            });
            EntityManager.AddBuffer <Hit>(hurtbox);

            ghostId          = 5;
            prefab           = EntityManager.GetBuffer <GhostPrefabBuffer>(ghostCollection.serverPrefabs)[ghostId].Value;
            var shieldHitbox = EntityManager.Instantiate(prefab);
            EntityManager.SetComponentData(shieldHitbox, new OwningPlayer {
                Value = player
            });
            EntityManager.SetComponentData(shieldHitbox, new AssociatedEntity {
                Value = shield
            });
            EntityManager.AddBuffer <Hit>(shieldHitbox);


            EntityManager.SetComponentData(player, new AgentComponent {
                PlayerId = EntityManager.GetComponentData <NetworkIdComponent>(reqSrc.SourceConnection).Value
            });

            InitializeAgent(player);

            PostUpdateCommands.AddBuffer <AgentInput>(player);

            PostUpdateCommands.SetComponent(reqSrc.SourceConnection, new CommandTargetComponent {
                targetEntity = player
            });

            PostUpdateCommands.DestroyEntity(reqEnt);

            Entity dash1 = DashSystem.AddAbility(player, 1, 1000, 7, new float3(0, 0, 1), KeyCode.A, EntityManager, ghostCollection);
            Entity dash2 = DashSystem.AddAbility(player, 1, 1000, 7, new float3(0, 0, -1), KeyCode.S, EntityManager, ghostCollection);
            Entity dash3 = DashSystem.AddAbility(player, 1, 1000, 7, new float3(1, 0, 0), KeyCode.D, EntityManager, ghostCollection);
            Entity dash4 = DashSystem.AddAbility(player, 1, 1000, 7, new float3(-1, 0, 0), KeyCode.F, EntityManager, ghostCollection);



//#if (!UNITY_EDITOR)
            //GameObject animate_prefab = Resources.Load<GameObject>("Prefabs/gladiator");
            //GameObject obj = UnityEngine.Object.Instantiate(animate_prefab);
            // setup pointer to entity from object
            //obj.GetComponent<PlayerMono>().entity = player;
            // setup pointers to entities from sword object
            //var swordObj = obj.transform.Find("CharArmature/Pelvis/Ribcage/Chest/Shoulder.R/UpperArm.R/Forearm.R/Hand.R/SwordArmature/Bone/Sword");
            //SwordMono swordMono = swordObj.GetComponent<SwordMono>();
            //swordMono.entity = sword;
            //swordMono.player = player;
            //EntityManager.AddComponentObject(sword, swordMono);

            //var shieldObj = obj.transform.Find("CharArmature/Pelvis/Ribcage/Chest/Shoulder.L/UpperArm.L/Forearm.L/ShieldArmature/Bone.001/Shield");
            //ShieldMono shieldMono = shieldObj.GetComponent<ShieldMono>();
            //shieldMono.entity = shield;
            //shieldMono.player = player;
            //EntityManager.AddComponentObject(shield, shieldMono);

            //obj.transform.localScale *= 0.5f;
            //EntityManager.AddComponentObject(player, obj);
            PostUpdateCommands.AddComponent <AnimationInitialized>(player);
//#endif
        });
    }
        unsafe protected override void OnUpdate()
        {
            // copy the shared component over to the renderable entities, and add the job-safe OcclusionMesh
            // component to the corresponding chunks
            Entities.WithNone <TextMesh>().ForEach((Occluder occluder) =>
            {
                var mesh = occluder.Mesh;

                if (!occluder.gameObject.activeInHierarchy || occluder.Mesh == null)
                {
                    return;
                }

                var meshRenderer = occluder.gameObject.GetComponent <MeshRenderer>();

                var entity = GetPrimaryEntity(occluder);// meshRenderer);

                var meshEntity = GetPrimaryEntity(mesh);

                if (meshRenderer == null)
                {
                    var occlusionMeshAsset = DstEntityManager.GetComponentData <OcclusionMeshAsset>(meshEntity);
                    DstEntityManager.AddComponentData(entity, new OcclusionMesh(ref occlusionMeshAsset, occluder));

                    var localToWorld = occluder.gameObject.transform.localToWorldMatrix;
                    DstEntityManager.AddComponentData(entity, new LocalToWorld {
                        Value = localToWorld
                    });
                }
                else
                {
                    var entities = GetEntities(meshRenderer).ToArray();

                    int entityCount = entities.Count();
                    if (meshRenderer.sharedMaterials.Length <= 1)
                    {
                        var occlusionMeshAsset = DstEntityManager.GetComponentData <OcclusionMeshAsset>(meshEntity);
                        DstEntityManager.AddComponentData <OcclusionMesh>(entity, new OcclusionMesh(ref occlusionMeshAsset, occluder));
                    }
                    else
                    {
                        var meshEntities    = GetEntities(mesh).ToArray();
                        var meshEntityCount = meshEntities.Length;

                        int lastOcclusionAsset = -1;
                        for (int i = 0; i < entityCount; i++)
                        {
                            bool found = false;
                            if (DstEntityManager.HasComponent <RenderMesh>(entities[i]))
                            {
                                var renderMesh = DstEntityManager.GetSharedComponentData <RenderMesh>(entities[i]);
                                for (int k = 0; k < meshEntityCount; k++)
                                {
                                    if (DstEntityManager.HasComponent <OcclusionMeshAsset>(meshEntities[k]))
                                    {
                                        lastOcclusionAsset = k;
                                        if (renderMesh.subMesh == k - 1)
                                        {
                                            var occlusionMeshAsset = DstEntityManager.GetComponentData <OcclusionMeshAsset>(meshEntities[k]);
                                            DstEntityManager.AddComponentData <OcclusionMesh>(entities[i], new OcclusionMesh(ref occlusionMeshAsset, occluder));
                                            found = true;
                                            break;
                                        }
                                    }
                                }

                                if (!found)
                                {
                                    if (lastOcclusionAsset >= 0)
                                    {
                                        // if we can't match occlusion assets to submeshes, that probably means that the
                                        // occlusion mesh is not the same as the render geometry.  in this case we assume
                                        // (for now at least) that the occlusion mesh has a single submesh.
                                        //
                                        // TODO:  more clear heuristics + verification
                                        var occlusionMeshAsset = DstEntityManager.GetComponentData <OcclusionMeshAsset>(meshEntities[lastOcclusionAsset]);
                                        DstEntityManager.AddComponentData <OcclusionMesh>(entities[i], new OcclusionMesh(ref occlusionMeshAsset, occluder));
                                    }
                                    else
                                    {
                                        Debug.LogWarning($"Couldn't match an occlusion asset to a submesh for {meshRenderer.name}");
                                    }
                                }
                            }
                        }
                    }
                }
            });

            Entities.ForEach((UnityEngine.MeshRenderer meshRenderer, UnityEngine.MeshFilter meshFilter, Occludee occludee) =>
            {
                if (occludee.enabled)
                {
                    var entities = GetEntities(meshRenderer);
                    foreach (var entity in entities)
                    {
                        DstEntityManager.AddComponentData(entity, new OcclusionTest(true));
                    }
                }
            });
        }
Esempio n. 44
0
 public CompetitorService(Entities dbContext) : base(dbContext)
 {
 }
Esempio n. 45
0
 public override void EnterEntityDeclaration(ExpressParser.EntityDeclarationContext context)
 {
     currentEntityInfo = new EntityDeclarationInfo(context.Identifier().GetText());
     Entities.Add(currentEntityInfo);
 }
Esempio n. 46
0
 protected override void OnCreateManager()
 {
     _query = Entities.WithAll <Health>().ToEntityQuery();
 }
Esempio n. 47
0
 public IEnumerable <T> GetEntities <T>() where T : class, IDescription
 {
     return(Entities.Where(entity => entity.Description.GetType() == typeof(T) || typeof(T).IsAssignableFrom(entity.Description.GetType())).Select(entity => entity.Description as T));
 }
        public List <EntityUid> ApplyEntityStates(EntityState[] curEntStates, IEnumerable <EntityUid> deletions,
                                                  EntityState[] nextEntStates)
        {
            var toApply      = new Dictionary <IEntity, (EntityState, EntityState)>();
            var toInitialize = new List <Entity>();
            var created      = new List <EntityUid>();

            deletions ??= new EntityUid[0];

            if (curEntStates != null && curEntStates.Length != 0)
            {
                foreach (var es in curEntStates)
                {
                    //Known entities
                    if (Entities.TryGetValue(es.Uid, out var entity))
                    {
                        toApply.Add(entity, (es, null));
                    }
                    else //Unknown entities
                    {
                        var metaState =
                            (MetaDataComponentState)es.ComponentStates.First(c => c.NetID == NetIDs.META_DATA);
                        var newEntity = CreateEntity(metaState.PrototypeId, es.Uid);
                        toApply.Add(newEntity, (es, null));
                        toInitialize.Add(newEntity);
                        created.Add(newEntity.Uid);
                    }
                }
            }

            if (nextEntStates != null && nextEntStates.Length != 0)
            {
                foreach (var es in nextEntStates)
                {
                    if (Entities.TryGetValue(es.Uid, out var entity))
                    {
                        if (toApply.TryGetValue(entity, out var state))
                        {
                            toApply[entity] = (state.Item1, es);
                        }
                        else
                        {
                            toApply[entity] = (null, es);
                        }
                    }
                }
            }

            // Make sure this is done after all entities have been instantiated.
            foreach (var kvStates in toApply)
            {
                var ent    = kvStates.Key;
                var entity = (Entity)ent;
                HandleEntityState(entity.EntityManager.ComponentManager, entity, kvStates.Value.Item1,
                                  kvStates.Value.Item2);
            }

            foreach (var kvp in toApply)
            {
                UpdateEntityTree(kvp.Key);
            }

            foreach (var id in deletions)
            {
                DeleteEntity(id);
            }

#if EXCEPTION_TOLERANCE
            HashSet <Entity> brokenEnts = new HashSet <Entity>();
#endif

            foreach (var entity in toInitialize)
            {
#if EXCEPTION_TOLERANCE
                try
                {
#endif
                InitializeEntity(entity);
#if EXCEPTION_TOLERANCE
            }
            catch (Exception e)
            {
                Logger.ErrorS("state", $"Server entity threw in Init: uid={entity.Uid}, proto={entity.Prototype}\n{e}");
                brokenEnts.Add(entity);
            }
#endif
            }

            foreach (var entity in toInitialize)
            {
#if EXCEPTION_TOLERANCE
                if (brokenEnts.Contains(entity))
                {
                    continue;
                }

                try
                {
#endif
                StartEntity(entity);
#if EXCEPTION_TOLERANCE
            }
            catch (Exception e)
            {
                Logger.ErrorS("state", $"Server entity threw in Start: uid={entity.Uid}, proto={entity.Prototype}\n{e}");
                brokenEnts.Add(entity);
            }
#endif
            }

            foreach (var entity in toInitialize)
            {
#if EXCEPTION_TOLERANCE
                if (brokenEnts.Contains(entity))
                {
                    continue;
                }
#endif
                UpdateEntityTree(entity);
            }
#if EXCEPTION_TOLERANCE
            foreach (var entity in brokenEnts)
            {
                entity.Delete();
            }
#endif

            return(created);
        }
Esempio n. 49
0
        public void Delete(int id)
        {
            var entity = Entities.Find(id);

            Context.Entry(entity).State = EntityState.Deleted;
        }
Esempio n. 50
0
        public static string Decode(string input)
        {
            if (input.IndexOf(EntityStart) == -1)
            {
                return(input);
            }

            var builder = new StringBuilder();
            var htmlEntityEndingChars = new[] { EntityEnd, EntityStart };

            for (var i = 0; i < input.Length; i++)
            {
                var c = input[i];

                if (c == EntityStart)
                {
                    // Found &. Look for the next ; or &. If & occurs before ;, then this is not entity, and next & may start another entity
                    var index = input.IndexOfAny(htmlEntityEndingChars, i + 1);
                    if (index > 0 && input[index] == EntityEnd)
                    {
                        var entity = input.Substring(i + 1, index - i - 1);

                        if (entity.Length > 1 && entity[0] == '#')
                        {
                            bool parsedSuccessfully;
                            uint parsedValue;
                            if (entity[1] == 'x' || entity[1] == 'X')
                            {
                                parsedSuccessfully = uint.TryParse(entity.Substring(2), NumberStyles.AllowHexSpecifier,
                                                                   NumberFormatInfo.InvariantInfo, out parsedValue);
                            }
                            else
                            {
                                parsedSuccessfully = uint.TryParse(entity.Substring(1), NumberStyles.Integer,
                                                                   NumberFormatInfo.InvariantInfo, out parsedValue);
                            }

                            if (parsedSuccessfully)
                            {
                                parsedSuccessfully = (0 < parsedValue && parsedValue <= Unicode00End);
                            }

                            if (parsedSuccessfully)
                            {
                                if (parsedValue <= Unicode00End)
                                {
                                    // single character
                                    builder.Append((char)parsedValue);
                                }
                                else
                                {
                                    // multi-character
                                    var utf32             = (int)(parsedValue - Unicode01Start);
                                    var leadingSurrogate  = (char)((utf32 / 0x400) + HighSurrogate);
                                    var trailingSurrogate = (char)((utf32 % 0x400) + LowSurrogate);

                                    builder.Append(leadingSurrogate);
                                    builder.Append(trailingSurrogate);
                                }

                                i = index;
                                continue;
                            }
                        }
                        else
                        {
                            i = index;
                            Entities.TryGetValue(entity, out var entityChar);

                            if (entityChar != (char)0)
                            {
                                c = entityChar;
                            }
                            else
                            {
                                builder.Append(EntityStart);
                                builder.Append(entity);
                                builder.Append(EntityEnd);
                                continue;
                            }
                        }
                    }
                }
                builder.Append(c);
            }
            return(builder.ToString());
        }
Esempio n. 51
0
 public async Task <T> GetAsync(int id) => await Entities.FirstOrDefaultAsync(f => f.Id == id);
Esempio n. 52
0
 public void Create(T item)
 {
     Entities.Add(item);
 }
Esempio n. 53
0
    protected override void OnUpdate()
    {
        Entities.WithAll <TagTerracedMapNeedBuild>().ForEach((Entity entity) =>
        {
            EntityManager.AddComponent <LocalToWorld>(entity);

            EntityManager.AddComponentData(entity, new RenderBounds
            {
                Value = new AABB
                {
                    Center  = new float3(GameSettings.MapSettingsInstance.mapSize / 2f),
                    Extents = new float3(GameSettings.MapSettingsInstance.mapSize / 2f),
                }
            });

            var msize        = GameSettings.MapSettingsInstance.mapSize - 1;
            var totalIndices = msize * msize * 6;

            var indices  = new NativeArray <int>(totalIndices, Allocator.TempJob);
            var vertices = new NativeArray <float3>(GameSettings.MapSettingsInstance.MapArea, Allocator.TempJob);
            var uvs      = new NativeArray <float2>(GameSettings.MapSettingsInstance.MapArea, Allocator.TempJob);

            var i = new NativeList <int>(Allocator.TempJob);
            var v = new NativeList <float3>(Allocator.TempJob);
            var u = new NativeList <float2>(Allocator.TempJob);

            var handle = new GridGenerator.CreateGridJob
            {
                Vertices = vertices,
                Indices  = indices,
                Uvs      = uvs,
                GridSize = GameSettings.MapSettingsInstance.mapSize,
            }.Schedule();

            handle = new Terraced.TerracedJob
            {
                uvs      = uvs,
                indices  = indices,
                vertices = vertices,

                maxHeight = (int)GameSettings.MapSettingsInstance.noiseAmplitude,

                entity           = entity,
                bufferFromEntity = GetBufferFromEntity <MapPointBuffer>(),

                i = i,
                v = v,
                u = u,
            }.Schedule(handle);

            handle.Complete();

            var mesh = new Mesh();

            mesh.SetVertices <float3>(v);
            mesh.SetIndices <int>(i, MeshTopology.Triangles, 0);
            mesh.SetUVs <float2>(0, u);
            mesh.RecalculateNormals();

            v.Dispose();
            i.Dispose();
            u.Dispose();

            EntityManager.AddSharedComponentData(entity, new RenderMesh
            {
                material       = GameSettings.MapMaterialInstance,
                castShadows    = ShadowCastingMode.On,
                receiveShadows = true,
                mesh           = mesh,
                subMesh        = 0,
                layer          = 0
            });

            EntityManager.RemoveComponent <TagTerracedMapNeedBuild>(entity);
        });
    }
Esempio n. 54
0
 public async Task <IEnumerable <T> > GetAllAsync() => await Entities.ToListAsync();
Esempio n. 55
0
 public CountryRegion(Entities countryRegionContext)
 {
     this.countryRegionContext = countryRegionContext;
 }
 public RomaneioRepository(Entities entities) : base(entities)
 {
 }
Esempio n. 57
0
        public List <AddressBookModels> GetAllAddressBooks(string searchString, string keyCode)
        {
            List <AddressBookModels> resultList    = new List <AddressBookModels>();
            UDCRepository            udcRepository = new UDCRepository();
            long xRefId = udcRepository.GetUdcByKeyCode("AB_Type", keyCode);

            try
            {
                using (var db = new Entities())
                {
                    var query = (from b in db.AddressBooks
                                 join c in db.UDCs
                                 on b.PeopleXrefId equals c.XRefId
                                 where (b.PeopleXrefId == c.XRefId && c.XRefId == xRefId)
                                 select new AddressBookModels
                    {
                        AddressId = b.AddressId,
                        Name = b.Name,
                        FirstName = b.FirstName,
                        LastName = b.LastName,
                        Company = b.Company,
                        CellPhone = b.CellPhone,
                        MailingCity = b.MailingCity,
                        MailingState = b.MailingState,
                        MailingAddress = b.MailingAddress,
                        MailingZipcode = b.MailingZipcode,
                        BillingCity = b.BillingCity,
                        BillingState = b.BillingState,
                        BillingZipcode = b.BillingZipcode,
                        BillingAddress = b.BillingAddress,
                        Type = c.KeyCode,
                        KeyCode = c.KeyCode,
                        Value = c.Value,
                        PeopleXrefId = b.PeopleXrefId,
                        ProductKey = b.ProductKey,
                        Email = b.Email,
                        Fax = b.Fax,
                        ShippingAddress = b.ShippingAddress,
                        ShippingCity = b.ShippingCity,
                        ShippingZipcode = b.ShippingZipcode,
                        ShippingState = b.ShippingState
                    });

                    if (!String.IsNullOrEmpty(searchString))
                    {
                        query = query.Where(s => s.Name.Contains(searchString) || s.FirstName.Contains(searchString) || s.LastName.Contains(searchString));
                    }

                    query = query.OrderBy(s => s.Name);

                    resultList = query.ToList <AddressBookModels>();

                    //foreach (var item in query)
                    //{
                    //    resultList.Add(item);
                    //}
                }
            }
            catch (Exception ex)
            {
            }
            return(resultList);
        }
Esempio n. 58
0
        public List <AddressBookModels> GetPersonList(string keyCode)
        {
            List <AddressBookModels> resultList    = new List <AddressBookModels>();
            UDCRepository            udcRepository = new UDCRepository();
            long xRefId = udcRepository.GetUdcByKeyCode("AB_Type", keyCode);

            try
            {
                using (var db = new Entities())
                {
                    var query = (from b in db.AddressBooks
                                 join c in db.UDCs
                                 on b.PeopleXrefId equals c.XRefId
                                 where (b.PeopleXrefId == c.XRefId && c.XRefId == xRefId)

                                 select new AddressBookModels
                    {
                        AddressId = b.AddressId,
                        Name = b.Name,
                        FirstName = b.FirstName,
                        LastName = b.LastName,
                        Company = b.Company,
                        CellPhone = b.CellPhone,
                        MailingCity = b.MailingCity,
                        MailingState = b.MailingState,
                        MailingAddress = b.MailingAddress,
                        MailingZipcode = b.MailingZipcode,
                        BillingCity = b.BillingCity,
                        BillingState = b.BillingState,
                        BillingZipcode = b.BillingZipcode,
                        BillingAddress = b.BillingAddress,
                        Type = c.KeyCode,
                        KeyCode = c.KeyCode,
                        Value = c.Value,
                        PeopleXrefId = b.PeopleXrefId,
                        ProductKey = b.ProductKey,
                        Email = b.Email,
                        Fax = b.Fax,
                        ShippingAddress = b.ShippingAddress,
                        ShippingCity = b.ShippingCity,
                        ShippingZipcode = b.ShippingZipcode,
                        ShippingState = b.ShippingState
                    }

                                 );

                    query      = query.OrderBy(s => s.Name);
                    resultList = query.ToList <AddressBookModels>();


                    /*
                     * var query = from b in db.AddressBooks
                     *          .Where(b => b.PeopleXrefId == xRefId)
                     *          select b;
                     *
                     * query = query.OrderBy(s => s.Name);
                     *
                     *
                     * foreach (var item in query)
                     * {
                     *  resultList.Add(item);
                     * }
                     */
                }
            }
            catch (Exception ex)
            { }
            return(resultList);
        }
Esempio n. 59
0
 public Dictionary <string, List <EntityRecord> > GetEntitiesByCategory()
 {
     return(Entities.GroupBy(x => $"{x.Type}" + (!string.IsNullOrWhiteSpace(x.SubType) ? $" ({x.SubType})" : ""))
            .OrderBy(x => x.Key)
            .ToDictionary(x => x.Key, x => x.ToList()));
 }
Esempio n. 60
0
 public Equipment(ContentManager content, ManagerMap managerMap, ManagerCamera managerCamera, Entities entities)
 {
     _items         = new List <Item>();
     _content       = content;
     _equipedItem   = new Dictionary <ItemSlot, Item>();
     _managerMap    = managerMap;
     _managerCamera = managerCamera;
     _entities      = entities;
 }