Exemple #1
0
    private void InsertUpdateCustomer()
    {
        try
        {
            BALUser    objBALUser    = new BALUser();
            UserEntity objUserEntity = new UserEntity();
            objUserEntity.user_master_id     = Convert.ToInt32(hfUserId.Value);
            objUserEntity.RoleId             = Convert.ToInt32(dropUserType.SelectedValue);
            objUserEntity.LocationId         = Convert.ToInt32(dropLocation.SelectedValue);
            objUserEntity.user_master_status = Convert.ToInt32(dropStatus.SelectedValue);
            //objUserEntity.IsLogin = bool.Parse(chkIsLogin.Text);
            objUserEntity.FirstName          = txtFirstName.Text;
            objUserEntity.LastName           = txtLastName.Text;
            objUserEntity.user_master_mobile = txtMobileNumber.Text;
            objUserEntity.user_master_land   = txtLandLineNumber.Text;
            objUserEntity.user_master_mail   = txtEmailId.Text;

            objUserEntity.user_master_name           = "";
            objUserEntity.user_master_desc           = "";
            objUserEntity.user_master_address        = "";
            objUserEntity.user_master_contact_person = "";
            objUserEntity.user_master_link           = "";
            if (fuUserImage.HasFile)
            {
                string str = fuUserImage.FileName;
                fuUserImage.SaveAs(Server.MapPath("/Admin/CustomerImages/" + fuUserImage.FileName));
            }
            else
            {
                labelError.Text = "Please Select Image";
                return;
            }
            objUserEntity.user_master_logo = fuUserImage.FileName;
            objUserEntity.password         = txtPassword.Text;
            objUserEntity.user_name        = txtEmailId.Text;
            objUserEntity.password         = txtConfirmPawd.Text;

            objUserEntity.user_master_created_by = Session["loginId"].ToString();


            int nResult = objBALUser.InsertUpdateUser(objUserEntity);

            if (nResult == -1)
            {
                labelError.Text = "User already Exist";
            }

            if (nResult > 0)
            {
                Response.Redirect("CustomerList.aspx", true);
            }
        }
        catch (Exception ex)
        {
        }
    }