Example #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            tblMain mainClass = new tblMain();
            mainClass.fldTypeID = 3;
            mainClass.fldLocation = ddlMunicipality.SelectedItem.Text.Trim();
            mainClass.fldSerialNo = txtFormSerialNo.Text.Trim();
            mainClass.fldFormNo = int.Parse(txtFormNp.Text.Trim());
            mainClass.fldFormFillPlace = txtFomFillPlace.Text.Trim();
            mainClass.fldFormFillDate = DateTime.Parse(txtDateFormFill.Value.Trim());
            mainClass.fldFormAgree = Convert.ToBoolean(int.Parse(rblFormAgree.SelectedValue));
            mainClass.fldAnswererName = txtAnswererName.Text.Trim();
            mainClass.fldAnsContactNo = txtAnsContactNo.Text.Trim();
            mainClass.fldMainName = txtMainFullName.Text.Trim();
            mainClass.fldMainProfessionID = int.Parse(ddlMainProfession.SelectedValue);
            mainClass.fldMainCastID = int.Parse(ddlMainCast.SelectedValue);
            mainClass.fldMainReligionID = int.Parse(ddlMainReligion.SelectedValue);
            mainClass.fldMainStayTypeID = int.Parse(ddlHabitantStatus.SelectedValue);
            mainClass.fldMainMenNo = int.Parse(txtMainFamilyMenNo.Text.Trim());
            mainClass.fldMainWomenNo = int.Parse(txtMainFamilyWomenNo.Text.Trim());
            mainClass.fldMainBoysNo = int.Parse(txtMainFamilyBoysNo.Text.Trim());
            mainClass.fldMainGirlsNo = int.Parse(txtMainFamilyGirlsNo.Text.Trim());
            mainClass.fldMainFamilyTotal = mainClass.fldMainMenNo + mainClass.fldMainWomenNo + mainClass.fldMainGirlsNo + mainClass.fldMainBoysNo;
            mainClass.fldMainEducation = txtMainEducation.Text.Trim();
            mainClass.fldSurveyerName = txtSurveyerName.Text.Trim();
            mainClass.fldSubmitDate = DateTime.Parse(txtFormSubmitDate.Value.Trim());
            mainClass.fldSurveyerNote = txtSurveyerNote.Text.Trim();
            mainClass.fldMainNote = txtMainNote.Text.Trim();
            mainClass.fldNote = "";
            mainClass.fldWorkPlace = "";

            tblAddress addPermanent = new tblAddress();
            addPermanent.fldAddType = "स्थायी";
            addPermanent.fldDistrict = int.Parse(ddlPermanentDistrict.SelectedValue);
            addPermanent.fldVillage = Convert.ToBoolean(int.Parse(rblPermanentVillage.SelectedValue));
            addPermanent.fldVMName = ddlPermanentMunorVdc.SelectedItem.Text.ToString();
            addPermanent.fldWardNo = int.Parse(txtPermanentWardNo.Text.Trim());
            addPermanent.fldTole = txtPermanentTole.Text.Trim();
            addPermanent.fldHouseNo = txtPermanentHouseNo.Text.Trim();
            addPermanent.fldAddNote = txtPermanentNote.Text.Trim();
            addPermanent.fldContactNo = "";

            tblAddress addTemp = new tblAddress();
            addTemp.fldAddType = "अस्थायी";
            addTemp.fldDistrict = int.Parse(ddlTempDistrict.SelectedValue);
            addTemp.fldVillage = Convert.ToBoolean(int.Parse(rblTempVillage.SelectedValue));
            addTemp.fldVMName = ddlTempMunOrVdc.SelectedItem.Text.ToString();
            addTemp.fldWardNo = int.Parse(txtTempWardNo.Text.Trim());
            addTemp.fldTole = txtTempTole.Text.Trim();
            addTemp.fldHouseNo = txtTempHouseNo.Text.Trim();
            addTemp.fldAddNote = txtTempNote.Text.Trim();
            addTemp.fldContactNo = "";

            tblKnowledge knowledgeClass = new tblKnowledge();
            knowledgeClass.fldChildRight = Convert.ToBoolean(int.Parse(rblKnowChildRight.SelectedValue));
            knowledgeClass.fldChildRightDesc = txtWhatIsChildRight.Text.Trim();
            knowledgeClass.fldNoWorkBelow14 = Convert.ToBoolean(int.Parse(ddlNoChildLaborBelow14.SelectedValue));
            knowledgeClass.fldAgreeNoWorkBelow14 = Convert.ToBoolean(int.Parse(ddlViewAboutNoChildLaborBelow14.SelectedValue));
            knowledgeClass.fldNoWorkBelow14Desc = txtViewAboutNoChildLaborBelow14.Text.Trim();
            knowledgeClass.fldChildLabourRisk = Convert.ToBoolean(int.Parse(ddlKnowThreeEffectsOfChildLabor.SelectedValue));
            knowledgeClass.fldNoChildLabourDesc = "";
            knowledgeClass.fldKnowChildAbuse = Convert.ToBoolean(int.Parse(ddlKnowChildAbuse.SelectedValue));
            //Only for Form A
            knowledgeClass.fldKnowAdultAvailable = false;
            knowledgeClass.fldUseAdultNotChild = false;
            knowledgeClass.fldUseAdultNotChildDesc = "";

            tblChildLabour childLabourClass = new tblChildLabour();
            childLabourClass.fldChildName = "";
            childLabourClass.fldChildGenderID = 1;
            childLabourClass.fldChildBirthDate = DateTime.Parse("1/1/2070");
            childLabourClass.fldChildAge = 0;
            childLabourClass.fldChildCastID = 1;
            childLabourClass.fldChildReligionID = 1;
            childLabourClass.fldChildHealth = "";
            childLabourClass.fldChildBirthReg = false;
            childLabourClass.fldChildStayTypeID = 1;
            childLabourClass.fldChildAdditionalIncome = "";

            tblChildLabourDetails childLabourDetailClass = new tblChildLabourDetails();
            childLabourDetailClass.fldChildStudyStateID = int.Parse(ddlDoesChildStudy.SelectedValue);
            childLabourDetailClass.fldChildStudyTypeID = int.Parse(ddlStudyType.SelectedValue);
            childLabourDetailClass.fldChildSchool = txtSchoolOrCenterNameAndClass.Text.Trim();
            childLabourDetailClass.fldChildSchoolGrade = int.Parse(txtSchoolOrCenterClass.Text.Trim());
            childLabourDetailClass.fldChildSchoolExpenseID = int.Parse(ddlWhoPaysEducation.SelectedValue);
            childLabourDetailClass.fldChildLeaveSchoolGrade = int.Parse(txtAtWhatClassSchoolLeft.Text.Trim());
            childLabourDetailClass.fldChildLeaveSchoolDesc = txtWhySchoolLeft.Text.Trim();
            childLabourDetailClass.fldChildTraining = Convert.ToBoolean(int.Parse(ddlWantVocationalTraining.SelectedValue));
            childLabourDetailClass.fldChildTrainingPlace = txtWhereVocationalTraining.Text.Trim();

            childLabourDetailClass.fldChildTrainingStay = txtWhereToStayDuringVocationalTraining.Text.Trim();
            childLabourDetailClass.fldChildInterestedArea = txtWhatWantToDo.Text.Trim();
            childLabourDetailClass.fldChildStudyContinue = Convert.ToBoolean(int.Parse(ddlWantContinuation.SelectedValue));
            childLabourDetailClass.fldChildStudyHelpSelf = txtHelpYourself.Text.Trim();
            childLabourDetailClass.fldChildStudyHelpFamily = txtHelpFamily.Text.Trim();
            childLabourDetailClass.fldChildStudyHelpOther = txtHelpOther.Text.Trim();

            tblChildWorkState childWorkClass = new tblChildWorkState();

            childWorkClass.fldWorkStartTime = float.Parse(txtYearWasChildInLabor.Text.Trim()) + float.Parse(txtMonthWasChildInLabor.Text.Trim()) / 12;
            //From 3 8.1
            childWorkClass.fldWorkPlaceKnow = Convert.ToBoolean(int.Parse(ddlWasChildInLabor.SelectedValue));
            childWorkClass.fldWorkContactTypeID = 1;
            //From 3 8.1
            childWorkClass.fldWorkContact = false;
            childWorkClass.fldWorkTimePerDay = 0;
            childWorkClass.fldWorkTimeDay = 0;
            childWorkClass.fldWorkTimeEvening = 0;
            childWorkClass.fldWorkDesc = txtFreeChildLaborRegion.Text.Trim();
            //Form 3 , FreeChild txtFreeChildLaborRegion
            //childWorkClass.fldWorkPayAmonunt = 0;
            childWorkClass.fldWorkPayTypeID = 1;
            childWorkClass.fldWorkPayReceiverID = 1;
            //Form 9.1
            childWorkClass.fldWorkHoliday = Convert.ToBoolean(int.Parse(ddlFreeChildLaborRegion.SelectedValue));
            childWorkClass.fldWorkHolidayID = 1;

            //From 3 your role in free child labour region
            childWorkClass.fldWorkPayReceiverName = txtYourRoleInFreeChildLaborRegion.Text.Trim();

            //tblMainFamilyBehaviour mainFamilyBehaviourClass = new tblMainFamilyBehaviour();
            //mainFamilyBehaviourClass.fldLoveMost = 1;

            //mainFamilyBehaviourClass.fldLoveWay = "";
            //mainFamilyBehaviourClass.fldAbuse = false;
            //mainFamilyBehaviourClass.fldAbusePerson = 1;
            //string strHateway = "";

            //mainFamilyBehaviourClass.fldAbuseType = strHateway;
            //mainFamilyBehaviourClass.fldAbuseReport = false;
            //mainFamilyBehaviourClass.fldAbuseReportDesc = "";
            //mainFamilyBehaviourClass.fldFoodStatus = false;
            //mainFamilyBehaviourClass.fldSleepStatus = false;
            //mainFamilyBehaviourClass.fldStayStatus = false;
            //mainFamilyBehaviourClass.fldEntertainmentStatus = false;
            //mainFamilyBehaviourClass.fldSecuritySeperateRoom = false;
            //mainFamilyBehaviourClass.fldSecurityDesc = "";
            //mainFamilyBehaviourClass.fldHealthStatusID = 1;
            //mainFamilyBehaviourClass.fldCertificate = false;
            ////mainFamilyBehaviourClass.fldFuturePlan = txtFuturePlan.Text.Trim();

            ////Form 3 बालकश्रम मुक्त घोषण गर्न उपयुक्त ८.१
            //mainFamilyBehaviourClass.fldPlanReturnHome = Convert.ToBoolean(int.Parse(ddlFreeChildLaborRegion.SelectedValue));
            ////string futurePlan="";
            ////futurePlan = txtFreeChildLaborRegion.Text + ";" + txtYourRoleInFreeChildLaborRegion.Text;
            //mainFamilyBehaviourClass.fldFuturePlan = txtFuturePlan.Text.Trim();
            //string strNoReturnHome = "";

            //mainFamilyBehaviourClass.fldNoPlanReturnHomeID = strNoReturnHome;
            //mainFamilyBehaviourClass.fldWhyLeaveHome = int.Parse(ddlLabourCause.SelectedValue);

            tblAboutChildLabour aboutChildLabour = new tblAboutChildLabour();
            aboutChildLabour.fldStayTypeID = 1;
            aboutChildLabour.fldAdditionalIncome = "";
            aboutChildLabour.fldChildLabour = false;
            aboutChildLabour.fldChildBoysNo = int.Parse(txtChildBoyNoInOffice.Text.Trim());
            aboutChildLabour.fldChildGirlsNo = int.Parse(txtChildGirlNoInOffice.Text.Trim());
            aboutChildLabour.fldChildTotal = int.Parse(txtChildTotalNoInOffice.Text.Trim());
            aboutChildLabour.fldChildSchoolYes = int.Parse(txtChildGoingSchoolNo.Text.Trim());
            aboutChildLabour.fldChildSchoolNo = int.Parse(txtChildNotGoingSchoolNo.Text.Trim());
            aboutChildLabour.fldSchoolName = txtChildScoolName.Text.Trim();
            aboutChildLabour.fldSchoolAddress = txtChildScoolAddress.Text.Trim();

            aboutChildLabour.fldLabourTakenID = int.Parse(ddlWhoTakesChild.SelectedValue);
            string strLabourWentHow = "";
            for (int i = 0; i < cblChildLabourWentHow.Items.Count; i++)
                if (cblChildLabourWentHow.Items[i].Selected)
                {
                    strLabourWentHow += cblChildLabourWentHow.Items[i].Value + ";";

                }

            aboutChildLabour.fldLabourWentHow = strLabourWentHow;

            string strLabourCause = "";
            for (int i = 0; i < cblLabourCause.Items.Count; i++)
                if (cblLabourCause.Items[i].Selected)
                {
                    strLabourCause += cblLabourCause.Items[i].Value + ";";

                }
            aboutChildLabour.fldLabourCause = strLabourCause;
            aboutChildLabour.fldJobAggrement = ddlAgreementNeeded.SelectedValue.ToString();

            string strJobAgreementPt = "";
            for (int i = 0; i < chkJobAgreement.Items.Count; i++)
                if (chkJobAgreement.Items[i].Selected)
                {
                    strJobAgreementPt += chkJobAgreement.Items[i].Value + ";";

                }

            aboutChildLabour.fldJobAgreementPoints = strJobAgreementPt;
            aboutChildLabour.fldChildWorkReason = txtMainResonToChildLabor.Text.Trim();
            aboutChildLabour.fldTimeIntervalMonth = 1; //Not Required
            aboutChildLabour.fldSalaryID = 1; //Not Required
            aboutChildLabour.fldContactTimes = 1; //Not Required
            aboutChildLabour.fldLabourTypeID = int.Parse(ddlLabourNature.SelectedValue);

            //tblChildLabourMainKa childLabourKa1 = new tblChildLabourMainKa();
            //tblChildLabourMainKa childLabourKa2 = new tblChildLabourMainKa();
            //tblChildLabourMainKa childLabourKa3 = new tblChildLabourMainKa();
            //tblChildLabourMainKa childLabourKa4 = new tblChildLabourMainKa();

            //childLabourKa1.fldChildNameKa = txtChildName.Text.Trim();
            //childLabourKa1.fldChildAgeKa = int.Parse(txtChildAge.Text.Trim());
            //childLabourKa1.fldParentNameKa = txtChildParentName.Text.Trim();
            //childLabourKa1.fldAddressKa = txtChildParentAddress.Text.Trim();
            //childLabourKa1.fldContactNoKa = txtChildParentContact.Text.Trim();

            //childLabourKa2.fldChildNameKa = txtChildName2.Text.Trim();
            //childLabourKa2.fldChildAgeKa = int.Parse(txtChidlAge3.Text.Trim());
            //childLabourKa2.fldParentNameKa = txtChildParentName2.Text.Trim();
            //childLabourKa2.fldAddressKa = txtChildParentAddress2.Text.Trim();
            //childLabourKa2.fldContactNoKa = txtChildParentContact2.Text.Trim();

            //childLabourKa3.fldChildNameKa = txtChildName3.Text.Trim();
            //childLabourKa3.fldChildAgeKa = int.Parse(txtChidlAge3.Text.Trim());
            //childLabourKa3.fldParentNameKa = txtChildParentName3.Text.Trim();
            //childLabourKa3.fldAddressKa = txtChildParentAddress3.Text.Trim();
            //childLabourKa3.fldContactNoKa = txtChildParentContact3.Text.Trim();

            //childLabourKa4.fldChildNameKa = txtChildName4.Text.Trim();
            //childLabourKa4.fldChildAgeKa = int.Parse(txtChidlAge4.Text.Trim());
            //childLabourKa4.fldParentNameKa = txtChildParentName4.Text.Trim();
            //childLabourKa4.fldAddressKa = txtChildParentAddress4.Text.Trim();
            //childLabourKa4.fldContactNoKa = txtChildParentContact4.Text.Trim();

            //ArrayList arr = new ArrayList();

            //if (childLabourKa1.fldChildNameKa != "")
            //    arr.Add(childLabourKa1);
            //if (childLabourKa2.fldChildNameKa != "")
            //    arr.Add(childLabourKa2);

            //if (childLabourKa3.fldChildNameKa != "")
            //    arr.Add(childLabourKa3);

            //if (childLabourKa4.fldChildNameKa != "")
            //    arr.Add(childLabourKa4);

            int mainID = ILODBAccess.saveDataIntblMain(mainClass);
            knowledgeClass.fldID = mainID;
            ILODBAccess.saveDataIntblKnowledge(knowledgeClass);
            childLabourClass.fldID = mainID;
            int childLabourID = ILODBAccess.saveDataIntblChildLabour(childLabourClass);
            childLabourDetailClass.fldID = mainID;
            childLabourDetailClass.fldChildLabourID = childLabourID;
            ILODBAccess.saveDataIntblChildLabourDetails(childLabourDetailClass);
            aboutChildLabour.fldID = mainID;
            ILODBAccess.saveDataIntblAboutChildLabour(aboutChildLabour);

            //for (int i = 0; i < arr.Count; i++)
            //{
            //    tblChildLabourMainKa tmpChildMainKa = (tblChildLabourMainKa)arr[i];
            //    tmpChildMainKa.fldID = mainID;
            //    ILODBAccess.saveDataIntblChildLabourMainKa(tmpChildMainKa);
            //}

            DataTable dtFamilyDetails = (DataTable)ViewState["CurrentData"];
            if (dtFamilyDetails != null && dtFamilyDetails.Rows.Count > 0)
            {
                ////insert the family details

                for (int i = 0; i < dtFamilyDetails.Rows.Count; i++)
                {
                    tblFamilyDetails tmpFamilyDetailsClass = new tblFamilyDetails();
                    tmpFamilyDetailsClass.fldChildLabourID = childLabourID;
                    tmpFamilyDetailsClass.fldID = mainID;
                    tmpFamilyDetailsClass.fldFamilyName = dtFamilyDetails.Rows[i][0].ToString();
                    DataTable dt = ILODBAccess.getDropDownData("fldGenderID", "tblGender", " fldGenderDesc=N'" + dtFamilyDetails.Rows[i][1].ToString() + "'");
                    tmpFamilyDetailsClass.fldFamilyGenderID = int.Parse(dt.Rows[0][0].ToString());
                    tmpFamilyDetailsClass.fldFamilyAge = int.Parse(dtFamilyDetails.Rows[i][2].ToString());
                    DataTable dt1 = ILODBAccess.getDropDownData("fldRelationID", "tblRelation", " fldRelationDesc=N'" + dtFamilyDetails.Rows[i][3].ToString() + "'");
                    tmpFamilyDetailsClass.fldFamilyRelationID = int.Parse(dt1.Rows[0][0].ToString());
                    tmpFamilyDetailsClass.fldFamilyEducation = dtFamilyDetails.Rows[i][4].ToString();
                    tmpFamilyDetailsClass.fldFamilyOccupation = dtFamilyDetails.Rows[i][5].ToString();
                    tmpFamilyDetailsClass.fldFamilyIdentitydoc = Convert.ToBoolean(dtFamilyDetails.Rows[i][8].ToString());
                    tmpFamilyDetailsClass.fldFamilyLabourStatus = dtFamilyDetails.Rows[i][7].ToString();
                    tmpFamilyDetailsClass.fldFamilyCurState = dtFamilyDetails.Rows[i][6].ToString();
                    ILODBAccess.saveDataIntblFamilyDetails(tmpFamilyDetailsClass);
                }

                DataTable dtProbableAddress = (DataTable)ViewState["CurrentData2"];
                if (dtProbableAddress != null && dtProbableAddress.Rows.Count > 0)
                {
                    ////insert the family details

                    for (int i = 0; i < dtProbableAddress.Rows.Count; i++)
                    {
                        tblAddress tmpAddress = new tblAddress();
                        //dtProbableAddress.fldChildLabourID = childLabourID;
                        tmpAddress.fldId = mainID;
                        tmpAddress.fldAddType = "सम्भावित श्रम स्थान";
                        DataTable dt = ILODBAccess.getDropDownData("DISTINCT District_id", "tblVDC", " District='" + dtProbableAddress.Rows[i][1].ToString() + "'");
                        tmpAddress.fldDistrict = int.Parse(dt.Rows[0][0].ToString());
                        //tmpAddress.fldFamilyAge = int.Parse(dtFamilyDetails.Rows[i][2].ToString());
                        //DataTable dt1 = ILODBAccess.getDropDownData("VDC_id", "tblVDC", "VDC_name='" + dtProbableAddress.Rows[i][2].ToString() + "'");
                        tmpAddress.fldVMName = dtProbableAddress.Rows[i][2].ToString();
                        tmpAddress.fldVillage = true;
                        tmpAddress.fldWardNo = int.Parse(dtProbableAddress.Rows[0][3].ToString());
                        tmpAddress.fldTole = dtProbableAddress.Rows[i][4].ToString();
                        tmpAddress.fldContactNo = dtProbableAddress.Rows[i][5].ToString();

                        ILODBAccess.saveDataIntblAddress(tmpAddress);
                    }

                }

                childWorkClass.fldID = mainID;
                childWorkClass.fldChildLabourID = childLabourID;
                ILODBAccess.saveDataIntblChildWorkState(childWorkClass);

                //mainFamilyBehaviourClass.fldID = mainID;
                //mainFamilyBehaviourClass.fldChildLabourID = childLabourID;
                //ILODBAccess.saveDataIntblMainFamilyBehaviour(mainFamilyBehaviourClass);

                addPermanent.fldId = mainID;
                addTemp.fldId = mainID;
                ILODBAccess.saveDataIntblAddress(addPermanent);
                ILODBAccess.saveDataIntblAddress(addTemp);
            }
        }
Example #2
0
        public static int saveDataIntblMain(tblMain tblMainClass)
        {
            string storeProcedureName = "sp_Insert_tblMain";
            try
            {
                int rowAffected = 0;
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection = ILODBConfig.GetConnection();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = storeProcedureName;

                    cmd.Parameters.AddWithValue("@fldTypeID", tblMainClass.fldTypeID);
                    cmd.Parameters.AddWithValue("@fldLocation", tblMainClass.fldLocation);
                    cmd.Parameters.AddWithValue("@fldSerialNo", tblMainClass.fldSerialNo);
                    cmd.Parameters.AddWithValue("@fldFormNo", tblMainClass.fldFormNo);
                    cmd.Parameters.AddWithValue("@fldFormFillPlace", tblMainClass.fldFormFillPlace);
                    cmd.Parameters.AddWithValue("@fldFormFillDate", tblMainClass.fldFormFillDate);
                    cmd.Parameters.AddWithValue("@fldFormAgree", tblMainClass.fldFormAgree);
                    cmd.Parameters.AddWithValue("@fldAnswererName", tblMainClass.fldAnswererName);
                    cmd.Parameters.AddWithValue("@fldAnsContactNo", tblMainClass.fldAnsContactNo);
                    cmd.Parameters.AddWithValue("@fldMainName", tblMainClass.fldMainName);
                    cmd.Parameters.AddWithValue("@fldMainProfessionID", tblMainClass.fldMainProfessionID);
                    cmd.Parameters.AddWithValue("@fldMainCastID", tblMainClass.fldMainCastID);
                    cmd.Parameters.AddWithValue("@fldMainReligionID", tblMainClass.fldMainReligionID);
                    cmd.Parameters.AddWithValue("@fldMainStayTypeID", tblMainClass.fldMainStayTypeID);
                    cmd.Parameters.AddWithValue("@fldMainMenNo", tblMainClass.fldMainMenNo);
                    cmd.Parameters.AddWithValue("@fldMainWomenNo", tblMainClass.fldMainWomenNo);
                    cmd.Parameters.AddWithValue("@fldMainBoysNo", tblMainClass.fldMainBoysNo);
                    cmd.Parameters.AddWithValue("@fldMainGirlsNo", tblMainClass.fldMainGirlsNo);
                    cmd.Parameters.AddWithValue("@fldMainFamilyTotal", tblMainClass.fldMainFamilyTotal);
                    cmd.Parameters.AddWithValue("@fldMainEducation", tblMainClass.fldMainEducation);
                    cmd.Parameters.AddWithValue("@fldSurveyerName", tblMainClass.fldSurveyerName);
                    cmd.Parameters.AddWithValue("@fldSubmitDate", tblMainClass.fldSubmitDate);
                    cmd.Parameters.AddWithValue("@fldSurveyerNote", tblMainClass.fldSurveyerNote);
                    cmd.Parameters.AddWithValue("@fldMainNote", tblMainClass.fldMainNote);
                    cmd.Parameters.AddWithValue("@fldNote", tblMainClass.fldNote);
                    cmd.Parameters.AddWithValue("@fldWorkPlace", tblMainClass.fldWorkPlace);
                    rowAffected = int.Parse(cmd.ExecuteScalar().ToString());
                }
                return rowAffected;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                ILODBConfig.GetConnection().Close();
            }
        }
Example #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            tblMain mainClass = new tblMain();
            mainClass.fldTypeID = 1;
            mainClass.fldLocation = ddlMunicipality.SelectedItem.Text.Trim();
            mainClass.fldSerialNo = txtFormSerialNo.Text.Trim();
            mainClass.fldFormNo = int.Parse(txtFormNp.Text.Trim());
            mainClass.fldFormFillPlace = txtFomFillPlace.Text.Trim();
            mainClass.fldFormFillDate = DateTime.Parse(txtDateFormFill.Value.Trim());
            mainClass.fldFormAgree = Convert.ToBoolean(int.Parse(rblFormAgree.SelectedValue));
            mainClass.fldAnswererName = txtAnswererName.Text.Trim();
            mainClass.fldAnsContactNo = txtAnsContactNo.Text.Trim();
            mainClass.fldMainName = txtEmployerFullName.Text.Trim();
            mainClass.fldMainProfessionID = int.Parse(ddlEmployerProfession.SelectedValue);
            mainClass.fldMainCastID = int.Parse(ddlEmployerCast.SelectedValue);
            mainClass.fldMainReligionID = int.Parse(ddlEmployerReligion.SelectedValue);
            mainClass.fldMainStayTypeID = int.Parse(ddlHabitantStatus.SelectedValue);
            mainClass.fldMainMenNo = int.Parse(txtEmployerFamilyMenNo.Text.Trim());
            mainClass.fldMainWomenNo = int.Parse(txtEmployerFamilyWomenNo.Text.Trim());
            mainClass.fldMainBoysNo = int.Parse(txtEmployerFamilyBoysNo.Text.Trim());
            mainClass.fldMainGirlsNo = int.Parse(txtEmployerFamilyGirlsNo.Text.Trim());
            mainClass.fldMainFamilyTotal = mainClass.fldMainMenNo + mainClass.fldMainWomenNo + mainClass.fldMainGirlsNo + mainClass.fldMainBoysNo;
            mainClass.fldMainEducation = txtEmployerEducation.Text.Trim();
            mainClass.fldSurveyerName = txtSurveyerName.Text.Trim();
            mainClass.fldSubmitDate = DateTime.Parse(txtSubmitDates.Value.Trim());
            mainClass.fldSurveyerNote = txtSurveyerNote.Text.Trim();
            mainClass.fldMainNote = txtEmployerNote.Text.Trim();
            mainClass.fldNote = "";
            mainClass.fldWorkPlace = "";

            tblAddress addPermanent = new tblAddress();
            addPermanent.fldAddType = "स्थायी";
            addPermanent.fldDistrict = int.Parse(drpPermanentDistrict.SelectedValue);
            addPermanent.fldVillage = Convert.ToBoolean(int.Parse(rblPermanentVillage.SelectedValue));
            addPermanent.fldVMName = drpPermanentMunorVdc.SelectedItem.Text.ToString();
            addPermanent.fldWardNo = int.Parse(txtPermanentWardNo.Text.Trim());
            addPermanent.fldTole = txtPermanentTole.Text.Trim();
            addPermanent.fldHouseNo = txtPermanentHouseNo.Text.Trim();
            addPermanent.fldAddNote = txtPermanetNote.Text.Trim();

            tblAddress addTemp = new tblAddress();
            addTemp.fldAddType = "अस्थायी";
            addTemp.fldDistrict = int.Parse(drpTempDistrict.SelectedValue);
            addTemp.fldVillage = Convert.ToBoolean(int.Parse(rblTempVillage.SelectedValue));
            addTemp.fldVMName = drpTempMunOrVdc.SelectedItem.Text.ToString();
            addTemp.fldWardNo = int.Parse(txtTempWardNo.Text.Trim());
            addTemp.fldTole = txtTempTole.Text.Trim();
            addTemp.fldHouseNo = txtTempHouseNo.Text.Trim();
            addTemp.fldAddNote = txtTempNote.Text.Trim();

            tblKnowledge knowledgeClass = new tblKnowledge();
            knowledgeClass.fldChildRight = Convert.ToBoolean(int.Parse(ddlKnowChildRight.SelectedValue));
            knowledgeClass.fldChildRightDesc = txtWhatIsChildRight.Text.Trim();
            knowledgeClass.fldNoWorkBelow14 = Convert.ToBoolean(int.Parse(ddlNoChildLaborBelow14.SelectedValue));
            knowledgeClass.fldAgreeNoWorkBelow14 = Convert.ToBoolean(int.Parse(ddlViewAboutNoChildLaborBelow14.SelectedValue));
            knowledgeClass.fldNoWorkBelow14Desc = txtViewAboutNoChildLaborBelow14.Text.Trim();
            knowledgeClass.fldChildLabourRisk = Convert.ToBoolean(int.Parse(ddlKnowThreeEffectsOfChildLabor.SelectedValue));
            knowledgeClass.fldNoChildLabourDesc = "";
            knowledgeClass.fldKnowChildAbuse = false;
            knowledgeClass.fldKnowAdultAvailable = Convert.ToBoolean(int.Parse(ddlKnowMaturedLabor.SelectedValue));
            knowledgeClass.fldUseAdultNotChild = Convert.ToBoolean(int.Parse(ddlUseAdultNotChild.SelectedValue));
            knowledgeClass.fldUseAdultNotChildDesc = txtWhyMaturedLabor.Text.Trim();

            tblChildLabour childLabourClass = new tblChildLabour();
            childLabourClass.fldChildName = txtChildName.Text.Trim();
            childLabourClass.fldChildGenderID = int.Parse(ddlChildSex.SelectedValue);
            childLabourClass.fldChildBirthDate = DateTime.Parse(txtBirthDate.Value.Trim());
            childLabourClass.fldChildAge = int.Parse(txtChildAge.Text.Trim());
            childLabourClass.fldChildCastID = int.Parse(ddlChildCastInfo.SelectedValue);
            childLabourClass.fldChildReligionID = int.Parse(ddlChildReligion.SelectedValue);
            childLabourClass.fldChildHealth = txtChildPhysicalStatus.Text.Trim();
            childLabourClass.fldChildBirthReg = Convert.ToBoolean(int.Parse(ddlIsBirthRegistration.SelectedValue));
            childLabourClass.fldChildStayTypeID = int.Parse(ddlChildHome.SelectedValue);
            childLabourClass.fldChildAdditionalIncome = txtOtherIncomeSource.Text.Trim();

            tblChildLabourDetails childLabourDetailClass = new tblChildLabourDetails();
            childLabourDetailClass.fldChildStudyStateID = int.Parse(ddlIsChildGoingStudy.SelectedValue);
            childLabourDetailClass.fldChildStudyTypeID = int.Parse(ddlStudyType.SelectedValue);
            childLabourDetailClass.fldChildSchool = txtSchoolOrCenterNameAndClass.Text.Trim();
            childLabourDetailClass.fldChildSchoolGrade = int.Parse(txtSchoolOrCenterClass.Text.Trim());
            childLabourDetailClass.fldChildSchoolExpenseID = int.Parse(ddlWhoPaysEducation.SelectedValue);
            childLabourDetailClass.fldChildLeaveSchoolGrade = int.Parse(txtAtWhatClassSchoolLeft.Text.Trim());
            childLabourDetailClass.fldChildLeaveSchoolDesc = txtWhySchoolLeft.Text.Trim();
            childLabourDetailClass.fldChildTraining = Convert.ToBoolean(int.Parse(ddlWantVocationalTraining.SelectedValue));
            childLabourDetailClass.fldChildTrainingPlace = txtWhereVocationalTraining.Text.Trim();

            childLabourDetailClass.fldChildTrainingStay = txtWhereToStayDuringVocationalTraining.Text.Trim();
            childLabourDetailClass.fldChildInterestedArea = txtWhatWantToDo.Text.Trim();
            //childLabourDetailClass.fldChildStudyContinue = 0;
            childLabourDetailClass.fldChildStudyHelpSelf = txtHelpYourself.Text.Trim();
            childLabourDetailClass.fldChildStudyHelpFamily = txtHelpFamily.Text.Trim();
            childLabourDetailClass.fldChildStudyHelpOther = txtHelpOther.Text.Trim();

            tblChildWorkState childWorkClass = new tblChildWorkState();
            childWorkClass.fldWorkStartTime = float.Parse(txtChildWorkedYear.Text.Trim()) + float.Parse(txtChildWorkedMonth.Text.Trim()) / 12;
            childWorkClass.fldWorkPlaceKnow = Convert.ToBoolean(int.Parse(ddlParentKnowWorkingStation.SelectedValue));
            childWorkClass.fldWorkContactTypeID = int.Parse(ddlParentContactFrequency.SelectedValue);
            childWorkClass.fldWorkContact = Convert.ToBoolean(int.Parse(ddlIsAllowedToContactParent.SelectedValue));
            childWorkClass.fldWorkTimePerDay = float.Parse(txtChildDailyHoursToWork.Text.Trim());
            childWorkClass.fldWorkTimeDay = float.Parse(txtChildMorningWorkTime.Text.Trim());
            childWorkClass.fldWorkTimeEvening = float.Parse(txtChildEveningWorkTime.Text.Trim());
            childWorkClass.fldWorkDesc = txtChildWhatTasksToDo.Text.Trim();
            childWorkClass.fldWorkPayAmonunt = float.Parse(txtMonthlySalary.Text.Trim());
            childWorkClass.fldWorkPayTypeID = int.Parse(ddlSalaryObtainFrequency.Text.Trim());
            childWorkClass.fldWorkPayReceiverID = int.Parse(ddlPayementReceiver.SelectedValue);
            childWorkClass.fldWorkHoliday = Convert.ToBoolean(int.Parse(ddlIsVacation.SelectedValue));
            childWorkClass.fldWorkHolidayID = int.Parse(ddlVacationFrequency.SelectedValue);
            childWorkClass.fldWorkPayReceiverName = txtOtherPersonToTakeSalary.Text.Trim();

            tblMainFamilyBehaviour mainFamilyBehaviourClass = new tblMainFamilyBehaviour();
            mainFamilyBehaviourClass.fldLoveMost = int.Parse(ddlWhoLovesMost.SelectedValue);

            string strLoveway = "";
            for (int i = 0; i < chkLoveway.Items.Count; i++)
                if (chkLoveway.Items[i].Selected)
                {
                    strLoveway += chkLoveway.Items[i].Value + ";";

                }

            mainFamilyBehaviourClass.fldLoveWay = strLoveway;
            mainFamilyBehaviourClass.fldAbuse = false;
            mainFamilyBehaviourClass.fldAbusePerson = int.Parse(ddlWhoHatesMost.SelectedValue);
            string strHateway = "";
            for (int i = 0; i < chkAbuseType.Items.Count; i++)
                if (chkAbuseType.Items[i].Selected)
                {
                    strHateway += chkAbuseType.Items[i].Value + ";";

                }
            mainFamilyBehaviourClass.fldAbuseType = strHateway;
            mainFamilyBehaviourClass.fldAbuseReport = Convert.ToBoolean(int.Parse(ddlProblemShare.SelectedValue));
            mainFamilyBehaviourClass.fldAbuseReportDesc = txtProblemShareToWhom.Text.Trim();
            mainFamilyBehaviourClass.fldFoodStatus = chkFooding.Checked;
            mainFamilyBehaviourClass.fldSleepStatus = chkSleeping.Checked;
            mainFamilyBehaviourClass.fldStayStatus = chkStaying.Checked;
            mainFamilyBehaviourClass.fldEntertainmentStatus = chkEntertainment.Checked;
            mainFamilyBehaviourClass.fldSecuritySeperateRoom = Convert.ToBoolean(int.Parse(ddlSeparateRoom.SelectedValue));
            mainFamilyBehaviourClass.fldSecurityDesc = txtRequiredSecurityEnvironment.Text.Trim();
            mainFamilyBehaviourClass.fldHealthStatusID = int.Parse(ddlHealthService.SelectedValue);
            //mainFamilyBehaviourClass.fldCertificate=0
            mainFamilyBehaviourClass.fldFuturePlan = txtFuturePlan.Text.Trim();
            mainFamilyBehaviourClass.fldPlanReturnHome = Convert.ToBoolean(int.Parse(ddlWantToReturnChild.SelectedValue));

            string strNoReturnHome = "";
            for (int i = 0; i < chkWhyNotReturnChild.Items.Count; i++)
                if (chkWhyNotReturnChild.Items[i].Selected)
                {
                    strNoReturnHome += chkWhyNotReturnChild.Items[i].Value + ";";

                }
            mainFamilyBehaviourClass.fldNoPlanReturnHomeID = strNoReturnHome;
            mainFamilyBehaviourClass.fldWhyLeaveHome = int.Parse(ddlLabourCause.SelectedValue);

            tblAboutChildLabour aboutChildLabour = new tblAboutChildLabour();
            aboutChildLabour.fldStayTypeID = 1;
            aboutChildLabour.fldAdditionalIncome = "";
            aboutChildLabour.fldChildLabour = false;
            aboutChildLabour.fldChildBoysNo = int.Parse(txtChildBoyNoInOffice.Text.Trim());
            aboutChildLabour.fldChildGirlsNo = int.Parse(txtChildGirlNoInOffice.Text.Trim());
            aboutChildLabour.fldChildTotal = int.Parse(txtChildTotalNoInOffice.Text.Trim());
            aboutChildLabour.fldChildSchoolYes = int.Parse(txtChildGoingSchoolNo.Text.Trim());
            aboutChildLabour.fldChildSchoolNo = int.Parse(txtChildNotGoingSchoolNo.Text.Trim());
            aboutChildLabour.fldSchoolName = txtChildShcoolName.Text.Trim();
            aboutChildLabour.fldSchoolAddress = txtChildSchoolAddress.Text.Trim();
            aboutChildLabour.fldLabourTakenID = int.Parse(ddlHowChildSearched.SelectedValue);
            aboutChildLabour.fldLabourCause = "";
            aboutChildLabour.fldLabourWentHow = "";
            aboutChildLabour.fldJobAggrement = ddlIsEmploymentAgreement.SelectedValue.ToString();

            string strJobAgreementPt = "";
            for (int i = 0; i < chkJobAgreement.Items.Count; i++)
                if (chkJobAgreement.Items[i].Selected)
                {
                    strJobAgreementPt += chkJobAgreement.Items[i].Value + ";";

                }

            aboutChildLabour.fldJobAgreementPoints = strJobAgreementPt;
            aboutChildLabour.fldChildWorkReason = txtMainResonToChildLabor.Text.Trim();
            aboutChildLabour.fldTimeIntervalMonth = int.Parse(txtWhenChildStartedWork.Text.Trim());
            aboutChildLabour.fldSalaryID = int.Parse(ddlSalaryInfo.SelectedValue);
            aboutChildLabour.fldContactTimes = int.Parse(txtFamilyMeetNo.Text.Trim());
            aboutChildLabour.fldLabourTypeID = 1;

            tblChildLabourMainKa childLabourKa1 = new tblChildLabourMainKa();
            tblChildLabourMainKa childLabourKa2 = new tblChildLabourMainKa();
            tblChildLabourMainKa childLabourKa3 = new tblChildLabourMainKa();
            tblChildLabourMainKa childLabourKa4 = new tblChildLabourMainKa();

            childLabourKa1.fldChildNameKa = txtChildName.Text.Trim();
            childLabourKa1.fldChildAgeKa = int.Parse(txtChildAge.Text.Trim());
            childLabourKa1.fldParentNameKa = txtChildParentName.Text.Trim();
            childLabourKa1.fldAddressKa = txtChildParentAddress.Text.Trim();
            childLabourKa1.fldContactNoKa = txtChildParentContact.Text.Trim();

            childLabourKa2.fldChildNameKa = txtChildName2.Text.Trim();
            childLabourKa2.fldChildAgeKa = int.Parse(txtChidlAge3.Text.Trim());
            childLabourKa2.fldParentNameKa = txtChildParentName2.Text.Trim();
            childLabourKa2.fldAddressKa = txtChildParentAddress2.Text.Trim();
            childLabourKa2.fldContactNoKa = txtChildParentContact2.Text.Trim();

            childLabourKa3.fldChildNameKa = txtChildName3.Text.Trim();
            childLabourKa3.fldChildAgeKa = int.Parse(txtChidlAge3.Text.Trim());
            childLabourKa3.fldParentNameKa = txtChildParentName3.Text.Trim();
            childLabourKa3.fldAddressKa = txtChildParentAddress3.Text.Trim();
            childLabourKa3.fldContactNoKa = txtChildParentContact3.Text.Trim();

            childLabourKa4.fldChildNameKa = txtChildName4.Text.Trim();
            childLabourKa4.fldChildAgeKa = int.Parse(txtChidlAge4.Text.Trim());
            childLabourKa4.fldParentNameKa = txtChildParentName4.Text.Trim();
            childLabourKa4.fldAddressKa = txtChildParentAddress4.Text.Trim();
            childLabourKa4.fldContactNoKa = txtChildParentContact4.Text.Trim();

            ArrayList arr = new ArrayList();

            if (childLabourKa1.fldChildNameKa != "")
                arr.Add(childLabourKa1);
            if (childLabourKa2.fldChildNameKa != "")
                arr.Add(childLabourKa2);

            if (childLabourKa3.fldChildNameKa != "")
                arr.Add(childLabourKa3);

            if (childLabourKa4.fldChildNameKa != "")
                arr.Add(childLabourKa4);

            int mainID = ILODBAccess.saveDataIntblMain(mainClass);
            knowledgeClass.fldID = mainID;
            ILODBAccess.saveDataIntblKnowledge(knowledgeClass);
            childLabourClass.fldID = mainID;
            int childLabourID = ILODBAccess.saveDataIntblChildLabour(childLabourClass);
            childLabourDetailClass.fldID = mainID;
            childLabourDetailClass.fldChildLabourID = childLabourID;
            ILODBAccess.saveDataIntblChildLabourDetails(childLabourDetailClass);
            aboutChildLabour.fldID = mainID;
            ILODBAccess.saveDataIntblAboutChildLabour(aboutChildLabour);

            for (int i = 0; i < arr.Count; i++)
            {
                tblChildLabourMainKa tmpChildMainKa = (tblChildLabourMainKa)arr[i];
                tmpChildMainKa.fldID = mainID;
                ILODBAccess.saveDataIntblChildLabourMainKa(tmpChildMainKa);
            }

            DataTable dtFamilyDetails = (DataTable)ViewState["CurrentData"];
            if (dtFamilyDetails != null && dtFamilyDetails.Rows.Count > 0)
            {
                ////insert the family details

                for (int i = 0; i < dtFamilyDetails.Rows.Count; i++)
                {
                    tblFamilyDetails tmpFamilyDetailsClass = new tblFamilyDetails();
                    tmpFamilyDetailsClass.fldChildLabourID = childLabourID;
                    tmpFamilyDetailsClass.fldID = mainID;
                    tmpFamilyDetailsClass.fldFamilyName = dtFamilyDetails.Rows[i][0].ToString();
                    DataTable dt = ILODBAccess.getDropDownData("fldGenderID", "tblGender", " fldGenderDesc=N'" + dtFamilyDetails.Rows[i][1].ToString() + "'");
                    tmpFamilyDetailsClass.fldFamilyGenderID = int.Parse(dt.Rows[0][0].ToString());
                    tmpFamilyDetailsClass.fldFamilyAge = int.Parse(dtFamilyDetails.Rows[i][2].ToString());
                    DataTable dt1 = ILODBAccess.getDropDownData("fldRelationID", "tblRelation", " fldRelationDesc=N'" + dtFamilyDetails.Rows[i][3].ToString() + "'");
                    tmpFamilyDetailsClass.fldFamilyRelationID = int.Parse(dt1.Rows[0][0].ToString());
                    tmpFamilyDetailsClass.fldFamilyEducation = dtFamilyDetails.Rows[i][4].ToString();
                    tmpFamilyDetailsClass.fldFamilyOccupation = dtFamilyDetails.Rows[i][5].ToString();
                    tmpFamilyDetailsClass.fldFamilyIdentitydoc = false;
                    tmpFamilyDetailsClass.fldFamilyLabourStatus = "";
                    tmpFamilyDetailsClass.fldFamilyCurState = dtFamilyDetails.Rows[i][6].ToString();
                    ILODBAccess.saveDataIntblFamilyDetails(tmpFamilyDetailsClass);
                }
            }
            childWorkClass.fldID = mainID;
            childWorkClass.fldChildLabourID = childLabourID;
            ILODBAccess.saveDataIntblChildWorkState(childWorkClass);

            mainFamilyBehaviourClass.fldID = mainID;
            mainFamilyBehaviourClass.fldChildLabourID = childLabourID;
            ILODBAccess.saveDataIntblMainFamilyBehaviour(mainFamilyBehaviourClass);

            addPermanent.fldId = mainID;
            addTemp.fldId = mainID;
            ILODBAccess.saveDataIntblAddress(addPermanent);
            ILODBAccess.saveDataIntblAddress(addTemp);
        }