• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Database.DataClasses1DataContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



DataClasses1DataContext类属于KVSCommon.Database命名空间,在下文中一共展示了DataClasses1DataContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: GetMakeByHSN

        /// <summary>
        /// Gibt alle Herstellern by HSN zurück
        /// </summary>
        /// <param name="hsn">HSN des Herstellers.</param>
        /// <param name="dbContext">Datenbankkontext für die Transaktion.</param>
        /// <returns>Herstellers</returns>
        public static string GetMakeByHSN(string hsn)
        {
            string hsnResult = string.Empty;
            bool atLeastOneHSNFound = false;

            DataClasses1DataContext dbContext = new DataClasses1DataContext();
            var hsnQuery = from make in dbContext.Make
                           where make.HSN == hsn
                           select make.Name;

            foreach (string hsnName in hsnQuery)
            {
                atLeastOneHSNFound = true;
                hsnResult += hsnName + " ";
            }

            hsnResult = "Hersteller: " + hsnResult;

            if (atLeastOneHSNFound == false)
            {
                hsnResult = "Wir haben kein Hersteller mit dem Nummer " + hsn + " gefunden";
            }

            return hsnResult;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:31,代码来源:Make.cs


示例3: GenerateInvoiceRunButton_Click

 /// <summary>
 /// Erstellt einen neuen Rechnungslauf Datensatz
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void GenerateInvoiceRunButton_Click(object sender, EventArgs e)
 {
     InvoiceRunError.Text="";
     using (DataClasses1DataContext dbContext = new DataClasses1DataContext())
     {
         try
         {
             Guid? customerId=null;
             Guid? invoiceType = null;
              if(CustomerDropDownList.SelectedValue != string.Empty)customerId=new Guid(CustomerDropDownList.SelectedValue);
              if (RechnungsTypComboBox.SelectedValue != string.Empty && RechnungsTypComboBox.Enabled==true) invoiceType = new Guid(RechnungsTypComboBox.SelectedValue);
              InvoiceRunReport run = new InvoiceRunReport()
              {
                  Id = Guid.NewGuid(),
                  CustomerId = customerId,
                  InvoiceTypeId = invoiceType,
                  CreateDate = DateTime.Now
              };
              dbContext.InvoiceRunReport.InsertOnSubmit(run);
              dbContext.SubmitChanges();
              RadGridInvoiceRun.MasterTableView.ClearChildEditItems();
              RadGridInvoiceRun.MasterTableView.ClearEditItems();
              RadGridInvoiceRun.Rebind();
         }
         catch (Exception ex)
         {
             InvoiceRunError.Visible = true;
             InvoiceRunError.Text = "Rechnungslauf Fehler " + ex.Message;
             dbContext.WriteLogItem("Rechnungslauf Error " + ex.Message, LogTypes.ERROR, "Rechnungslauf");
         }
     }
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:37,代码来源:InvoiceRun.ascx.cs


示例4: 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


示例5: 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


示例6: CreateAccounts

        /// <summary>
        /// Erstelle zu der jeweiligen Rechnung ein neues Erlöskonto
        /// </summary>
        /// <param name="dbContext">DB Kontext</param>
        /// <param name="inv">Rechnungsobjekt</param>
        public static void CreateAccounts(DataClasses1DataContext dbContext, Invoice inv)
        {
            List<_Accounts> acc = null;
             acc = Accounts.generateAccountNumber(dbContext,inv.Id).ToList();

             if (acc != null && acc.Count() == inv.InvoiceItem.Count)
             {
                 foreach (var thisItems in acc)
                 {
                     var myAccount = new InvoiceItemAccountItem
                     {
                         InvoiceItemId = thisItems.InvoiceItemId,
                         RevenueAccountText = thisItems.AccountNumber
                     };
                     var contains = dbContext.InvoiceItemAccountItem.FirstOrDefault(q => q.InvoiceItemId ==
                         thisItems.InvoiceItemId && q.RevenueAccountText == thisItems.AccountNumber.Trim());
                     if (contains != null)
                     {
                         contains.RevenueAccountText = thisItems.AccountNumber.Trim();
                     }
                     else
                     {
                         dbContext.InvoiceItemAccountItem.InsertOnSubmit(myAccount);
                     }
                     dbContext.SubmitChanges();
                 }
             }
             else
             {
                 throw new Exception("Die Rechnung konnte nicht gedruckt werden, da nicht alle Dienstleistungen ein Erlöskonto haben! Sie können die Erlöskonten im Reiter 'Rechnung erstellen' zuweisen und die Rechnung erneut drucken.");
             }
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:37,代码来源:InvoiceHelper.cs


示例7: CreateAccount

 public static void CreateAccount(Guid? AccountNumber, Price _object, DataClasses1DataContext dbContext, bool withLocation = false)
 {
     if (AccountNumber != null)
        {
        IQueryable<PriceAccount> myAccount = null;
        if (withLocation == false)
        {
            myAccount = dbContext.PriceAccount.Where(q => q.PriceId == _object.Id && q.Price.LocationId == null);
        }
        else
        {
            myAccount = dbContext.PriceAccount.Where(q => q.PriceId == _object.Id && q.Price.LocationId == _object.LocationId);
        }
        if (myAccount.Count() > 0)
        {
            dbContext.PriceAccount.DeleteAllOnSubmit<PriceAccount>(myAccount);
            dbContext.SubmitChanges();
        }
        if (myAccount.Count() == 0)
        {
            var myNewAccount = new PriceAccount
            {
                PriceId = _object.Id,
                AccountId = AccountNumber.Value
            };
            dbContext.PriceAccount.InsertOnSubmit(myNewAccount);
            dbContext.SubmitChanges();
        }
        }
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:30,代码来源:PriceAccountHelper.cs


示例8: CheckDienstleistungAndAmtGebuhr

 //Checked if amt.gebühr UND mind.eine Dienstleistung vorhanden ist
 protected bool CheckDienstleistungAndAmtGebuhr(Guid orderId)
 {
     bool DienstVorhanden = false;
     bool AmtGebuhVorhanden = false;
     using (DataClasses1DataContext dbContext = new DataClasses1DataContext(new Guid(Session["CurrentUserId"].ToString())))
     {
         var searchOrderQuery = dbContext.Order.SingleOrDefault(q => q.Id == orderId);
         if (searchOrderQuery != null)
         {
             foreach (OrderItem item in searchOrderQuery.OrderItem)
             {
                 if (item.IsAuthorativeCharge == true)
                 {
                     AmtGebuhVorhanden = true;
                 }
                 else if (item.IsAuthorativeCharge == false)
                 {
                     DienstVorhanden = true;
                 }
             }
         }
     }
     if (AmtGebuhVorhanden == true && DienstVorhanden == true)
         return true;
     else
         return false;
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:28,代码来源:LieferscheinAbmeldung.ascx.cs


示例9: RadGridAllChanges_DetailTableDataBind

 protected void RadGridAllChanges_DetailTableDataBind(object source, GridNeedDataSourceEventArgs e)
 {
     DataClasses1DataContext dbContext = new DataClasses1DataContext();
     try
     {
         RadGrid sender = source as RadGrid;
         Panel item = sender.Parent as Panel;
         Label lblReferenceId = item.FindControl("lblReferenceId") as Label;
         Label lblTableName = item.FindControl("lblTableName") as Label;
         DataTable t = new DataTable();
         if (lblReferenceId.Text != string.Empty || lblTableName.Text != string.Empty)
         {
             var tableColumns = dbContext.ChangeLogColumNames.SingleOrDefault(q => q.TableName == lblTableName.Text);
             string thisSelect = "";
             if (tableColumns != null)
             {
                 string idName = tableColumns.IdColumnName;
                 foreach (var col in tableColumns.ColumnNames.Split(';'))
                 {
                     if (thisSelect == string.Empty)
                     {
                         thisSelect = "[" + col + "]";
                     }
                     else
                     {
                         thisSelect += ",[" + col + "]";
                     }
                 }
                 dbContext.Connection.Close();
                 string myQuery = "";
                 if (thisSelect != string.Empty && idName != string.Empty && lblTableName.Text != string.Empty)
                 {
                     myQuery = "select " + thisSelect + " from [" + lblTableName.Text + "] where " + idName + " ='" + lblReferenceId.Text + "'";
                     using (SqlConnection c = new SqlConnection(dbContext.Connection.ConnectionString))
                     {
                         c.Open();
                         using (SqlDataAdapter a = new SqlDataAdapter(myQuery, c))
                         {
                             a.Fill(t);
                         }
                     }
                     sender.DataSource = t;
                 }
             }
             else
             {
                 setEmptyDataSet(((RadGrid)sender));
             }
         }
         else
         {
             setEmptyDataSet(((RadGrid)sender));
         }
     }
     catch (Exception ex)
     {
         dbContext.WriteLogItem("Fehler beim generieren des ChangeLogs Details. " + ex.Message, LogTypes.ERROR);
         dbContext.SubmitChanges();
     }
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:60,代码来源:ChangeLog.aspx.cs


示例10: AllChangesLinq_Selected

 protected void AllChangesLinq_Selected(object sender, LinqDataSourceSelectEventArgs e)
 {
     DataClasses1DataContext con = new DataClasses1DataContext();
     var changes = from chang in con.ChangeLog
                   let tableName = chang.TableName
                   let status = chang.TableProperty
                   let allStates = con.OrderStatus
                   let myOrder = con.Order
                   let myOrderItem=con.OrderItem
                   let Ref = (!chang.ReferenceId.HasValue)?Guid.Empty: chang.ReferenceId.Value
                   where chang.TableName == "Order" || chang.TableName == "OrderItem"
                   select new OrderLogging
                   {
                       LogId = chang.Expr1,
                       TableName = tableName,
                       Name = chang.Name,
                       FirstName = chang.FirstName,
                       Login = chang.Login,
                       Type= tableName=="Order" ? "Auftrag":"Auftragsposition",
                       Date = chang.Date,
                       ReferenceId = (!chang.ReferenceId.HasValue)?Guid.Empty: chang.ReferenceId.Value,
                       TranslatedText = TranslatedText(status,chang.Text, allStates),
                       OrderNumber = tableName == "Order" ? myOrder.FirstOrDefault(q => q.Id == Ref).Ordernumber : myOrderItem.FirstOrDefault(q => q.Id == Ref).Order.Ordernumber
                   };
     changes = changes.OrderByDescending(q=>q.OrderNumber);
     e.Result = changes;
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:27,代码来源:OrderHistory.aspx.cs


示例11: 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


示例12: AllChangesLinq_Selected

 protected void AllChangesLinq_Selected(object sender, LinqDataSourceSelectEventArgs e)
 {
     DataClasses1DataContext con = new DataClasses1DataContext();
     var changes = from chang in con.ChangeLog orderby chang.Expr1 descending
                   select chang;
     e.Result = changes;
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:7,代码来源:ChangeLog.aspx.cs


示例13: 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


示例14: 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


示例15: GetAllCustomerDataSource_Selecting

        protected void GetAllCustomerDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            DataClasses1DataContext dbContext = new DataClasses1DataContext();

            var query = from cust in dbContext.Customer
                        select cust;
            e.Result = query;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:8,代码来源:CustomerDetails.ascx.cs


示例16: GetAllPermissionProfileDataSource_Selecting

 protected void GetAllPermissionProfileDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
 {
     DataClasses1DataContext dbContext = new DataClasses1DataContext();
     var query = from permissions in dbContext.PermissionProfile
                 where permissions.UserPermissionProfile.Any(q => q.UserId == new Guid(e.WhereParameters["Id"].ToString())) == false
                 orderby permissions.Name
                 select new { permissions.Id, permissions.Name, permissions.Description };
     e.Result = query;
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:9,代码来源:UserPermission.ascx.cs


示例17: getAllInvoiceDataSource_Selecting

 /// <summary>
 /// Gibt die Mastergrid zurück (Informationen zur allen Rechnungen)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void getAllInvoiceDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
 {
     DataClasses1DataContext dbContext = new DataClasses1DataContext();
     var query = from cust in dbContext.Customer
                 join inv in dbContext.Invoice on cust.Id equals  inv.CustomerId
                 join inn in dbContext.InvoiceNumber on inv.Id equals inn.InvoiceId
                 where inv.IsPrinted == true
                 select new
                 {
                     TableId = "Outer",
                     InvoiceNumber_ = inn.Number,
                     CustomerId=cust.Id,
                     CreateDate= inv.CreateDate,
                     Printed = (inv.IsPrinted)? "Ja": "Nein",
                     inv.PrintDate,
                     InvoiceRecipient = inv.InvoiceRecipient,
                     CustomerName = //cust.Name,
                        cust.SmallCustomer != null &&
                                 cust.SmallCustomer.Person != null ?
                                 cust.SmallCustomer.Person.FirstName + " " +
                                 cust.SmallCustomer.Person.Name : cust.Name,
                     CustomerNumber = cust.CustomerNumber,
                     DebitorNumber = cust.Debitornumber,
                     InternalAccountNumber = cust.MatchCode,
                     NettoSum = inv.NetSum,
                     Discount = inv.discount
                 };
     if (CustomerNameBox.SelectedIndex > 0)
     {
         query = query.Where(q => q.CustomerId == Int32.Parse(CustomerNameBox.SelectedValue));
     }
     if (RechnungsnummerSearchBox.Text != string.Empty && isNumber(RechnungsnummerSearchBox.Text))
     {
         query = query.Where(q => q.InvoiceNumber_ == int.Parse(RechnungsnummerSearchBox.Text));
     }
     if (DebitorennummerSearchBox.Text != string.Empty)
     {
         query = query.Where(q => q.DebitorNumber == DebitorennummerSearchBox.Text);
     }
     if (RechnungsempfaengerSearchBox.Text != string.Empty)
     {
         query = query.Where(q => q.InvoiceRecipient == RechnungsempfaengerSearchBox.Text);
     }
     if (KontonummerSearchBox.Text != string.Empty)
     {
         query = query.Where(q => q.InternalAccountNumber == KontonummerSearchBox.Text);
     }
     if (FromDateSearchBox.SelectedDate != null)
     {
         query = query.Where(q => q.CreateDate >= FromDateSearchBox.SelectedDate);
     }
     if (ToDateSearchBox.SelectedDate != null)
     {
         query = query.Where(q => q.CreateDate <= ToDateSearchBox.SelectedDate);
     }
     e.Result = query;
 }
开发者ID:HedinRakot,项目名称:KVS,代码行数:62,代码来源:ExportInvoices.ascx.cs


示例18: 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


示例19: CreateCustomers

        public static void CreateCustomers()
        {
            DataClasses1DataContext dbContext = new DataClasses1DataContext(new Guid("E6232890-B6E9-4AA4-B68C-36CF5C9A0918"));
            var allCustomers = from cat in dbContext.temp_Customers2

                                select new { cat };
            foreach (var allc in allCustomers)
            {

                var existsCustomer = dbContext.Customer.FirstOrDefault(q => q.CustomerNumber == allc.cat.Kundennummer);
                if (existsCustomer != null)
                {

                    existsCustomer.LogDBContext = dbContext;
                    existsCustomer.Name = allc.cat.Firma;
                    existsCustomer.Adress.Street = allc.cat.Strasse;
                    existsCustomer.Adress.StreetNumber = allc.cat.Hausnummer;
                    existsCustomer.Adress.Zipcode = allc.cat.Zip;
                    existsCustomer.Adress.City = allc.cat.Ort;
                    existsCustomer.Adress.Country = allc.cat.Land;
                    existsCustomer.Contact.LogDBContext = dbContext;
                    existsCustomer.Contact.Phone = allc.cat.Telefon;
                    existsCustomer.Contact.Fax = allc.cat.Telefax;
                    existsCustomer.Contact.Email = allc.cat.EMAIL;
                    existsCustomer.MatchCode = allc.cat.Matchcode;
                    existsCustomer.Debitornumber = allc.cat.Debitorenkonto;
                    Guid? myPersonId = null;
                    if ((allc.cat.Name != string.Empty || allc.cat.Vorname != string.Empty || allc.cat.Zusatz != string.Empty) && existsCustomer.LargeCustomer.PersonId == null)
                    {
                        myPersonId = Person.CreatePerson(dbContext, allc.cat.Vorname, allc.cat.Name, allc.cat.Anrede, allc.cat.Zusatz).Id;
                    }
                    else if ((allc.cat.Name != string.Empty || allc.cat.Vorname != string.Empty || allc.cat.Zusatz != string.Empty) && existsCustomer.LargeCustomer.PersonId != null)
                    {
                        existsCustomer.LargeCustomer.Person.LogDBContext= dbContext;
                        existsCustomer.LargeCustomer.Person.Title = allc.cat.Anrede;
                        existsCustomer.LargeCustomer.Person.Name = allc.cat.Name;
                        existsCustomer.LargeCustomer.Person.FirstName = allc.cat.Vorname;
                        existsCustomer.LargeCustomer.Person.Extension = allc.cat.Zusatz;
                    }
                    dbContext.SubmitChanges();

                }
                else
                {
                    Guid? myPersonId = null;
                    if (allc.cat.Name != string.Empty || allc.cat.Vorname != string.Empty || allc.cat.Zusatz != string.Empty)
                    {
                        myPersonId = Person.CreatePerson(dbContext, allc.cat.Vorname, allc.cat.Name, allc.cat.Anrede, allc.cat.Zusatz).Id;
                    }

                    LargeCustomer.CreateLargeCustomer(dbContext, allc.cat.Firma, allc.cat.Strasse, allc.cat.Hausnummer, allc.cat.Zip, allc.cat.Ort, allc.cat.Land, allc.cat.Telefon, allc.cat.Telefax, "", allc.cat.EMAIL, 0, true, false, null,
                        allc.cat.Kundennummer,
                        allc.cat.Matchcode, allc.cat.Debitorenkonto, myPersonId, new Guid("DB455FDA-46E8-432E-9251-662F91258F6B"));
                }
                //LargeCustomer.CreateLargeCustomer(dbContext, allc.cat.Name, allc.cat.Strasse, allc.cat.Hausnummer, allc.cat.Zip, allc.cat.Ort, allc.cat.Ort, allc.cat.Telefon, allc.cat.Telefax, "", allc.cat.EMAIL, 0, true, false, null, allc.cat.Kundennummer, allc.cat.Matchcode, allc.cat.Debitorenkonto);
            }
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:57,代码来源:Program.cs


示例20: CustomerLinq_Selected

        /// <summary>
        /// Datasource fuer die Kundenliste
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void CustomerLinq_Selected(object sender, LinqDataSourceSelectEventArgs e)
        {
            DataClasses1DataContext con = new DataClasses1DataContext();

            var customerQuery = from cust in con.Customer
                                where cust.Id == cust.LargeCustomer.CustomerId
                                select new { Name = cust.Name, Value = cust.Id, Matchcode = cust.MatchCode, Kundennummer = cust.CustomerNumber };
            e.Result = customerQuery;
        }
开发者ID:HedinRakot,项目名称:KVS,代码行数:14,代码来源:InvoiceRun.ascx.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# KacTalk.ktList类代码示例发布时间:2022-05-26
下一篇:
C# DBA.KuanMaiEntities类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap