private void SaveHubDetails() { if (isStorageTypeChanged) { isStorageTypeChanged = false; BLL.ItemPrefferedLocation ipl = new ItemPrefferedLocation(); ipl.LoadByItemID(itemId); while (!ipl.EOF) { ipl.MarkAsDeleted(); ipl.MoveNext(); } ipl.Save(); } Item itm = new Item(); if (cmbStorageType.SelectedValue != null) { if (cmbStorageType.SelectedValue.ToString() == StorageType.BulkStore) { // store the stacked storage settings itm.LoadByPrimaryKey(itemId); itm.IsStackStored = chkIsStackStored.Checked; itm.Save(); if (lstPreferredPalletLocation.ItemCount > 0) { //Items itm = new Items(); // save near expiry trigger point ItemPrefferedLocation ipr = new ItemPrefferedLocation(); DataView dv = (DataView)lstPreferredPalletLocation.DataSource; foreach (DataRowView drv in dv) { ipr.SaveNewItemPreferredRack(itemId, Convert.ToInt32(drv["ID"]),false); } } // store pickface settings pf.Rewind(); PickFace pfc = new PickFace(); while (!pf.EOF) { pf.AcceptChanges(); if (!pf.IsColumnNull("PalletLocationID")) { pfc.SavePickFaceLocation(itemId, pf.PalletLocationID, pf.LogicalStore); } else { pfc.LoadPickFaceFor(itemId, pf.LogicalStore); if (pfc.RowCount> 0 && (pfc.IsColumnNull("Balance") || pfc.Balance == 0)) { pfc.ClearPickFaceFor(itemId, pfc.LogicalStore); } else { //TODO: show the error message for the user } } pf.MoveNext(); } } else { // Save the fixed locations var ipr = new ItemPrefferedLocation(); DataView dv = (DataView)lstPreferredPalletLocation.DataSource; if (dv != null) { foreach (DataRowView drv in dv) { ipr.SaveNewItemPreferredRack(itemId, Convert.ToInt32(drv["ID"]), true); } } } itm.LoadByPrimaryKey(itemId); itm.StorageTypeID = int.Parse(cmbStorageType.SelectedValue.ToString()); itm.NearExpiryTrigger = Convert.ToDouble(numNearExpiryTrigger.Value); itm.Save(); } }
private void BindPalletLocationForEdit(object sender, EventArgs e) { // Keep the reference of the current popup control so that the cancel logic works just fine. CurrentPopup = (PopupContainerEdit)sender; //Get the selected row DataRow dr = detailView.GetFocusedDataRow(); int palletLocationID = Convert.ToInt32(dr["PalletLocationID"]); // Enable and disable optional fields String SType = dr["STI"].ToString(); if (SType == "") { SType = dr["ShelfStorageType"].ToString(); } cmbFixedPrefered.Enabled = true; if (SType == StorageType.BulkStore) { //lstPreferedItems.Visible = true; //lblPreferredItem.Visible = true; //cmbFixedPrefered.Enabled = false; lblFixedPickItem.Visible = false; cmbFixedPrefered.Visible = false; } else if (SType == StorageType.PickFace) { lblFixedPickItem.Text = "Pick Item"; lstPreferedItems.Visible = false; lblPreferredItem.Visible = false; cmbFixedPrefered.Properties.DataSource = Item.GetItems(StorageType.BulkStore); PickFace pf = new PickFace(); pf.LoadByPalletLocation(palletLocationID); if (pf.RowCount >0 && !pf.IsColumnNull("DesignatedItem")) { cmbFixedPrefered.EditValue = pf.DesignatedItem; } else { cmbFixedPrefered.EditValue = null; } lblFixedPickItem.Visible = true; cmbFixedPrefered.Visible = true; } else { cmbFixedPrefered.Properties.DataSource = Item.GetItems(dr["STI"].ToString()); BLL.ItemPrefferedLocation ipl = new ItemPrefferedLocation(); ipl.LoadByRackID( palletLocationID ); if (ipl.RowCount > 0) { cmbFixedPrefered.EditValue = ipl.ItemID; } else { cmbFixedPrefered.EditValue = null; } lblFixedPickItem.Text = "Fixed Item"; lblFixedPickItem.Visible = true; cmbFixedPrefered.Visible = true; lstPreferedItems.Visible = false; lblPreferredItem.Visible = false; } // Bind the available variables txtPalletLocationLabel.Text = dr["Label"].ToString(); chkEnabled.Checked = Convert.ToBoolean(dr["IsEnabled"]); }