private void toolStripButton3_Click(object sender, EventArgs e) { if (!CustomDelete) { if (string.IsNullOrEmpty(DeleteSql)) { MessageBox.Show("Nenurodyta duomenų trynimo procedūra", "Įspėjimas", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dataGridView1.SelectedCells.Count <= 0) { MessageBox.Show("Nepasirinkta duomenų eilutė", "Įspėjimas", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(FormMainId)) { MessageBox.Show("Nenurodytas formos ID", "Įspėjimas", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int id = NullCheck.IsNullInt(NullCheck.IsNullString(dataGridView1.SelectedRows[0].Cells[FormMainId].Value)); if (id > 0) { Sql.ExecuteCmd(DeleteSql, new object[] { $"@{FormMainId}", id }); } RefreshGrid(); } }
private void DView_DoubleClick(object sender, EventArgs e) { try { if (dView.DataSource != null && ((DataTable)dView.DataSource).Rows.Count > 0 && ShipmentId > 0) { DataGridViewRow row = dView.SelectedRows[0]; if (row != null) { bool Deselect = NullCheck.IsNullInt(row.Cells["ShipmentId"].Value) > 0 ? true : false; Sql.ExecuteCmd("ChangeShipmentAssign", new object[] { "@RcvOrdId", NullCheck.IsNullInt(row.Cells["RcvOrderId"].Value), "@ShipmentId", Deselect ? 0 : ShipmentId }); row.Cells["ShipmentId"].Value = Deselect ? 0 : ShipmentId; if (!Deselect) { row.DefaultCellStyle.BackColor = Color.Cyan; } else { row.DefaultCellStyle.BackColor = Color.LightGreen; } dView.SelectedRows[0].Selected = false; } } } catch { } }
private void Save() { if (ShipmentId == -1) { Sql.ExecuteCmd(SaveProcedure, new object[] { "@ShipmentId", tShipmentId.Text, "@ShipmentNo", tShipmentNo.Text, "@PartnerId", SelectedPartnerId, "@WarehouseId", GlobalUser.CurrentWarehouseId, "@CreateDate", DateTime.Now.ToShortDateString(), "@UpdateDate", DateTime.Now.ToShortDateString() }); ShipmentId = NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateSaveShipment('{tShipmentNo.Text}')")); tShipmentId.Text = NullCheck.IsNullString(ShipmentId); if (ShipmentId > 0) { LoadData(); } } else { Sql.ExecuteCmd(UpdateProcedure, new object[] { "@ShipmentId", ShipmentId, "@ShipmentNo", tShipmentNo.Text, "@PartnerId", SelectedPartnerId, "@WarehouseId", GlobalUser.CurrentWarehouseId, "@UpdateDate", DateTime.Now.ToShortDateString() }); } LogAction(ShipmentId == -1 ? SaveProcedure : UpdateProcedure); }
private void Save() { if (DocId == -1) { Sql.ExecuteCmd(SaveProcedure, new object[] { "@DocNo", tDocNo.Text, "@WarehouseId", GlobalUser.CurrentWarehouseId, "@CreateDate", DateTime.Now.ToShortDateString(), "@UpdateDate", DateTime.Now.ToShortDateString() }); DocId = NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateSaveRcvOrd('{tDocNo.Text}')")); if (DocId > 0) { LoadData(); } } else { Sql.ExecuteCmd(UpdateProcedure, new object[] { "@DocNo", tDocNo.Text, "@WarehouseId", GlobalUser.CurrentWarehouseId, "@UpdateDate", DateTime.Now.ToShortDateString(), "@RcvDocId", DocId }); } LogAction(DocId == -1 ? SaveProcedure : UpdateProcedure); }
public void LoadData() { DataTable dt = Sql.GetTable(SelectProcedure, new object[] { "@WarehouseZoneId", WarehouseZoneId }); if (dt.Rows.Count > 0) { tFZoneCode.Text = NullCheck.IsNullString(dt.Rows[0]["ZoneCode"]); tFZoneName.Text = NullCheck.IsNullString(dt.Rows[0]["ZoneName"]); tWarehouse.Text = NullCheck.IsNullString(dt.Rows[0]["WarehouseName"]); tCreated.Text = NullCheck.IsNullDate(dt.Rows[0]["CreateDate"]).ToShortDateString(); tUpdated.Text = NullCheck.IsNullDate(dt.Rows[0]["UpdateDate"]).ToShortDateString(); FZoneParentId = NullCheck.IsNullInt(dt.Rows[0]["ParentID"]); tSpotHeight.Text = NullCheck.IsNullString(dt.Rows[0]["SpotHeight"]); tSpotLength.Text = NullCheck.IsNullString(dt.Rows[0]["SpotLength"]); tSpotWidth.Text = NullCheck.IsNullString(dt.Rows[0]["SpotWidth"]); tSpotVolume.Text = NullCheck.IsNullString(dt.Rows[0]["SpotVolume"]); } RemainingVolume = NullCheck.IsNullDecimal(Sql.GetString($"SELECT dbo.RemainingZoneVolume('{WarehouseZoneId}')")); if (NullCheck.IsNullDecimal(dt.Rows[0]["SpotVolume"]) != RemainingVolume) { tSpotHeight.Enabled = false; tSpotLength.Enabled = false; tSpotVolume.Enabled = false; tSpotWidth.Enabled = false; } }
private void DataGridView1_DoubleClick(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { ItemMapper.selectedId = NullCheck.IsNullInt(dataGridView1.SelectedRows[0].Cells["ItemId"].Value); this.Close(); } }
private int GetSelectedItemId(DataGridView dView) { if (dView.SelectedRows.Count <= 0) { MessageBox.Show("Pasirinkite eilutę, kurią norite redaguoti!", "Informacija", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(NullCheck.IsNullInt(dView.SelectedRows[0].Cells[FormMainId].Value)); }
private void button1_Click(object sender, EventArgs e) { if (ValueChanged) { GlobalUser.CurrentWarehouseId = NullCheck.IsNullInt(cWarehouses.SelectedValue); } DialogResult = DialogResult.OK; this.Close(); }
private bool ValidInput() { string errorMsg = string.Empty; if (string.IsNullOrEmpty(tFZoneCode.Text)) { errorMsg += "Negalimas zonos kodas\n"; } if (string.IsNullOrEmpty(tFZoneName.Text)) { errorMsg += "Negalimas zonos pavadinimas\n"; } if (string.IsNullOrEmpty(tSpotWidth.Text)) { errorMsg += "Negalimas zonos plotis\n"; } if (string.IsNullOrEmpty(tSpotVolume.Text)) { errorMsg += "Negalimas zonos tūris\n"; } if (string.IsNullOrEmpty(tSpotHeight.Text)) { errorMsg += "Negalimas zonos aukštis\n"; } if (string.IsNullOrEmpty(tSpotLength.Text)) { errorMsg += "Negalimas zonos ilgis\n"; } int Exists = NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateFZone('{tFZoneName.Text}', '{tFZoneCode.Text}')")); if (Exists > 0 && WarehouseZoneId < 0) { errorMsg += "Zonos kodo ir pavadinimo kombinacija nėra unikali\n"; } if (Exists > 0 && WarehouseZoneId > 0) { if (NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.CheckIfFZoneIsUnique('{WarehouseZoneId}','{tFZoneName.Text}','{tFZoneCode.Text}')")) == 0) { errorMsg += "Zonos kodo ir pavadinimo kombinacija nėra unikali\n"; } } if (!string.IsNullOrEmpty(errorMsg)) { MessageBox.Show("Negalima išsaugoti zonos:\n" + errorMsg, "Klaida", MessageBoxButtons.OK); return(false); } return(true); }
public static void ParseDataTable(DataTable data) { Username = NullCheck.IsNullString(data.Rows[0][nameof(Username)]); Name = NullCheck.IsNullString(data.Rows[0][nameof(Name)]); Surname = NullCheck.IsNullString(data.Rows[0][nameof(Surname)]); UserLevel = NullCheck.IsNullInt(data.Rows[0][nameof(UserLevel)]); UserId = NullCheck.IsNullInt(data.Rows[0][nameof(UserId)]); SuperUser = NullCheck.IsNullBoolean(data.Rows[0][nameof(SuperUser)]); LogLogin(); }
private void CWarehouses_SelectedValueChanged(object sender, EventArgs e) { if (GlobalUser.CurrentWarehouseId != NullCheck.IsNullInt(cWarehouses.SelectedValue)) { ValueChanged = true; } else { ValueChanged = false; } }
private int GetSelectedItemId() { string NodeKey = treeView1.SelectedNode.Name; if (NodeKey == null) { MessageBox.Show("Pasirinkite eilutę, kurią norite redaguoti!", "Informacija", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(NullCheck.IsNullInt(NodeKey)); }
private void DView_SelectionChanged(object sender, EventArgs e) { ChangeButtonBehaviour(AccessGrid()); if (AccessGrid().SelectedRows.Count > 0 && NullCheck.IsNullInt(AccessGrid().SelectedRows[0].Cells["ShipmentId"].Value) > 0) { dataGridView2.Visible = true; MapOrderedItemData(NullCheck.IsNullInt(AccessGrid().SelectedRows[0].Cells["ShipmentId"].Value)); } else { dataGridView2.Visible = false; } }
private void AssignWarehouse() { try { GlobalUser.SetWarehouseId(NullCheck.IsNullInt(dViewDataShow.SelectedRows[0].Cells["WarehouseId"].Value)); } catch { SelectWarehouse(); } activeMenu = ActiveMenuTypes.MainMenu; HideDataShow(); ShowMenu(new string[] { "Priėmimas", "Padėjimas", "Surinkimas", "Išvežimas" }); }
private void ProcessPickQuantity() { decimal ScannedAmount = NullCheck.IsNullDecimal(tBoxInput2.Text); if (ScannedAmount == Decimal.Zero) { EnableRows(9); SetRow9("Netinkama įvestis", ContentAlignment.MiddleCenter, Color.Red); return; } DataRow row = ItemList.AsEnumerable().Where(x => x.Field <string>("Barcode") == tBoxInput1.Text).FirstOrDefault(); decimal RequestedAmount = NullCheck.IsNullDecimal(row["Quantity"]); if (ScannedAmount > RequestedAmount) { EnableRows(9); SetRow9("Surinktas didesnis kiekis nei reikia surinkti", ContentAlignment.MiddleCenter, Color.Red); return; } PickingActions.SetWOInProcess(NullCheck.IsNullInt(row["WOrderId"])); DisableRows(9); decimal LeftQty = RequestedAmount - ScannedAmount; if (LeftQty == decimal.Zero) { PickingActions.CloseWO(NullCheck.IsNullInt(row["WOrderId"])); ItemList.Rows.Remove(row); } else { row["Quantity"] = LeftQty; } ClearInput(input1: false); if (ItemList.Rows.Count > 0) { if (LeftQty == Decimal.Zero) { SetScanWO(); } processMethod = new Action(ProcessWOScan); } else { ClearInput(); EnableInput(); ProcessWO(); } }
public void LoadData() { DataTable dt = Sql.GetTable(SelectProcedure, new object[] { "@OutOrderId", DocId }); if (dt.Rows.Count > 0) { tDocNo.Text = NullCheck.IsNullString(dt.Rows[0]["DocumentNo"]); tCustomer.Text = NullCheck.IsNullString(dt.Rows[0]["PartnerName"]); dtPlannedShipment.Value = NullCheck.IsNullDate(dt.Rows[0]["ShippingPlanned"]); tState.Text = NullCheck.IsNullString(dt.Rows[0]["OOStateName"]); tCreateDate.Text = NullCheck.IsNullDate(dt.Rows[0]["Created"]).ToShortDateString(); tUpdated.Text = NullCheck.IsNullDate(dt.Rows[0]["Updated"]).ToShortDateString(); SelectedPartnerId = NullCheck.IsNullInt(dt.Rows[0]["PartnerId"]); StateId = NullCheck.IsNullInt(dt.Rows[0]["OOStateId"]); } }
public void LoadData() { DataTable dt = Sql.GetTable(SelectProcedure, new object[] { "@ShipmentId", ShipmentId }); if (dt != null && dt.Rows.Count > 0) { tShipmentId.Text = NullCheck.IsNullString(ShipmentId); SelectedPartnerId = NullCheck.IsNullInt(dt.Rows[0]["PartnerId"]); tPartner.Text = NullCheck.IsNullString(dt.Rows[0]["PartnerName"]); tWarehouse.Text = NullCheck.IsNullString(dt.Rows[0]["WarehouseName"]); tShipmentNo.Text = NullCheck.IsNullString(dt.Rows[0]["ShipmentNo"]); tCreateDate.Text = NullCheck.IsNullDate(dt.Rows[0]["CreateDate"]).ToShortDateString(); tUpdated.Text = NullCheck.IsNullDate(dt.Rows[0]["UpdateDate"]).ToShortDateString(); LoadDView(); } }
private void Shipment_Click(object sender, EventArgs e) { int SelectedParcelId = GetSelectedItemId(AccessGrid()); if (SelectedParcelId > 0) { DataTable dt = Sql.GetTable("GetRelatedOutOrders", new object[] { "@ParcelId", SelectedParcelId }); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DataTable relatedItemId = Sql.GetTable("StartOutOrderDocsAndGetOrderedItems", new object[] { "@OutOrderId", row["OutOrderID"] }); GenerateWO(relatedItemId, NullCheck.IsNullInt(row["OutOrderID"])); } } } }
private void LoadUnloadBarcode() { string ScannedBarcode = NullCheck.IsNullString(tBoxInput1.Text); DataRow row = ItemList.AsEnumerable().Where(x => x.Field <string>("Barcode") == ScannedBarcode).FirstOrDefault(); ShippingActions.LoadCU(NullCheck.IsNullInt(row["StoredPalletId"])); ItemList.Rows.Remove(row); ClearInput(); if (ItemList.Rows.Count > 0) { ProcessCULoading(); } else { ProcessLoading(); } }
private bool ValidInput() { string errorMsg = string.Empty; if (string.IsNullOrEmpty(tPartnerCode.Text)) { tPartnerName.Invalidate(); errorMsg += "Negalimas partnerio kodas\n"; } if (string.IsNullOrEmpty(tPartnerName.Text)) { tPartnerName.Invalidate(); errorMsg += "Negalimas partnerio pavadinimas\n"; } if (!cbCustomer.Checked && !cbSupply.Checked) { errorMsg += "Pasirinkite partnerio tipą\n"; } int Exists = NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidatePartner('{tPartnerName.Text}', '{tPartnerCode.Text}')")); if (Exists > 0 && PartnerId < 0) { errorMsg += "Partnerio kodo ir pavadinimo kombinacija nėra unikali\n"; } if (Exists > 0 && PartnerId > 0) { if (NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.CheckIfPartnerIsUnique('{PartnerId}','{tPartnerName.Text}','{tPartnerCode.Text}')")) == 0) { errorMsg += "Partnerio kodo ir pavadinimo kombinacija nėra unikali\n"; } } if (!string.IsNullOrEmpty(errorMsg)) { MessageBox.Show("Negalima išsaugoti partnerio:\n" + errorMsg, "Klaida", MessageBoxButtons.OK); return(false); } return(true); }
public void LoadData() { DataTable dt = Sql.GetTable(SelectProcedure, new object[] { "@RcvDocId", DocId }); if (dt.Rows.Count > 0) { tDocNo.Text = NullCheck.IsNullString(dt.Rows[0]["DocCode"]); tSupplier.Text = NullCheck.IsNullString(dt.Rows[0]["PartnerName"]); dtArrivalPlanned.Value = NullCheck.IsNullDate(dt.Rows[0]["ArrivalPlaned"]); tTruckNo.Text = NullCheck.IsNullString(dt.Rows[0]["TruckNo"]); tTrailerNo.Text = NullCheck.IsNullString(dt.Rows[0]["TrailerNo"]); tDriver.Text = NullCheck.IsNullString(dt.Rows[0]["Driver"]); tState.Text = NullCheck.IsNullString(dt.Rows[0]["IOStateName"]); tCreateDate.Text = NullCheck.IsNullDate(dt.Rows[0]["CreateDate"]).ToShortDateString(); tUpdated.Text = NullCheck.IsNullDate(dt.Rows[0]["UpdateDate"]).ToShortDateString(); SelectedPartnerId = NullCheck.IsNullInt(dt.Rows[0]["SupplierId"]); StateId = NullCheck.IsNullInt(dt.Rows[0]["StateId"]); } }
private void LoadDView() { DataTable dt = Sql.GetTable("GetRcvDocsForOrderEditor", new object[] { "@RcvOrdId", DocId }); dView.DataSource = dt; EditColumns(); foreach (DataGridViewRow row in dView.Rows) { if (NullCheck.IsNullInt(row.Cells["RcvOrderId"].Value) == DocId) { row.DefaultCellStyle.BackColor = Color.Cyan; } else { row.DefaultCellStyle.BackColor = Color.LightGreen; } } }
public void SaveRow(DataGridViewRow row) { if (NullCheck.IsNullInt(row.Cells["ItemId"].Value) > 0 && NullCheck.IsNullDecimal(row.Cells["Quantity"].Value) > 0) { Sql.ExecuteCmd(NullCheck.IsNullInt(row.Cells["OrderedItemId"].Value) <= 0 ? SaveRcvDocDet : UpdateRcvDocDet, new object[] { "@OrderedItemId", NullCheck.IsNullInt(row.Cells["OrderedItemId"].Value), "@Quantity", NullCheck.IsNullDecimal(row.Cells["Quantity"].Value), "@Created", DateTime.Now, "@Updated", DateTime.Now, "@ItemId", NullCheck.IsNullInt(row.Cells["ItemId"].Value), "@RcvDocId", CurrentRcvDocId }); _handle = false; if (NullCheck.IsNullInt(row.Cells["OrderedItemId"].Value) <= 0) { ((DataTable)dataGridView2.DataSource).Rows.Add(); } row.Cells["OrderedItemId"].Value = NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateDetSave('{NullCheck.IsNullInt(row.Cells["ItemId"].Value)}','{CurrentRcvDocId}')")); _handle = true; } }
private bool ValidInput() { string errorMsg = string.Empty; if (string.IsNullOrEmpty(tCode.Text)) { tCode.Invalidate(); errorMsg += "Negalimas sandėlio kodas\n"; } if (string.IsNullOrEmpty(tName.Text)) { tName.Invalidate(); errorMsg += "Negalimas sandėlio pavadinimas\n"; } int Exists = NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateWarehouse('{tCode.Text}', '{tName.Text}')")); if (Exists > 0 && WarehouseId < 0) { errorMsg += "Sandėlio kodo ir pavadinimo kombinacija nėra unikali\n"; } if (Exists > 0 && WarehouseId > 0) { if (NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.CheckIfWarehouseIsUnique('{WarehouseId}','{tName.Text}','{tCode.Text}')")) == 0) { errorMsg += "Sandėlio kodo ir pavadinimo kombinacija nėra unikali\n"; } } if (!string.IsNullOrEmpty(errorMsg)) { MessageBox.Show("Negalima išsaugoti sandėlio:\n" + errorMsg, "Klaida", MessageBoxButtons.OK); return(false); } return(true); }
private void LoadDView() { DataTable dt = Sql.GetTable("GetRcvOrdersForShipmentEditor", new object[] { "@ShipmentId", ShipmentId }); dView.DataSource = dt; if (dt != null) { EditColumns(); foreach (DataGridViewRow row in dView.Rows) { if (NullCheck.IsNullInt(row.Cells["ShipmentId"].Value) == ShipmentId) { row.DefaultCellStyle.BackColor = Color.Cyan; } else { row.DefaultCellStyle.BackColor = Color.LightGreen; } } } }
private void SetupForm() { DataTable dt = Sql.GetTable(WarehouseComboSql); if (dt != null && dt.Rows.Count > 0) { if (dt.AsEnumerable().Where(x => x.Field <string>("WarehouseCode") == "TEST").FirstOrDefault() != null) { GlobalUser.SetWarehouseId(NullCheck.IsNullInt(dt.AsEnumerable().Where(x => x.Field <string>("WarehouseCode") == "TEST").FirstOrDefault()["WarehouseId"])); } else { GlobalUser.SetWarehouseId(NullCheck.IsNullInt(dt.Rows[0]["WarehouseId"])); } } else { MessageBox.Show("Nerastas registruotas sandėlys sistemoje.", "Ispėjimas", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.MinimizeBox = false; this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = FormBorderStyle.FixedSingle; SetupUserInfo(); }
private static DataTable ProcessDataTableQuantityById(DataTable dt) { DataTable clone = dt.Clone(); foreach (DataRow row in dt.Rows) { DataRow _row = clone.AsEnumerable().Where(x => x.Field <int>("ItemId") == NullCheck.IsNullInt(row["ItemId"])).FirstOrDefault(); if (_row == null) { clone.Rows.Add(row.ItemArray); } else { _row["Quantity"] = NullCheck.IsNullDecimal(_row["Quantity"]) + NullCheck.IsNullDecimal(row["Quantity"]); } } return(clone); }
public static int ZoneExists(string ZoneCode) { return(NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateReceivingLocation('{GlobalUser.CurrentWarehouseId}','{ZoneCode}')"))); }
public static int ValidatePallet(string Barcode) { return(NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateBarcode('{Barcode}')"))); }
private int GetParentNodeKey() { return(NullCheck.IsNullInt(treeView1.SelectedNode.Parent != null ? treeView1.SelectedNode.Parent.Name : treeView1.SelectedNode.Name)); }