Пример #1
0
        protected void CreateUser(object sender, EventArgs e)
        {
            int addressId = 0;

            if (!string.IsNullOrEmpty(txtAddressLineOne.Text) && !string.IsNullOrEmpty(txtDistrict.Text) && !string.IsNullOrEmpty(txtPincode.Text) &&
                !string.IsNullOrEmpty(txtVillage.Text))
            {
                var address = PageDataService.AddAddressByAdoNet(txtAddressLineOne.Text, txtVillage.Text, txtDistrict.Text,
                                                                 txtPincode.Text);
                if (address != null)
                {
                    addressId = address.AddressId;
                }
            }

            if (!string.IsNullOrEmpty(txtUserName.Text) && !string.IsNullOrEmpty(txtUserEmail.Text) && !string.IsNullOrEmpty(txtUserPassword.Text) &&
                addressId != 0)
            {
                var user = PageDataService.AddUserAdoNet(txtUserName.Text, txtUserEmail.Text, txtUserPassword.Text,
                                                         Convert.ToDateTime(wdcEffectiveDate.Text),
                                                         Convert.ToDateTime(wdcExpirationDate.Text), addressId);
                if (user != null)
                {
                    foreach (ListItem item in chklstGroup.Items)
                    {
                        if (item.Selected)
                        {
                            PageDataService.AddUserGroupAssociationByEntityFrameWork(Convert.ToInt32(item.Value), user.UserId);
                        }
                    }
                }
                Response.Redirect(Request.RawUrl, false);
            }
        }