示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ClubDBEntities club = new ClubDBEntities();

            long?id = null;
            int? i  = null;

            Client client = new Client()
            {
                FirstName    = tbFirstName.Text,
                SecondName   = tbSecondName.Text,
                LastName     = tbLastName.Text,
                FamilyName   = tbFamilyName.Text,
                DOB          = string.IsNullOrEmpty(tbDOB.Text) ? i : Convert.ToInt32(tbDOB.Text),
                Nationality  = tbNation.Text,
                IDNumber     = string.IsNullOrEmpty(tbID.Text) ? id : Convert.ToInt64(tbID.Text),
                Phone        = string.IsNullOrEmpty(tbPhone.Text) ? id : Convert.ToInt64(tbPhone.Text),
                Marital      = rbMarital.SelectedValue,
                RefferedFrom = tbRefferedFrom.Text,
                RefferedDate = DateTime.Now.Date,
                Status       = Status.Inactive.toString()
            };

            club.AddToClients(client);
            club.SaveChanges();
            //string Message = " تمت اضافة العضوة  ";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", string.Format("alert('{0}');", Message), true);

            Response.Redirect("Invoice.aspx?New=" + client.ClientID);
        }