本文整理汇总了C#中Customers类的典型用法代码示例。如果您正苦于以下问题:C# Customers类的具体用法?C# Customers怎么用?C# Customers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Customers类属于命名空间,在下文中一共展示了Customers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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);
}
示例3: DeleteCustomer
public void DeleteCustomer(Customers cus)
{
Customers customer = db.Customers.Find(cus.CustomerID);
db.Customers.Remove(customer);
db.SaveChanges();
}
示例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));
}
}
}
示例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);
}
示例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;
}
示例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);
}
示例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");
}
}
}
示例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"]
});
}
}
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
示例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");
}
}
示例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();
}
示例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
}