public static int saveDataIntblMain(tblEmployee tblEmployeeClass)
        {
            string storeProcedureName = "sp_Insert_tblMain";
            try
            {
                int rowAffected = 0;
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection = EmployeeMGRConfig.GetConnection();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = storeProcedureName;

                    cmd.Parameters.AddWithValue("@fldEmployeeID", tblEmployeeClass.fldEmployeeID);
                    cmd.Parameters.AddWithValue("@fldFirstName", tblEmployeeClass.fldFirstName);
                    cmd.Parameters.AddWithValue("@fldMiddleName",tblEmployeeClass.fldMiddleName);
                    cmd.Parameters.AddWithValue("@fldLastName", tblEmployeeClass.fldLastName);
                    cmd.Parameters.AddWithValue("@fldGender", tblEmployeeClass.fldGender);
                    cmd.Parameters.AddWithValue("@fldDob", tblEmployeeClass.fldDob);
                    cmd.Parameters.AddWithValue("@fldPhoneNo", tblEmployeeClass.fldPhoneNo);
                    cmd.Parameters.AddWithValue("@fldMobileNo", tblEmployeeClass.fldMobileNo);
                    cmd.Parameters.AddWithValue("@fldFaxNo", tblEmployeeClass.fldFaxNo);
                    cmd.Parameters.AddWithValue("@fldPersonalEmail", tblEmployeeClass.fldPersonalEmail);
                    cmd.Parameters.AddWithValue("@fldOfficialEmail",tblEmployeeClass.fldOfficialEmail);
                    cmd.Parameters.AddWithValue("@fldAddress",tblEmployeeClass.fldAddress);
                    cmd.Parameters.AddWithValue("@fldDistrict",tblEmployeeClass.fldDistrict);
                    cmd.Parameters.AddWithValue("@fldCitizenshipNo", tblEmployeeClass.fldCitizenshipNo);
                    cmd.Parameters.AddWithValue("@fldCitizenshipIssuedDate", tblEmployeeClass.fldCitizenshipIssuedDate);
                    cmd.Parameters.AddWithValue("@fldCitzenshipIssuedDistrict", tblEmployeeClass.fldCitzenshipIssuedDistrict);
                    cmd.Parameters.AddWithValue("@fldDateofJoin", tblEmployeeClass.fldDateofJoin);
                    cmd.Parameters.AddWithValue("@fldDateofPermanent",tblEmployeeClass.fldDateofPermanent);
                    cmd.Parameters.AddWithValue("@fldDateofRetirement", tblEmployeeClass.fldDateofRetirement);
                    cmd.Parameters.AddWithValue("@fldMaritalStatus", tblEmployeeClass.fldMaritalStatus);
                    cmd.Parameters.AddWithValue("@fldChildBoy", tblEmployeeClass.fldChildBoy);
                    cmd.Parameters.AddWithValue("@fldChildGirl", tblEmployeeClass.fldChildGirl);
                    cmd.Parameters.AddWithValue("@fldPpPhoto", tblEmployeeClass.fldPpPhoto);
                    cmd.Parameters.AddWithValue("@fldCitizenshipCopy", tblEmployeeClass.fldCitizenshipCopy);
                    cmd.Parameters.AddWithValue("@fldLeaveHome", tblEmployeeClass.fldLeaveHome);
                    cmd.Parameters.AddWithValue("@fldLeaveSick", tblEmployeeClass.fldLeaveSick);
                    cmd.Parameters.AddWithValue("@fldIsActive",tblEmployeeClass.fldIsActive);
                    cmd.Parameters.AddWithValue("@fldCreatedBy", tblEmployeeClass.fldCreatedBy);
                    cmd.Parameters.AddWithValue("@fldCreatedDate",tblEmployeeClass.fldCreatedDate);
                    cmd.Parameters.AddWithValue("@fldUpdatedBy",tblEmployeeClass.fldUpdatedBy);
                    cmd.Parameters.AddWithValue("@fldUpdatedDate",tblEmployeeClass.fldUpdatedDate);
                    cmd.Parameters.AddWithValue("@fldDocument",tblEmployeeClass.fldDocument);
                    cmd.Parameters.AddWithValue("@fldNote",tblEmployeeClass.fldNote);

                    rowAffected = int.Parse(cmd.ExecuteScalar().ToString());
                }
                return rowAffected;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                EmployeeMGRConfig.GetConnection().Close();
            }
        }
예제 #2
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     tblEmployee emp = new tblEmployee();
         emp.fldFirstName = txtFirstName.Text.Trim();
         emp.fldMiddleName = txtMiddleName.Text.Trim();
         emp.fldLastName = txtLastNameNepali.Text.Trim();
         emp.fldGender = GetSelectedRadioButton(rbnMale, rbnFemale, rbnOther).Text.Trim();
         emp.fldDob = Convert.ToDateTime(txtBirthDate.Text.Trim());
         emp.fldPhoneNo = txtPhone.Text.Trim();
         emp.fldMobileNo = txtMobile.Text.Trim();
         emp.fldFaxNo = txtFax.Text.Trim();
         emp.fldPersonalEmail = txtPersonalEmail.Text.Trim();
         emp.fldOfficialEmail = txtOfficialEmail.Text.Trim();
         emp.fldAddress = txtAddress.Text.Trim();
         emp.fldDistrict = txtAddress.Text.Trim();
         emp.fldCitizenshipNo = txtCitizenshipNo.Text.Trim();
         emp.fldCitizenshipIssuedDate = Convert.ToDateTime(txtCitizenshipIssuedDate.Text.Trim());
         emp.fldCitzenshipIssuedDistrict = txtCitizenshipIssuedDistrict.Text.Trim();
         emp.fldDateofJoin = Convert.ToDateTime(txtJoinDate.Text.Trim());
         emp.fldDateofPermanent = Convert.ToDateTime(txtPermanentDate.Text.Trim());
         emp.fldDateofRetirement = Convert.ToDateTime(txtRetirementDate.Text.Trim());
         emp.fldMaritalStatus = GetSelectedRadioButton(rbnMarried, rbnUnMarred).Text.Trim();
         emp.fldChildBoy = EmployeeMGRConfig.ConvertDigits(txtChildBoy.Text.Trim());
         emp.fldChildGirl = EmployeeMGRConfig.ConvertDigits(txtChildGirl.Text.Trim());
         emp.fldPpPhoto = "Test";
         emp.fldCitizenshipCopy = "Citizenship_Copy";
         emp.fldLeaveHome = float.Parse(txtLeaveHome.Text.Trim());
         emp.fldLeaveSick=float.Parse(txtSickLeave.Text.Trim());
         emp.fldIsActive=true;
         emp.fldCreatedBy=txtCreatedBy.Text.Trim();
         emp.fldCreatedDate=Convert.ToDateTime(txtCreatedDate.Text.Trim());
         emp.fldUpdatedBy=txtUpdatedBy.Text.Trim();
         emp.fldUpdatedDate=Convert.ToDateTime(txtUpdatedDate.Text.Trim());
         emp.fldDocument=txtDocument.Text.Trim();
         emp.fldNote = txtNote.Text.Trim();
     Console.WriteLine("Class Created Successfully");
 }