本文整理汇总了C#中Customers类的典型用法代码示例。如果您正苦于以下问题:C# Customers类的具体用法?C# Customers怎么用?C# Customers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Customers类属于命名空间,在下文中一共展示了Customers类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: loadGridView
/// <summary>
/// Method which loads the gridview with all the Customers.
/// </summary>
protected void loadGridView()
{
Customers customer = new Customers();
GridView1.DataSource = customer.getAllCustomers();
GridView1.DataBind();
}
开发者ID:efigarolam,项目名称:Snackthat,代码行数:10,代码来源:viewallcustomers.aspx.cs
示例2: FindCustomersTestBlankString
public void FindCustomersTestBlankString()
{
Customers target = new Customers
{new Customer()
{ CustomerId = 1,
FirstName="Rosie",
LastName = "Cotton",
EmailAddress = "[email protected]"},
new Customer()
{ CustomerId = 2,
FirstName="Bilbo",
LastName = "Baggins",
EmailAddress = "[email protected]"},
new Customer()
{ CustomerId = 3,
FirstName="Frodo",
LastName = "Baggins",
EmailAddress = "[email protected]"}};
string customerName = " ";
List<Customer> expected = null;
List<Customer> actual;
actual = target.FindCustomers(customerName);
Assert.AreEqual(expected, actual);
}
开发者ID:fredatgithub,项目名称:VS-AcmeCustomerManagement,代码行数:26,代码来源:CustomersTest.cs
示例3: DeleteCustomer
public void DeleteCustomer(Customers cus)
{
Customers customer = db.Customers.Find(cus.CustomerID);
db.Customers.Remove(customer);
db.SaveChanges();
}
开发者ID:CemreAkyel,项目名称:AjaxStudy,代码行数:7,代码来源:HomeController.cs
示例4: AuthorizeOrder
public static void AuthorizeOrder(dynamic customer, dynamic order) {
dynamic itemTable = new OrderItems();
dynamic productionsTable = new Productions();
dynamic customersTable = new Customers();
//loop the items and set auth accordingly
foreach (var item in itemTable.Find(OrderID:order.ID)) {
if (item.SKU == "monthly") {
//bump the customer's streaming
if (customer.StreamUntil < DateTime.Today.AddMonths(-1))
customer.StreamUntil = DateTime.Today.AddMonths(-1);
customer.StreamUntil = customer.StreamUntil.AddMonths(1);
customersTable.Update(customer,customer.ID);
} else if (item.SKU == "yearly") {
if (customer.StreamUntil < DateTime.Today.AddYears(-1))
customer.StreamUntil = DateTime.Today.AddYears(-1);
if (customer.DownloadUntil < DateTime.Today.AddYears(-1))
customer.DownloadUntil = DateTime.Today.AddYears(-1);
customer.StreamUntil = customer.StreamUntil.AddYears(1);
customer.DownloadUntil = customer.DownloadUntil.AddYears(1);
customersTable.Update(customer,customer.ID);
} else {
Authorize(customer, productionsTable.First(Slug: item.SKU));
}
}
}
开发者ID:kodoroph,项目名称:mvc3,代码行数:28,代码来源:DigitalRights.cs
示例5: loadCustomers
/// <summary>
/// Loads all the Customers and its Addresses on the gridview
/// </summary>
protected void loadCustomers(int idRoute)
{
Customers customers = new Customers();
DataTable dt;
dt = customers.getCustomersAndAddressesToEdit(idRoute);
if (dt != null && dt.Rows.Count > 0)
{
showCustomers = true;
GridView1.DataSource = dt;
GridView1.DataBind();
}
else
{
showCustomers = false;
}
DataTable addressesByRoute;
addressesByRoute = customers.getCustomersAndAddressesByRoute(idRoute);
for (int i = 0; i < addressesByRoute.Rows.Count; i++)
{
this.idAddressesByRoute.Add(addressesByRoute.Rows[i].ItemArray[0].ToString());
}
this.setDataToScript(this.idAddressesByRoute);
}
开发者ID:efigarolam,项目名称:Snackthat,代码行数:29,代码来源:editroute.aspx.cs
示例6: CustomerEdit
/// <summary>
/// 此方法用于修改客户信息
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static bool CustomerEdit(Customers obj)
{
List<SqlParameter> list = new List<SqlParameter>
{
new SqlParameter("@CusAddress",obj.CusAddress),
new SqlParameter("@CusZip",obj.CusZip),
new SqlParameter("@CusFax",obj.CusFax),
new SqlParameter("@CusWebsite",obj.CusWebsite),
new SqlParameter("@CusLicenceNo",obj.CusLicenceNo),
new SqlParameter("@CusChieftain",obj.CusChieftain),
new SqlParameter("@CusBankroll",obj.CusBankroll),
new SqlParameter("@CusTurnover",obj.CusTurnover),
new SqlParameter("@CusBank",obj.CusBank),
new SqlParameter("@CusBankNo",obj.CusBankNo),
new SqlParameter("@CusLocalTaxNo",obj.CusLocalTaxNo),
new SqlParameter("@CusNationalTaxNo",obj.CusNationalTaxNo),
new SqlParameter("@CusID",obj.CusID)
};
string sql = @"update Customers set
[email protected] ,
[email protected] ,
[email protected] ,
[email protected] ,
[email protected] ,
[email protected] ,
[email protected] ,
[email protected] ,
[email protected] ,
[email protected] ,
[email protected]usLocalTaxNo ,
[email protected]
where [email protected] ";
return DBHelp.ExecuteCUD(sql, list) > 0;
}
开发者ID:BensterS,项目名称:CRM,代码行数:39,代码来源:CustomersDAL.cs
示例7: PostCustomers
public IHttpActionResult PostCustomers(Customers customers)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
db.Customers.Add(customers);
try
{
db.SaveChanges();
}
catch (DbUpdateException)
{
if (CustomersExists(customers.CustomerID))
{
return Conflict();
}
else
{
throw;
}
}
return CreatedAtRoute("DefaultApi", new { id = customers.CustomerID }, customers);
}
开发者ID:optimized4u,项目名称:WebAPICRUD,代码行数:27,代码来源:CustomerController.cs
示例8: btnConfirm_Click
protected void btnConfirm_Click(object sender, EventArgs e)
{
if (!chkUser.Checked)
{
Response.Write("<script LANGUAGE='JavaScript' >alert('You should accpet our license to register in our website!')</script>");
}
else
{
if (this.IsValid && this.IsPostBack)
{
Customers customer = new Customers();
customer.Email = txtEmail.Text;
customer.Name = txtName.Text;
customer.PassWord = txtPassWord2.Text;
customer.Address = txtAddress.Text;
customer.CardNo = txtCardNo.Text;
customer.CardName = txtCardName.Text;
customer.PhoneNumber = txtPhoneNumber.Text;
customer.ExpireDate = txtExpireDate.Text;
customer.Spent = "0";
CustomersDB.InsertCustomer(customer);
Application["AccountEmail"] = txtEmail.Text;
Session["AccountEmail"] = txtEmail.Text;
Response.Redirect("AccountPage.aspx");
}
}
}
开发者ID:Chengxuan,项目名称:ClothStore,代码行数:28,代码来源:Register.aspx.cs
示例9: GetCustomersByState
public List<Customers> GetCustomersByState(string state)
{
using (var conn = new SqlConnection(_connectionString))
{
conn.Open();
var cmd = new SqlCommand(@"
Select * from Customers Where State = @state
",conn);
cmd.Parameters.Add("@state",SqlDbType.NVarChar, 50).Value = state;
using (var rd = cmd.ExecuteReader())
{
while(rd.Read())
{
var c = new Customers {
CustomerID = (int)rd["CustomerID"],
FirstName = (string)rd["FirstName"],
LastName = (string)rd["LastName"],
Address = (string)rd["Address"]
});
}
}
}
}
开发者ID:JEAlcala,项目名称:EpicU_Coding,代码行数:25,代码来源:OrderService.cs
示例10: GetCustomers
public static List<Customers> GetCustomers()
{
List<Customers> cumstomerList = new System.Collections.Generic.List<Customers>();
SqlConnection con = new SqlConnection(GetConnectionString());
string sel = "SELECT Email,Name,PassWord,Address,CardNo,CardName,Spent,PhoneNumber,ExpireDate " +
"FROM Customers ORDER BY Email";
SqlCommand cmd = new SqlCommand(sel, con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
Customers customer;
while (dr.Read())
{
customer = new Customers();
customer.Email = dr["Email"].ToString();
customer.Name = dr["Name"].ToString();
customer.PassWord = dr["PassWord"].ToString();
customer.Address = dr["Address"].ToString();
customer.CardNo = dr["CardNo"].ToString();
customer.CardName = dr["CardName"].ToString();
customer.Spent = dr["Spent"].ToString();
customer.PhoneNumber = dr["PhoneNumber"].ToString();
customer.ExpireDate = dr["ExpireDate"].ToString();
cumstomerList.Add(customer);
}
dr.Close();
return cumstomerList;
}
开发者ID:Chengxuan,项目名称:ClothStore,代码行数:27,代码来源:CustomersDB.cs
示例11: ChckCustId
protected void ChckCustId()
{
string cust_id = Request.QueryString["cust_id"];
if (cust_id != null)
{
Customers ChckCust = new Customers();
bool result = ChckCust.ChckCustById(Convert.ToInt32(cust_id));
bool CustNb = ChckCust.ChckCustNetBankingById(Convert.ToInt32(cust_id));
if (result != false)
{
if (CustNb != false)
{
Panel2.Visible = true;
Panel1.Visible = false;
NetBanking NBCustDataById = NetBanking.NBData_ByCustId(Convert.ToInt32(cust_id));
if (NBCustDataById.NB_Status == "1")
{
ButtonAllowNB.Visible = false;
}
}
else
{
Panel1.Visible = true;
}
}
else
{
Panel1.Visible = true;
}
}
}
开发者ID:rkchauhan,项目名称:Net-Banking-in-DotNet-LW,代码行数:34,代码来源:net_banking.aspx.cs
示例12: Save
public Customers Save(Customers entity)
{
if(entity.Id==0)
{
var ret = this.context.Customers.Add(entity);
this.context.SaveChanges();
return ret;
}else
{
Customers data = GetById(entity.Id);
data.CustomerCode = entity.CustomerCode;
data.CompanyName = entity.CompanyName;
data.ContactName = entity.ContactName;
data.ContactTitle = entity.ContactTitle;
data.Address = entity.Address;
data.CountryID = entity.CountryID;
data.CityID = entity.CityID;
data.RegionID = entity.RegionID;
data.PostalCode = entity.PostalCode;
data.Phone = entity.Phone;
data.Fax = entity.Fax;
data.UpdateBy = entity.UpdateBy;
data.UpdateDate = DateTime.Now;
data.DemoGraphics = entity.DemoGraphics;
this.context.SaveChanges();
return data;
}
}
开发者ID:anawatj,项目名称:Northwind_net,代码行数:31,代码来源:CustomersRepository.cs
示例13: Page_Load
/// <summary>
/// Loads the page and analizes the QueryString to catch de GET vars.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (Request.QueryString.Get("id") != null)
{
int idRoute = Convert.ToInt16(Request.QueryString.Get("id"));
Routes route = new Routes();
DataTable dt;
dt = route.getRouteByID(idRoute);
if (dt != null && dt.Columns[0].Caption == "Router_Dont_Exists")
{
Response.Redirect(webURL + "views/routes/viewallroutes.aspx");
}
else if (dt.Rows.Count == 1)
{
this.routeid = dt.Rows[0].ItemArray[0].ToString();
this.name = dt.Rows[0].ItemArray[1].ToString();
DetailsView1.DataSource = dt;
DetailsView1.DataBind();
if (DetailsView1.Rows[2].Cells[1].Text == " ")
{
DetailsView1.Rows[2].Cells[1].Text = "<a href=\"" + webURL + "views/routes/assignroutes.aspx\">Asignar</a>";
}
Customers customers = new Customers();
dt = customers.getCustomersAndAddressesByRoute(Convert.ToInt16(this.routeid));
if (dt != null && dt.Rows.Count > 0 )
{
showCustomers = true;
GridView1.DataSource = dt;
GridView1.DataBind();
}
else
{
showCustomers = false;
}
}
else
{
Response.Redirect(webURL + "views/routes/viewallroutes.aspx");
}
}
else
{
Response.Redirect(webURL + "views/routes/viewallroutes.aspx");
}
}
catch (Exception ex)
{
Response.Redirect(webURL + "views/routes/viewallroutes.aspx");
}
}
开发者ID:efigarolam,项目名称:Snackthat,代码行数:65,代码来源:viewroute.aspx.cs
示例14: Main
static void Main(string[] args)
{
// ---------- STRUCTS ----------
Customers bob = new Customers();
bob.createCust("Bob", 15.50, 12345);
bob.showCust();
Console.WriteLine("Press Enter to terminate...");
Console.Read();
}
开发者ID:JohnCDunn,项目名称:Course-Work-TTA,代码行数:11,代码来源:Structs.cs
示例15: Main
static void Main(string[] args)
{
// ---------- STRUCTS ----------
Customers bob = new Customers();
bob.createCust("Bob", 15.50, 12345);
bob.showCust();
//-See more at: http://www.newthinktank.com/2015/07/learn-c-one-video/#sthash.aY8Gro6z.dpuf
}
开发者ID:rebeccapizano,项目名称:Coursework,代码行数:12,代码来源:Structs.cs
示例16: SetUp
public void SetUp()
{
validRequest = new Customers {
Id = 1,
FirstName = "FirstName",
LastName = "LastName",
Address = "12345 Address St, New York",
Company = "Company",
Discount = 10,
HasDiscount = true,
Postcode = "11215",
};
}
开发者ID:tystol,项目名称:ServiceStack,代码行数:13,代码来源:CustomerServiceValidationTests.cs
示例17: cuvEmail_ServerValidate
protected void cuvEmail_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = true;
List<Customers> customerList = CustomersDB.GetCustomers();
Customers customer = new Customers();
foreach (Customers cus in customerList)
{
if (txtEmail.Text == cus.Email)
{
args.IsValid = false;
}
}
}
开发者ID:Chengxuan,项目名称:ClothStore,代码行数:13,代码来源:Register.aspx.cs
示例18: FindCustomersTestValidString
public void FindCustomersTestValidString()
{
var target = new Customers
{new Customer()
{ CustomerId = 1,
FirstName="Rosie",
LastName = "Cotton",
EmailAddress = "[email protected]"},
new Customer()
{ CustomerId = 2,
FirstName="Bilbo",
LastName = "Baggins",
EmailAddress = "[email protected]"},
new Customer()
{ CustomerId = 3,
FirstName="Frodo",
LastName = "Baggins",
EmailAddress = "[email protected]"}};
string searchString = "agg";
List<Customer> expected = new List<Customer>
{new Customer()
{ CustomerId = 2,
FirstName="Bilbo",
LastName = "Baggins",
EmailAddress = "[email protected]"},
new Customer()
{ CustomerId = 3,
FirstName="Frodo",
LastName = "Baggins",
EmailAddress = "[email protected]"}};
List<Customer> actual;
actual = target.FindCustomers(searchString);
TestContext.WriteLine(searchString);
Debug.WriteLine("Using Debug: " + searchString);
Assert.AreEqual(expected.Count, actual.Count);
foreach (Customer item in actual)
{
TestContext.WriteLine(item.ToString());
// Find the item in the expected list
Customer expectedItem = expected.FirstOrDefault(c => c.CustomerId == item.CustomerId);
Assert.AreEqual(expectedItem.LastName, item.LastName);
Assert.AreEqual(expectedItem.FirstName, item.FirstName);
Assert.AreEqual(expectedItem.EmailAddress, item.EmailAddress);
}
}
开发者ID:BarryBurke,项目名称:VS2015-AcmeCustomerManagement,代码行数:51,代码来源:CustomersTest.cs
示例19: ButtonSubmit_Click
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
int CustID = Convert.ToInt32(TextBoxCustId.Text);
Customers ChckCustID = new Customers();
bool ChckCust = ChckCustID.ChckCustById(CustID);
bool ChckCustNB = ChckCustID.ChckCustNetBankingById(CustID);
if(ChckCust != true)
{
LabelError.Text = "You enter wrong customer ID.";
}
else if (ChckCustNB != false)
{
LabelError.Text = "You already apply for it.";
}
else if (TextBoxPass.Text.Length < 6)
{
LabelError.Text = "Your password must be at least 6 characters.";
}
else if (TextBoxPass.Text != TextBoxConfirmPass.Text)
{
LabelError.Text = "Your confirm password did not match.";
}
else
{
Connection con = new Connection();
string strConnString = con.GetConnString();
using (SqlConnection SqlCon = new SqlConnection(strConnString))
{
SqlCommand SqlComm = new SqlCommand("", SqlCon);
SqlCon.Open();
string ReqDate = DateTime.Now.ToString();
string Status = "0";
string query = string.Format("INSERT INTO net_banking(nb_cid, nb_pass, nb_date, nb_status) VALUES('" + CustID + "', '" + TextBoxPass.Text + "', '" + ReqDate + "', '" + Status + "')");
SqlComm.CommandText = query;
SqlComm.ExecuteNonQuery();
/*string SetStatus = string.Format("UPDATE cust_details SET c_net_banking='1' WHERE c_id='" + CustID + "'");
SqlComm.CommandText = SetStatus;
SqlComm.ExecuteNonQuery();*/
}
Panel1.Visible = false;
Panel2.Visible = true;
}
}
开发者ID:rkchauhan,项目名称:Net-Banking-in-DotNet-LW,代码行数:49,代码来源:aply_netbanking.aspx.cs
示例20: Can_Get_Customers_By_State
public void Can_Get_Customers_By_State()
{
//new repository
ICustomerRepository customers = new Customers();
//a state that *is* NY
var ny = new State("New York", "ny");
//an address in NY
var nyAddress = new Address("1", "Main Street", "New York", ny, "12345");
//a state *not* NY
var notNy = new State("New Jersey", "nj");
//an address *not* in NY
var notNyAddress = new Address("1", "Main Street", "Trenton", notNy, "12345");
//a customer not in NY
var notNyCustomer1 = new Customer();
notNyCustomer1.ChangeAddress(notNyAddress);
//a customer in NY
var nyCustomer1 = new Customer();
nyCustomer1.ChangeAddress(nyAddress);
//another customer in NY
var nyCustomer2 = new Customer();
nyCustomer2.ChangeAddress(nyAddress);
//still one more customer in NY
var nyCustomer3 = new Customer();
nyCustomer3.ChangeAddress(nyAddress);
//add all the customers to the repository
customers.AddCustomer(nyCustomer1);
customers.AddCustomer(nyCustomer2);
customers.AddCustomer(nyCustomer3);
customers.AddCustomer(notNyCustomer1);
//select customers from the state that is NY
var results = customers.FromState(ny);
Assert.That(results, Has.Member(nyCustomer1));
Assert.That(results, Has.Member(nyCustomer2));
Assert.That(results, Has.Member(nyCustomer3));
Assert.That(results.Count(), Is.EqualTo(3));
Assert.That(results, Has.No.Member(notNyCustomer1));
}
开发者ID:owaisfas,项目名称:talks,代码行数:49,代码来源:CustomerRepositoryTests.cs
注:本文中的Customers类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论