protected void btnadd_Click(object sender, EventArgs e) { if (photo.HasFile) { //create the path to save the file string fileName = Path.Combine(Server.MapPath("~/StaffPhoto"), photo.FileName); //save the file to our local path photo.SaveAs(fileName); //AlumniImage.ImageUrl = "~/AlumniPhoto/" + PhotoUpload.FileName; strphoto = photo.FileName; } i = obj.AddStaff(txtname.Text, txtmname.Text, txtlname.Text, "~/StaffPhoto/" + strphoto, txtAddress.Text, txtcontact.Text, txtmobile.Text, txtquali.Text, "Admin", DateTime.Now.ToString()); if (i > 0) { BindGrid(); ClearFields(); lblmsg.Text = "Data Added Sucessfully"; } }
protected void BtnAdd_Click(object sender, EventArgs e) { if (Photo.HasFile) { //create the path to save the file string fileName = Path.Combine(Server.MapPath("~/StaffPhoto"), Photo.FileName); //save the file to our local path Photo.SaveAs(fileName); //AlumniImage.ImageUrl = "~/AlumniPhoto/" + PhotoUpload.FileName; strphoto = Photo.FileName; } i = obj.AddStaff(ddnsal.SelectedItem.Text, txtfname.Text, txtmname.Text, txtlname.Text, ddngender.SelectedItem.Text, txtdob.Text, txtaddress.Text, ddnstate.SelectedValue, ddncity.SelectedValue, txtpin.Text, "iNDIA", txtcontact.Text, txtmobile.Text, txtaadhar.Text, "~/StaffPhoto/" + strphoto, "General Staff", ddnshifthrs.SelectedValue, ddnstafftype.SelectedItem.Text, txtcode.Text, txtusername.Text, txtpwd.Text, "Admin", 1, DateTime.Now.ToString("dd-MM-yyyy")); if (i > 0) { dtstaffid = obj.GetCurrentStaffId(); if (dtstaffid.Rows.Count > 0) { staffid = Convert.ToInt32(dtstaffid.Rows[0]["staffId"]); io = obj.StaffJoinig(Convert.ToInt32(ddnsmtype.SelectedValue), staffid, txtrole.Text, txtdate.Text, "Available", "Admin", 1, DateTime.Now.ToString()); if (io > 0) { //BindData1(); basic = Convert.ToInt32(txtbasic.Text); ta = Convert.ToInt32(txtta.Text); da = Convert.ToInt32(txtda.Text); hra = Convert.ToInt32(txthra.Text); others = Convert.ToInt32(txtother.Text); iu = obj.StaffSalary(staffid, basic, ta, da, hra, others, Convert.ToInt32(txtactual.Text), "Admin", 1, DateTime.Now.ToString()); if (iu > 0) { lblmsg.Text = "Data Has Been Added"; //BindData2(); BindData(); Response.Redirect("AddStaffMaster.aspx"); } } } } ClearFields(); }