Ejemplo n.º 1
0
 public void UpdateCardVerifuStatus(StatusInfo statusInfo)
 {
     using (DataContext _db = new DataContext())
     {
         _db.Database.ExecuteSqlCommand("UPDATE [book].[Cards] SET [juridical_verification] ='" + statusInfo.statusArray[0] + "' where id=" + statusInfo.id);
         _db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void DeleteStatus(StatusInfo statusInfo)
 {
     using (DataContext _db = new DataContext())
     {
         _db.Database.ExecuteSqlCommand("DELETE FROM [dbo].[JuridicalStatus] where card_id=" + statusInfo.id + "");
         _db.Database.ExecuteSqlCommand("UPDATE [book].[Cards] SET [juridical_verify_status] ='" + String.Join(",", statusInfo.statusArray.Select(s => s.ToString()).ToArray()) + "' where id=" + statusInfo.id + "");
         _db.SaveChanges();
     }
 }
Ejemplo n.º 3
0
        public ReturnJson SaveLogging(StatusInfo statusInfo, int user_id, CardNumID card)
        {
            using (DataContext _db = new DataContext())
            {
                using (DbContextTransaction tran = _db.Database.BeginTransaction(System.Data.IsolationLevel.Snapshot))
                {
                    try
                    {
                        _db.Loggings.Add(new Logging()
                        {
                            Tdate     = DateTime.Now,
                            UserId    = user_id,
                            Type      = LogType.Card,
                            Mode      = LogMode.JuridVerify,
                            TypeValue = card.card_num,
                            TypeId    = card.id
                        });

                        _db.SaveChanges();
                        tran.Commit();
                        return(new ReturnJson
                        {
                            Status = _db.Database.SqlQuery <int>($"SELECT s.status FROM dbo.JuridicalStatus s where card_id={statusInfo.id}").ToList(),
                            ID = 1
                        });
                    }
                    catch
                    {
                        return(new ReturnJson
                        {
                            Status = null,
                            ID = 0
                        });
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public ReturnJson SaveStatusLogic(StatusInfo statusInfo, int user_id)
        {
            JuridicalData juridicalStatus = new JuridicalData();
            var           card            = juridicalStatus.CardInfoData(statusInfo.id);

            if (card != null)
            {
                juridicalStatus.DeleteStatus(statusInfo);
            }
            if (statusInfo.statusArray.Length == 1)
            {
                juridicalStatus.UpdateCardVerifuStatus(statusInfo);
            }
            using (DataContext _Db = new DataContext())
            {
                statusInfo.statusArray.Select(st =>
                                              new SaveStatusInfos(statusInfo.id, user_id, st, _Db).
                                              Result()).Select(sl =>
                                                               new SaveLoggings(statusInfo.id, user_id, 1, _Db).
                                                               Result()
                                                               ).ToList();
            }
            return(juridicalStatus.SaveLogging(statusInfo, user_id, card));
        }
Ejemplo n.º 5
0
        public ReturnJson EndSaveStatus(StatusInfo statusInfo, int user_id)
        {
            JuridicalLogic juridicalLogic = new JuridicalLogic();

            return(juridicalLogic.SaveStatusLogic(statusInfo, user_id));
        }