private void btnSaveRoute_Click(object sender, EventArgs e)
        {
            if (routeValidation.Validate())
            {
                if (route.RowCount == 0)
                {
                    route.AddNew();
                }

                route.Name = txtRouteName.Text;
                route.Save();

                if (rusForRoute.RowCount > 0)
                {
                    rusForRoute.Save();
                }
                Route r = new Route();
                r.LoadAll();
                gridRoute.DataSource = r.DefaultView;

                btnAddRoute.Enabled = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Add-Route") : true;


                XtraMessageBox.Show("Your changes have been saved.", "Confirmation", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
            }
        }
Пример #2
0
        protected void AddInstitution(object sender, CommandEventArgs e)
        {
            string instName = InstitutionName.Text;

            if (!string.IsNullOrEmpty(instName))
            {
                InstitutionDa da          = new InstitutionDa();
                DataTable     dt          = da.GetInstitutions();
                bool          isDuplicate = false;
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        if (row[Institution.Institution_Field].ToString() == instName)
                        {
                            isDuplicate = true;
                        }
                    }
                }
                if (!isDuplicate)
                {
                    Institution biz = new Institution();
                    biz[Institution.Institution_Field] = instName;
                    biz.Save();
                }
            }
            SetEditInstitutionsMode();
            InstitutionGrid.DataBind();
        }
Пример #3
0
 protected void SaveInstitutionsGrid(object sender, CommandEventArgs e)
 {
     foreach (int dirtyRow in dirtyRows)
     {
         GridViewRow row     = InstitutionGrid.Rows[dirtyRow];
         TextBox     instCon = (TextBox)row.FindControl("InstitutionName");
         int         priKey  = int.Parse(((HiddenField)row.FindControl("InstitutionId")).Value);
         string      newVal  = instCon.Text;
         if (!string.IsNullOrEmpty(newVal))
         {
             Institution biz = new Institution();
             biz.Get(priKey);
             biz[Institution.Institution_Field] = newVal;
             biz[Institution.UpdatedTime]       = DateTime.Now.ToString();
             biz.Save();
         }
     }
     dirtyRows.Clear();
     AddPanel.Visible = false;
 }
Пример #4
0
 protected void SaveInstitutionsGrid(object sender, CommandEventArgs e)
 {
     foreach (GridViewRow row in InstitutionGrid.DirtyGridRows)
     {
         ICaisisInputControl instCon = row.FindControl("InstitutionName") as ICaisisInputControl;
         object priKey          = InstitutionGrid.DataKeys[row.RowIndex][BOL.Institution.InstitutionId];
         string institutionName = instCon.Value;
         if (!string.IsNullOrEmpty(institutionName))
         {
             Institution biz = new Institution();
             // update
             if (!string.IsNullOrEmpty(priKey.ToString()))
             {
                 biz.Get(int.Parse(priKey.ToString()));
             }
             biz[Institution.Institution_Field] = institutionName;
             biz.Save();
         }
     }
     InstitutionGrid.DirtyRows.Clear();
     RegisterUpdateScript();
 }
Пример #5
0
        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();
                }
            }
        }