Пример #1
0
 //        public string GetClientIdFromInt(string clientInt)
 //        {
 //            string result = clientInt.ToString(CultureInfo.InvariantCulture);
 //            if (result.Length == 1)
 //            {
 //                result = "00" + result;
 //            }
 //            else if (result.Length == 2)
 //            {
 //                result = Options.OptionsInstance().UsualClient + result;
 //            }
 //            return result;
 //        }
 public void CreateNewClient(string clientId, string name, string email, DateTime birthday, string phone,
     string activationdate, double personalDiscount, double playedSum)
 {
     //            string clientID = GetClientIdFromInt(clientId);
     if (CheckClientIdOnRepeat(clientId))
     {
         var c = new client_info_t
         {
             client_id = clientId,
             activation_date = DateTime.Parse(activationdate),
             email = email,
             birthday = birthday,
             name = name,
             pers_discount = personalDiscount,
             phone = phone,
             played_sum = playedSum
         };
         DataBaseClass.Instancedb().AddNewClient(c);
         MessageBox.Show(@"Succesfully created!");
     }
     else
     {
         MessageBox.Show(@"This id is already created, choose another one!");
     }
 }
Пример #2
0
 partial void Deleteclient_info_t(client_info_t instance);
Пример #3
0
 partial void Updateclient_info_t(client_info_t instance);
Пример #4
0
 partial void Insertclient_info_t(client_info_t instance);
Пример #5
0
 public void UpdateClientInfo(client_info_t cInfo)
 {
     var db = new dbDataContext();
     lock (db)
     {
         for (int i = 0; i < 5; i++)
         {
             try
             {
                 var matchedRecord = (from c in db.GetTable<client_info_t>()
                     where c.client_id == cInfo.client_id
                     select c).SingleOrDefault();
                 if (matchedRecord != null)
                 {
                     matchedRecord.name = cInfo.name;
                     matchedRecord.birthday = cInfo.birthday;
                     matchedRecord.email = cInfo.email;
                     matchedRecord.phone = cInfo.phone;
                 }
                 db.SubmitChanges();
                 break;
             }
             catch (Exception)
             {
                 if (i <= 0)
                 {
                     MessageBox.Show(ErrorsAndWarningsMessages.ErrorsAndWarningsInstance()
                         .GetErrorWithLine(1, 88));
                 }
             }
         }
     }
 }
Пример #6
0
        public void AddNewClient(client_info_t clientInfo)
        {
            var db = new dbDataContext();
            lock (db)
            {
                Table<client_info_t> personalInfoTable = db.GetTable<client_info_t>();
                client_info_t user = clientInfo;

                personalInfoTable.InsertOnSubmit(user);
                db.SubmitChanges();
                AddNewSaVingsForClient(user.client_id);
            }
        }