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


C# Dealer.InsertNewDealer方法代码示例

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


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

示例1: 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();
//.........这里部分代码省略.........
开发者ID:Davidsobey,项目名称:Tweek-Performance,代码行数:101,代码来源:MaintainClientDealer.aspx.cs


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