private void chkEditInprocess_CheckedChanged(object sender, EventArgs e) { DataRow dr = grdViewClientStatus.GetFocusedDataRow(); int id = Convert.ToInt32(dr["ID"]); BLL.Institution ru = new BLL.Institution(); ru.LoadByPrimaryKey(id); bool PreviousValue; if (!dr.IsNull("InProcess")) { PreviousValue = Convert.ToBoolean(dr["InProcess"]); } else { PreviousValue = false; } if (!Convert.ToBoolean(dr["Active"])) { ru.InProcess = PreviousValue; LoadReceivingUnits(); XtraMessageBox.Show(string.Format("The {0} is inactive, you are not allow to change any status", dr["Name"].ToString().ToUpper()), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (XtraMessageBox.Show(string.Format("Are you sure you want to allow {0} to get service ", dr["Name"].ToString()), "Are you Sure", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { ru.InProcess = !PreviousValue; ru.Save(); } else { ru.InProcess = PreviousValue; } LoadReceivingUnits(); }
private void btnIssueSave_Click(object sender, EventArgs e) { // do the validation here if (issueLocationValidation.Validate()) { Institution recUnit = new Institution(); if (ID != -1) //This is not new. { recUnit.LoadByPrimaryKey(receivingUnitId); recUnit.IsUsedAtFacility = chkIsInstitutionUsedAtFacility.Checked; } else { recUnit.AddNew(); recUnit.IsDraft = true; //If it is locally added, we mark it as draft until confirmed centrally. recUnit.Active = true; recUnit.IsUsedAtFacility = true; recUnit.IsLocalSite = true; recUnit.OperationalStatus = true; recUnit.Rowguid = Guid.NewGuid(); recUnit.NUrowguid = Guid.NewGuid(); recUnit.ModifiedBy = CurrentContext.LoggedInUser.ID.ToString(); recUnit.ModifiedDate = DateTimeHelper.ServerDateTime; recUnit.SN = 1; //Saving default value here. The actual value to come from the directory services. } recUnit.Name = txtReceivingUnit.Text; recUnit.Phone = txtPhone.Text; recUnit.Description = txtDescription.Text; recUnit.Route = Convert.ToInt32(lkRoute.EditValue); recUnit.Ownership = Convert.ToInt32(lkOwnership.EditValue); recUnit.RUType = Convert.ToInt32(lkRUType.EditValue); if (lkWoreda.EditValue != null) recUnit.Woreda = int.Parse(lkWoreda.EditValue.ToString()); if (lkZone.EditValue != null) recUnit.Zone = int.Parse(lkZone.EditValue.ToString()); if (BLL.OwnershipType.IsPrivate(recUnit.Ownership)) { if (string.IsNullOrEmpty(txtLicenseNo.Text)) { XtraMessageBox.Show("Please fill in the license number!", "Missing Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } recUnit.LicenseNo = txtLicenseNo.Text; recUnit.VATNo = txtVATNo.Text; recUnit.TinNo = txtTinNo.Text; recUnit.DateOfRegistration = dtRegistration.Value; } if (ID == -1) { if (XtraMessageBox.Show(string.Format("Are you sure you want to add a new Receiving Unit", recUnit.Name.ToString()), "Confirmation", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { recUnit.Save(); this.Close(); } } else if (XtraMessageBox.Show(string.Format("Are you sure you want to save change to {0}", recUnit.Name.ToString()), "Confirmation", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { recUnit.Save(); this.Close(); } } }
private void chkEditInprocess_CheckedChanged(object sender, EventArgs e) { DataRow dr = grdViewClientStatus.GetFocusedDataRow(); int id = Convert.ToInt32(dr["ID"]); BLL.Institution ru = new BLL.Institution(); ru.LoadByPrimaryKey(id); bool PreviousValue; if (!dr.IsNull("InProcess")) PreviousValue = Convert.ToBoolean(dr["InProcess"]); else PreviousValue = false; if (!Convert.ToBoolean(dr["Active"])) { ru.InProcess = PreviousValue; LoadReceivingUnits(); XtraMessageBox.Show(string.Format("The {0} is inactive, you are not allow to change any status", dr["Name"].ToString().ToUpper()), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (XtraMessageBox.Show(string.Format("Are you sure you want to allow {0} to get service ", dr["Name"].ToString()), "Are you Sure", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { ru.InProcess = !PreviousValue; ru.Save(); } else ru.InProcess = PreviousValue; LoadReceivingUnits(); }