Ejemplo n.º 1
0
        public void CRUD_Donor()
        {
            DonorBE mod = new DonorBE();
            //mod.SiteCode = "QST";
            //mod.EntityName = "Raja Rizwan";
            ////p.EntityTypeCode = "DNR";

            //int donorId = _alKhairSvc.AddDonor(mod);

            var list = _alKhairSvc.GetViewOfAllDonors("QST").OrderByDescending(m => m.ID).ToList();
            if (list != null && list.Count > 0)
            {
                mod = list[0].ToDonor();
                mod.EntityName = "Raja Rizwan ...";
                //p = pv.ToPerson();
                //p.EntityName = "Imran ...";
                //p.Signature = "imran@123";
                if (_alKhairSvc.ModifyDonor(mod))
                {

                }
                //p = _bdmSvc.GetPersonById(pv.SiteCode, pv.EntityTypeCode, pv.ID);
            }
        }
Ejemplo n.º 2
0
 public DonorViewModel()
 {
     Donor = new DonorBE();
     //Donors = new List<DonorView>();
     Donors = new List<DonorBE>();
 }
Ejemplo n.º 3
0
        public DonorViewModel ModifyDonor(DonorBE mod)
        {
            DonorViewModel model = new DonorViewModel();

            try
            {
                DBOperations op = mod.IsActive ? DBOperations.Update : DBOperations.Delete;
                mod.SiteCode = AppConstants.SITE_CODE;
                model.Donor = mod;
                model.IsValid = model.Validate();
                if (op == DBOperations.Delete || model.IsValid)
                {
                    //_bdmSvc.ModifyEntity(mod);
                    _alKhairSvc.ModifyDonor(mod);

                    model.FieldId = "donorName";
                    model.Donor = new DonorBE();
                    model.Donors = _alKhairSvc.GetViewOfAllDonors(AppConstants.SITE_CODE);
                    model.Message = op == DBOperations.Update ? string.Format(AppConstants.CRUD_UPDATE, "Donor Name") : string.Format(AppConstants.CRUD_DELETE, "Donor Name");
                }
            }
            catch (Exception ex)
            {
                model.IsValid = false;
                model.Message = ex.Message;
                if (ex.Message.Contains("Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions."))
                    model.Message = "Unable to modify Region Code";
            }
            return model;
        }
Ejemplo n.º 4
0
 public int AddDonor(DonorBE mod)
 {
     mod.EntityTypeCode = EntityTypeCodes.DNR.ToString();
     return _bdmSvc.AddPerson(mod.ToPerson());
 }
Ejemplo n.º 5
0
 public bool ModifyDonor(DonorBE mod)
 {
     mod.EntityTypeCode = EntityTypeCodes.DNR.ToString();
     return _bdmSvc.ModifyPerson(mod.ToPerson());
 }