private void EditOrder_PageClose(EditOrder form)
 {
     form.Hide();
     form         = null;
     CurrentOrder = null;
     FillList();
 }
Beispiel #2
0
    public void EnterEditMode(RaycastHit2D hitInformation)
    {
        //	GameObject EditingBuilding = Instantiate(PreBuilding,transform.position,Quaternion.identity);
        //	gameObject.SetActive(false);
        //	EditingBuilding.SetActive(false);
        UICanvas = GameObject.Find("UICanvas");
        //	CancelBuildingButton = GameObject.Find("BuildingManager").GetComponent<BuildingManager>().CancelButton;
        //	GameObject.Find("BuildingManager").GetComponent<BuildingManager>().SetEditBuilding(gameObject);
        //	GameObject.Find("BuildingManager").GetComponent<BuildingManager>().SetMoveEditBuilding(EditingBuilding);

        ChangeOrderCanvas = GameObject.Find("ChnageOrderCanvas");
        if (UICanvas != null)
        {
            UICanvas.SetActive(false);
        }
        //	CancelBuildingButton.SetActive(true);

        GameObject ReverseEditBuildingButton = GameObject.Find("BuildingManager").GetComponent <BuildingManager>().ReverseEditBuildingButton;

        ReverseEditBuildingButton.SetActive(true);

        ChangeOrderCanvas.GetComponent <Canvas>().sortingLayerName = "Player";

        EditOrder = GameObject.FindObjectsOfType <EditOrder>()[0].GetComponent <EditOrder>();

        EditOrder.NowChangeBuilding = hitInformation.collider.gameObject;
    }
Beispiel #3
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row      = dataGridView1.CurrentRow;
            EditOrder       editform = new EditOrder(row);

            editform.Show();
        }
Beispiel #4
0
        private void ExecuteChoice(string userChoice)
        {
            switch (userChoice)
            {
            case "1":
                DisplayOrder flow1 = _kernel.Get <DisplayOrder>();   //WHAT DOES THIS MEAN IN ENGLISH?
                flow1.Execute();
                break;

            case "2":
                AddOrder flow2 = _kernel.Get <AddOrder>();
                flow2.Execute();
                break;

            case "3":
                EditOrder flow3 = _kernel.Get <EditOrder>();
                flow3.Execute();
                break;

            case "4":
                RemoveOrder flow4 = _kernel.Get <RemoveOrder>();
                flow4.Execute();
                break;

            case "5":
                break;

            default:
                Console.WriteLine("That was not a valid input.");
                break;
            }
        }
Beispiel #5
0
        public OrderInfo Update(int id, EditOrder order)
        {
            var selectedOrder = _orderDbContext.Orders.Include(o => o.OrderItems).FirstOrDefault(o => o.Id == id);

            if (selectedOrder != null)
            {
                selectedOrder.CreateDate = DateTime.Now;
                selectedOrder.OrderItems.Clear();
                _orderDbContext.SaveChanges();
                foreach (var item in order.OrderItems)
                {
                    var oItem = new OrderItem()
                    {
                        OrderId   = id,
                        ProductId = item.ProductId,
                        Count     = item.Count
                    };
                    selectedOrder.OrderItems.Add(oItem);
                }
                _orderDbContext.SaveChanges();
                //var obj1 = _orderDbContext.Orders.Include(o=>o.OrderItems).ThenInclude(p=>p.Product).FirstOrDefault(o => o.Id == obj.Id);
                return(_mapper.Map <OrderInfo>(selectedOrder));
            }
            else
            {
                throw new ArgumentException();
            }
        }
Beispiel #6
0
        public async Task <IActionResult> Put(int id, [FromBody] EditOrder order)
        {
            var updated = await _orderList.Update(id, order);

            if (updated == null)
            {
                throw new EntityNotFoundException();
            }
            return(Ok(updated));
        }
        public void EditOrder()
        {
            RightEditPanel.Controls.Clear();
            EditOrder editOrder = new EditOrder(ref CurrentOrder, EditOrder_PageClose);

            editOrder.TopLevel = false;
            editOrder.Dock     = DockStyle.Fill;
            RightEditPanel.Controls.Add(editOrder);
            editOrder.Show();
        }
Beispiel #8
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            Order selectedOrder = GvOperations.GetSelectedOrder(gvOrders);

            if (selectedOrder != null)
            {
                EditOrder editOrderForm = new EditOrder(selectedOrder);
                editOrderForm.ShowDialog();
            }
        }
        //Update Order
        public JsonResult EditOrderUpdateData(EditOrderViewModel order)
        {
            if (order == null)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            EditOrder edit = new EditOrder(order);

            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Beispiel #10
0
        public async Task <IActionResult> Update(int id, EditOrder order)
        {
            var upOrder = await _ordersList.Update(id, order);

            if (upOrder == null)
            {
                return(new BadRequestResult());
            }

            return(Ok(upOrder));
        }
Beispiel #11
0
        private void EditOrders_OnClick(object sender, RoutedEventArgs e)
        {
            _applicationManager.getCustomers();
            _applicationManager.getEmployees();
            _applicationManager.getProducts();
            _applicationManager.GetOrderDetails();

            var editOrdersForm = new EditOrder();

            editOrdersForm.Show();
        }
        public async Task <IActionResult> PutAsync(int id, [FromBody] EditOrder value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = await _ordersService.Update(id, value);

            return(Ok(result));
        }
 private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (OrderVerification())
     {
         EditOrder editOrder = new EditOrder(_orderId);
         editOrder.Show();
     }
     else
     {
         MessageBox.Show("Please, select the order");
     }
 }
Beispiel #14
0
        public IActionResult Put(int id, [FromBody] EditOrder value)
        {
            var order = _ordersList.GetAllOrders()
                        .FirstOrDefault(p => p.Id == id && !p.IsDeleted);

            if (order == null)
            {
                return(NotFound());
            }
            _mapper.Map <EditOrder, Order>(value, order);
            return(Ok(_mapper.Map <OrderInfo>(order)));
        }
 public ActionResult Update(int id, [FromBody] EditOrder order)
 {
     if (ModelState.IsValid)
     {
         var obj = _orderList.Update(id, order);
         return(Ok(obj));
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }
Beispiel #16
0
        public ActionResult Edit([Bind(Prefix = "Item")] EditOrder model)
        {
            var ss           = model.AllCommodity.Count;
            int num          = 0;
            int serialnumber = model.Serialnumber;

            model.Detials = new List <OrderDetial1>();
            List <OrderDetial1> detials = new List <OrderDetial1>();

            for (int i = 0; i < ss; i++)
            {
                OrderDetial1 detial = new OrderDetial1();
                if (Request.Form["Item.AllCommodity[" + i.ToString() + "].Checked"].ToLower().IndexOf("true") > -1)
                {
                    num++;
                    detial.GoodId = int.Parse(Request.Form["Item.AllCommodity[" + i.ToString() + "].Id"]);
                    detial.Amount = int.Parse(Request.Form["Item.AllCommodity[" + i.ToString() + "].Amount"]);
                    detial.price  = decimal.Parse(Request.Form["Item.AllCommodity[" + i.ToString() + "].Price"]);
                    if ((detial.price * detial.Amount) <= 0)
                    {
                        model.AddMsg("没有正确的输入数量或单价");
                        model.Read();
                        model.Ready();
                        return(View(new EcardModelItem <EditOrder>(model, model)));
                    }
                    detials.Add(detial);
                }
            }
            if (num > 0)
            {
                model.Detials = detials;
                IMessageProvider msg = null;
                if (ModelState.IsValid)
                {
                    this.ModelState.Clear();

                    msg   = model.Edit();
                    model = _unityContainer.Resolve <EditOrder>();
                }
                model.LoadInnerObject(serialnumber);
                model.Read();
                model.Ready();
                return(View(new EcardModelItem <EditOrder>(model, msg)));
            }
            else
            {
                // new Exception("没有选择商品");
                model.AddMsg("没有选择商品");
                model.LoadInnerObject(serialnumber);
                model.Read();
                model.Ready(); return(View(new EcardModelItem <EditOrder>(model, model)));
            }
        }
        public async Task <Order> Update(int id, EditOrder order)
        {
            var toBeUpdated = await _context.Orders.FirstOrDefaultAsync(p => p.Id == id && !p.IsDeleted);

            if (toBeUpdated == null)
            {
                return(null);
            }
            toBeUpdated.OrderItems = order.OrderItems;
            await _context.SaveChangesAsync();

            return(toBeUpdated);
        }
        public async Task <OrderInfo> Update(int id, EditOrder order)
        {
            var updateOrder = await _context.Orders.FirstOrDefaultAsync(o => o.Id == id && !o.IsDeleted);

            if (updateOrder != null)
            {
                //updateOrder.OrderDetails = order.OrderDetails;
            }

            await _context.SaveChangesAsync();

            return(_mapper.Map <OrderInfo>(updateOrder));
        }
 public void Edit(EditOrder model, int id)
 {
     if (User.Identity.IsAuthenticated)
     {
         Order order = db.Orders.FirstOrDefault(x => x.Id == id);
         if (order != null)
         {
             order.Address            = model.Address;
             order.CompletionDateTime = DateTime.Parse(model.Date + " " + model.Time);
             order.Joinings.First().Text = model.Text;
             db.SaveChanges();
         }
     }
     Response.Write("<script>history.go(-1);</script>");
     //return RedirectToAction("Index", "Account");
 }
Beispiel #20
0
        public ActionResult ShipOrder(int id)
        {
            Orders order;

            using (MySqlConnection conn = DBUtils.GetConnection())
            {
                OrderRepository repo = new OrderRepository(conn);
                order = repo.GetById(id);
            }

            EditOrder ship = new EditOrder();

            ship.OrderID      = order.OrderID;
            ship.OrderDate    = order.OrderDate;
            ship.RequiredDate = order.RequiredDate;
            ship.ShippedName  = order.ShippedName;
            return(View(ship));
        }
Beispiel #21
0
        public async Task <OrderInfo> Update(int id, EditOrder value)
        {
            var order = await _context.Orders
                        .Include(i => i.OrderItems)
                        .FirstOrDefaultAsync(o => o.Id == id);

            if (order == null || value == null)
            {
                throw new EntityNotFoundException();
            }

            order.OrderItems.Clear();
            order.OrderItems = _mapper.Map <ICollection <OrderItem> >(value.OrderItems);
            await _context.SaveChangesAsync();

            order = await GetOrderItemsForOrder(order);

            return(_mapper.Map <OrderInfo>(order));
        }
Beispiel #22
0
        public ActionResult EditPost([Bind(Prefix = "id")] int orderId, string returnUrl)
        {
            var order = _orderService.Orders.Where(x => x.Id == orderId && x.IsActive).FirstOrDefault();

            if (order == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            // przenieść do serwisu
            var viewModel = new EditOrder(order)
            {
                Employees = _employeeService.Employees.Select(n => new SelectListItem
                {
                    Value = n.Id.ToString(),
                    Text  = string.Format("{0} {1}", n.Name, n.Surname)
                }),
                ReturnUrl = returnUrl
            };

            if (!TryUpdateModel(viewModel) || !ModelState.IsValid)
            {
                return(View(viewModel));
            }

            try
            {
                _orderService.Update(viewModel.ToEdit());

                if (viewModel.OrderStatusId == 4) //do odbioru
                {
                    return(RedirectToAction("Create", "Cost", new { id = order.Id, returnUrl = HttpContext.Request.Url }));
                }

                return(Redirect(viewModel.ReturnUrl));
            }
            catch (Exception ex)
            {
                return(View(viewModel));

                throw ex;
            }
        }
Beispiel #23
0
        public async Task <IActionResult> Put(int id, [FromBody] EditOrder value)
        {
            if (ModelState.IsValid)
            {
                var order = await _context
                            .Orders
                            .Include(i => i.OrderItems)
                            .FirstOrDefaultAsync(p => p.Id == id && !p.IsDeleted);

                if (order == null)
                {
                    throw new EntityNotFoundException();
                }
                _mapper.Map <EditOrder, Order>(value, order);
                await _context.SaveChangesAsync();

                return(Ok(_mapper.Map <OrderInfo>(order)));
            }
            return(BadRequest(ModelState));
        }
Beispiel #24
0
        public ActionResult ShipOrder(EditOrder ship)
        {
            if (ModelState.IsValid)
            {
                using (MySqlConnection conn = DBUtils.GetConnection())
                {
                    Orders order = new Orders();

                    order.OrderID     = ship.OrderID;
                    order.ShippedDate = ship.ShippedDate;

                    OrderRepository repo = new OrderRepository(conn);
                    repo.Save(order);
                }

                return(RedirectToAction("Index"));
            }

            return(View(ship));
        }
 public ActionResult Edit(int id)
 {
     if (User.Identity.IsAuthenticated)
     {
         Order order = db.Orders.FirstOrDefault(x => x.Id == id);
         if (order != null)
         {
             AuthorizedUser creator = (AuthorizedUser)order.Creator;
             if (creator.AppUserId == null && creator.AppUserId != User.Identity.GetUserId())
             {
                 return(View("Index"));
             }
             EditOrder currentOrder = new EditOrder();
             currentOrder.Address = order.Address;
             currentOrder.Date    = order.CompletionDateTime.Date.ToShortDateString();
             currentOrder.Time    = order.CompletionDateTime.ToShortTimeString();
             currentOrder.Text    = order.Joinings.First().Text;
             return(View(currentOrder));
         }
     }
     return(RedirectToAction("SignIn", "Account"));
 }
Beispiel #26
0
        public ActionResult Edit([Bind(Prefix = "id")] int orderId, string returnUrl)
        {
            var order = _orderService.Orders.Where(x => x.Id == orderId && x.IsActive).FirstOrDefault();

            if (order == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            //przenieść do serwisu
            var viewModel = new EditOrder(order)
            {
                Employees = _employeeService.Employees.Select(n => new SelectListItem
                {
                    Value = n.Id.ToString(),
                    Text  = string.Format("{0} {1}", n.Name, n.Surname)
                }),
                ReturnUrl = returnUrl,
                Cost      = _costService.Costs.FirstOrDefault(x => x.Order.Id == order.Id)
            };

            return(View(viewModel));
        }
 private void btn_EditOrder_Click(object o, EventArgs e)
 {
     EditOrder?.Invoke();
 }
Beispiel #28
0
    protected override void OnInit(EventArgs e)
    {
        contentListOrders.OnDblClickClientScriptFunction = "listDblClick";
        btnEditOrder.ClientScript = "listDblClick(" + contentListOrders.ClientScriptId + ");";

        if (Request["open"] != null) {
            string key = Request["open"].ToString();
            EditOrder editOrderWM = new EditOrder();
            editOrderWM.SetUnsecureInput("Key", key);
            WAFContext.StartWorkflowMethod(editOrderWM);
        } else if (WAFContext.Session.CurrentNodeId > 0 && WAFContext.Request.SpecifiesNodeId) {
            EditOrder editOrderWM = new EditOrder();
            editOrderWM.SetUnsecureInput("Key", new CKeyNLR(WAFContext.Session.CurrentNodeId, WAFContext.Session.LCID, 0).ToString());
            WAFContext.StartWorkflowMethod(editOrderWM);
        }

        base.OnInit(e);
    }
Beispiel #29
0
        public async Task <IActionResult> EditAsync([FromBody] EditOrder command)
        {
            await DispatchAsync(command);

            return(NoContent());
        }
Beispiel #30
0
        /// <summary>
        /// область снизу справа - просмотр и редактирование ордера
        /// </summary>
        /// <param name="inRect"></param>
        public void DoWindowEditOrder(Rect inRect)
        {
            if (PlaceCurrent == null)
            {
                PlaceCurrent = new Place();
                WorldObject wo;
                if (PlaceMap != null)
                {
                    wo = PlaceMap.info.parent;
                }
                else
                {
                    wo = PlaceCaravan;
                }
                PlaceCurrent.Name          = wo.LabelCap;
                PlaceCurrent.PlaceServerId = UpdateWorldController.GetServerInfo(wo).ServerId;
                PlaceCurrent.ServerName    = SessionClientController.My.ServerName;
                PlaceCurrent.Tile          = wo.Tile;
                PlaceCurrent.DayPath       = 0;
            }
            if (EditOrder == null)
            {
                //Действие не выбрано: по умолчанию настраиваем панельна создание нового ордера
                EditOrderTitle = "OCity_Dialog_Exchenge_Order_Create".Translate();
                var editOrder = new OrderTrade();
                editOrder.Owner         = SessionClientController.My;
                editOrder.Place         = PlaceCurrent;
                editOrder.CountBeginMax = 1;

                editOrder.SellThings = new List <ThingTrade>();
                editOrder.BuyThings  = new List <ThingTrade>();
                var silverDef = (ThingDef)GenDefDatabase.GetDef(typeof(ThingDef), "Silver");
                var th        = ThingTrade.CreateTrade(silverDef, 0f, QualityCategory.Awful, 1);
                editOrder.BuyThings.Add(th);

                editOrder.PrivatPlayers = new List <Player>();

                SetEditOrder(editOrder);
            }

            bool existInServer = EditOrder.Id != 0;

            //заголовок
            Rect rect = new Rect(0f, 0f, inRect.width, 18);

            inRect.yMin += rect.height;
            Text.Font    = GameFont.Tiny; // высота Tiny 18
            Text.Anchor  = TextAnchor.MiddleCenter;
            Widgets.Label(rect, EditOrderTitle);

            ///todo
            ///полоску проскрутки

            //кнопка в углу
            rect = new Rect(inRect.width - 150f, 20f, 150f, 24);
            if (!EditOrderToTrade)
            {
                GUI.color = Color.red;
            }
            if (Widgets.ButtonText(rect.ContractedBy(1f)
                                   , EditOrderIsMy
                    ? existInServer ? "OCity_Dialog_Exchenge_Save".Translate() : "OCity_Dialog_Exchenge_Create".Translate()
                    : "OCity_Dialog_Exchenge_Trade".Translate()
                                   , true, false, true))
            {
                GUI.color = Color.white;
                SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                if (!EditOrderToTrade)
                {
                    return;
                }

                if (!EditOrderIsMy)
                {
                    //торговать
                    //todo
                }
                else
                {
                    //создать или отредактировать
                    SessionClientController.Command((connect) =>
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);

                        if (!connect.ExchengeEdit(EditOrder))
                        {
                            Loger.Log("Client ExchengeEdit error: " + connect.ErrorMessage);
                            Find.WindowStack.Add(new Dialog_Input("OCity_Dialog_Exchenge_Action_Not_CarriedOut".Translate(), connect.ErrorMessage, true));
                        }
                        else
                        {
                            SetEditOrder(null);
                        }

                        UpdateOrders();
                    });
                    return;
                }

                EditOrderChange();
                return;
            }
            GUI.color = Color.white;

            //кнопка
            if (!EditOrderIsMy)
            {
                rect = new Rect(160f, 20f, inRect.width - 160f - 160f, 24);
                if (Widgets.ButtonText(rect.ContractedBy(1f)
                                       , "OCity_Dialog_Exchenge_Counterproposal".Translate()
                                       , true, false, true))
                {
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);

                    //todo

                    return;
                }
            }
            if (EditOrderIsMy && existInServer && EditOrder.Id != 0)
            {
                rect = new Rect(160f, 20f, 100f, 24);
                if (Widgets.ButtonText(rect.ContractedBy(1f)
                                       , "OCity_Dialog_Exchenge_Delete".Translate()
                                       , true, false, true))
                {
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);

                    SessionClientController.Command((connect) =>
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);

                        EditOrder.Id = -EditOrder.Id;
                        if (!connect.ExchengeEdit(EditOrder))
                        {
                            EditOrder.Id = -EditOrder.Id;
                            Loger.Log("Client ExchengeEdit error: " + connect.ErrorMessage);
                            Find.WindowStack.Add(new Dialog_Input("OCity_Dialog_Exchenge_Action_Not_CarriedOut".Translate(), connect.ErrorMessage, true));
                        }
                        else
                        {
                            SetEditOrder(null);
                        }

                        UpdateOrders();
                    });

                    return;
                }
            }

            rect = new Rect(0, 20f, 150f, 24f);
            if (Widgets.ButtonText(rect.ContractedBy(1f)
                                   , "OCity_Dialog_Exchenge_Order_New".Translate()
                                   , true, false, true))
            {
                SoundDefOf.Tick_High.PlayOneShotOnCamera(null);

                SetEditOrder(null);

                return;
            }

            inRect.yMin += rect.height;

            rect        = new Rect(0f, 44f, inRect.width, 24f);
            Text.Anchor = TextAnchor.MiddleLeft;

            if (EditOrderIsMy)
            {
                Widgets.Label(rect, "OCity_Dialog_Exchenge_No_Exchanges".Translate());
                var rect2 = new Rect(rect.x + 250f, rect.y, 70f, rect.height);

                int    countToTransfer = EditOrder.CountBeginMax;
                string editBuffer;
                if (!EditOrderEditBuffer.TryGetValue(EditOrder.GetHashCode(), out editBuffer))
                {
                    EditOrderEditBuffer.Add(EditOrder.GetHashCode(), editBuffer = countToTransfer.ToString());
                }
                Widgets.TextFieldNumeric <int>(rect2.ContractedBy(2f), ref countToTransfer, ref editBuffer, 1f, 999999999f);
                EditOrderEditBuffer[EditOrder.GetHashCode()] = editBuffer;
                if (countToTransfer > 0)
                {
                    EditOrder.CountBeginMax = countToTransfer;
                    EditOrderChange();
                }

                rect.y += 24f;
            }

            Widgets.Label(rect, "OCity_Dialog_Exchenge_No_Available_Exchange".Translate() + EditOrder.CountReady.ToString());
            if (EditOrderIsMy)
            {
                rect.xMin += 250;
                Widgets.Label(rect, "OCity_Dialog_Exchenge_Done_Once".Translate() + EditOrder.CountFnished.ToString());
                rect.xMin = 0;
            }
            rect.y += 24f;

            if (EditOrderIsMy)
            {
                Widgets.Label(rect, "OCity_Dialog_Exchenge_We_Give".Translate());
                rect.y += 24f;
                EditOrderShowSellThings(ref rect);

                Widgets.Label(rect, "OCity_Dialog_Exchenge_We_Get".Translate());
                rect.y += 24f;
                EditOrderShowBuyThings(ref rect);
            }
            else
            {
                Widgets.Label(rect, "OCity_Dialog_Exchenge_We_Get".Translate());
                rect.y += 24f;
                EditOrderShowBuyThings(ref rect);

                Widgets.Label(rect, "OCity_Dialog_Exchenge_We_Give2".Translate(EditOrder.Owner.Login));
                rect.y += 24f;
                EditOrderShowSellThings(ref rect);
            }

            if (EditOrder.PrivatPlayers == null || EditOrder.PrivatPlayers.Count == 0)
            {
                Widgets.Label(rect, "OCity_Dialog_Exchenge_No_User_Restrictions".Translate());
                rect.y += 24f;
            }
            else
            {
                Widgets.Label(rect, "OCity_Dialog_Exchenge_User_Restrictions".Translate());
                rect.y += 24f;
                for (int i = 0; i < EditOrder.PrivatPlayers.Count; i++)
                {
                    var rect3 = new Rect(rect.x, rect.y, 24f, 24f);
                    Widgets.Label(rect3, EditOrder.PrivatPlayers[i].Login);

                    rect3 = new Rect(rect.xMax - 24f, rect.y, 24f, 24f);
                    if (EditOrderIsMy && Widgets.ButtonImage(rect3, IconDelTex))
                    {
                        EditOrder.PrivatPlayers.RemoveAt(i--);
                    }
                    rect.y += 24f;
                }
            }
            var rect4 = new Rect(rect);

            rect4.width = 150f;
            if (Widgets.ButtonText(rect4.ContractedBy(1f)
                                   , "OCity_Dialog_Exchenge_Add_User".Translate()
                                   , true, false, true))
            {
                SoundDefOf.Tick_High.PlayOneShotOnCamera(null);

                var editOrder = EditOrder;
                var list      = SessionClientController.Data.Players.Keys
                                .Where(p => !editOrder.PrivatPlayers.Any(pp => pp.Login == p) && p != "system")
                                .Select(p => new FloatMenuOption(p,
                                                                 () =>
                {
                    if (editOrder.PrivatPlayers.Any(pp => pp.Login == p))
                    {
                        return;
                    }
                    editOrder.PrivatPlayers.Add(SessionClientController.Data.Players[p].Public);
                }))
                                .ToList();
                if (list.Count == 0)
                {
                    return;
                }
                var menu = new FloatMenu(list);
                Find.WindowStack.Add(menu);

                return;
            }
        }
Beispiel #31
0
        private void btnedit_Click(object sender, EventArgs e)
        {
            if (gvPurchase.SelectedRows.Count != 1)
            {
                MessageBox.Show("please select one row first");

                return;
            }

            if (userRolesObj.getCheckstate("AddEditOrders") == true)
            {
                Forms.Order.EditOrder ec = new EditOrder(this);

                LotNo              = int.Parse(this.gvPurchase.CurrentRow.Cells[3].Value.ToString());
                ec.LotNo           = LotNo;
                ec.OrderId         = this.gvPurchase.CurrentRow.Cells[0].Value.ToString();
                ec.DeliveryOrderNo = this.gvPurchase.CurrentRow.Cells[16].Value.ToString();

                ec.cmLotNo.DataSource    = new DAO().GetLotNoS();
                ec.cmLotNo.DisplayMember = "LotNo";
                ec.cmLotNo.ValueMember   = "IId";
                int lotNoIndex = getIndexLotNo(ec.cmLotNo, LotNo.ToString());
                ec.cmLotNo.SelectedIndex = lotNoIndex;


                decimal SellingWeight = decimal.Parse(gvPurchase.CurrentRow.Cells[7].Value.ToString());
                ec.SellingWt = SellingWeight;
                decimal Shortage = decimal.Parse(gvPurchase.CurrentRow.Cells[6].Value.ToString());


                string partyname = this.gvPurchase.CurrentRow.Cells[2].Value.ToString();
                ec.cbCustName.DataSource    = new DAO().GetPartiesFrmAccount();
                ec.cbCustName.DisplayMember = "Name";
                ec.cbCustName.ValueMember   = "Party-ID";
                int PartyIndex = getIndexParty(ec.cbCustName, partyname);
                ec.cbCustName.SelectedIndex = PartyIndex;

                Brokername = this.gvPurchase.CurrentRow.Cells[12].Value.ToString();
                ec.cmBrokerName.DataSource    = new DAO().GetBrokers();
                ec.cmBrokerName.DisplayMember = "BrokerName";
                ec.cmBrokerName.ValueMember   = "BId";
                int brokerIndex = getIndexbroker(ec.cmBrokerName, Brokername);
                ec.cmBrokerName.SelectedIndex = brokerIndex;


                ec.dtODate.MinDate = new DateTime(DateTime.Now.Year, 1, 1);
                ec.dtODate.MaxDate = DateTime.Now;
                ec.dtODate.Value   = DateTime.Parse(this.gvPurchase.CurrentRow.Cells[1].Value.ToString());

                DataTable dt2 = new DAO().GetItemsforLotNo(LotNo);

                ec.IId = int.Parse(dt2.Rows[0]["IId"].ToString());

                ec.txtGarden.Text = dt2.Rows[0]["IGarden"].ToString();

                ec.txtGrade.Text = dt2.Rows[0]["IGrade"].ToString();

                sellingQty = decimal.Parse(gvPurchase.CurrentRow.Cells[5].Value.ToString());


                decimal TotalQuantityleft = decimal.Parse(dt2.Rows[0]["IQty"].ToString());
                ec.txtQtyLeft.Text = TotalQuantityleft.ToString();

                int ItemWtPerBag = int.Parse(dt2.Rows[0]["IWtPerBag"].ToString());
                ec.txtWtPerBag.Text = ItemWtPerBag.ToString();

                decimal TotalWeightLeft = decimal.Parse(dt2.Rows[0]["ITotalWeight"].ToString());
                ec.txtWtLeft.Text = TotalWeightLeft.ToString();

                ec.SellingQty         = decimal.Parse(gvPurchase.CurrentRow.Cells[5].Value.ToString());
                ec.txtSellingQty.Text = gvPurchase.CurrentRow.Cells[5].Value.ToString();

                ec.txtSellingWt.Text = SellingWeight.ToString();

                ec.txtShortage.Text = Shortage.ToString();

                ec.NetWeight         = SellingWeight - Shortage;
                ec.txtNetWeight.Text = Convert.ToString(SellingWeight - Shortage);

                ec.txtRatePerKg.Text = gvPurchase.CurrentRow.Cells[4].Value.ToString();
                ec.RatePerKg         = int.Parse(gvPurchase.CurrentRow.Cells[4].Value.ToString());
                ec.txtTotal.Text     = gvPurchase.CurrentRow.Cells[8].Value.ToString();
                // ec.txtSellingQty.Text = gvPurchase.CurrentRow.Cells[5].Value.ToString();

                ec.txtQtyLeft.Enabled  = false;
                ec.txtWtLeft.Enabled   = false;
                ec.txtWtPerBag.Enabled = false;


                ec.cmBrokerName.SelectedText = this.gvPurchase.CurrentRow.Cells[12].Value.ToString();

                BrokeryAmount            = decimal.Parse(this.gvPurchase.CurrentRow.Cells[11].Value.ToString());
                ec.txtBrokeryAmount.Text = this.gvPurchase.CurrentRow.Cells[11].Value.ToString();
                ec.txtBardena.Text       = this.gvPurchase.CurrentRow.Cells[13].Value.ToString();
                ec.txtTulai.Text         = this.gvPurchase.CurrentRow.Cells[15].Value.ToString();
                ec.txtCarrage.Text       = this.gvPurchase.CurrentRow.Cells[14].Value.ToString();
                ec.WindowState           = FormWindowState.Maximized;

                ec.Show();
            }
            else
            {
                MessageBox.Show("you don't have permission to enter here, Contact admin For further Details");
                return;
            }
        }