private void btnSave_Click(object sender, EventArgs e) { if (XtraMessageBox.Show("Are you sure you would like to change the status of this store/warehouse?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } DataTable table = gridManageInvetoryView.GetFocusedDataRow().Table; foreach (DataRow dr in table.Rows) { if (dr != null && dr.RowState == DataRowState.Modified) { var freezChoice = Convert.ToString(ComboBoxFreezChoice.Text); if (freezChoice == "Cluster") { int selected = Convert.ToInt32(dr["LocationID"]); Cluster cluster = new Cluster(); cluster.LoadByPrimaryKey(selected); cluster.IsActive = Convert.ToBoolean(dr["Status"]); cluster.Save(); this.LogActivity("Changed Status of Cluster"); BLL.Warehouse warehouse = new BLL.Warehouse(); warehouse.UpdateWarehouseStatusbyCluster(selected, Convert.ToBoolean(dr["Status"])); BLL.PhysicalStore physicalStore = new PhysicalStore(); physicalStore.UpdatePhysicalStoreStatusbyCluster(selected, Convert.ToBoolean(dr["Status"])); } else if (freezChoice == "Warehouse") { int selected = Convert.ToInt32(dr["LocationID"]); BLL.Warehouse warehouse = new BLL.Warehouse(); warehouse.LoadByPrimaryKey(selected); warehouse.IsActive = Convert.ToBoolean(dr["Status"]); warehouse.Save(); this.LogActivity("Changed Status of Warehouse"); BLL.PhysicalStore physicalStore = new PhysicalStore(); physicalStore.UpdatePhysicalStoreStatusbyWarehouse(selected, Convert.ToBoolean(dr["Status"])); } else if (freezChoice == "Physical Store") { int selected = Convert.ToInt32(dr["LocationID"]); PhysicalStore physicalStore = new PhysicalStore(); physicalStore.LoadByPrimaryKey(selected); physicalStore.IsActive = Convert.ToBoolean(dr["Status"]); physicalStore.Save(); this.LogActivity("Changed Status of Store"); } } } XtraMessageBox.Show("The freezing and unfreezing you have made have been saved.", "Successfully Saved", MessageBoxButtons.OK); }
private void btnSave_Click(object sender, EventArgs e) { if (XtraMessageBox.Show("Are you sure you would like to change the status of this store/warehouse?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } DataTable table = gridManageInvetoryView.GetFocusedDataRow().Table; foreach(DataRow dr in table.Rows) { if (dr != null && dr.RowState == DataRowState.Modified) { var freezChoice = Convert.ToString(ComboBoxFreezChoice.Text); if (freezChoice == "Cluster") { int selected = Convert.ToInt32(dr["LocationID"]); Cluster cluster = new Cluster(); cluster.LoadByPrimaryKey(selected); cluster.IsActive = Convert.ToBoolean(dr["Status"]); cluster.Save(); this.LogActivity("Changed Status of Cluster"); BLL.Warehouse warehouse = new BLL.Warehouse(); warehouse.UpdateWarehouseStatusbyCluster(selected, Convert.ToBoolean(dr["Status"])); BLL.PhysicalStore physicalStore = new PhysicalStore(); physicalStore.UpdatePhysicalStoreStatusbyCluster(selected, Convert.ToBoolean(dr["Status"])); } else if (freezChoice == "Warehouse") { int selected = Convert.ToInt32(dr["LocationID"]); BLL.Warehouse warehouse = new BLL.Warehouse(); warehouse.LoadByPrimaryKey(selected); warehouse.IsActive = Convert.ToBoolean(dr["Status"]); warehouse.Save(); this.LogActivity("Changed Status of Warehouse"); BLL.PhysicalStore physicalStore = new PhysicalStore(); physicalStore.UpdatePhysicalStoreStatusbyWarehouse(selected, Convert.ToBoolean(dr["Status"])); } else if (freezChoice == "Physical Store") { int selected = Convert.ToInt32(dr["LocationID"]); PhysicalStore physicalStore = new PhysicalStore(); physicalStore.LoadByPrimaryKey(selected); physicalStore.IsActive = Convert.ToBoolean(dr["Status"]); physicalStore.Save(); this.LogActivity("Changed Status of Store"); } } } XtraMessageBox.Show("The freezing and unfreezing you have made have been saved.", "Successfully Saved", MessageBoxButtons.OK); }
private void btnSavePhysicalStoreType_Click(object sender, EventArgs e) { psType.Rewind(); while (!psType.EOF) { if (psType.IsColumnNull("Name")) { XtraMessageBox.Show("You cannot leave the Name field as Empty, Please fix that and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } psType.MoveNext(); } psType.Save(); XtraMessageBox.Show("Your changes have been saved!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); }