Exemplo n.º 1
0
 public static SaMIProfiles GetSaMIProfile(int SaMIProfileID)
 {
     SaMIProfiles objSaMIProfiles = new SaMIProfiles();
     return (SaMIProfiles)(new SaMIProfileDAO().FillDTO(objSaMIProfiles, "SaMIProfileID=" + SaMIProfileID));
 }
Exemplo n.º 2
0
 public static int UpdateProfile(SaMIProfiles objSaMIProfiles)
 {
     return new SaMIProfileDAO().UpdateProfile(objSaMIProfiles);
 }
Exemplo n.º 3
0
 public static int DeleteProfile(SaMIProfiles objSaMIProfiles)
 {
     return new SaMIProfileDAO().DeleteProfile(objSaMIProfiles);
 }
Exemplo n.º 4
0
        public int DeleteProfile(SaMIProfiles objSaMIProfiles)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "Status" };
                rowsaffected = Update(objSaMIProfiles, UpdateProperties);


                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
Exemplo n.º 5
0
 public static int InsertProfile(SaMIProfiles objSaMIProfiles)
 {
     objSaMIProfiles.SaMIProfileNumber = new SaMIProfileDAO().GenerateRegistrationNumber(objSaMIProfiles.DistrictID);
     return new SaMIProfileDAO().InsertProfile(objSaMIProfiles);
 }
Exemplo n.º 6
0
        public int UpdateProfile(SaMIProfiles objSaMIProfiles)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "SaMIProfileNumber", "RegistrationDate", "DistrictID", "Gender", 
                                                            "FirstName", "MiddleName", "LastName", "CasteID",
                                                            "IsDiscriminated", "Address", "AddressDistrictID", "VDCID", "Ward",
                                                            "AddressTemp", "AddressDistrictIDTemp", "VDCTemp", "WardTemp",
                                                            "VisitorPhone", "FamilyMemberPhone",
                                                            "AgeGroupID", "EducationalStatusID", "MaritalStatusID",
                                                            "NoOfChildren", "NoOfAdultMale", "NoOfAdultFemale",
                                                            "OccupationTypeID", "UpdatedBy", "UpdatedDate", "ICKnowledgeID",
                                                            "FrequencyOfVisit", "ReasonForVisiting", "ValidRegions", "EthnicityID", "Status",
                                                            "FamilyHeadName", "FamilyHeadRelation", "SyncStatus"
                                                            };
                rowsaffected = Update(objSaMIProfiles, UpdateProperties);


                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
Exemplo n.º 7
0
        public int InsertProfile(SaMIProfiles objSaMIProfiles)
        {
            objSaMIProfiles.SaMIProfileID = 1;
            BeginTransaction();

            try
            {
                objSaMIProfiles.SaMIProfileID = Insert(objSaMIProfiles);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objSaMIProfiles.SaMIProfileID = -1;
            }

            return objSaMIProfiles.SaMIProfileID;
        }
Exemplo n.º 8
0
 protected void gvSaMIProfile_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     SaMIProfiles objSamiProfile = new SaMIProfiles();
     if (e.CommandName.Equals("cmdDelete"))
     {
         int SaMIProfileID = Convert.ToInt32(e.CommandArgument);
         objSamiProfile.SaMIProfileID = SaMIProfileID;
         objSamiProfile.Status = 0;
         int rowaffected = SaMIProfileBO.DeleteProfile(objSamiProfile);
        LoadProfiles();
     }
 }
Exemplo n.º 9
0
        //protected void btnSaveAndClose_Click(object sender, EventArgs e)
        //{
        //    SaMIProfileBO.UpdateProfile(MapSaMIProfilesDTO());

        //    ClearForeignEmployemntExperience();
        //    LoadPreviousFEExperience(Convert.ToInt32(hfSaMIProfileID.Value));
        //    //LoadPreviousFEExperiences(Convert.ToInt32(hfSaMIProfileID.Value));
        //    LoadValidRegions(Convert.ToInt32(ddlEthnicity.SelectedValue));
        //    Response.Redirect("Index.aspx");
        //}

        SaMIProfiles MapSaMIProfilesDTO()
        {
            SaMIProfiles objSaMIProfiles = new SaMIProfiles();
            objSaMIProfiles.SaMIProfileID = Convert.ToInt32(Request.QueryString.Get("ID"));
            objSaMIProfiles.SaMIProfileNumber = txtSaMIProfileNumber.Text.Trim();
            objSaMIProfiles.RegistrationDate = Convert.ToDateTime(txtRegistrationDate.Text.Trim());
            objSaMIProfiles.DistrictID = Convert.ToInt32(ddlDistrict.SelectedValue);
            if (rbMale.Checked)
                objSaMIProfiles.Gender = "M";
            else
                objSaMIProfiles.Gender = "F";

            objSaMIProfiles.FirstName = txtFirstName.Text.Trim();
            objSaMIProfiles.MiddleName = txtMiddleName.Text.Trim();
            objSaMIProfiles.LastName = txtLastName.Text.Trim();
            objSaMIProfiles.CasteID = Convert.ToInt32(Request.Params["ctl00$MainContent$ddlCaste"]);
            objSaMIProfiles.EthnicityID = Convert.ToInt32(ddlEthnicity.SelectedValue);

            string ValidRegions = string.Empty;

            for (int j = 0; j < rbValidRegions.Items.Count; j++)
            {
                if (rbValidRegions.Items[j].Selected == true)
                {
                    if (j == 0)
                        ValidRegions = rbValidRegions.Items[j].Value;
                    else
                        ValidRegions = ValidRegions + "," + rbValidRegions.Items[j].Value;
                }
            }

            objSaMIProfiles.ValidRegions = ValidRegions;

            objSaMIProfiles.Address = txtAddress.Text.Trim();
            objSaMIProfiles.AddressDistrictID = Convert.ToInt32(ddlAddressDistrict.SelectedValue);
            objSaMIProfiles.VDCID = Convert.ToInt32(ddlVDC.SelectedValue);
            objSaMIProfiles.Ward = txtWard.Text;

            objSaMIProfiles.VisitorPhone = txtVisitorPhone.Text;
            objSaMIProfiles.FamilyMemberPhone = txtFamilyMemberPhone.Text.Trim();
            objSaMIProfiles.AgeGroupID = Convert.ToInt32(ddlAgeGroup.SelectedValue);
            objSaMIProfiles.EducationalStatusID = Convert.ToInt32(ddlEducationalStatus.SelectedValue);
            objSaMIProfiles.MaritalStatusID = Convert.ToInt32(ddlMaritalStatus.SelectedValue);
            objSaMIProfiles.ICKnowledgeID = Convert.ToInt32(ddlICKnowledge.SelectedValue);
            objSaMIProfiles.FrequencyOfVisit = Convert.ToInt32(ddlFrequencyOfVisit.SelectedValue);
            objSaMIProfiles.ReasonForVisiting = Convert.ToInt32(ddlReasonOfVisit.SelectedValue);

            objSaMIProfiles.FamilyHeadName = txtFamilyHeadName.Text;
            objSaMIProfiles.FamilyHeadRelation = txtFamilyHeadRelation.Text;

           
            objSaMIProfiles.UpdatedBy = UserAuthentication.GetUserId(this.Page);
            objSaMIProfiles.UpdatedDate = DateTime.Now;

            objSaMIProfiles.Status = 1;
            objSaMIProfiles.SyncStatus = 0;

            return objSaMIProfiles;
        }
Exemplo n.º 10
0
        public SaMIProfiles MapSaMIProfileDTO(String data)
        {
            Boolean blnSameAsPermanent = false;

            SaMIProfiles objSaMIProfiles = new SaMIProfiles();
            String[] arrData = data.Split(',');
            foreach (String cdata in arrData)
            {
                string[] val = cdata.Split(':');
                switch (val[0])
                {
                    case "informationSource":
                        objSaMIProfiles.InformationSource = val[1];
                        break;
                    case "registrationDate":
                        String strDate = Regex.Unescape(val[1]);
                        using (StreamWriter _testData = new StreamWriter(HttpContext.Current.Server.MapPath("~/data.txt"), true))
                        {
                            _testData.WriteLine(strDate);
                        }
                        
                        objSaMIProfiles.RegistrationDate = Convert.ToDateTime(strDate);
                        break;
                    case "district":
                        objSaMIProfiles.DistrictID = AppCommonBO.GetOptionValue(val[1], "DistrictName", "DistrictID", "tbl_districts");
                        break;
                    case "gender":
                        if (val[1] == "Male")
                            objSaMIProfiles.Gender = "M";
                        else
                            objSaMIProfiles.Gender = "F";
                        break;
                    case "fname":
                        objSaMIProfiles.FirstName = val[1];
                        break;
                    case "mname":
                        objSaMIProfiles.MiddleName = val[1];
                        break;
                    case "lname":
                        objSaMIProfiles.LastName = val[1];
                        break;
                    case "age":
                        objSaMIProfiles.AgeGroupID = AppCommonBO.GetOptionValue(val[1], "AgeGroupDesc", "AgeGroupID", "tbl_age_groups");
                        break;
                    case "casteCaste":
                        objSaMIProfiles.CasteID = AppCommonBO.GetOptionValue(val[1], "CasteName", "CasteID", "tbl_caste");
                        break;
                    case "casteEthnicity":
                        break;
                    case "isDiscriminated":
                        if (val[1] == "true")
                            objSaMIProfiles.IsDiscriminated = 1;
                        else
                            objSaMIProfiles.IsDiscriminated = 0;
                        break;                    
                    case "phone":
                        objSaMIProfiles.VisitorPhone = val[1];
                        break;
                    case "phoneFamily":
                        objSaMIProfiles.FamilyMemberPhone = val[1];
                        break;
                    case "permanentDistrict":
                        objSaMIProfiles.AddressDistrictID = AppCommonBO.GetOptionValue(val[1], "DistrictName", "DistrictID", "tbl_districts");
                        break;
                    case "permanentVDC":
                        objSaMIProfiles.VDCID = AppCommonBO.GetOptionValue(val[1], "VDCName", "VDCID", "tbl_VDC");
                        break;
                    case "permanentWard":
                        objSaMIProfiles.Ward = val[1];
                        break;
                    case "permanentDetails":
                        objSaMIProfiles.Address = val[1];
                        break;
                    case "temporarySameAsPermanent":
                        if (val[1] == "true")
                            blnSameAsPermanent = true;
                        break;
                    case "temporaryDistrict":
                        if(!blnSameAsPermanent)
                            objSaMIProfiles.AddressDistrictIDTemp = AppCommonBO.GetOptionValue(val[1], "DistrictName", "DistrictID", "tbl_districts");
                        break;
                    case "temporaryVDC":
                        if (!blnSameAsPermanent)
                            objSaMIProfiles.VDCIDTemp = AppCommonBO.GetOptionValue(val[1], "VDCName", "VDCID", "tbl_VDC");
                        break;
                    case "temporaryWard":
                        if (!blnSameAsPermanent)
                            objSaMIProfiles.WardTemp = val[1];
                        break;
                    case "temporaryDetails":
                        if (!blnSameAsPermanent)
                            objSaMIProfiles.AddressTemp = val[1];
                        break;
                    case "educationalStatus":
                        objSaMIProfiles.EducationalStatusID = AppCommonBO.GetOptionValue(val[1], "EducationalStatusDesc", "EducationalStatusID", "tbl_educational_status");
                        break;
                    case "presentOccupation":
                        objSaMIProfiles.OccupationTypeID = AppCommonBO.GetOptionValue(val[1], "OccupationTypeDesc", "OccupationTypeID", "tbl_occupation_types");
                        break;
                    case "maritalStatus":
                        objSaMIProfiles.MaritalStatusID = AppCommonBO.GetOptionValue(val[1], "MaritalStatusDesc", "MaritalStatusID", "tbl_marital_status");
                        break;
                    case "familyMembersA":
                        if (val[1] != "Select")
                            objSaMIProfiles.NoOfChildMale = Convert.ToInt32(val[1]);
                        break;
                    case "familyMembersB":
                        if (val[1] != "Select")
                            objSaMIProfiles.NoOfChildFemale = Convert.ToInt32(val[1]);
                        break;
                    case "familyMembersC":
                        if (val[1] != "Select")
                            objSaMIProfiles.NoOfAdultMale = Convert.ToInt32(val[1]);
                        break;
                    case "familyMembersD":
                        if (val[1] != "Select")
                            objSaMIProfiles.NoOfAdultFemale = Convert.ToInt32(val[1]);
                        break;
                    case "username":
                        break;
                    case "registrationNumber":
                        objSaMIProfiles.RegistrationNumber = val[1];
                        break;
                    case "howYouKnowIC":
                        if (val[1] != "Select")
                            objSaMIProfiles.ICKnowledgeID = AppCommonBO.GetOptionValue(val[1], "ICKnowledgeDesc", "ICKnowledgeID", "tbl_ic_knowledges");
                        break;
                    case "frequencyOfVisit":
                        if (val[1] == "Once")
                            objSaMIProfiles.FrequencyOfVisit = 1;
                        else
                            objSaMIProfiles.FrequencyOfVisit = 2;
                        break;
                    case "reasonForVisiting":
                        if (val[1] == "General Information")
                            objSaMIProfiles.ReasonForVisiting = 1;
                        else
                            objSaMIProfiles.ReasonForVisiting = 2;
                        break;
                    case "gpsLongitude":
                        try
                        {
                            objSaMIProfiles.GPSLongitude = Convert.ToDecimal(val[1]);
                        }
                        catch (Exception ex)
                        {
                            
                        }
                        break;
                    case "gpsLatitude":
                        try
                        {
                            objSaMIProfiles.GPSLatitude = Convert.ToDecimal(val[1]);
                        }
                        catch (Exception ex)
                        {

                        }
                        break;
                    default:
                        break;
                }
            }

            if (blnSameAsPermanent)
            {
                objSaMIProfiles.AddressDistrictIDTemp = objSaMIProfiles.AddressDistrictID;
                objSaMIProfiles.VDCIDTemp = objSaMIProfiles.VDCID;
                objSaMIProfiles.WardTemp = objSaMIProfiles.Ward;
                objSaMIProfiles.AddressTemp = objSaMIProfiles.Address;
            }
            return objSaMIProfiles;
        }