Beispiel #1
0
 private void Add_Button_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(Type_TextBox.Text) || String.IsNullOrWhiteSpace(CodeOfType_TextBox.Text))
     {
         Alert.DisplayError("Invalid input!");
         return;
     }
     try
     {
         if (!mode)
         {
             Act_dict type = new Act_dict();
             type.act_name = Type_TextBox.Text;
             type.act_type = CodeOfType_TextBox.Text;
             ManagerService.NewActType(type);
             this.Close();
             this.Dispose();
         }
         else
         {
             Object_type type = new Object_type();
             type.name_type = Type_TextBox.Text;
             type.code_type = CodeOfType_TextBox.Text;
             ManagerService.NewObjectType(type);
             this.Close();
             this.Dispose();
         }
     } catch (ServiceException exc)
     {
         Alert.DisplayError(exc.Message);
     }
 }
Beispiel #2
0
    public void UpdateItemCount(Item item)
    {
        if (Object_type.ToLower() == item.Title.ToLower())
        {
            Objnumber = Inventory.InventoryScr.ItemCount(item.Title);

            if (Objnumber <= Totalnumber)
            {
                MessageManager.TheMessageManager.Message(string.Format("{0} : {1}/{2}", item.Title, Objnumber, Totalnumber));
            }

            Questlog.Log.UpdateProgress();
            Questlog.Log.Check_Finished();
        }
    }
Beispiel #3
0
 public static void NewObjectType(Object_type type)
 {
     try
     {
         CarWorkshopModelContext dc = new CarWorkshopModelContext();
         var res = (from el in dc.Object_type
                    where (el.name_type == type.name_type)
                    ||
                    (el.code_type == type.code_type)
                    select el).SingleOrDefault();
         if (res == null)
         {
             dc.Object_type.Add(type);
             dc.SaveChanges();
             return;
         }
         throw new ServiceException("Type already exists!");
     }
     catch (System.Data.Entity.Core.EntityException e)
     {
         throw new ServiceException("Database connection error!");
     }
 }