//protected void btnRegUser_Click(object sender, EventArgs e) //{ // RegServiceClient rsc = new RegServiceClient(); // string level = role.Value; // BASE_USER user = new BASE_USER(); // user.Name = name.Value; // user.Surname = surname.Value; // user.Email = email.Value; // user.Level = level; // user.Pass = password.Value; // string strResponse = rsc.RegisterUser(user); // if (strResponse.ToLower().Contains("succ")) // { // Response.Redirect("LoginPage.aspx"); // } // else // { // Response.Redirect("RegistrationPage.aspx"); // } //} protected void lnkReg_Click(object sender, EventArgs e) { RegServiceClient rsc = new RegServiceClient(); string level = role.Value; BASE_USER user = new BASE_USER(); user.Name = name.Value; user.Surname = surname.Value; user.Email = email.Value; user.Level = level; user.Pass = password.Value; int strResponse = rsc.RegisterUser(user); if (strResponse != 0) //Login Success { //Upload Image makeDirectory(Convert.ToString(strResponse)); //Upload Team Image ImageFile img = new ImageFile(); img = UploadFile(flUserImge, Convert.ToString(strResponse), "User_Image", "Users"); //Upload Event Main's Image to client directory FileClient fc = new FileClient(); string res1 = fc.saveUserImage(img); //Upload Event Main's Image to Database string number = res1; Response.Redirect("LoginPage.aspx"); } else { Response.Redirect("RegistrationPage.aspx"); } }
protected void btnRegUser_Click(object sender, EventArgs e) { RegServiceClient rsc = new RegServiceClient(); string level = txtLevel.Text; BASE_USER user = new BASE_USER(); user.Name = txtName.Text; user.Surname = txtSurname.Text; user.Email = txtEmail.Text; user.Level = txtLevel.Text; user.Pass = txtPass.Text; int strResponse = rsc.RegisterUser(user); //if(strResponse.ToLower().Contains("succ")) //{ // txtName.Text = "Success"; //}else //{ // txtName.Text = "Success"; //} }
//Uplaoding player spreadsheet string ImportData(FileUpload flInfo, int SportID) { string path = ""; string response = ""; bool isValidGuestColumn = false; int startColumn; int startRow; ExcelWorksheet PlayersSheet; int count = 0; if (flInfo.HasFile) { try { string filename = Path.GetFileName(flInfo.FileName); string serverLocation = "~/temp/" + "/" + filename; string SaveLoc = Server.MapPath(serverLocation); flInfo.SaveAs(SaveLoc); path = Server.MapPath("/") + "\\temp\\" + filename; var package = new ExcelPackage(new System.IO.FileInfo(path)); startColumn = 1; //where the file in the class excel start startRow = 2; PlayersSheet = package.Workbook.Worksheets[1]; //read sheet one isValidGuestColumn = ValidatePlayerColumns(PlayersSheet); // isValidColumn = true; } catch { response = "Failed"; return(response); } //check staff sheet object data = null; if (isValidGuestColumn == true) { do { data = PlayersSheet.Cells[startRow, startColumn].Value; //column Number if (data == null) { continue; } //read column class name object Name = PlayersSheet.Cells[startRow, startColumn].Value; object Position = PlayersSheet.Cells[startRow, startColumn + 1].Value; object Performance = PlayersSheet.Cells[startRow, startColumn + 2].Value; object Description = PlayersSheet.Cells[startRow, startColumn + 3].Value; Player player = new Player(); player.Name = Name.ToString(); player.Position = Position.ToString(); player.PerformanceRate = Convert.ToDecimal(Performance.ToString()); player.Desc = Description.ToString(); player.SportID = SportID; //import db RegServiceClient reg = new RegServiceClient(); response = reg.InsertTeamPlayer(player); if (response.Contains("succes")) { count++; } startRow++; } while (data != null); } else { response += " Failed to upload Exceel: Check columns"; } } else { response = "Failed: File not found"; } return(response); }