Пример #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);
            }
        }
        protected void CreateStudent(object sender, EventArgs e)
        {
            int addressId = 0;

            if (txtStudentName != null && txtMotherName != null && txtFatherName != null && txtAge != null &&
                ddlGender != null && ddlClassInAddStudent != null && ddlSectionInAddStudent != null &&
                ddlMediumInAddStudent != null && ddlCastInAddStudent != null && txtAddressLineOne != null &&
                txtVillage != null && txtDistrict != null && txtPincode != null)
            {
                if (!String.IsNullOrEmpty(txtStudentName.Text.Trim()) && !String.IsNullOrEmpty(txtMotherName.Text.Trim()) && !String.IsNullOrEmpty(txtAge.Text.Trim()) &&
                    !String.IsNullOrEmpty(txtFatherName.Text.Trim()) && !String.IsNullOrEmpty(txtAddressLineOne.Text.Trim()) &&
                    !String.IsNullOrEmpty(txtVillage.Text.Trim()) && !String.IsNullOrEmpty(txtDistrict.Text.Trim()) &&
                    !String.IsNullOrEmpty(txtPincode.Text.Trim()))
                {
                    var address = PageDataService.AddAddressByAdoNet(txtAddressLineOne.Text, txtVillage.Text, txtDistrict.Text,
                                                                     txtPincode.Text);
                    if (address != null)
                    {
                        addressId = address.AddressId;
                    }
                    if (addressId != 0)
                    {
                        PageDataService.AddStudentAdoNet(txtStudentName.Text.Trim(), txtMotherName.Text.Trim(),
                                                         txtFatherName.Text.Trim(), Convert.ToInt32(txtAge.Text.Trim()),
                                                         ddlGender.SelectedValue,
                                                         Convert.ToInt32(ddlClassInAddStudent.SelectedValue),
                                                         Convert.ToInt32(ddlSectionInAddStudent.SelectedValue),
                                                         Convert.ToInt32(ddlCastInAddStudent.SelectedValue),
                                                         Convert.ToInt32(ddlMediumInAddStudent.SelectedValue), addressId);
                    }
                }
            }
            Response.Redirect(Request.RawUrl, false);
        }