本文整理汇总了C#中Dealer.UpdateDealer方法的典型用法代码示例。如果您正苦于以下问题:C# Dealer.UpdateDealer方法的具体用法?C# Dealer.UpdateDealer怎么用?C# Dealer.UpdateDealer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dealer
的用法示例。
在下文中一共展示了Dealer.UpdateDealer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Unnamed_Click1
protected void Unnamed_Click1(object sender, EventArgs e)
{
User u = new User();
string firstName = FirstName.Text;
string surname = Surname.Text;
string email = MCEmail.Text;
string contactNumber = ContactNumber.Text;
string address = PhysicalAddress.Text;
string date = default_datetimepickerss.Text;
if (String.IsNullOrEmpty(date))
{
date = "10/10/2010";
}
string[] words = date.Split('/');
words[2] = words[2].Substring(0, 4);
DateTime birthday = new DateTime(Convert.ToInt32(words[2]), Convert.ToInt32(words[0]), Convert.ToInt32(words[1]));
int cityNumber = Convert.ToInt32(CityDDL.SelectedValue) + 1;
string gender = GenderDDL.Text;
int securityRoleNumber = 1;
User updateUser = new User(usernumber, firstName, surname, email, contactNumber, address, password, securityRoleNumber, cityNumber, birthday, gender, false);
Dealer d = new Dealer();
int rowIndex = gvwStudents.SelectedIndex;
usernumber = userNumbersList[rowIndex];
foreach (Client c in ClientBindingList.MyClientList)
{
if (usernumber == c.UserNumber)
{
if (c.ClientType == "Dealer")
{
d.UpdateDealer(usernumber, 0, false);
}
c.UpdateClient(usernumber, "Client", false);
u.UpdateUser(updateUser);
}
}
}
示例2: Unnamed_Click
protected void Unnamed_Click(object sender, EventArgs e)
{
int rowIndex = gvwStudents.SelectedIndex;
usernumber = userNumbersList[rowIndex];
User u = new User();
string firstName = FirstName.Text;
string surname = Surname.Text;
string email = MCEmail.Text;
string contactNumber = ContactNumber.Text;
string address = PhysicalAddress.Text;
string date = default_datetimepickerss.Text;
if (String.IsNullOrEmpty(date))
{
date = "10/10/2010";
}
string[] words = date.Split('/');
words[2] = words[2].Substring(0, 4);
DateTime birthday = new DateTime(Convert.ToInt32(words[2]), Convert.ToInt32(words[0]), Convert.ToInt32(words[1]));
int cityNumber = Convert.ToInt32(CityDDL.SelectedIndex) + 1;
string gender = GenderDDL.Text;
Boolean active = true;
//Automatically assign as Client because a Dealer/Employee is added by a manager
int securityRoleNumber = 1;
foreach (Client c in ClientBindingList.MyClientList)
{
if (usernumber == c.UserNumber)
{
//Update Client & Dealer normal details
User updateUser = new User(usernumber, firstName, surname, email, contactNumber, address, password, securityRoleNumber, cityNumber, birthday, gender, active);
//When Client is changed into a Dealer
if (c.ClientType == "Client" && CheckBox1.Checked == true)
{
updateUser.SecurityRoleNumber = 4;
updateUser.UpdateUser(updateUser);
Dealer d = new Dealer();
bool found = false;
//If a Client used to be a dealer
foreach (Dealer inD in DealerBindingList.DealerList)
{
if (c.UserNumber == inD.UserNumber)
{
d.UpdateDealer(inD.UserNumber, Convert.ToInt32(TextBox8.Text), true);
c.UpdateClient(c.UserNumber, "Dealer", true);
found = true;
}
}
//If the client has never been a dealer
if (found == false)
{
updateUser.UpdateUser(updateUser);
d.InsertNewDealer(c.UserNumber, Convert.ToInt32(TextBox8.Text), true);
c.UpdateClient(c.UserNumber, "Dealer", true);
}
}
//When a dealer is changed back into a client
else if (c.ClientType == "Dealer" && CheckBox1.Checked == false)
{
Dealer d = new Dealer();
updateUser.UpdateUser(updateUser);
d.UpdateDealer(c.UserNumber, 0, false);
c.UpdateClient(c.UserNumber, "Client", true);
}
//changing the details associated with an existing dealer
else if (c.ClientType == "Dealer" && CheckBox1.Checked == true)
{
Dealer d = new Dealer();
updateUser.SecurityRoleNumber = 4;
updateUser.UpdateUser(updateUser);
d.UpdateDealer(c.UserNumber, Convert.ToInt32(TextBox8.Text), true);
}
//Changing the details of an existing client that has never been a dealer
else if (c.ClientType == "Client" && CheckBox1.Checked == false)
{
updateUser.UpdateUser(updateUser);
}
}
}
List<Cli> myLi = new List<Cli>();
foreach (Client inC in ClientBindingList.MyClientList)
{
userNumbersList.Add(inC.UserNumber);
Cli me = new Cli();
me.FirstName = inC.FirstName;
me.Surname = inC.Surname;
me.ContactNumber = inC.ContactNumber;
myLi.Add(me);
}
gvwStudents.DataSource = myLi;
gvwStudents.DataBind();
//.........这里部分代码省略.........