Exemplo n.º 1
0
        public void AddClientDispositionDefaultSelected(AddClientDispositionViewModel model)
        {
            try
            {
                if (model != null)
                {
                    List <PQClientDisposition> entities = new List <PQClientDisposition>();
                    PQClientDisposition        entity;

                    var disposition = db.MasterDispositions.Where(d => (d.CheckFamilyRowID == model.CheckFamilyRowID || d.CheckFamilyRowID == 39) && d.IsSetDefault == 1 && d.Status == 1).ToList();
                    foreach (var item in disposition)
                    {
                        if (!IsClientDispositionExist(model.ClientRowID, item.CheckFamilyRowID, item.DispositionRowId))
                        {
                            entity                   = new PQClientDisposition();
                            entity.ClientRowID       = model.ClientRowID;
                            entity.CheckFamilyRowID  = item.CheckFamilyRowID;
                            entity.DispositionRowId  = item.DispositionRowId;
                            entity.SeverityGridRowId = item.SeverityGridRowId;
                            entities.Add(entity);
                        }
                    }
                    db.PQClientDispositions.AddRange(entities);
                    db.SaveChanges();
                }
                else
                {
                    throw new Exception("Invalid Client Id!");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public void AddClientDisposition(AddClientDispositionViewModel model)
        {
            try
            {
                if (model != null)
                {
                    PQClientDisposition entity = new PQClientDisposition();
                    entity.ClientRowID       = model.ClientRowID;
                    entity.CheckFamilyRowID  = model.CheckFamilyRowID;
                    entity.DispositionRowId  = model.DispositionRowId;
                    entity.SeverityGridRowId = model.SeverityGridRowId;

                    db.PQClientDispositions.Add(entity);
                }
                else
                {
                    throw new Exception("Disposition could not be blank!");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }