//private void CheckReportType()
        //{
        //    try
        //    {
        //        if (hdnBorrowerType.Value.ToUpper() == "C")
        //        {
        //            lblBtype.Text = "Corporate";
        //            lblDob.Text = "Date of Eshtablishment";

        //            divIndividual.Attributes.CssStyle.Add("display", "none");
        //            divCorporate.Attributes.CssStyle.Add("display", "block");
        //            divGender.Attributes.CssStyle.Add("display", "none");
        //        }
        //        else
        //        {
        //            lblBtype.Text = "Individual";
        //            lblDob.Text = "Date of Birth";

        //            divIndividual.Attributes.CssStyle.Add("display", "block");
        //            divCorporate.Attributes.CssStyle.Add("display", "none");
        //            divGender.Attributes.CssStyle.Add("display", "block");
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        objMasters.InsertWebsiteLog(Common.TOKEN, "ucReportDebt.aspx.cs", "CheckReportType", "", ex.ToString());
        //    }
        //}

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Guid _reportId = Guid.NewGuid();

            try
            {
                #region UserReportReportingType
                List<UserReportReportingType> objLReportingType = new List<UserReportReportingType>();
                UserReportReportingType objReportingType;

                if (chkReportType1.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 1;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType2.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 2;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType3.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 3;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType4.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 4;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType5.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 5;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType6.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 6;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType7.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 7;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType8.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 8;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType9.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 9;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                if (chkReportType10.Checked)
                {
                    objReportingType = new UserReportReportingType();
                    objReportingType.REPORTID = _reportId;
                    objReportingType.REPORTINGTYPE = 10;
                    objReportingType.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                    objReportingType.STATUS = true;
                    objLReportingType.Add(objReportingType);
                }

                #endregion

                #region UserReportDetail
                UserReportDetail objRequest = new UserReportDetail();
                objRequest.ID = _reportId;
                objRequest.REPORTID = "R" + Convert.ToString(DateTime.Now.ToString("yyyyMMddHHmmss"));

                objRequest.UNIQUEUSERID = objMasters.GenerateCorporateUniqueId(txtBCompanyname.Text.Trim(), Convert.ToDateTime(txtDob.Value.Trim()));
                objRequest.REPORTTYPE = 2;

                #region Borrower's Details
                objRequest.FIRSTNAME = txtBFirstname.Text.Trim();
                objRequest.LASTNAME = txtBLastname.Text.Trim();
                objRequest.COMPANYNAME = txtBCompanyname.Text.Trim();
                objRequest.DOB = Convert.ToDateTime(txtDob.Value.Trim());

                objRequest.GENDER = 0;
                objRequest.BUSINESSTYPEID = Convert.ToInt32(ddlBusiness.SelectedValue);
                objRequest.EMAIL = txtEmail.Text.Trim();
                objRequest.MOBILE = txtMobile.Text.Trim();
                #endregion

                #region Borrower's Address Details
                objRequest.ADDRESS = txtBAddress.Text.Trim();
                objRequest.PINCODE = txtBPincode.Text.Trim();
                objRequest.STATEID = Convert.ToInt32(ddlBState.SelectedValue);
                objRequest.CITYID = Convert.ToInt32(ddlBCity.SelectedValue);
                #endregion

                #region Borrower's ID Details
                objRequest.PAN = txtPAN.Text.Trim().ToUpper();

                objRequest.SHOPESTABLISHMENT = txtShopEstablishment.Text.Trim().ToUpper();
                objRequest.VAT = txtVat.Text.Trim().ToUpper();
                objRequest.CST = txtCst.Text.Trim().ToUpper();

                #endregion

                #region Borrower's Borrowing Details

                objRequest.BORROWINGDATE = Convert.ToDateTime(txtBorrowingDate.Value.Trim());
                objRequest.BORROWINGAMOUNT = txtBorrowingAmount.Text.Trim();
                objRequest.HIDEBORROWINGAMOUNT = chkHideAmount.Checked;
                objRequest.BORROWINGDESCRIPTION = txtDescription.Text.Trim();

                #endregion

                objRequest.ISVERIFIED = 0;
                objRequest.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                objRequest.STATUS = true;

                #endregion

                #region Borrower's Other Details

                UserReportOtherDetails objOtherDetails = new UserReportOtherDetails();

                objOtherDetails.REPORTID = _reportId;
                objOtherDetails.COMMERCIALPREMISES = Convert.ToInt32(ddlCommercialPremises.SelectedValue);
                objOtherDetails.OPERATESMORETHANONEBANKACCOUNT = Convert.ToInt32(ddlMoreBankAccount.SelectedValue);
                objOtherDetails.RESIDENTIALPREMISES = Convert.ToInt32(ddlResidentialPremises.SelectedValue);
                objOtherDetails.PREVIOUSPAYMENTBEHAVIOUR = Convert.ToInt32(ddlPaymentBehavior.SelectedValue);
                objOtherDetails.LIVINGATPRESENTADDRESS = Convert.ToInt32(ddlLivingAddress.SelectedValue);
                objOtherDetails.CHEQUERETURNHABIT = Convert.ToInt32(ddlChequeReturn.SelectedValue);
                objOtherDetails.LIVINGWITHFAMILY = Convert.ToInt32(ddlLivingWith.SelectedValue);
                //objOtherDetails.FINANCIALWORTHINESS = Convert.ToInt32(ddlFinancialWorthiness.SelectedValue);
                //objOtherDetails.SOCIALSTATUS = Convert.ToInt32(ddlSocialStatus.SelectedValue);
                objOtherDetails.RELATIONSHIPPERIOD = Convert.ToInt32(ddlRelationshipPeriod.SelectedValue);
                objOtherDetails.CREATEDBY = new Guid(Request.Cookies["USERID"].Value);
                objOtherDetails.STATUS = true;

                #endregion

                objReport = new Report();
                int _result1 = objReport.InsertUserReportDetails(objRequest);
                int _result2 = objReport.InsertUserReportReportingType(objLReportingType);
                int _result3 = objReport.InsertUserReportOtherDetails(objOtherDetails);

                if (_result1 == 1 && _result2 == 1 && _result3 == 1)
                {
                    SendReportingEmailtoReporter(objRequest);
                    SendReportingEmailtoBorrower(objRequest);
                    Response.Redirect("~/thank-you/report-debt.aspx", false);
                }
                else
                {
                    lblMsg.Text = "Oops! Seems like there is some problem while reporting.";
                }
            }
            catch (Exception ex)
            {
                objMasters.InsertWebsiteLog(Common.TOKEN, "ucReportDebt.aspx.cs", "btnSubmit_Click", "", ex.ToString());
            }
        }
 private void SendReportingEmailtoReporter(UserReportDetail objRequest)
 {
     try
     {
         //TODO:write code for emailing
     }
     catch (Exception ex)
     {
         objMasters.InsertWebsiteLog(Common.TOKEN, "ucReportDebt.aspx.cs", "SendReportingEmailtoReporter", JsonConvert.SerializeObject(objRequest), ex.ToString());
     }
 }
        private void SendReportingEmailtoBorrower(UserReportDetail objReportDetails)
        {
            try
            {
                objUser = new User();
                EmailContent objEmailContent = objUser.GetEmailTemplatebyID(4);
                UserDetails objUserDetails = objUser.GetRegisteredUserDetails(new Guid(Request.Cookies["USERID"].Value));

                objEmailContent.ToAddress = objReportDetails.EMAIL;
                objEmailContent.IsEmailTemplate = true;
                Dictionary<string, string> Obj = new Dictionary<string, string>();
                List<Dictionary<string, string>> List = new List<Dictionary<string, string>>();
                Obj.Add("XXXREPORTERNAMEXXX", objUserDetails.FIRSTNAME + " " + objUserDetails.LASTNAME);
                Obj.Add("XXXREPORTIDXXX", objReportDetails.REPORTID);
                Obj.Add("XXXBORROWINGDATEXXX", objReportDetails.BORROWINGDATE.ToString("dd/MM/yyyy"));
                Obj.Add("XXXBORROWINGAMOUNTXXX", objReportDetails.BORROWINGAMOUNT);

                List.Add(Obj);
                objEmailContent.TemplateObject = new List<Dictionary<string, string>>();
                objEmailContent.TemplateObject = List;
                objUser.Send(objEmailContent);
            }
            catch (Exception ex)
            {
                objMasters.InsertWebsiteLog(Common.TOKEN, "ucReportDebt.aspx.cs", "SendReportingEmailtoBorrower", JsonConvert.SerializeObject(objReportDetails), ex.ToString());
            }
        }
Ejemplo n.º 4
0
        public int InsertUserReportDetails(UserReportDetail objRequest)
        {
            int result = -1;
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[34];
                sqlParams[0] = new SqlParameter("@ID", SqlDbType.UniqueIdentifier);
                sqlParams[0].Value = objRequest.ID;
                sqlParams[1] = new SqlParameter("@UNIQUEUSERID", SqlDbType.VarChar);
                sqlParams[1].Value = objRequest.UNIQUEUSERID;
                sqlParams[2] = new SqlParameter("@BUSINESSTYPEID", SqlDbType.Int);
                sqlParams[2].Value = objRequest.BUSINESSTYPEID;
                sqlParams[3] = new SqlParameter("@FIRSTNAME", SqlDbType.VarChar);
                sqlParams[3].Value = objRequest.FIRSTNAME;
                sqlParams[4] = new SqlParameter("@LASTNAME", SqlDbType.VarChar);
                sqlParams[4].Value = objRequest.LASTNAME;
                sqlParams[5] = new SqlParameter("@NICKNAME", SqlDbType.VarChar);
                sqlParams[5].Value = objRequest.NICKNAME;
                sqlParams[6] = new SqlParameter("@COMPANYNAME", SqlDbType.VarChar);
                sqlParams[6].Value = objRequest.COMPANYNAME;
                sqlParams[7] = new SqlParameter("@GENDER", SqlDbType.Int);
                sqlParams[7].Value = objRequest.GENDER;
                sqlParams[8] = new SqlParameter("@DOB", SqlDbType.DateTime);
                sqlParams[8].Value = objRequest.DOB;
                sqlParams[9] = new SqlParameter("@EMAIL", SqlDbType.VarChar);
                sqlParams[9].Value = objRequest.EMAIL;
                sqlParams[10] = new SqlParameter("@MOBILE", SqlDbType.VarChar);
                sqlParams[10].Value = objRequest.MOBILE;
                sqlParams[11] = new SqlParameter("@ADDRESS", SqlDbType.VarChar);
                sqlParams[11].Value = objRequest.ADDRESS;
                sqlParams[12] = new SqlParameter("@PINCODE", SqlDbType.VarChar);
                sqlParams[12].Value = objRequest.PINCODE;
                sqlParams[13] = new SqlParameter("@COUNTRYID", SqlDbType.Int);
                sqlParams[13].Value = objRequest.COUNTRYID;
                sqlParams[14] = new SqlParameter("@STATEID", SqlDbType.Int);
                sqlParams[14].Value = objRequest.STATEID;
                sqlParams[15] = new SqlParameter("@CITYID", SqlDbType.Int);
                sqlParams[15].Value = objRequest.CITYID;
                sqlParams[16] = new SqlParameter("@PAN", SqlDbType.VarChar);
                sqlParams[16].Value = objRequest.PAN;
                sqlParams[17] = new SqlParameter("@ADHAR", SqlDbType.VarChar);
                sqlParams[17].Value = objRequest.ADHAR;
                sqlParams[18] = new SqlParameter("@PASSPORT", SqlDbType.VarChar);
                sqlParams[18].Value = objRequest.PASSPORT;
                //sqlParams[19] = new SqlParameter("@VOTER", SqlDbType.VarChar);
                //sqlParams[19].Value = objRequest.VOTER;
                //sqlParams[20] = new SqlParameter("@RATIONCARD", SqlDbType.VarChar);
                //sqlParams[20].Value = objRequest.RATIONCARD;
                sqlParams[21] = new SqlParameter("@DRIVINGLICENSE", SqlDbType.VarChar);
                sqlParams[21].Value = objRequest.DRIVINGLICENSE;
                sqlParams[22] = new SqlParameter("@VAT", SqlDbType.VarChar);
                sqlParams[22].Value = objRequest.VAT;
                sqlParams[23] = new SqlParameter("@CST", SqlDbType.VarChar);
                sqlParams[23].Value = objRequest.CST;
                sqlParams[24] = new SqlParameter("@SHOPESTABLISHMENT", SqlDbType.VarChar);
                sqlParams[24].Value = objRequest.SHOPESTABLISHMENT;
                sqlParams[25] = new SqlParameter("@BORROWERPHOTO", SqlDbType.VarBinary);
                sqlParams[25].Value = objRequest.BORROWERPHOTO;
                sqlParams[26] = new SqlParameter("@BORROWINGDATE", SqlDbType.DateTime);
                sqlParams[26].Value = objRequest.BORROWINGDATE;
                sqlParams[27] = new SqlParameter("@BORROWINGAMOUNT", SqlDbType.VarChar);
                sqlParams[27].Value = objRequest.BORROWINGAMOUNT;
                sqlParams[28] = new SqlParameter("@BORROWINGDESCRIPTION", SqlDbType.VarChar);
                sqlParams[28].Value = objRequest.BORROWINGDESCRIPTION;
                sqlParams[29] = new SqlParameter("@ISVERIFIED", SqlDbType.Bit);
                sqlParams[29].Value = objRequest.ISVERIFIED;
                sqlParams[30] = new SqlParameter("@CREATEDBY", SqlDbType.UniqueIdentifier);
                sqlParams[30].Value = objRequest.CREATEDBY;
                sqlParams[31] = new SqlParameter("@STATUS", SqlDbType.Bit);
                sqlParams[31].Value = objRequest.STATUS;
                sqlParams[32] = new SqlParameter("@HIDEBORROWINGAMOUNT", SqlDbType.Bit);
                sqlParams[32].Value = objRequest.HIDEBORROWINGAMOUNT;
                sqlParams[33] = new SqlParameter("@REPORTID", SqlDbType.VarChar);
                sqlParams[33].Value = objRequest.REPORTID;

                result = CExecuteNonQuery("USP_INSERTUSERREPORTINGDETAILS", sqlParams);
            }
            catch (Exception ex)
            {
                InsertWebsiteLog(Common.TOKEN, "Report.cs", "InsertUserReportDetails", JsonConvert.SerializeObject(objRequest), ex.ToString());
            }
            return result;
        }