当前位置: 首页>>代码示例>>C#>>正文


C# DataClasses1DataContext.WriteLogItem方法代码示例

本文整理汇总了C#中KVSCommon.Database.DataClasses1DataContext.WriteLogItem方法的典型用法代码示例。如果您正苦于以下问题:C# DataClasses1DataContext.WriteLogItem方法的具体用法?C# DataClasses1DataContext.WriteLogItem怎么用?C# DataClasses1DataContext.WriteLogItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KVSCommon.Database.DataClasses1DataContext的用法示例。


在下文中一共展示了DataClasses1DataContext.WriteLogItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveOrderItem

        /// <summary>
        /// Loescht eine Auftragsposition und ggf. die Amtlichen Gebuehren dazu
        /// </summary>
        /// <param name="dbContext">DB Kontext</param>
        /// <param name="orderItemId">AuftragspositionID</param>
        public static void RemoveOrderItem(DataClasses1DataContext dbContext, int orderItemId)
        {
            var orderItemToDelete = dbContext.OrderItem.FirstOrDefault(q => q.Id == orderItemId);
            if (orderItemToDelete != null)
            {

                if (orderItemToDelete.Status > (int)OrderItemStatusTypes.Open)
                    throw new Exception("Der Auftragsstatus ist nicht mehr Offen, löschen nicht möglich");
                if (orderItemToDelete.Order.DocketList != null)
                    throw new Exception("Laufzettel wurde bereits erstellt, löschen nicht möglich");
                if (orderItemToDelete.Order.PackingList != null)
                    throw new Exception("Lieferschein wurde bereits erstellt, löschen nicht möglich");

                var itemsAnzahl = dbContext.OrderItem.Count(q => q.Id != orderItemId && q.SuperOrderItemId != orderItemId && q.OrderNumber == orderItemToDelete.OrderNumber);
                if (itemsAnzahl == 0)
                    throw new Exception("Mind. eine Position muss pro Auftrag verfügbar sein");

                var hasChildItems = dbContext.OrderItem.FirstOrDefault(q => q.SuperOrderItemId == orderItemToDelete.Id);
                dbContext.OrderItem.DeleteOnSubmit(hasChildItems);

                if (orderItemToDelete.SuperOrderItemId.HasValue == true)
                {
                    RemoveOrderItem(dbContext, orderItemToDelete.SuperOrderItemId.Value);
                }

                dbContext.OrderItem.DeleteOnSubmit(orderItemToDelete);
                dbContext.WriteLogItem("Auftragsposition " + orderItemToDelete.ProductName + " mit der Auftragsnummer " + orderItemToDelete.Order.OrderNumber + " wurde gelöscht.",
                    LogTypes.DELETE, orderItemToDelete.Id, "OrderItem");
            }
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:35,代码来源:OrderItem.cs

示例2: GetCustomerProductInformation

        public Kundendaten GetCustomerProductInformation(string username, string password, string InternalId)
        {
            Kundendaten knd = new Kundendaten();
            List<Guid> allowedCustomers = new List<Guid>();
            try
            {
                allowedCustomers = CheckLogin.CheckUser(username, password, InternalId);
                if (allowedCustomers.Count > 0)
                {
                    using (DataClasses1DataContext dbContext = new DataClasses1DataContext(new Guid(ConfigurationManager.AppSettings["currentUser"])))
                    {
                        dbContext.WriteLogItem("Zugriff von der IP Adresse: " + this.Context.Request.UserHostAddress + "Webservice GetCustomerInformation()", LogTypes.INFO);
                        ValidateOrderType.GetCutomerInformation(out knd, allowedCustomers, dbContext);
                    }
                }
                else
                {
                    throw new Exception("Für Ihre Daten konnten keine Kunden gefunden werden!");
                }
            }
            catch(Exception ex)
            {
                throw new Exception("Fehler beim verabeiten der Daten, bitte wiederholen Sie den Vorgang" + Environment.NewLine + "Fehlermeldung: " + ex.Message);
            }

            return knd;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:27,代码来源:Zulassungswebservice.asmx.cs

示例3: CreateSmallCustomer

        /// <summary>
        /// Erstellt einen Laufkunden.
        /// </summary>
        /// <param name="name">Name des Kunden.</param>
        /// <param name="firstName">Vorname des Kunden.</param>
        /// <param name="title">Anrede.</param>
        /// <param name="gender">Geschlecht.</param>
        /// <param name="street">Straße.</param>
        /// <param name="streetnumber">Hausnummer.</param>
        /// <param name="zipcode">Postleitzahl.</param>
        /// <param name="city">Straße.</param>
        /// <param name="country">Land.</param>
        /// <param name="phone">Telefonnummer.</param>
        /// <param name="fax">Faxnummer.</param>
        /// <param name="mobilephone">Mobiltelefonnummer.</param>
        /// <param name="email">Emailaddresse.</param>
        /// <param name="vat">Mehrwersteuersatz für den Kunden.</param>
        /// <param name="termOfCredit">Zahlungsziel (in Tagen).</param>
        /// <param name="customerNumber">Kundennummer.</param>
        /// <param name="dbContext">Datenbankkontext für die Transaktion.</param>
        /// <returns>Den neuen Laufkunden.</returns>
        public static SmallCustomer CreateSmallCustomer(string name, string firstName, string title, string gender, string street, string streetnumber, string zipcode, string city, 
            string country, string phone, string fax, string mobilephone, string email, decimal vat, int? termOfCredit, string customerNumber, DataClasses1DataContext dbContext)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("Der Name darf nicht leer sein.");
            }

            var customer = Customer.CreateCustomer(name, street, streetnumber, zipcode, city, country, phone, fax, mobilephone, email, vat, termOfCredit, customerNumber);
            customer._dbContext = dbContext;
            var person = new Person()
            {
                FirstName = firstName,
                Name = name,
                Gender = gender,
                Title = title
            };

            var smallCustomer = new SmallCustomer()
            {
                Customer = customer,
                Person = person
            };

            dbContext.SmallCustomer.InsertOnSubmit(smallCustomer);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Kunde " + firstName + " " + name + " wurde angelegt.", LogTypes.INSERT, customer.Id, "SmallCustomer");

            return smallCustomer;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:51,代码来源:SmallCustomer.cs

示例4: cmbCustomerProducts_OnLoad

        // public void cmbCustomerProducts_OnLoad(object sender, EventArgs e)
        public void cmbCustomerProducts_OnLoad(RadComboBox Box)
        {
            using (DataClasses1DataContext dbContext = new DataClasses1DataContext())
            {
                try
                {
                    if (Session["editableProductId"] != null && !String.IsNullOrEmpty(Session["editableProductId"].ToString()))
                    {
                        string myProductId = Session["editableProductId"].ToString();
                        Box.Visible = true;

                        var myCustomers = from cust in dbContext.Customer
                                          join lCust in dbContext.LargeCustomer on cust.Id equals lCust.CustomerId
                                          orderby cust.Name ascending
                                          select new
                                          {
                                              CustomerId = cust.Id,
                                              CustomerName = String.IsNullOrEmpty(cust.MatchCode) ? cust.Name : cust.Name + "(" + cust.MatchCode + ")",
                                              IsChecked = dbContext.CustomerProduct.SingleOrDefault(q => q.ProductId == Int32.Parse(myProductId) && q.CustomerId == cust.Id) != null ? true : false
                                          };

                        Box.DataSource = myCustomers;
                        Box.DataBind();
                    }
                }
                catch (Exception ex)
                {
                    dbContext.WriteLogItem("Product Error " + ex.Message, LogTypes.ERROR, "Product");
                    throw new Exception(ex.Message);
                }
            }
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:33,代码来源:AllProducts.ascx.cs

示例5: ChangeSaveBtn_Click

 protected void ChangeSaveBtn_Click(object sender, EventArgs e)
 {
     DataClasses1DataContext dbContext = new DataClasses1DataContext(Int32.Parse(Session["CurrentUserId"].ToString())); // hier kommt die Loggingid
     try
     {
         if (txbNewPassword.Text == txbRepeatPWD.Text)
         {
             var thisUser = dbContext.User.SingleOrDefault(q => q.Id == Int32.Parse(Session["CurrentUserId"].ToString()));
             if (thisUser != null)
             {
                 thisUser.ChangePassword(txbNewPassword.Text, txbOldPWD.Text, dbContext);
                 dbContext.SubmitChanges();
                 RadWindowManagerChangePassword.RadAlert("Das Passwort wurde erfolgreich geändert", 380, 180, "Info", "");
             }
             else
             {
                 Response.Redirect("../login.aspx");
             }
         }
         else
         {
             FailureText.Text = "Die neuen Passwörter stimmen nicht überein";
         }
     }
     catch (Exception ex)
     {
         FailureText.Text = ex.Message;
         dbContext.WriteLogItem("ChangePassowrd Error:  " + ex.Message, LogTypes.ERROR, "User");
     }
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:30,代码来源:ChangePassword.aspx.cs

示例6: bSaveClick

 protected void bSaveClick(object sender, EventArgs e)
 {
     ResetErrorLabels();
     if (checkFields() == true)
     {
         DataClasses1DataContext dbContext = new DataClasses1DataContext(((Guid)Session["CurrentUserId"]));
         try
         {
             var createUser = KVSCommon.Database.User.CreateUser(txbUserLogin.Text, txbUserPassword1.Text, txbUserNachname.Text, txbUserVorname.Text, txbUserTitle.Text, dbContext);
             if (hasContactData() == true)
             {
                 var createContact = Contact.CreateContact(txbUserPhone.Text, txbUserFax.Text, txbUserMobile.Text, txbUserEmail.Text, dbContext);
                 createUser.Contact = createContact;
             }
             dbContext.SubmitChanges();
             RadWindowManagerCreateUser.RadAlert("Der Benutzer wurde erfolgreich angelegt!", 380, 180, "Info", "");
             txbUserLogin.Text=""; txbUserPassword1.Text=""; txbUserNachname.Text="";
             txbUserVorname.Text = ""; txbUserTitle.Text = "";
             txbUserPhone.Text = ""; txbUserFax.Text = ""; txbUserMobile.Text = ""; txbUserEmail.Text = "";
         }
         catch (Exception ex)
         {
             RadWindowManagerCreateUser.RadAlert(Server.HtmlEncode(ex.Message).RemoveLineEndings(), 380, 180, "Fehler", "");
             try
             {
                 dbContext.WriteLogItem("Create User Error " + ex.Message, LogTypes.ERROR, "User");
                 dbContext.SubmitChanges();
             }
             catch { }
         }
     }
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:32,代码来源:CreateUser.aspx.cs

示例7: DeleteBank

 /// <summary>
 /// Löscht die angegebene Bank aus der Datenbank.
 /// </summary>
 /// <param name="adressId">Id der Bank.</param>
 /// <param name="dbContext"></param>
 public static void DeleteBank(int bankId, DataClasses1DataContext dbContext)
 {
     BankAccount bank = dbContext.BankAccount.SingleOrDefault(q => q.Id == bankId);
     if (bank != null)
     {
         dbContext.WriteLogItem("bank gelöscht.", LogTypes.DELETE, bankId, "BankAccount");
         dbContext.BankAccount.DeleteOnSubmit(bank);
     }
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:14,代码来源:BankAccount.cs

示例8: DeleteContact

 /// <summary>
 /// Löscht den angegeben Kontakt aus der Datenbank
 /// </summary>
 /// <param name="adressId">Id des Kontakts.</param>
 /// <param name="dbContext"></param>
 public static void DeleteContact(int contactId, DataClasses1DataContext dbContext)
 {
     Contact contact = dbContext.Contact.SingleOrDefault(q => q.Id == contactId);
     if (contact != null)
     {
         dbContext.WriteLogItem("Contact gelöscht.", LogTypes.DELETE, contactId, "Contact");
         dbContext.Contact.DeleteOnSubmit(contact);
     }
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:14,代码来源:Contact.cs

示例9: CreatePrice

        /// <summary>
        /// Erstellt einen neuen Preis.
        /// </summary>
        /// <param name="amount">Der Betrag des Preises.</param>
        /// <param name="authorativeCharge">Die behoerdliche Gebuehr.</param>
        /// <param name="productId">Id des Produkts, für den der Preis gilt.</param>
        /// <param name="locationId">Id des Standorts, falls benoetigt. </param>
        /// <param name="dbContext">Datenbankkontext für die Transaktion.</param>
        /// <returns>Den neuen Preis.</returns>
        public static Price CreatePrice(decimal amount, decimal? authorativeCharge, int productId, int? locationId, int? accountId, DataClasses1DataContext dbContext)
        {
            if (dbContext.Price.Any(q => q.ProductId == productId && q.LocationId == locationId))
            {
                throw new Exception("Für dieses Produkt und diesen Standort ist bereits ein Preis eingetragen.");
            }

            var productName = dbContext.Product.Single(q => q.Id == productId).Name;
            string standortText = string.Empty;
            if (locationId.HasValue)
            {
                standortText = " und Standort " + dbContext.Location.Single(q => q.Id == locationId).Name;
            }

            var price = new Price()
            {
                Amount = amount,
                AuthorativeCharge = authorativeCharge,
                LocationId = locationId,
                ProductId = productId,

            };

            dbContext.Price.InsertOnSubmit(price);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Preis für Produkt " + productName + standortText + " eingetragen.", LogTypes.INSERT, price.Id, "Price");

            if (accountId.HasValue)
            {

                var account = new PriceAccount()
                {
                    Price = price,
                    AccountId =accountId.Value

                };
                dbContext.PriceAccount.InsertOnSubmit(account);
                dbContext.SubmitChanges();
                dbContext.WriteLogItem("Account für Produkt " + productName + standortText + " eingetragen.", LogTypes.INSERT, price.Id, "Price");
            }

            return price;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:52,代码来源:Price.cs

示例10: CreateProductCategory

        /// <summary>
        /// Erstellt eine neue Produktkategorie mit uebergebenem Namen.
        /// </summary>
        /// <param name="name">Name der Kategorie.</param>
        /// <param name="dbContext">Datenbankkontext, mit dem die Kategorie erstellt wird.</param>
        /// <returns>Die neu erstellte Produktkategorie.</returns>
        public static ProductCategory CreateProductCategory(string name, DataClasses1DataContext dbContext)
        {
            var item = new ProductCategory()
            {
                LogDBContext = dbContext,
                Name = name
            };

            dbContext.ProductCategory.InsertOnSubmit(item);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Produktkategorie " + item.Name + " angelegt.", LogTypes.INSERT, item.Id, "ProductCategory");
            return item;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:19,代码来源:ProductCategory.cs

示例11: DeleteOrderInvoice

        /// <summary>
        /// Loescht eine Auftrags/Rechnungsverknuepfung
        /// </summary>
        /// <param name="OrderNumber">AuftragsID</param>
        /// <param name="invoiceId">RechnungsID</param>
        /// <param name="dbContext">DB Kontext</param>
        public static void DeleteOrderInvoice(int orderNumber, int invoiceId, DataClasses1DataContext dbContext)
        {
            var item = dbContext.OrderInvoice.SingleOrDefault(q => q.OrderNumber == orderNumber && q.InvoiceId == invoiceId);
            if (item == null)
            {
                var invoiceNumber = dbContext.Invoice.Where(q => q.Id == invoiceId).Select(q => q.InvoiceNumber.Number).SingleOrDefault();
                throw new Exception("Es existiert keine Verknüpfung zwischen dem Auftrag Nr. " + orderNumber + " und der Rechnung Nr. " + invoiceNumber);
            }

            dbContext.OrderInvoice.DeleteOnSubmit(item);
            dbContext.WriteLogItem("Verknüpfung zwischen Auftrag Nr. " + item.Order.OrderNumber + " und Rechnung Nr. " +
                item.Invoice.InvoiceNumber.Number + " wurde gelöscht.",
                LogTypes.DELETE, orderNumber, "OrderInvoice", invoiceId);
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:20,代码来源:OrderInvoice.cs

示例12: CreateOrderInvoice

        /// <summary>
        /// Erstellt eine Verknuepfung zwischen einem Auftrag und einer Rechnung.
        /// </summary>
        /// <param name="OrderNumber">Id des Auftrags.</param>
        /// <param name="invoiceId">Id der Rechnung.</param>
        /// <param name="dbContext">Datenbankkontext für die Transaktion.</param>
        /// <returns>Die neue Verknüpfung.</returns>
        public static OrderInvoice CreateOrderInvoice(Order order, Invoice invoice, DataClasses1DataContext dbContext)
        {
            OrderInvoice item = new OrderInvoice()
            {
                Order = order,
                Invoice = invoice
            };

            dbContext.OrderInvoice.InsertOnSubmit(item);
            ///  var invoiceNumber = dbContext.Invoice.Where(q => q.Id == invoiceId).Select(q => q.InvoiceNumber).Single();
            var orderNumber = dbContext.Order.Where(q => q.OrderNumber == order.OrderNumber).Select(q => q.OrderNumber).Single();
            dbContext.WriteLogItem("Rechnung wurde mit Auftrag " + orderNumber + " verknüpft.", LogTypes.INSERT, order.OrderNumber, "OrderInvoice", invoice.Id);
            return item;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:21,代码来源:OrderInvoice.cs

示例13: AddInvoiceType_Click

        protected void AddInvoiceType_Click(object sender, EventArgs e)
        {
            bool insertUpdateOk = true;
            using (TransactionScope ts = new TransactionScope())
            {
                DataClasses1DataContext dbContext = new DataClasses1DataContext();

                try
                {
                    RadButton AddInvoiceType = ((RadButton)sender);
                    GridDataItem myItem = AddInvoiceType.Parent.Parent.Parent.Parent as GridDataItem;
                    RadComboBox cmbSelectedType = AddInvoiceType.Parent.FindControl("cmbInvoiceTypes") as RadComboBox;

                    if (myItem != null && myItem["Id"].Text != string.Empty && !String.IsNullOrEmpty(myItem["Id"].Text) && cmbSelectedType != null
                        && cmbSelectedType.SelectedValue != string.Empty && !String.IsNullOrEmpty(cmbSelectedType.SelectedValue))
                    {
                        var customer = dbContext.LargeCustomer.FirstOrDefault(q => q.CustomerId == Int32.Parse(myItem["Id"].Text));
                        if (customer != null)
                        {
                            customer.InvoiceTypesID = Int32.Parse(cmbSelectedType.SelectedValue);
                            dbContext.SubmitChanges();
                        }
                        ts.Complete();

                    }
                }
                catch (Exception ex)
                {
                    insertUpdateOk = false;
                    if (ts != null)
                        ts.Dispose();
                    RadWindowManagerLargeCustomer.RadAlert(Server.HtmlEncode(ex.Message).RemoveLineEndings(), 380, 180, "Fehler", "");
                    try
                    {
                        dbContext = new DataClasses1DataContext(Int32.Parse(Session["CurrentUserId"].ToString()));
                        dbContext.WriteLogItem("AddInvoiceType_Click Error " + ex.Message, LogTypes.ERROR, "Customer");
                        dbContext.SubmitChanges();
                    }
                    catch { }
                }

            }
            if (insertUpdateOk)
            {
                getAllCustomer.EditIndexes.Clear();
                getAllCustomer.MasterTableView.IsItemInserted = false;
                getAllCustomer.MasterTableView.Rebind();
            }
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:49,代码来源:LargeCustomerDetails.ascx.cs

示例14: cmbCustomerProducts_OnLoad

        // public void cmbCustomerProducts_OnLoad(object sender, EventArgs e)
        public void cmbCustomerProducts_OnLoad(RadComboBox Box)
        {
            using (DataClasses1DataContext dbContext = new DataClasses1DataContext())
            {
                try
                {
                    //RadComboBox cmbCustomerProducts = ((RadComboBox)sender);

                    //cmbCustomerProducts.Items.Clear();
                    //cmbCustomerProducts.Text = string.Empty;

                    if (Session["editableProductId"] != null && Session["editableProductId"].ToString() != string.Empty)
                    {
                        string myProductId = Session["editableProductId"].ToString();
                        Box.Visible = true;
                        //var myCustomers = from cust in dbContext.Customer
                        //                  join custProd in dbContext.CustomerProduct on cust.Id equals custProd.CustomerId into JoinedCustProd
                        //                  from custProd in JoinedCustProd.DefaultIfEmpty()
                        //                  orderby cust.Name ascending
                        //                  select new
                        //                  {
                        //                      CustomerId = cust.Id,
                        //                      CustomerName = cust.Name,
                        //                      IsChecked = custProd.ProductId == new Guid(Session["selectedProductId"].ToString()) ? true : false
                        //                  };

                        var myCustomers = from cust in dbContext.Customer
                                          join lCust in dbContext.LargeCustomer on cust.Id equals lCust.CustomerId
                                          orderby cust.Name ascending
                                          select new
                                          {
                                              CustomerId = cust.Id,
                                              CustomerName = String.IsNullOrEmpty(cust.MatchCode) ? cust.Name : cust.Name + "(" + cust.MatchCode + ")",
                                              IsChecked = dbContext.CustomerProduct.SingleOrDefault(q => q.ProductId == new Guid(myProductId) && q.CustomerId == cust.Id) != null ? true : false
                                          };

                        Box.DataSource = myCustomers;
                        Box.DataBind();
                        //cmbCustomerProducts.DataSource = myCustomers;
                        //cmbCustomerProducts.DataBind();
                    }
                }
                catch (Exception ex)
                {
                    dbContext.WriteLogItem("Product Error " + ex.Message, LogTypes.ERROR, "Product");
                    throw new Exception(ex.Message);
                }
            }
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:50,代码来源:AllProducts.ascx.cs

示例15: CreateContact

        /// <summary>
        /// Erstelle einene neuen Kontakt 
        /// </summary>
        /// <param name="phone">Telefon</param>
        /// <param name="fax">Fax</param>
        /// <param name="mobilePhone">Mobil</param>
        /// <param name="email">Mail</param>
        /// <param name="dbContext">Datenbankkontext</param>
        /// <returns>Den neue erstellten Kontakt</returns>
        public static Contact CreateContact(string phone, string fax, string mobilePhone, string email, DataClasses1DataContext dbContext)
        {
            Contact contact = new Contact()
            {
                Phone = phone,
                Fax = fax,
                MobilePhone = mobilePhone,
                Email = email
            };

            dbContext.Contact.InsertOnSubmit(contact);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Kontakt angelegt.", LogTypes.INSERT, contact.Id, "Contact");
            return contact;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:24,代码来源:Contact.cs


注:本文中的KVSCommon.Database.DataClasses1DataContext.WriteLogItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。