private void SaveParty()
        {
            var result = new PartyBLL().SaveParty(ExtractData(), Mode);

            if (result > 0)
            {
                PartyId = result;
                if (KYCUpload.HasFile)
                {
                    var fileName = KYCUpload.FileName;
                    var filext   = fileName.Substring(fileName.LastIndexOf(".") + 1);
                    if (filext.ToLower() != "pdf")
                    {
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Only pdf file is accepted!');</script>", false);
                        return;
                    }
                    var path        = Server.MapPath("~/Forwarding/KYCUploads");
                    var newFileName = "KYC" + PartyId.ToString().TrimEnd();  //  Guid.NewGuid().ToString();

                    if (!string.IsNullOrEmpty(path))
                    {
                        path            += @"\" + newFileName + System.IO.Path.GetExtension(fileName);
                        hdnKYCPath.Value = path;
                        KYCUpload.PostedFile.SaveAs(path);
                    }
                }
                Response.Redirect("~/Forwarding/Master/ManageParties.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RetriveParameters();
            if (!IsPostBack)
            {
                LoadDefault();
                //lblUploadedFileName.Text = "";

                if (Request.QueryString["GroupId"] != string.Empty)
                {
                    try
                    {
                        var id  = GeneralFunctions.DecryptQueryString(Request.QueryString["GroupId"]);
                        var pid = Convert.ToInt32(id);
                        if (pid > 0)
                        {
                            PartyId = pid;
                            LoadData(pid);
                        }
                    }
                    catch { }
                }
            }
            CheckUserAccess(PartyId.ToString());
        }
Example #3
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomTariffSerializer">A delegate to serialize custom tariff JSON objects.</param>
        /// <param name="CustomTariffElementSerializer">A delegate to serialize custom tariff element JSON objects.</param>
        /// <param name="CustomPriceComponentSerializer">A delegate to serialize custom price component JSON objects.</param>
        /// <param name="CustomTariffRestrictionsSerializer">A delegate to serialize custom tariff restrictions JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <Tariff> CustomTariffSerializer = null,
                              CustomJObjectSerializerDelegate <TariffElement> CustomTariffElementSerializer           = null,
                              CustomJObjectSerializerDelegate <PriceComponent> CustomPriceComponentSerializer         = null,
                              CustomJObjectSerializerDelegate <TariffRestrictions> CustomTariffRestrictionsSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("country_code", CountryCode.ToString()),
                new JProperty("party_id", PartyId.ToString()),
                new JProperty("id", Id.ToString()),

                new JProperty("currency", Currency.ToString()),

                TariffType.HasValue
                               ? new JProperty("type", TariffType.Value.ToString())
                               : null,

                TariffAltText.SafeAny()
                               ? new JProperty("tariff_alt_text", new JArray(TariffAltText.Select(tariffAltText => tariffAltText.ToJSON())))
                               : null,

                TariffAltURL.HasValue
                               ? new JProperty("tariff_alt_url", TariffAltURL.ToString())
                               : null,

                MinPrice.HasValue
                               ? new JProperty("min_price", MinPrice.Value.ToJSON())
                               : null,

                MaxPrice.HasValue
                               ? new JProperty("max_price", MaxPrice.Value.ToJSON())
                               : null,

                TariffElements.SafeAny()
                               ? new JProperty("elements", new JArray(TariffElements.Select(tariffElement => tariffElement.ToJSON(CustomTariffElementSerializer,
                                                                                                                                  CustomPriceComponentSerializer,
                                                                                                                                  CustomTariffRestrictionsSerializer))))
                               : null,

                Start.HasValue
                               ? new JProperty("start_date_time", Start.Value.ToIso8601())
                               : null,

                End.HasValue
                               ? new JProperty("end_date_time", End.Value.ToIso8601())
                               : null,

                EnergyMix != null
                               ? new JProperty("energy_mix", EnergyMix.ToJSON())
                               : null,

                new JProperty("last_updated", LastUpdated.ToIso8601())

                );

            return(CustomTariffSerializer != null
                       ? CustomTariffSerializer(this, JSON)
                       : JSON);
        }
        private void LoadData(int id)
        {
            var src = new PartyBLL().GetParty(id, new SearchCriteria()
            {
                StringParams = new List <string>()
                {
                    "0", ""
                }
            });

            if (src != null && src.Count() > 0)
            {
                var party = src.FirstOrDefault();
                txtEmailID.Text       = party.emailID;
                txtContactPerson.Text = party.ContactPerson;
                txtAddress.Text       = party.PartyAddress;
                txtFAX.Text           = party.FAX;
                txtPAN.Text           = party.PAN;
                txtPartyName.Text     = party.PartyName;
                txtPhone.Text         = party.Phone;
                txtMob.Text           = party.Mobile;
                txtTAN.Text           = party.TAN;
                txtFullName.Text      = party.FullName;
                hdnKYCPath.Value      = "KYC" + PartyId.ToString().TrimEnd();
                //ddlLine.SelectedValue = party.fLineID.ToString();
                ddlPartyType.SelectedValue       = party.PartyType.ToString();
                ddlGroup.SelectedValue           = party.GroupID.ToString();
                ddlPrincipal.SelectedValue       = party.PrincipalID.ToString();
                AutoCompleteCountry1.CountryId   = party.CountryID.ToString();
                AutoCompleteCountry1.CountryName = party.CountryName;


                var path        = Server.MapPath("~/Forwarding/KYCUploads");
                var newFileName = "KYC" + PartyId.ToString().TrimEnd();  //  Guid.NewGuid().ToString();

                if (!string.IsNullOrEmpty(path))
                {
                    path += @"\" + newFileName + ".pdf";
                    //System.IO.Path.GetExtension(fileName);
                    hdnKYCPath.Value = path;
                    if (File.Exists(path))
                    {
                        lnkKYCUpload.Enabled = true;
                        lnkKYCUpload.Text    = newFileName + ".pdf";
                        //lblUploadedFileName.Text = newFileName;
                        //lblUploadedFileName.Visible = true;
                    }
                }
            }
        }
Example #5
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomTokenSerializer">A delegate to serialize custom token JSON objects.</param>
        /// <param name="CustomEnergyContractSerializer">A delegate to serialize custom energy contract JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <Token> CustomTokenSerializer = null,
                              CustomJObjectSerializerDelegate <EnergyContract> CustomEnergyContractSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("country_code", CountryCode.ToString()),
                new JProperty("party_id", PartyId.ToString()),
                new JProperty("uid", Id.ToString()),
                new JProperty("type", Type.ToString()),
                new JProperty("contract_id", ContractId.ToString()),

                VisualNumber.IsNotNullOrEmpty()
                               ? new JProperty("visual_number", VisualNumber)
                               : null,

                new JProperty("issuer", Issuer),

                GroupId.HasValue
                               ? new JProperty("group_id", GroupId.ToString())
                               : null,

                new JProperty("valid", IsValid),
                new JProperty("whitelist", WhitelistType.ToString()),

                UILanguage.HasValue
                               ? new JProperty("language", UILanguage.ToString())
                               : null,

                DefaultProfile.HasValue
                               ? new JProperty("default_profile_type", DefaultProfile.ToString())
                               : null,

                EnergyContract.HasValue
                               ? new JProperty("energy_contract", EnergyContract.Value.ToJSON(CustomEnergyContractSerializer))
                               : null,

                new JProperty("last_updated", LastUpdated.ToIso8601())

                );

            return(CustomTokenSerializer != null
                       ? CustomTokenSerializer(this, JSON)
                       : JSON);
        }
Example #6
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="Embedded">Whether this data is embedded into another data structure.</param>
        /// <param name="CustomRemotePartySerializer">A delegate to serialize custom remote party JSON objects.</param>
        /// <param name="CustomBusinessDetailsSerializer">A delegate to serialize custom business details JSON objects.</param>
        /// <param name="IncludeCryptoHash">Include the crypto hash value of this object.</param>
        public JObject ToJSON(Boolean Embedded,
                              CustomJObjectSerializerDelegate <RemoteParty> CustomRemotePartySerializer         = null,
                              CustomJObjectSerializerDelegate <BusinessDetails> CustomBusinessDetailsSerializer = null,
                              Boolean IncludeCryptoHash = false)
        {
            var JSON = JSONObject.Create(

                Id.ToJSON("@id"),

                Embedded
                               ? new JProperty("@context", DefaultJSONLDContext.ToString())
                               : null,

                new JProperty("countryCode", CountryCode.ToString()),
                new JProperty("partyId", PartyId.ToString()),
                new JProperty("role", Role.ToString()),
                new JProperty("partyStatus", Status.ToString()),

                BusinessDetails != null
                               ? new JProperty("businessDetails", BusinessDetails.ToJSON(CustomBusinessDetailsSerializer))
                               : null,

                _AccessInfo.SafeAny()
                               ? new JProperty("accessInfos", new JArray(_AccessInfo.SafeSelect(accessInfo => accessInfo.ToJSON())))
                               : null,

                _RemoteAccessInfos.SafeAny()
                               ? new JProperty("remoteAccessInfos", new JArray(_RemoteAccessInfos.SafeSelect(remoteAccessInfo => remoteAccessInfo.ToJSON())))
                               : null,

                new JProperty("last_updated", LastUpdated.ToIso8601()),

                IncludeCryptoHash
                               ? new JProperty("sha256Hash", SHA256Hash)
                               : null

                );

            return(CustomRemotePartySerializer != null
                       ? CustomRemotePartySerializer(this, JSON)
                       : JSON);
        }
Example #7
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomCredentialsRoleSerializer">A delegate to serialize custom credentials roles JSON objects.</param>
        /// <param name="CustomBusinessDetailsSerializer">A delegate to serialize custom business details JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <CredentialsRole> CustomCredentialsRoleSerializer = null,
                              CustomJObjectSerializerDelegate <BusinessDetails> CustomBusinessDetailsSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("country_code", CountryCode.ToString()),
                new JProperty("party_id", PartyId.ToString()),
                new JProperty("role", Role.ToString()),
                new JProperty("business_details", BusinessDetails.ToJSON(CustomBusinessDetailsSerializer))

                //AllowDowngrades.HasValue
                //    ? new JProperty("allow_downgrades",  AllowDowngrades.Value)
                //    : null

                );

            return(CustomCredentialsRoleSerializer != null
                       ? CustomCredentialsRoleSerializer(this, JSON)
                       : JSON);
        }
Example #8
0
        private void LoadData()
        {
            MoneyReceiptsBLL mrBll = new MoneyReceiptsBLL();
            int       PartyId;
            DataTable dt;

            if (_AdvanceId == 0)
            {
                dt = mrBll.GetInvoiceDetailForAdvance(_AdvanceId, _jobid, _PaymentType);

                txtDate.Text    = DateTime.Now.ToShortDateString();
                txtJobNo.Text   = dt.Rows[0]["JOBNO"].ToString();
                txtJobDate.Text = Convert.ToDateTime(dt.Rows[0]["JOBDATE"].ToString()).ToString("dd/MM/yyyy");
                hdnJobID.Value  = dt.Rows[0]["pk_JobID"].ToString();
            }
            else
            {
                dt              = mrBll.GetAdvanceforEdit(_AdvanceId, _jobid, _PaymentType);
                txtChqNo.Text   = dt.Rows[0]["ChequeNo"].ToString();
                txtChqDate.Text = dt.Rows[0]["ChequeDate"].ToString().Split(' ')[0];
                //ddlParty.SelectedValue = dt.Rows[0]["fk_PartyID"].ToString();
                ddlPartyType.SelectedValue = dt.Rows[0]["fk_PartyTypeID"].ToString();
                txtJobNo.Text         = dt.Rows[0]["JobNo"].ToString();
                txtChequeAmt.Text     = dt.Rows[0]["ChequePayment"].ToString();
                txtCashAmt.Text       = dt.Rows[0]["CashPayment"].ToString();
                txtBankName.Text      = dt.Rows[0]["ChequeBank"].ToString();
                txtMRNo.Text          = dt.Rows[0]["pmtReference"].ToString();
                PartyId               = dt.Rows[0]["fk_PartyID"].ToInt();
                txtDate.Text          = dt.Rows[0]["pmtDate"].ToString().Split(' ')[0];
                txtJobDate.Text       = dt.Rows[0]["JobDate"].ToString().Split(' ')[0];
                txtCurrentAmount.Text = (txtCashAmt.Text.ToDecimal() + txtChequeAmt.Text.ToDecimal()).ToString();
                hdnJobID.Value        = dt.Rows[0]["fk_JobID"].ToString();
                GetPartyValuesSetToDdl(ddlPartyType.SelectedValue.ToInt());
                ddlParty.SelectedValue = PartyId.ToString();
            }
            //if (_PaymentType == "C")
            //{
            //    ddlParty.SelectedValue = Convert.ToString(dt.Rows[0]["fk_CreditorID"]);
            //    ddlParty.Enabled = false;
            //}
        }
Example #9
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomSessionSerializer">A delegate to serialize custom session JSON objects.</param>
        /// <param name="CustomCDRTokenSerializer">A delegate to serialize custom charge detail record token JSON objects.</param>
        /// <param name="CustomEnergyMeterSerializer">A delegate to serialize custom energy meter JSON objects.</param>
        /// <param name="CustomTransparencySoftwareSerializer">A delegate to serialize custom transparency software JSON objects.</param>
        /// <param name="CustomChargingPeriodSerializer">A delegate to serialize custom charging period JSON objects.</param>
        /// <param name="CustomCDRDimensionSerializer">A delegate to serialize custom charge detail record dimension JSON objects.</param>
        /// <param name="CustomPriceSerializer">A delegate to serialize custom price JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <Session> CustomSessionSerializer         = null,
                              CustomJObjectSerializerDelegate <CDRToken> CustomCDRTokenSerializer       = null,
                              CustomJObjectSerializerDelegate <EnergyMeter> CustomEnergyMeterSerializer = null,
                              CustomJObjectSerializerDelegate <TransparencySoftware> CustomTransparencySoftwareSerializer = null,
                              CustomJObjectSerializerDelegate <ChargingPeriod> CustomChargingPeriodSerializer             = null,
                              CustomJObjectSerializerDelegate <CDRDimension> CustomCDRDimensionSerializer = null,
                              CustomJObjectSerializerDelegate <Price> CustomPriceSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("country_code", CountryCode.ToString()),
                new JProperty("party_id", PartyId.ToString()),
                new JProperty("id", Id.ToString()),

                new JProperty("start_date_time", Start.ToIso8601()),

                End.HasValue
                               ? new JProperty("end_date_time", End.Value.ToIso8601())
                               : null,

                new JProperty("kwh", kWh),

                new JProperty("cdr_token", CDRToken.ToJSON(CustomCDRTokenSerializer)),
                new JProperty("auth_method", AuthMethod.ToString()),

                AuthorizationReference.HasValue
                               ? new JProperty("authorization_reference", AuthorizationReference.ToString())
                               : null,

                new JProperty("location_id", LocationId.ToString()),
                new JProperty("evse_uid", EVSEUId.ToString()),
                new JProperty("connector_id", ConnectorId.ToString()),

                MeterId.HasValue
                               ? new JProperty("meter_id", MeterId.ToString())
                               : null,

                EnergyMeter != null
                               ? new JProperty("energy_meter", EnergyMeter.ToJSON(CustomEnergyMeterSerializer))
                               : null,

                TransparencySoftwares.SafeAny()
                               ? new JProperty("transparency_softwares", new JArray(TransparencySoftwares.Select(software => software.ToJSON(CustomTransparencySoftwareSerializer))))
                               : null,

                new JProperty("currency", Currency.ToString()),

                ChargingPeriods.SafeAny()
                               ? new JProperty("charging_periods", new JArray(ChargingPeriods.Select(chargingPeriod => chargingPeriod.ToJSON(CustomChargingPeriodSerializer,
                                                                                                                                             CustomCDRDimensionSerializer))))
                               : null,

                TotalCosts.HasValue
                               ? new JProperty("total_cost", TotalCosts.Value.ToJSON(CustomPriceSerializer))
                               : null,

                new JProperty("status", Status.ToString()),


                new JProperty("last_updated", LastUpdated.ToIso8601())

                );

            return(CustomSessionSerializer != null
                       ? CustomSessionSerializer(this, JSON)
                       : JSON);
        }