Esempio n. 1
0
        private void InsertPosition(string hotelId, string hotelCode, IList <OTA_HotelDescriptiveInfoRS.HotelDescriptiveContentsLocalType.HotelDescriptiveContentLocalType.HotelInfoLocalType.PositionLocalType> Position)
        {
            if (Position != null)
            {
                using (var context = new TravelDBContext())
                {
                    EfRepository <Position> EfContext = new EfRepository <Position>(context);

                    var positions = (from p in EfContext.Table where p.HotelID == hotelId select p).ToList();
                    if (positions != null)
                    {
                        EfContext.Delete(positions);
                    }

                    IList <Position> ps = new List <Position>();

                    foreach (var item in Position)
                    {
                        Position p = new Model.Position();
                        p.HotelID          = hotelId;
                        p.Latitude         = Convert.ToDecimal(item.Latitude);
                        p.Longitude        = Convert.ToDecimal(item.Longitude);
                        p.PositionTypeCode = Convert.ToInt32(item.PositionTypeCode);
                        p.LastMofifyTime   = DateTime.Now;
                        LoggerHelper(hotelCode, "Position " + p.Latitude + "," + p.Longitude + "," + "Inserted");
                        ps.Add(p);
                    }

                    EfContext.Insert(ps);
                    LoggerHelper(hotelCode, "Position Inserted Finished");
                }
            }
        }
Esempio n. 2
0
        public ActionResult Save()
        {
            Position position = new Position();
            try
            {
                string stated = Request.Form["stated"];
                position.Id = Convert.ToInt32(Request.Form["Id"]);
                position.positionName = Request.Form["positionName"];

                PositionBLL pBll = new PositionBLL();
                if (stated == "add")
                {
                    if (pBll.AddEntity(position))
                    {
                        return Content("{'success':'ok'}");
                    }
                }
                else if (stated == "update")
                {
                    if (pBll.ModifyEntity(position))
                    {
                        return Content("{'success':'ok'}");
                    }
                }
            }
            catch { }
            return Content("{}");
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static int Add(Position model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dbo.tb_Position ");
            strSql.Append("(position_name, position_description)");
            strSql.Append(" values (");
            strSql.Append("'").Append(model.Position_name).Append("'");
            strSql.Append(",").Append("'").Append(model.Position_description).Append("'").Append(")");

            return DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Esempio n. 4
0
 public override IEnumerable<GameAction> Click(Game game, int commandID, Position p)
 {
     StoneColor oldColor = game.State.Stones[p.X, p.Y];
     StoneColor newColor;
     if (commandID == 1)
         newColor = StoneColor.Black;
     else if (commandID == 2)
         newColor = StoneColor.White;
     else
         newColor = StoneColor.None;
     if (newColor == oldColor)
         newColor = StoneColor.None;
     yield return new SetStoneAction(p, newColor);
 }
Esempio n. 5
0
        public override IEnumerable<GameAction> Click(Game game, int actionIndex, Position p)
        {
            string oldLabel = game.State.Labels[p.X, p.Y];
            string newLabel;

            HashSet<string> existingLabels = new HashSet<string>();
            foreach (string s in game.State.Labels)
            {
                existingLabels.Add(s);
            }

            newLabel = getLabel(game, actionIndex, existingLabels, oldLabel);
            if (newLabel == null)
                throw new InvalidOperationException();
            yield return new LabelAction(p, newLabel);
        }
Esempio n. 6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Position model)
        {
            //StringBuilder strSql = new StringBuilder();
            //strSql.Append("insert into Position(");
            //strSql.Append("ID,PosiCode,PosiName,FatherCode,OrganID)");
            //strSql.Append(" values (");
            //strSql.Append("@ID,@PosiCode,@PosiName,@FatherCode,@OrganID)");
            //SqlParameter[] parameters = {
            //        new SqlParameter("@ID", SqlDbType.Int,4),
            //        new SqlParameter("@PosiCode", SqlDbType.VarChar,50),
            //        new SqlParameter("@PosiName", SqlDbType.VarChar,50),
            //        new SqlParameter("@FatherCode", SqlDbType.VarChar,50),
            //        new SqlParameter("@OrganID", SqlDbType.Int,4)};
            //parameters[0].Value = model.ID;
            //parameters[1].Value = model.PosiCode;
            //parameters[2].Value = model.PosiName;
            //parameters[3].Value = model.FatherCode;
            //parameters[4].Value = model.OrganID;

            //int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            //if (rows > 0)
            //{
            //    return true;
            //}
            //else
            //{
            //    return false;
            //}

            SqlParameter[] parameters = {
                    new SqlParameter("@name", model.PosiName),
                    new SqlParameter("@fatherCode", model.FatherCode),
                    new SqlParameter("@InputBy", model.InputBy),
                    new SqlParameter("@organID", model.OrganID)};
            int re = 0;
            DbHelperSQL.RunProcedure("Proc_AddPosition", parameters, out re);
            if (re > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            PositionBLL positionBLL = new PositionBLL();

            Position  temp = new  Position();

            temp.Position_name = txtbPositionname.Text.Trim();
            temp.Position_description = txtbPositionDes.Text.Trim();

            if (positionBLL.Add(temp) !=-1)
            {
                MessageBox.ShowAndRedirect(this, "添加成功", "PositionList.aspx");
            }
            else
            {
                MessageBox.ShowAndRedirect(this, "添加失败", "PositionList.aspx");
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Position> DataTableToList(DataTable dt)
 {
     List<Position> modelList = new List<Position>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Position model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Position();
             if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
             {
                 model.ID=int.Parse(dt.Rows[n]["ID"].ToString());
             }
             if(dt.Rows[n]["PosiCode"]!=null && dt.Rows[n]["PosiCode"].ToString()!="")
             {
             model.PosiCode=dt.Rows[n]["PosiCode"].ToString();
             }
             if(dt.Rows[n]["PosiName"]!=null && dt.Rows[n]["PosiName"].ToString()!="")
             {
             model.PosiName=dt.Rows[n]["PosiName"].ToString();
             }
             if(dt.Rows[n]["FatherCode"]!=null && dt.Rows[n]["FatherCode"].ToString()!="")
             {
             model.FatherCode=dt.Rows[n]["FatherCode"].ToString();
             }
             if(dt.Rows[n]["OrganID"]!=null && dt.Rows[n]["OrganID"].ToString()!="")
             {
                 model.OrganID=int.Parse(dt.Rows[n]["OrganID"].ToString());
             }
             if (dt.Rows[n]["InputTime"] != null && dt.Rows[n]["InputTime"].ToString() != "")
             {
                 model.InputTime = DateTime.Parse(dt.Rows[n]["InputTime"].ToString());
             }
             if (dt.Rows[n]["InputBy"] != null && dt.Rows[n]["InputBy"].ToString() != "")
             {
                 model.InputBy = dt.Rows[n]["InputBy"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Esempio n. 9
0
 /// <summary>
 /// Konstruktor, Initialisiert die Körperpunkte
 /// </summary>
 private Body()
 {
     AnkleLeft = new Position();
     AnkleRight = new Position();
     ElbowLeft = new Position();
     ElbowRight = new Position();
     FootLeft = new Position();
     FootRight = new Position();
     HandLeft = new Position();
     HandRight = new Position();
     Head = new Position();
     HipCenter = new Position();
     HipLeft = new Position();
     HipRight = new Position();
     KneeLeft = new Position();
     KneeRight = new Position();
     ShoulderCenter = new Position();
     ShoulderLeft = new Position();
     ShoulderRight = new Position();
     Spine = new Position();
     WristLeft = new Position();
     WristRight = new Position();
 }
 void RenderLabel(Position pos, string s)
 {
     if (String.IsNullOrEmpty(s))
         return;
     Vector2f point = GameToImage(pos);
     RawColor color;
     switch (State.Stones[pos])
     {
         case StoneColor.Black:
             {
                 color = RawColor.White;
                 break;
             }
         case StoneColor.White:
             {
                 color = RawColor.Black;
                 break;
             }
         case StoneColor.None:
             {
                 Graphics.FillCircle(BackgroundColor, point, 0.4f * BlockSize);
                 color = RawColor.Black;
                 break;
             }
         default:
             {
                 throw new NotImplementedException();
             }
     }
     if (s == "#TR")
     {
         float cos = (float)Math.Cos(Math.PI / 6);
         float sin = 0.5f;
         float radius = 0.35f * BlockSize;
         Vector2f p1 = new Vector2f(point.X, point.Y - radius);
         Vector2f p2 = new Vector2f(point.X + cos * radius, point.Y + sin * radius);
         Vector2f p3 = new Vector2f(point.X - cos * radius, point.Y + sin * radius);
         Graphics.DrawPolygon(new Pen(color, 2), new Vector2f[] { p1, p2, p3 });
     }
     else if ((s == "#SQ") || (s == "#KO"))
     {
         Vector2f pL = new Vector2f(point.X - 0.25f * BlockSize, point.Y - 0.25f * BlockSize);
         Graphics.DrawRectangle(new Pen(color, 2), RectangleF.FromLTWH(pL.X, pL.Y, (int)(0.5f * BlockSize), (int)(0.5f * BlockSize)));
     }
     else if (s == "#CR")
     {
         Vector2f pL = new Vector2f(point.X - 0.3f * BlockSize, point.Y - 0.3f * BlockSize);
         Graphics.DrawCircle(new Pen(color, 2), point, 0.3f * BlockSize);
     }
     else DrawString(s, GetFont(s.Length), color, new Vector2f(point.X, point.Y), new Vector2f(0.5f, 0.5f));
 }
Esempio n. 11
0
        public Model.Position Select(Model.Position Pos)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("Select * From [FAMIS].[dbo].[Position] Where Position_id =" + Pos.Position_id, db.Db());
                SqlDataReader dr = cmd.ExecuteReader();

                Model.Position position = new Model.Position();

                if (dr.Read())
                {
                    if (!dr.IsDBNull(0))
                    {
                        position.Position_id = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        position.Code = dr.GetString(1);
                    }
                    if (!dr.IsDBNull(2))
                    {
                        position.Department_id = dr.GetInt32(2);
                    }
                    if (!dr.IsDBNull(3))
                    {
                        position.Name = dr.GetString(2);
                    }
                    if (!dr.IsDBNull(4))
                    {
                        position.Salary_research = dr.GetDecimal(4);
                    }
                }
                return position;

            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 12
0
        //Nesse caso vai retornar uma lista de objeto. Não sei se seu retorno vão ter vários, ou um por vez. Se for um por vez, não precisa usar lista.
        public List<Model.Position> Select(String pWhere)
        {
            List<Model.Position> lstPosition = new List<Model.Position>();
            Model.Position position;

            SqlCommand cmd = new SqlCommand("Select * From dbo.[Position] " + pWhere, db.Db());

            using (SqlDataReader dr = cmd.ExecuteReader())
            {
                while (dr.Read())
                {
                    position = new Model.Position();

                    if (!dr.IsDBNull(0))
                    {
                        position.Position_id = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        position.Code = dr.GetString(1);
                    }
                    if (!dr.IsDBNull(2))
                    {
                        position.Department_id = dr.GetInt32(2);
                    }
                    if (!dr.IsDBNull(3))
                    {
                        position.Name = dr.GetString(3);
                    }
                    if (!dr.IsDBNull(4))
                    {
                        position.Salary_research = dr.GetDecimal(4);
                    }

                    lstPosition.Add(position);
                }
            }

            return lstPosition;
        }
 private void Field_Click(object sender, EventArgs e)
 {
     NavigationFocus.Focus();
     if (View.Editor == null || View.Editor.ActiveTool == null)
         return;
     var mE = (MouseEventArgs)e;
     Vector2f pf = ren.ImageToGame(mE.X, mE.Y - (Field.Height - Field.Image.Height) / 2);
     Position p = new Position((int)Math.Round(pf.X), (int)Math.Round(pf.Y));
     int actionIndex = 0;
     if (mE.Button == MouseButtons.Left)
         actionIndex = 1;
     if (mE.Button == MouseButtons.Right)
         actionIndex = 2;
     if (mE.Button == MouseButtons.Left && ModifierKeys == Keys.Shift)
         actionIndex = 2;
     if (mE.Button == MouseButtons.Middle)
         actionIndex = 3;
     if (mE.Button == MouseButtons.Left && ModifierKeys == Keys.Control)
         actionIndex = 3;
     if (actionIndex == 0)
         return;
     if (!Game.State.IsPositionValid(p))
         return;
     List<GameAction> actions = View.Editor.ActiveTool.Click(Game, actionIndex, p).ToList();
     View.Editor.AddActions(actions);
 }
Esempio n. 14
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Position model)
 {
     return dal.Update(model);
 }
 public Vector2i GameToImage(Position p)
 {
     return GameToImage(p.X, p.Y);
 }
Esempio n. 16
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Position GetModel(string PosiCode)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 * from Position ");
            strSql.Append(" where PosiCode=@PosiCode ");
            SqlParameter[] parameters = {
                    new SqlParameter("@PosiCode", SqlDbType.VarChar,50)			};
            parameters[0].Value = PosiCode;

            Position model = new Position();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PosiCode"] != null && ds.Tables[0].Rows[0]["PosiCode"].ToString() != "")
                {
                    model.PosiCode = ds.Tables[0].Rows[0]["PosiCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PosiName"] != null && ds.Tables[0].Rows[0]["PosiName"].ToString() != "")
                {
                    model.PosiName = ds.Tables[0].Rows[0]["PosiName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["FatherCode"] != null && ds.Tables[0].Rows[0]["FatherCode"].ToString() != "")
                {
                    model.FatherCode = ds.Tables[0].Rows[0]["FatherCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrganID"] != null && ds.Tables[0].Rows[0]["OrganID"].ToString() != "")
                {
                    model.OrganID = int.Parse(ds.Tables[0].Rows[0]["OrganID"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Esempio n. 17
0
 public abstract IEnumerable<GameAction> Click(Game game, int commandID, Position p);
Esempio n. 18
0
 public override IEnumerable<GameAction> Click(Game game, int commandID, Position p)
 {
     if (commandID == 1)
     {
         if (game.State.Stones[p.X, p.Y] == StoneColor.None)
         {
             int? alreadyPlayed = game.Tree.MoveAlreadyPlayed(p);
             if (alreadyPlayed != null)
             {
                 yield return new SelectStateAction((int)alreadyPlayed);
             }
             else
             {
                 yield return new StoneMoveAction(p, game.State.PlayerToMove);
                 if (game.State.Labels.Any(s => s != null))
                     yield return LabelAction.ClearLabels;
             }
         }
     }
     if (commandID == 2)
     {
         int? moveIndex = game.Tree.FindMove(p);
         if (moveIndex != null)
         {
             yield return new SelectStateAction((int)moveIndex);
         }
     }
 }
Esempio n. 19
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Position model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update Position set ");
            strSql.Append("PosiName=@PosiName,");
            strSql.Append("FatherCode=@FatherCode,");
            strSql.Append("OrganID=@OrganID");
            strSql.Append(" where PosiCode=@PosiCode ");
            SqlParameter[] parameters = {
                    new SqlParameter("@PosiName",  model.PosiName),
                    new SqlParameter("@FatherCode", model.FatherCode),
                    new SqlParameter("@OrganID", model.OrganID),
                    new SqlParameter("@PosiCode", model.PosiCode)};

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 20
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Position model)
 {
     return dal.Add(model);
 }
Esempio n. 21
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Position  model)
 {
     return PositionDAL.Add(model);
 }