Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oPosition = new DataAccess.Position();
            if (tbxPosition.Text.Trim() != String.Empty)
            {
                oMPosition          = new Model.Position();
                oMPosition.ID       = eVariable.sID;
                oMPosition.POSITION = tbxPosition.Text;
                oMPosition.STATUS   = chkStatus.Checked == true ? "ACTIVE" : "INACTIVE";

                if (TransactionType == eVariable.TransactionType.EDIT)
                {
                    oPosition.UpdatePosition(oMPosition);
                }
                else
                {
                    if (oPosition.IsPositionExists(tbxPosition.Text))
                    {
                        oFrmMsgBox             = new frmMessageBox("RECORD ALREADY EXISTS");
                        oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                        return;
                    }
                    oPosition = new DataAccess.Position();
                    oPosition.InsertPosition(oMPosition);
                }
                oFrmMsgBox             = new frmMessageBox("RECORD SUCCESSFULLY SAVED");
                oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                LoadPosition();
                eVariable.ClearText(panel3);
                TransactionType = eVariable.TransactionType.ADD;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 通过编号找到库位.
        /// </summary>
        /// <param name="nnum">库位编号.</param>
        public Model.Position getPositionByNum(string nnum)
        {
            Model.Position      posi     = null;
            string              sqltext  = "select * from position where positionNum=@positionNum";
            List <SqlParameter> para     = new List <SqlParameter>();
            SqlParameter        sqlpara1 = new SqlParameter("@positionNum", nnum);

            para.Add(sqlpara1);
            SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para);

            while (sdr.Read())
            {
                posi                = new Model.Position();
                posi.PositionNum    = sdr["positionNum"].ToString();
                posi.RoomNum        = sdr["roomNum"].ToString();
                posi.ChestNum       = sdr["chestNum"].ToString();
                posi.PositiontypeId = sdr["positionTypeId"].ToString();
                posi.GoodsTypes     = sdr["goodsTypes"].ToString();
                posi.Remark         = sdr["remark"].ToString();
                posi.CreateTime     = DateTime.Parse(sdr["createTime"].ToString());
                posi.UpdateTime     = DateTime.Parse(sdr["updateTime"].ToString());
                posi.M              = sdr["M"].ToString();
                posi.Height         = sdr["Height"].ToString();
            }
            sdr.Close();
            DBTools.DBClose();
            return(posi);
        }
        protected void Button200_Click(object sender, EventArgs e)
        {
            Model.Position delete = new Model.Position();
            int            x      = Convert.ToInt32(Session["e"]);

            delete.PositionNum = GridView1.Rows[x].Cells[1].Text;
            Warehouse.Tools.queryV qu = new Tools.queryV();
            Warehouse.Tools.apartV qp = new Tools.apartV();
            string chestNum           = qu.query("select chestNum from Position where PositionNum='" + delete.PositionNum + "' ");
            string positionM          = qu.query("select M from Position where PositionNum='" + delete.PositionNum + "' ");
            string M  = qu.query("select M from Chest where chestNum='" + chestNum + "' ");
            bool   yy = new DAL.PositionDAO().deletePositionByNum(delete.PositionNum);

            if (yy)
            {
                Warehouse.Tools.updateChestM up = new Tools.updateChestM();
                double bb = (Convert.ToDouble(qp.apart(M)) + Convert.ToDouble(qp.apart(positionM)));
                up.update((bb.ToString() + "平方米"), chestNum);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true);
                ideas.Style["display"] = "none";
                pg.Refresh("select num,positionNum,chestNum,roomNum,positionTypeId,goodsTypes,M,remark from Position", "positionNum", GridView1);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true);
                ideas.Style["display"] = "none";
            }
        }
Beispiel #4
0
        void AddItemOnClick(object obj)
        {
            Model.Position newPositions;
            using (SqlConnection con = new SqlConnection(GValues.connString))
            {
                con.Open();
                using (SqlCommand command = new SqlCommand())
                {
                    newPositions               = new Model.Position();
                    newPositions.itemId        = 0;
                    newPositions.xcount        = 0;
                    newPositions.currencyId    = Model.Position.lastCurrency;
                    newPositions.xprice        = 0;
                    newPositions.isAvalForEdit = true;

                    command.Connection  = con;
                    command.CommandText = " INSERT INTO document_items(xdocument, item, ref_dimensions, xcount, currency, xprice, ref_status) " +
                                          " VALUES(@xdocument, @item, @ref_dimensions, @xcount, @currency, @xprice, @ref_status ); " +
                                          " SELECT SCOPE_IDENTITY();";

                    command.Parameters.Add("xdocument", SqlDbType.Int).Value      = DataModel.CurDocument.Id;
                    command.Parameters.Add("item", SqlDbType.Int).Value           = newPositions.itemId;
                    command.Parameters.Add("ref_dimensions", SqlDbType.Int).Value = newPositions.dimensionId;
                    command.Parameters.Add("xcount", SqlDbType.Decimal).Value     = newPositions.xcount;
                    command.Parameters.Add("currency", SqlDbType.Decimal).Value   = newPositions.currencyId;
                    command.Parameters.Add("xprice", SqlDbType.Decimal).Value     = newPositions.xprice;
                    command.Parameters.Add("ref_status", SqlDbType.Int).Value     = 1;

                    newPositions.id = (decimal)command.ExecuteScalar();
                }
            }
            DataModel.CurDocument.DocumentPositions.Add(newPositions);
            newPositions = null;
        }
Beispiel #5
0
        /// <summary>
        /// 获取所有的库位.
        /// </summary>
        /// <returns>库位对象泛型集合.</returns>
        public List <Model.Position> getAllPositions()
        {
            List <Model.Position> posi = new List <Model.Position>();
            string        sqltext      = "select * from position";
            SqlDataReader sdr          = DBTools.exereaderSQL(sqltext, new List <SqlParameter> ());

            while (sdr.Read())
            {
                Model.Position p = new Model.Position();
                p.PositionNum    = sdr["positionNum"].ToString();
                p.RoomNum        = sdr["roomNum"].ToString();
                p.ChestNum       = sdr["chestNum"].ToString();
                p.PositiontypeId = sdr["positionTypeId"].ToString();
                p.GoodsTypes     = sdr["goodsTypes"].ToString();
                p.Remark         = sdr["remark"].ToString();
                p.CreateTime     = DateTime.Parse(sdr["createTime"].ToString());
                p.UpdateTime     = DateTime.Parse(sdr["updateTime"].ToString());
                p.M      = sdr["M"].ToString();
                p.Height = sdr["Height"].ToString();
                p.Rest   = sdr["Rest"].ToString();
                posi.Add(p);
            }
            sdr.Close();
            DBTools.DBClose();
            return(posi);
        }
Beispiel #6
0
        public void Run(Model.MlbStatsContext context)
        {
            var url     = Feeds.PositionsFeed.GetFeedUrl();
            var rawJson = JsonUtility.GetRawJsonFromUrl(url);
            var feed    = Feeds.PositionsFeed.FromJson(rawJson);

            var dbPositions = context.Positions.ToDictionary(x => x.PositionAbbr);

            foreach (var feedPosition in feed)
            {
                if (!dbPositions.TryGetValue(feedPosition.Abbrev, out Model.Position dbPosition))
                {
                    dbPosition = new Model.Position
                    {
                        PositionAbbr = feedPosition.Abbrev,
                        ShortName    = feedPosition.ShortName,
                        FullName     = feedPosition.FullName,
                        FormalName   = feedPosition.FormalName,
                        DisplayName  = feedPosition.DisplayName,
                        PositionCode = feedPosition.Code,
                        IsFielder    = feedPosition.Fielder,
                        IsPitcher    = feedPosition.Pitcher,
                        IsOutfield   = feedPosition.Outfield,
                        PositionType = feedPosition.Type
                    };
                    dbPositions.Add(dbPosition.PositionAbbr, dbPosition);
                    context.Positions.Add(dbPosition);
                }
                else
                {
                    ;                     // TODO: ADD NO-CHANGE VALIDATION LOGIC
                }
            }
            context.SaveChanges();
        }
Beispiel #7
0
 /// <summary>
 /// 添加职务(确定按钮)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ImageButton1_Click(object sender, EventArgs e)
 {
     try
     {
         if (TextBox1.Text.Trim() != "")
         {
             Maticsoft.Model.Position zhiwu = new Model.Position();
             zhiwu.name   = TextBox1.Text.Trim();
             zhiwu.beizhu = TextBox2.Text.Trim();
             int a = zw.Add(zhiwu);
             if (a > 0)
             {
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('添加成功!');</script>");
                 bind(sql);
             }
             else
             {
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('添加失败!');</script>");
                 bind(sql);
             }
         }
         else
         {
             ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('职务名称不能为空!');</script>");
             ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>");
         }
     }
     catch (Exception ee)
     {
         //Response.Write("<script>alert('确定异常 " + ee.Message + "')</script>");
         ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('确定异常 " + ee.Message + "');</script>");
     }
 }
Beispiel #8
0
 public frmSearch()
 {
     InitializeComponent();
     oMStudent  = new Model.Student();
     oMParty    = new Model.Party();
     oMPosition = new Model.Position();
     eVariable.DisableTextPanelEnterKey(panel3);
     eVariable.DisableKeyPress(cboSearch);
 }
Beispiel #9
0
        public void ConvertAccidentalTest_Position(string meipos, Model.Position convertedPos)
        {
            if (meipos != null)
            {
                meiaccid.SetAccidPos(meipos);
            }

            AccidentalConverter.ConvertAccidental(convertedAccid, meiaccid);

            Assert.AreEqual(convertedPos, convertedAccid.AccidentalPosition);
        }
        async void OnNewSightClicked(object sender, EventArgs args)
        {
            Model.Position currentPosition = BindingContext as Model.Position;
            Sight          newSight        = new Sight(currentPosition.ID);
            await AlmicantaratXF.Views.App.PositionsSightsDB.SaveSightAsync(newSight);

            /*
             * await Navigation.PushAsync(new SightPage
             * {
             *  BindingContext = newSight
             * });
             */
            await Navigation.PushAsync(new SightPage(newSight, currentPosition));
        }
Beispiel #11
0
        public static ChangedEnum WhatsChanged(cAlgo.API.Position Position)
        {
            Model.Position LocalPosition = GetByID(Position.Id);


            if (LocalPosition == null)
            {
                return(ChangedEnum.Status);
            }
            // else if (LocalPosition.TakeProfit <> (decimal)Position.TakeProfit  )
            //   return ChangedEnum.TakeProfit

            return(ChangedEnum.Unknown);
        }
Beispiel #12
0
 void DatagridSelect(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgPosition.Rows.Count > 0 && e.RowIndex >= 0)
         {
             oMPosition          = new Model.Position();
             oMPosition.ID       = dgPosition.Rows[e.RowIndex].Cells[0].Value.ToString().Trim();
             oMPosition.POSITION = dgPosition.Rows[e.RowIndex].Cells[1].Value.ToString().Trim();
             oMPosition.STATUS   = dgPosition.Rows[e.RowIndex].Cells[2].Value.ToString().Trim();
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #13
0
 public void insertPosition(Model.Position position)
 {
     try
     {
         if (null == position)
         {
             return;
         }
         IDAL.IPosition dal = DALFactory.Position.Create();
         dal.insertPosition(position);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        async void OnDelete(object sender, EventArgs args)
        {
            bool answer = await DisplayAlert(
                rm.GetString("warning"),
                rm.GetString("messageDeletePosition"),
                rm.GetString("deleteAnyway"),
                rm.GetString("cancel"));

            //System.Diagnostics.Debug.WriteLine("Answer: " + answer);
            if (answer)
            {
                Model.Position currentPosition = BindingContext as Model.Position;
                //TODO delete sights
                AlmicantaratXF.Views.App.PositionsSightsDB.DeleteSights(currentPosition.ID);
                await AlmicantaratXF.Views.App.PositionsSightsDB.DeletePositionAsync(currentPosition);

                await Navigation.PopAsync();
            }
        }
Beispiel #15
0
 protected void Button66_Click(object sender, EventArgs e)
 {
     Model.Outout add = new Model.Outout();
     if (Button66.Text == "增加")
     {
         if (Image1.ImageUrl == "~/Image/对号.png" && Image2.ImageUrl == "~/Image/对号.png" && Image3.ImageUrl == "~/Image/对号.png" && Image4.ImageUrl == "~/Image/对号.png" && Image5.ImageUrl == "~/Image/对号.png" && Image6.ImageUrl == "~/Image/对号.png" && Image7.ImageUrl == "~/Image/对号.png" && Image8.ImageUrl == "~/Image/对号.png")
         {
             Warehouse.Tools.queryV qq = new Tools.queryV();
             DAL.Query quu             = new DAL.Query();
             int       n = quu.query("Outout");
             add.Num         = n + 1;
             add.OuID        = TextBox11.Text;
             add.GoodsNum    = TextBox12.Text;
             add.PositionNum = TextBox9.Text;
             add.OutAmount   = Convert.ToDouble(TextBox2.Text);
             add.BatchNum    = TextBox3.Text;
             add.Date        = Convert.ToDateTime(TextBox4.Text);
             add.UserId      = qu.query("select staffNum from Staff where staffName='" + TextBox5.Text + "'");
             add.Remark      = TextBox6.Text;
             bool xx = new DAL.OutoutDAO().addOut(add);
             if (xx)
             {
                 Model.Amount update = new Model.Amount();
                 update.Amounts = Convert.ToDouble(Session["max"].ToString()) - Convert.ToDouble(add.OutAmount);
                 double d = Convert.ToDouble(Session["V"].ToString()) / Convert.ToDouble(Session["max"].ToString());
                 update.V           = (update.Amounts * d).ToString();
                 update.GoodsNum    = TextBox12.Text;
                 update.PositionNum = TextBox9.Text;
                 update.Vp          = d.ToString();
                 bool yy = new DAL.AmountDAO().update(update);
                 if (yy)
                 {
                     double         rest   = Convert.ToDouble(qu.query("select Rest from Position where positionNum='" + TextBox9.Text + "'"));
                     Model.Position Update = new Model.Position();
                     Update.Rest        = (rest + d * add.OutAmount).ToString();
                     Update.PositionNum = TextBox9.Text;
                     bool cc = new DAL.PositionDAO().update(Update);
                 }
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');window.location.href='出库登记.aspx'", true);
             }
         }
     }
 }
Beispiel #16
0
 /// <summary>
 /// 修改弹窗赋值
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
     try
     {
         //获取button 控件
         LinkButton lb = (LinkButton)sender;
         //获取传过来的commwntid
         int            id = Convert.ToInt32(lb.CommandArgument);
         Model.Position po = zw.GetModel(id);
         Label1.Text   = po.id.ToString();
         TextBox4.Text = po.name;
         TextBox5.Text = po.beizhu;
         ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv2();</script>");
     }
     catch (Exception ee)
     {
         //Response.Write("<script>alert('确定异常 " + ee.Message + "')</script>");
         ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('修改弹窗异常 " + ee.Message + "');</script>");
     }
 }
Beispiel #17
0
        /// <summary>
        /// 更新某个库位.库位编号不可更改.
        /// </summary>
        /// <param name="posi">库位对象.</param>
        public bool update(Model.Position posi)
        {
            string sqltext                = "update Position set rest=@rest where positionNum=@positionNum";
            List <SqlParameter> para      = new List <SqlParameter>();
            SqlParameter        sqlpara1  = new SqlParameter("@positionNum", posi.PositionNum);
            SqlParameter        sqlpara11 = new SqlParameter("@Rest", posi.Rest);

            para.Add(sqlpara1);
            para.Add(sqlpara11);
            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #18
0
        /// <summary>
        /// 添加一个库位.库位编号是主键.
        /// </summary>
        /// <param name="posi">库位对象.</param>
        /// <returns>通过布尔类型判断操作是否成功.</returns>
        public bool addPosition(Model.Position posi)
        {
            string sqltext                = "insert position(num,positionNum,chestNum,roomNum,positionTypeId,goodsTypes,M,Height,Rest,remark,createTime,updateTime) values(@num,@positionNum,@chestNum,@roomNum,@positionTypeId,@goodsTypes,@M,@Height,@Rest,@remark,@createTime,@updateTime)";
            List <SqlParameter> para      = new List <SqlParameter>();
            SqlParameter        sqlpara   = new SqlParameter("@num", posi.Num);
            SqlParameter        sqlpara1  = new SqlParameter("@positionNum", posi.PositionNum);
            SqlParameter        sqlpara2  = new SqlParameter("@chestNum", posi.ChestNum);
            SqlParameter        sqlpara3  = new SqlParameter("@roomNum", posi.RoomNum);
            SqlParameter        sqlpara4  = new SqlParameter("@positionTypeId", posi.PositiontypeId);
            SqlParameter        sqlpara5  = new SqlParameter("@goodsTypes", posi.GoodsTypes);
            SqlParameter        sqlpara51 = new SqlParameter("@M", posi.M);
            SqlParameter        sqlpara52 = new SqlParameter("@Height", posi.Height);
            SqlParameter        sqlpara53 = new SqlParameter("@Rest", posi.Rest);
            SqlParameter        sqlpara6  = new SqlParameter("@remark", posi.Remark);
            SqlParameter        sqlpara7  = new SqlParameter("@createTime", posi.CreateTime.ToString());
            SqlParameter        sqlpara8  = new SqlParameter("@updateTime", posi.UpdateTime.ToString());

            para.Add(sqlpara);
            para.Add(sqlpara1);
            para.Add(sqlpara2);
            para.Add(sqlpara3);
            para.Add(sqlpara4);
            para.Add(sqlpara5);
            para.Add(sqlpara51);
            para.Add(sqlpara52);
            para.Add(sqlpara53);
            para.Add(sqlpara6);
            para.Add(sqlpara7);
            para.Add(sqlpara8);
            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #19
0
        public void insertPosition(Model.Position position)
        {
            String sql = "";

            try
            {
                if (position.Task_id < 0)
                {
                    sql = " insert into Position "
                          + " (LATITUDE,LONGITUDE,RECEIVETIME,USERNAME,PATROLER_ID,TASK_ID)VALUES("
                          + position.Latitude + ","
                          + position.Longitude + ","
                          + "to_date('" + position.ReceiveTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss')" + ","
                          + "'" + position.Username + "',"
                          + position.Patroler_id + ","
                          + position.Task_id + ")";
                }
                else
                {
                    sql = " insert into Position "
                          + " (LATITUDE,LONGITUDE,RECEIVETIME,USERNAME,PATROLER_ID)VALUES("
                          + position.Latitude + ","
                          + position.Longitude + ","
                          + "to_date('" + position.ReceiveTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss')" + ","
                          + "'" + position.Username + "',"
                          + position.Patroler_id + ")";
                }
                OracleParameter[] parms  = null;
                string            strCnn = OracleHelper.ConnectionStringOrderDistributedTransaction;
                using (OracleConnection cnn = new OracleConnection(strCnn))
                {
                    OracleHelper.ExecuteNonQuery(cnn, CommandType.Text, sql, parms);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #20
0
        /// <summary>
        /// 更新某个库位.库位编号不可更改.
        /// </summary>
        /// <param name="posi">库位对象.</param>
        public bool updatePosition(Model.Position posi)
        {
            string sqltext                = "update position set roomNum=@roomNum,chestNum=@chestNum,positionTypeId=@positionTypeId,goodsTypes=@goodsTypes,remark=@remark,createTime=@createTime,updateTime=@updateTime,M=@M,Height=@Height where positionNum=@positionNum";
            List <SqlParameter> para      = new List <SqlParameter>();
            SqlParameter        sqlpara1  = new SqlParameter("@positionNum", posi.PositionNum);
            SqlParameter        sqlpara2  = new SqlParameter("@roomNum", posi.RoomNum);
            SqlParameter        sqlpara3  = new SqlParameter("@chestNum", posi.ChestNum);
            SqlParameter        sqlpara4  = new SqlParameter("@positionTypeId", posi.PositiontypeId);
            SqlParameter        sqlpara5  = new SqlParameter("@goodsTypes", posi.GoodsTypes);
            SqlParameter        sqlpara6  = new SqlParameter("@remark", posi.Remark);
            SqlParameter        sqlpara7  = new SqlParameter("@createTime", posi.CreateTime.ToString());
            SqlParameter        sqlpara8  = new SqlParameter("@updateTime", posi.UpdateTime.ToString());
            SqlParameter        sqlpara9  = new SqlParameter("@M", posi.M);
            SqlParameter        sqlpara10 = new SqlParameter("@Height", posi.Height);
            SqlParameter        sqlpara11 = new SqlParameter("@Rest", posi.Rest);

            para.Add(sqlpara2);
            para.Add(sqlpara3);
            para.Add(sqlpara4);
            para.Add(sqlpara5);
            para.Add(sqlpara6);
            para.Add(sqlpara7);
            para.Add(sqlpara8);
            para.Add(sqlpara1);
            para.Add(sqlpara9);
            para.Add(sqlpara10);
            para.Add(sqlpara11);
            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #21
0
        public static void UpdatePositions(IAccount Account, cAlgo.API.Positions Positions)
        {
            // Check for any open Positions that are no longer open in cTrader...
            List <Model.Position> CurrentOpenPositions = Business.Positions.GetByAccountID(Account.Number, "Opened");

            foreach (Model.Position LocalPosition in CurrentOpenPositions)
            {
                bool ClosedExternally = true;
                foreach (cAlgo.API.Position AlgoP in Positions)
                {
                    if (LocalPosition.ID == AlgoP.Id)
                    {
                        ClosedExternally = false;
                    }
                }

                if (ClosedExternally)
                {
                    LocalPosition.Status = "Closed";
                    Business.Positions.Save(LocalPosition);
                    //AB: SEND TO SERVICE BUS to CLOSE Positions...
                }
            }



            // For each Open Position, update the SL/TP etc and add it if its not in the Database...
            foreach (cAlgo.API.Position AlgoP in Positions)
            {
                Model.Position LocalPosition = Business.Positions.GetByID(AlgoP.Id);

                // find any changes to syn out to shadows...
                //if (AlgoP.TakeProfit <> LocalPosition.TakeProfit | AlgoP.StopLoss  <> LocalPosition.StopLoss )

                //Update Postions...
                Update(Account, AlgoP, "Opened");
            }
        }
Beispiel #22
0
        private void SelectRecord()
        {
            if (dgDetails.Rows.Count >= 0 && iRowIndex >= 0)
            {
                if (RecordType == RECORD_TYPE.STUDENT)
                {
                    oMStudent = new Model.Student();

                    oMStudent.UNIQUE_ID   = dgDetails.Rows[iRowIndex].Cells[0].Value.ToString();
                    oMStudent.FIRST_NAME  = dgDetails.Rows[iRowIndex].Cells[1].Value.ToString();
                    oMStudent.MIDDLE_NAME = dgDetails.Rows[iRowIndex].Cells[2].Value.ToString();
                    oMStudent.LAST_NAME   = dgDetails.Rows[iRowIndex].Cells[3].Value.ToString();
                    oMStudent.DOB         = dgDetails.Rows[iRowIndex].Cells[4].Value.ToString();
                    oMStudent.AGE         = dgDetails.Rows[iRowIndex].Cells[5].Value.ToString();
                    oMStudent.COURSE      = dgDetails.Rows[iRowIndex].Cells[6].Value.ToString();
                    oMStudent.SECTION     = dgDetails.Rows[iRowIndex].Cells[7].Value.ToString();
                    oMStudent.CONTACT_NO  = dgDetails.Rows[iRowIndex].Cells[8].Value.ToString();
                    oMStudent.ADDRESS     = dgDetails.Rows[iRowIndex].Cells[9].Value.ToString();
                }
                else if (RecordType == RECORD_TYPE.PARTY)
                {
                    oMParty = new Model.Party();

                    oMParty.ID    = dgDetails.Rows[iRowIndex].Cells[0].Value.ToString();
                    oMParty.PARTY = dgDetails.Rows[iRowIndex].Cells[1].Value.ToString();
                }
                else if (RecordType == RECORD_TYPE.POSITION)
                {
                    oMPosition = new Model.Position();

                    oMPosition.ID       = dgDetails.Rows[iRowIndex].Cells[0].Value.ToString();
                    oMPosition.POSITION = dgDetails.Rows[iRowIndex].Cells[1].Value.ToString();
                }
            }

            Close();
        }
Beispiel #23
0
 public PositionToAngles(Model.Position pos)
 {
     this.pos = pos;
 }
Beispiel #24
0
 /// <summary>
 /// 更新某个库位.库位编号不变.
 /// </summary>
 /// <param name="posi">库位对象</param>
 public bool updatePosition(Model.Position posi)
 {
     throw new System.NotImplementedException();
 }
Beispiel #25
0
 public static cAlgo.API.Position ToCAlgo(Model.Position Position)
 {
     return(null);
 }
Beispiel #26
0
        public static bool Save(Model.Position Position)
        {
            Hashtable Parameters = Data.Objects.ToHashTable(Position, "Save");

            return(Data.SQLServer.Query().Execute(CommandType.StoredProcedure, StoredProcedure, Parameters));
        }
        protected void Button6_Click(object sender, EventArgs e)
        {
            switch (Button6.Text)
            {
            case "增加":
            {
                Warehouse.Tools.queryV    qu  = new Tools.queryV();
                Warehouse.Tools.apartV    ap  = new Tools.apartV();
                Warehouse.Tools.tiqushuzi quu = new Tools.tiqushuzi();
                string L = qu.query("select length from PositionType where PositionTypeId='" + TextBox7.Text + "'  ");
                string W = qu.query("select width from PositionType where PositionTypeId='" + TextBox7.Text + "'  ");
                string H = qu.query("select height from PositionType where PositionTypeId='" + TextBox7.Text + "'  ");
                double a = double.Parse(qu.query("select M from Chest where chestNum='" + TextBox2.Text + "'"));
                double b = double.Parse(qu.query("select Height from Chest where chestNum='" + TextBox2.Text + "'"));
                double c = a * b - new Warehouse.Tools.positionSum().Sum(TextBox2.Text);
                if ((quu.tiqu(L) * quu.tiqu(W) * (quu.tiqu(H)) < c))
                {
                    try
                    {
                        DAL.Query      nn  = new DAL.Query();
                        int            n   = nn.query("position");
                        string         nnn = "";
                        Model.Position add = new Model.Position();
                        add.Num            = (n + 1).ToString();
                        add.PositionNum    = TextBox1.Text;
                        add.ChestNum       = TextBox2.Text;
                        add.RoomNum        = TextBox3.Text;
                        add.PositiontypeId = TextBox7.Text;
                        add.M      = (Convert.ToDouble(ap.apart(L)) * Convert.ToDouble(ap.apart(W))).ToString();
                        add.Height = (Convert.ToDouble(ap.apart(H))).ToString();
                        Warehouse.Tools.tiqushuzi tiqu = new Tools.tiqushuzi();
                        add.Rest = (tiqu.tiqu(add.M) * tiqu.tiqu(add.Height)).ToString();
                        for (int i = 0; i < ListBox3.Items.Count; i++)
                        {
                            if (nnn == "")
                            {
                                nnn += ListBox3.Items[i].Text;
                            }
                            else
                            {
                                nnn += "、" + ListBox3.Items[i].Text;
                            }
                        }
                        add.GoodsTypes = nnn;
                        add.Remark     = TextBox6.Text;
                        add.CreateTime = DateTime.Now;
                        add.UpdateTime = DateTime.Now;
                        bool xx = new DAL.PositionDAO().addPosition(add);
                        //if (xx == true)
                        //{
                        //    double kk = Convert.ToDouble(ap.apart(qu.query("select M from Chest where chestNum='" + TextBox2.Text + "' "))) - (Convert.ToDouble(ap.apart(L)) * Convert.ToDouble(ap.apart(W)));
                        //    Warehouse.Tools.updateChestM up = new Tools.updateChestM();
                        //    up.update(kk + "m²", TextBox2.Text);
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');window.location.href='管理库位.aspx'", true);
                        //}
                    }
                    catch
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true);
                    }
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败,最大体积为" + (a * b - new Warehouse.Tools.positionSum().Sum(TextBox1.Text)) + "!');", true);
                }
            }
            break;

            case "确定":
            {
                Button         btn    = sender as Button;
                Model.Position update = new Model.Position();
                update.PositionNum    = TextBox1.Text;
                update.ChestNum       = TextBox2.Text;
                update.RoomNum        = TextBox3.Text;
                update.PositiontypeId = TextBox7.Text;
                string nnn = "";
                for (int bbb = 0; bbb < ListBox3.Items.Count; bbb++)
                {
                    if (nnn == "")
                    {
                        nnn += ListBox3.Items[bbb].Text;
                    }
                    else
                    {
                        nnn += "、" + ListBox3.Items[bbb].Text;
                    }
                }
                update.GoodsTypes = nnn;
                update.Remark     = TextBox6.Text;
                update.UpdateTime = DateTime.Now;
                bool xx = new DAL.PositionDAO().updatePosition(update);
                if (xx)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改成功!');", true);
                    pg.Refresh("select num,positionNum,chestNum,roomNum,positionTypeId,goodsTypes,M,remark from Position", "positionNum", GridView1);
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改失败!');", true);
                }
            }
            break;
            }
        }
Beispiel #28
0
        public override void ExecuteCommand(EmsSession session, StringRequestInfo requestInfo)
        {
            session.LastLoginTime = System.DateTime.Now;
            session.Logger.Info("##########################开始执行Command##########################");
            try
            {
                session.LastLoginTime = System.DateTime.Now;
                byte[]   data         = new byte[128];
                string[] dataList     = requestInfo.Body.Split('$');
                string   patrolerName = dataList[0];
                string   equip        = dataList[1];
                double   x            = Convert.ToDouble(dataList[2]);
                double   y            = Convert.ToDouble(dataList[3]);

                if ("OFFLINE" == session.Patroler.AccountState)
                {
                    //不在线
                    //修改巡检员在线状态
                    session.Patroler.AccountState = "ONLINE";
                    new BLL.Patroler().setPatrolerAccountStateByName(session.Patroler);
                    session.Logger.Info("离线巡检人" + session.Patroler.UserName + "状态更新为ONLINE");

                    //查询是否有任务
                    session.Taskinfo = new BLL.TaskInfo().getTaskInfo(session.Patroler.UserName, "下发任务");

                    if (null == session.Taskinfo)
                    {
                        data = Encoding.UTF8.GetBytes("none" + "\r\n");
                        session.Send(data, 0, data.Length);
                        session.Logger.Info("离线巡检人" + session.Patroler.UserName + "没有获取到下发任务");
                    }
                    else
                    {
                        //发送任务工单号!
                        data = Encoding.UTF8.GetBytes(session.Taskinfo.DbId + "\r\n");
                        session.Send(data, 0, data.Length);
                        session.Logger.Info("离线巡检人" + session.Patroler.UserName + "获取到下发任务");
                    }

                    Model.LogInfo logInfoModel = new Model.LogInfo();
                    logInfoModel.Equipment    = session.Equipment.MacId;
                    logInfoModel.Operate      = "登录";
                    logInfoModel.Operate_time = DateTime.Now;
                    logInfoModel.Username     = session.Patroler.UserName;
                    logInfoModel.Patroler_id  = session.Patroler.DbId;
                    new BLL.LogInfo().insertLogInfo(logInfoModel);

                    session.Logger.Info("保存离线巡检人" + session.Patroler.UserName + "操作日志");
                }
                else
                {
                    //在线人员定位信息
                    Model.Position position = new Model.Position();
                    position.Longitude   = x;
                    position.Latitude    = y;
                    position.Username    = session.Patroler.UserName;
                    position.Patroler_id = session.Patroler.DbId;
                    position.ReceiveTime = DateTime.Now;

                    if (null != session.Taskinfo)
                    {
                        //插入带下发任务编号的人员定位信息
                        position.Task_id = session.Taskinfo.DbId;
                        new BLL.Position().insertPosition(position);
                        data = Encoding.UTF8.GetBytes(session.Taskinfo.DbId + "\r\n");
                        session.Send(data, 0, data.Length);
                        session.Logger.Info("保存在线巡检人" + session.Patroler.UserName + "任务位置信息!");
                    }
                    else
                    {//无下发任务编号 插入人员定位信息
                        new BLL.Position().insertPosition(position);
                        data = Encoding.UTF8.GetBytes("none" + "\r\n");
                        session.Send(data, 0, data.Length);
                        session.Logger.Info("保存在线巡检人" + session.Patroler.UserName + "位置信息!");
                    }
                }
                session.Logger.Info("##########################Command执行成功##########################");
                session.Logger.Info("\n");
                session.Logger.Info("\n");
                session.Logger.Info("\n");
            }
            catch (Exception e)
            {
                session.Logger.Error("##########################Command执行错误##########################");
                session.Logger.Error(e.ToString());
                session.Logger.Error("\n");
                session.Logger.Error("\n");
                session.Logger.Error("\n");
            }
        }
Beispiel #29
0
        public static bool Update(IAccount Account, cAlgo.API.Position Position, string Status)
        {
            Model.Position LocalPosition = GetByID(Position.Id);

            if (LocalPosition == null)
            {
                LocalPosition = new Model.Position();
            }

            LocalPosition.ID        = Position.Id;
            LocalPosition.AccountID = Account.Number;
            LocalPosition.Symbol    = Position.SymbolCode;
            LocalPosition.TradeType = Position.TradeType.ToString();
            if (Position.Volume != 0)
            {
                LocalPosition.Volume = Position.Volume;
            }
            if (Position.Quantity != 0)
            {
                LocalPosition.Quantity = Position.Quantity;
            }
            if (Position.EntryPrice != 0)
            {
                LocalPosition.EntryPrice = (decimal)Position.EntryPrice;
            }
            if (Position.StopLoss != null)
            {
                LocalPosition.StopLoss = (decimal)Position.StopLoss;
            }
            if (Position.TakeProfit != null)
            {
                LocalPosition.TakeProfit = (decimal)Position.TakeProfit;
            }
            // LocalPosition.ClosedPrice = "";
            if (Position.Swap != 0)
            {
                LocalPosition.Swap = (decimal)Position.Swap;
            }
            LocalPosition.Channel = "";
            if (Position.Label != null)
            {
                LocalPosition.Label = Position.Label;
            }
            if (Position.Comment != null)
            {
                LocalPosition.Comment = Position.Comment;
            }
            LocalPosition.GrossProfit = (decimal)Position.GrossProfit;
            LocalPosition.NetProfit   = (decimal)Position.NetProfit;
            LocalPosition.Pips        = Position.Pips;

            if (Status == "Opened")
            {
                LocalPosition.DateTimeCreatedUTC = DateTime.UtcNow;
            }

            LocalPosition.DateTimeLastModifiedUTC = DateTime.UtcNow;
            LocalPosition.Status = Status;

            return(Save(LocalPosition));
        }