コード例 #1
0
        private void btnPreviewNSave_Click(object sender, EventArgs e)
        {
            Person oPerson = null;

            if (validateControls())
            {
                oPerson                  = new Person();
                oPerson.PersonID         = 0;
                oPerson.PersonCode       = "";
                oPerson.PersonFirstName  = txtPersonFName.Text.Trim();
                oPerson.PersonMiddleName = txtPersonMName.Text.Trim();
                oPerson.PersonLastName   = txtPersonLName.Text.Trim();
                oPerson.OrganizationName = "";
                oPerson.PersonDOB        = Convert.ToDateTime(mskPersonDOB.Text.Trim());
                int nGender = -1;
                if (rdPersonMale.Checked)
                {
                    nGender = 1;
                }
                else if (rdPersonFemale.Checked)
                {
                    nGender = 2;
                }
                else if (rdPersonOthers.Checked)
                {
                    nGender = 0;
                }
                oPerson.PersonEntityTypeCode = eGlobal.EntityType.Individual.GetHashCode();
                oPerson.PersonEntityTypeDesc = eGlobal.EntityType.Individual.ToString();

                oPerson.PersonGender   = nGender;
                oPerson.PersonTypeCode = PersonType.GetHashCode();
                oPerson.personTypeDesc = PersonType.ToString();

                AddressDetails oAddress = new AddressDetails();
                oAddress.AddressID    = 0;
                oAddress.PersonID     = 0;
                oAddress.AddressType  = 1;
                oAddress.AddressLine1 = txtAddressLine1.Text.Trim();
                oAddress.AddressLine2 = txtAddressLine2.Text.Trim();
                oAddress.City         = txtArea.Text.Trim();
                oAddress.Taluka       = txtTaluka.Text.Trim();
                oAddress.District     = txtDistrict.Text.Trim();
                oAddress.State        = txtState.Text.Trim();
                oAddress.ZipCode      = txtPincode.Text.Trim();

                //oPerson.AddressDetails = oAddress;

                List <ContactDetails> lstContactDetails = new List <ContactDetails>();
                ContactDetails        oContact          = new ContactDetails();
                oContact.ContactID       = 0;
                oContact.PersonID        = 0;
                oContact.ContactNo       = txtMobileNo.Text.Trim();
                oContact.ContactTypeCode = eGlobal.ContactType.MobileNo.GetHashCode().ToString();
                oContact.ContactTypeDesc = eGlobal.ContactType.MobileNo.ToString();// "MobileNo";
                //oPerson.ContactDetails.Add(oContact);
                lstContactDetails.Add(oContact);
                oContact = null;

                oContact                 = new ContactDetails();
                oContact.ContactID       = 0;
                oContact.PersonID        = 0;
                oContact.ContactNo       = txtFaxNo.Text.Trim();
                oContact.ContactTypeCode = eGlobal.ContactType.FaxNo.GetHashCode().ToString();
                oContact.ContactTypeDesc = eGlobal.ContactType.FaxNo.ToString();// "FaxNo";
                //oPerson.ContactDetails.Add(oContact);
                lstContactDetails.Add(oContact);
                oContact = null;

                oContact                 = new ContactDetails();
                oContact.ContactID       = 0;
                oContact.PersonID        = 0;
                oContact.ContactNo       = txtEmail.Text.Trim();
                oContact.ContactTypeCode = eGlobal.ContactType.EmailID.GetHashCode().ToString();
                oContact.ContactTypeDesc = eGlobal.ContactType.EmailID.ToString();// "EmailID";
                //oPerson.ContactDetails.Add(oContact);
                lstContactDetails.Add(oContact);

                //oPerson.ContactDetails = lstContactDetails;

                VerificationDetails oVerification = new VerificationDetails();
                oVerification.PersonID                = 0;
                oVerification.AadhaarCardNo           = txtAadhaarNo.Text.Trim();
                oVerification.DrivingLicenceNo        = txtDrivingLicenceNo.Text.Trim();
                oVerification.PANCardNo               = txtPANNo.Text.Trim();
                oVerification.OtherIdCardDocumentNo   = txtOtherDocumentID.Text.Trim();
                oVerification.OtherIdCardDocumentName = txtOtherDocumentName.Text.Trim();
                oVerification.AadhaarCardID           = 0;
                oVerification.DrivingLicenceID        = 0;
                oVerification.PANID = 0;
                oVerification.OtherIdCardDocumentID = 0;

                //oPerson.VerificationDetails = oVerification;

                PhotoDetails oPhotoDetails = new PhotoDetails();
                if (PersonPhotoExtention != null)
                {
                    oPhotoDetails.PhotoID       = 0;
                    oPhotoDetails.PersonID      = 0;
                    oPhotoDetails.iPhoto        = File.ReadAllBytes(PersonPhotoLocation);
                    oPhotoDetails.FileExtension = PersonPhotoExtention;
                    oPhotoDetails.MIMEType      = "";
                    oPhotoDetails.FileSize      = PersonPhotoSize;
                    oPhotoDetails.Width         = PersonPhotoWidth;
                    oPhotoDetails.Height        = PersonPhotoHeight;
                    oPhotoDetails.Thumbnail     = File.ReadAllBytes(PersonThumbImagePath);
                }

                //oPerson.PhotoDetails = oPhotoDetails;

                DataTable dtContactDetails = eGlobal.CreateDataTable <ContactDetails>(lstContactDetails);
                //oPerson.ContactDetails = dtContactDetails;


                List <CardDetails> lstCardDetails = new List <CardDetails>();
                CardDetails        oCardDetails   = new CardDetails();

                oCardDetails                   = new CardDetails();
                oCardDetails.CardID            = 0;
                oCardDetails.PersonID          = 0;
                oCardDetails.ReferenceID       = oVerification.AadhaarCardID;
                oCardDetails.IDTypeCode        = eGlobal.CardType.AadhaarCard.GetHashCode();
                oCardDetails.IDTypeDescription = eGlobal.CardType.AadhaarCard.ToString();
                oCardDetails.iPhoto            = null;
                lstCardDetails.Add(oCardDetails);
                oCardDetails = null;

                oCardDetails                   = new CardDetails();
                oCardDetails.CardID            = 0;
                oCardDetails.PersonID          = 0;
                oCardDetails.ReferenceID       = oVerification.PANID;
                oCardDetails.IDTypeCode        = eGlobal.CardType.PanCard.GetHashCode();
                oCardDetails.IDTypeDescription = eGlobal.CardType.PanCard.ToString();
                oCardDetails.iPhoto            = null;
                lstCardDetails.Add(oCardDetails);
                oCardDetails = null;

                oCardDetails                   = new CardDetails();
                oCardDetails.CardID            = 0;
                oCardDetails.PersonID          = 0;
                oCardDetails.ReferenceID       = oVerification.DrivingLicenceID;
                oCardDetails.IDTypeCode        = eGlobal.CardType.DrivingLicenceID.GetHashCode();
                oCardDetails.IDTypeDescription = eGlobal.CardType.DrivingLicenceID.ToString();
                oCardDetails.iPhoto            = null;
                lstCardDetails.Add(oCardDetails);
                oCardDetails = null;

                oCardDetails                   = new CardDetails();
                oCardDetails.CardID            = 0;
                oCardDetails.PersonID          = 0;
                oCardDetails.ReferenceID       = oVerification.OtherIdCardDocumentID;
                oCardDetails.IDTypeCode        = eGlobal.CardType.OtherIDCard.GetHashCode();
                oCardDetails.IDTypeDescription = eGlobal.CardType.OtherIDCard.ToString();
                oCardDetails.iPhoto            = null;
                lstCardDetails.Add(oCardDetails);
                oCardDetails = null;

                DataTable dtCardDetails = eGlobal.CreateDataTable <CardDetails>(lstCardDetails);
                //oPerson.CardDetails = dtCardDetails;
                //oPerson.iPhoto=
                if (oPerson != null)
                {
                    frmViewPersonDetails_Confirm ofrmViewPersonDetails = new frmViewPersonDetails_Confirm();
                    ofrmViewPersonDetails.PersonType    = PersonType;
                    ofrmViewPersonDetails.PersonDetails = oPerson;
                    ofrmViewPersonDetails.oAddress      = oAddress;
                    ofrmViewPersonDetails.lstCard       = lstCardDetails;
                    ofrmViewPersonDetails.lstContact    = lstContactDetails;
                    ofrmViewPersonDetails.oPhoto        = oPhotoDetails;
                    ofrmViewPersonDetails.oVerification = oVerification;
                    ofrmViewPersonDetails.ShowDialog(this);
                    ofrmViewPersonDetails.Dispose();
                    ofrmViewPersonDetails = null;
                }
            }
        }
コード例 #2
0
        private void btnDetails_Click(object sender, EventArgs e)
        {
            if (dgvPersonList != null)
            {
                int rowindex = dgvPersonList.CurrentCell.RowIndex;
                int colindex = 0;

                Int64   PersonID = Convert.ToInt64(dgvPersonList.Rows[rowindex].Cells[colindex].Value);
                DataSet ds       = GetPersonDetails(PersonID);

                if (ds != null && ds.Tables.Count > 0)
                {
                    AddressDetails        oAddress      = new AddressDetails();
                    Person                oPerson       = new Person();
                    PhotoDetails          oPhoto        = new PhotoDetails();
                    VerificationDetails   oVerification = new VerificationDetails();
                    List <ContactDetails> lstContact    = new List <ContactDetails>();

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        oAddress.AddressID    = Convert.ToInt64(dr["AddressId"]);
                        oAddress.AddressType  = Convert.ToInt16(dr["AddressType"]);
                        oAddress.AddressLine1 = Convert.ToString(dr["AddressLine1"]);
                        oAddress.AddressLine2 = Convert.ToString(dr["AddressLine2"]);
                        oAddress.City         = Convert.ToString(dr["City"]);
                        oAddress.Taluka       = Convert.ToString(dr["Taluka"]);
                        oAddress.District     = Convert.ToString(dr["District"]);
                        oAddress.State        = Convert.ToString(dr["State"]);
                        oAddress.ZipCode      = Convert.ToString(dr["ZipCode"]);
                    }

                    foreach (DataRow dr in ds.Tables[1].Rows)
                    {
                        ContactDetails oContact = new ContactDetails();
                        oContact.ContactID       = Convert.ToInt64(dr["ContactId"]);
                        oContact.ContactNo       = Convert.ToString(dr["ContactNo"]);
                        oContact.ContactTypeCode = Convert.ToString(dr["ContactTypeCode"]);
                        oContact.ContactTypeDesc = Convert.ToString(dr["ContactTypeDesc"]);

                        lstContact.Add(oContact);
                        oContact = null;
                    }

                    foreach (DataRow dr in ds.Tables[2].Rows)
                    {
                        oPhoto.PhotoID = Convert.ToInt64(dr["PhotoID"]);
                        //oPhoto.iPhoto = Convert.(dr[""]);
                        oPhoto.FileExtension = Convert.ToString(dr["FileExtension"]);
                        oPhoto.MIMEType      = Convert.ToString(dr["MIMEType"]);
                        oPhoto.FileSize      = Convert.ToInt64(dr["FileSize"]);
                        oPhoto.Width         = Convert.ToInt16(dr["Width"]);
                        oPhoto.Height        = Convert.ToInt16(dr["Height"]);
                        //oPhoto.Thumbnail = Convert.(dr[""]);
                    }

                    foreach (DataRow dr in ds.Tables[3].Rows)
                    {
                        switch (Convert.ToString(dr["TypeCode"]))
                        {
                        case "0":
                        {
                            oVerification.AadhaarCardID = Convert.ToInt64(dr["ID"]);
                            oVerification.AadhaarCardNo = Convert.ToString(dr["No"]);
                        }
                        break;

                        case "1":
                        {
                            oVerification.PANID     = Convert.ToInt64(dr["ID"]);
                            oVerification.PANCardNo = Convert.ToString(dr["No"]);
                        }
                        break;

                        case "2":
                        {
                            oVerification.DrivingLicenceID = Convert.ToInt64(dr["ID"]);
                            oVerification.DrivingLicenceNo = Convert.ToString(dr["No"]);
                        }
                        break;

                        case "3":
                        {
                            oVerification.OtherIdCardDocumentID   = Convert.ToInt64(dr["ID"]);
                            oVerification.OtherIdCardDocumentNo   = Convert.ToString(dr["No"]);
                            oVerification.OtherIdCardDocumentName = Convert.ToString(dr["Name"]);
                        }
                        break;
                        }
                    }

                    foreach (DataRow dr in ds.Tables[4].Rows)
                    {
                        oPerson.PersonID             = Convert.ToInt64(dr["PersonID"]);;
                        oPerson.PersonCode           = Convert.ToString(dr["Code"]);
                        oPerson.PersonFirstName      = Convert.ToString(dr["FirstName"]);
                        oPerson.PersonMiddleName     = Convert.ToString(dr["MiddleName"]);
                        oPerson.PersonLastName       = Convert.ToString(dr["LastName"]);
                        oPerson.OrganizationName     = Convert.ToString(dr["OrganizationName"]);
                        oPerson.PersonDOB            = Convert.ToDateTime(dr["DOB"]);
                        oPerson.PersonEntityTypeCode = Convert.ToInt32(dr["EntityTypeCode"]);;
                        oPerson.PersonEntityTypeDesc = Convert.ToString(dr["EntityTypeDesc"]);
                        oPerson.PersonGender         = Convert.ToInt32(dr["Gender"]);
                        oPerson.PersonTypeCode       = Convert.ToInt32(dr["PersonTypeCode"]);
                        oPerson.personTypeDesc       = Convert.ToString(dr["personTypeDesc"]);
                    }

                    frmViewPersonDetails_Confirm ofrmViewPersonDetails_Confirm = new frmViewPersonDetails_Confirm();
                    //ofrmViewPersonDetails_Confirm.PersonType = PersonType;
                    ofrmViewPersonDetails_Confirm.PersonDetails   = oPerson;
                    ofrmViewPersonDetails_Confirm.oAddress        = oAddress;
                    ofrmViewPersonDetails_Confirm.lstCard         = new List <CardDetails>();
                    ofrmViewPersonDetails_Confirm.lstContact      = lstContact;
                    ofrmViewPersonDetails_Confirm.oPhoto          = oPhoto;
                    ofrmViewPersonDetails_Confirm.oVerification   = oVerification;
                    ofrmViewPersonDetails_Confirm.btnSave.Visible = false;
                    ofrmViewPersonDetails_Confirm.ShowDialog(this);
                    ofrmViewPersonDetails_Confirm.Dispose();
                    ofrmViewPersonDetails_Confirm = null;
                }
            }
        }