コード例 #1
0
        private void DeleteExchangeRate(int haulageChgID)
        {
            ChargeBLL chargeBll = new ChargeBLL();

            chargeBll.DeleteExchangeRate(haulageChgID, _userId);
            LoadExchangeRate();
            ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00010") + "');</script>", false);
        }
コード例 #2
0
        private void LoadData()
        {
            IExchangeRate exchRate = new ChargeBLL().GetExchangeRate(_exchRateId);

            if (!ReferenceEquals(exchRate, null))
            {
                txtDate.Text = exchRate.ExchangeDate.ToString(Convert.ToString(ConfigurationManager.AppSettings["DateFormat"]));
                txtRate.Text = exchRate.USDExchangeRate.ToString();
                //txtFreeDays.Text = exchRate.FreeDays.ToString();
            }
        }
コード例 #3
0
        void AddRates()
        {
            Rates = (List <IChargeRate>)ViewState["ChargeRates"];
            if (Rates == null)
            {
                Rates = new List <IChargeRate>();
            }
            oChargeBLL = new ChargeBLL();

            oChargeBLL.DeactivateAllRatesAgainstChargeId(Convert.ToInt32(hdnChargeID.Value));

            foreach (IChargeRate Rate in Rates)
            {
                Rate.ChargesID = Convert.ToInt32(hdnChargeID.Value);
                oChargeBLL.AddEditChargeRates(Rate);
            }
        }
コード例 #4
0
        private void SaveExchangeRate()
        {
            ChargeBLL     chargeBll = new ChargeBLL();
            IExchangeRate exchRate  = new ExchangeRateEntity();
            string        message   = string.Empty;

            BuildExchangeRateEntity(exchRate);
            message = chargeBll.SaveExchangeRate(exchRate, _userId);

            if (message == string.Empty)
            {
                Response.Redirect("~/View/ManageExchRate.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, message);
            }
        }
コード例 #5
0
        void FillChargeRate(int ChargesID)
        {
            //oChargeRates = new List<ChargeRateEntity>();
            oChargeBLL = new ChargeBLL();
            Rates      = new List <IChargeRate>();
            Rates      = oChargeBLL.GetChargeRates(ChargesID);
            if (Rates.Count <= 0)
            {
                IChargeRate rt = new ChargeRateEntity();
                Rates.Add(rt);
            }
            else
            {
                ViewState["ChargeRates"] = Rates;
            }

            dgChargeRates.DataSource = Rates;
            dgChargeRates.DataBind();
        }
コード例 #6
0
        void FillChargeDetails(int ChargesID)
        {
            oChargeEntity = new ChargeEntity();
            oChargeBLL    = new ChargeBLL();
            oChargeEntity = (ChargeEntity)oChargeBLL.GetChargeDetails(ChargesID);


            //oChargeEntity.ChargeActive = true;
            txtChargeName.Text = oChargeEntity.ChargeDescr;
            //ddlChargeType.SelectedIndex = ddlChargeType.Items.IndexOf(ddlChargeType.Items.FindByValue(oChargeEntity.ChargeType.ToString()));
            txtChgAbbr.Text = oChargeEntity.ChgAbbr;

            ddlCurrency.SelectedIndex = ddlCurrency.Items.IndexOf(ddlCurrency.Items.FindByValue(oChargeEntity.Currency.ToString()));
            txtEffectDate.Text        = oChargeEntity.EffectDt.ToShortDateString();
            //ddlInvLink.SelectedIndex = ddlInvLink.Items.IndexOf(ddlInvLink.Items.FindByValue(oChargeEntity.DocumentType.ToString()));
            //ddlLine.SelectedIndex = ddlLine.Items.IndexOf(ddlLine.Items.FindByValue(oChargeEntity.NVOCCID.ToString()));
            //ddlHeaderLocation.SelectedIndex = ddlHeaderLocation.Items.IndexOf(ddlHeaderLocation.Items.FindByValue(oChargeEntity.Location.ToString()));



            rdbServiceTaxApplicable.Items.FindByValue(oChargeEntity.ServiceTax.ToString().ToLower() == "true" ? "1" : "0").Selected = true;
            //rdbTerminalRequired.Items.FindByValue(oChargeEntity.IsTerminal.ToString().ToLower() == "true" ? "1" : "0").Selected = true;
            rdbRateChange.Items.FindByValue(oChargeEntity.RateChangeable.ToString().ToLower() == "true" ? "1" : "0").Selected = true;
            //rdbDestinationCharge.Items.FindByValue(oChargeEntity.DestinationCharge.ToString().ToLower() == "true" ? "1" : "0").Selected = true;

            //hdnFPOD.Value = oChargeEntity.FPOD;
            //if (oChargeEntity.FPOD != string.Empty)
            //{
            //    hdnFPOD.Value = oChargeEntity.FPOD.Substring(oChargeEntity.FPOD.IndexOf('|') + 1);
            //    txtFPOD.Text = oChargeEntity.FPOD.Substring(0, oChargeEntity.FPOD.IndexOf('|'));
            //}


            //FillServices();
            //if (ddlService.Items.Count > 0)
            //{
            //    ddlService.SelectedIndex = ddlService.Items.IndexOf(ddlService.Items.FindByValue(oChargeEntity.Service.ToString()));
            //}

            hdnChargeID.Value = oChargeEntity.ChargesID.ToString();
        }
コード例 #7
0
        private void LoadExchangeRate()
        {
            if (!ReferenceEquals(Session[Constants.SESSION_SEARCH_CRITERIA], null))
            {
                SearchCriteria searchCriteria = (SearchCriteria)Session[Constants.SESSION_SEARCH_CRITERIA];

                if (!ReferenceEquals(searchCriteria, null))
                {
                    BuildSearchCriteria(searchCriteria);
                    ChargeBLL chargeBll = new ChargeBLL();

                    gvwExch.PageIndex = searchCriteria.PageIndex;
                    if (searchCriteria.PageSize > 0)
                    {
                        gvwExch.PageSize = searchCriteria.PageSize;
                    }

                    gvwExch.DataSource = chargeBll.GetExchangeRate(searchCriteria);
                    gvwExch.DataBind();
                }
            }
        }
コード例 #8
0
        private void LoadCharge()
        {
            if (!ReferenceEquals(Session[Constants.SESSION_SEARCH_CRITERIA], null))
            {
                SearchCriteria searchCriteria = (SearchCriteria)Session[Constants.SESSION_SEARCH_CRITERIA];

                if (!ReferenceEquals(searchCriteria, null))
                {
                    BuildSearchCriteria(searchCriteria);
                    CommonBLL commonBll = new CommonBLL();

                    gvwCharge.PageIndex = searchCriteria.PageIndex;
                    if (searchCriteria.PageSize > 0)
                    {
                        gvwCharge.PageSize = searchCriteria.PageSize;
                    }

                    gvwCharge.DataSource = ChargeBLL.GetAllCharges(searchCriteria, 1, 'I');
                    gvwCharge.DataBind();
                }
            }
        }
コード例 #9
0
 private void DeleteLocation(int ChargeId)
 {
     ChargeBLL.DeleteCharge(ChargeId);
     LoadCharge();
     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00006") + "');</script>", false);
 }
コード例 #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                oChargeEntity = new ChargeEntity();
                oChargeBLL    = new ChargeBLL();


                //if (rdbRateChange.SelectedItem.Value == "0")
                //{
                //    if (ViewState["ChargeRates"] == null)
                //    {
                //        lblMessage.Text = "Please enter rates!";
                //        return;
                //    }
                //    else
                //    {
                //        Rates = (List<IChargeRate>)ViewState["ChargeRates"];
                //        if (Rates.Count() <= 0)
                //        {
                //            lblMessage.Text = "Please enter rates!";
                //            return;
                //        }
                //    }
                //}

                oChargeEntity.ChargeActive = true;
                oChargeEntity.ChargeDescr  = txtChargeName.Text.Trim();
                //oChargeEntity.ChargeType = Convert.ToInt32(ddlChargeType.SelectedValue);

                //This ID will be the companyid of the currently loggedin user
                //IUser user = (IUser)Session[Constants.SESSION_USER_INFO];
                oChargeEntity.CompanyID = 1;
                oChargeEntity.Currency  = Convert.ToInt32(ddlCurrency.SelectedValue);
                oChargeEntity.EffectDt  = Convert.ToDateTime(txtEffectDate.Text.Trim());
                oChargeEntity.IEC       = 'F';
                //oChargeEntity.IsTerminal = Convert.ToBoolean(Convert.ToInt32(rdbTerminalRequired.SelectedItem.Value));
                //oChargeEntity.IsWashing = Convert.ToBoolean(Convert.ToInt32(rdbWashing.SelectedItem.Value));
                //oChargeEntity.NVOCCID = Convert.ToInt32(ddlLine.SelectedValue);
                oChargeEntity.RateChangeable = Convert.ToBoolean(Convert.ToInt32(rdbRateChange.SelectedItem.Value));
                oChargeEntity.ServiceTax     = Convert.ToBoolean(Convert.ToInt32(rdbServiceTaxApplicable.SelectedItem.Value));
                //oChargeEntity.Location = Convert.ToInt32(ddlHeaderLocation.SelectedValue);
                oChargeEntity.ChgAbbr = txtChgAbbr.Text;

                //if (ddlService.SelectedIndex > 0)
                //    oChargeEntity.Service = Convert.ToInt32(ddlService.SelectedValue);

                //oChargeEntity.DestinationCharge = Convert.ToBoolean(rdbDestinationCharge.SelectedValue == "1" ? true : false);
                //oChargeEntity.FPOD = hdnFPOD.Value;

                //if (ddlInvLink.Items != null)
                //    oChargeEntity.DocumentType = Convert.ToInt32(ddlInvLink.SelectedValue);

                oChargeEntity.DeliveryMode = '0';

                if (Convert.ToInt32(hdnChargeID.Value) <= 0) //insert
                {
                    oChargeEntity.CreatedBy  = _userId;      // oUserEntity.Id;
                    oChargeEntity.CreatedOn  = DateTime.Today.Date;
                    oChargeEntity.ModifiedBy = _userId;      // oUserEntity.Id;
                    oChargeEntity.ModifiedOn = DateTime.Today.Date;

                    hdnChargeID.Value = oChargeBLL.AddEditCharge(oChargeEntity).ToString();

                    if (Convert.ToInt32(hdnChargeID.Value) > 0)
                    {
                        //AddRates();
                        lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00009");
                        ClearAll();
                        EnableAllField();
                        ViewState["ChargeRates"] = null;
                        //WashingSelection(rdbWashing);
                    }
                    else if (hdnChargeID.Value == "-1")
                    {
                        lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076");
                    }
                    else
                    {
                        lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011");
                    }
                }
                else   //update
                {
                    oChargeEntity.ChargesID  = Convert.ToInt32(hdnChargeID.Value);
                    oChargeEntity.ModifiedBy = _userId;// oUserEntity.Id;
                    oChargeEntity.ModifiedOn = DateTime.Today.Date;

                    switch (oChargeBLL.AddEditCharge(oChargeEntity))
                    {
                    case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011");
                        break;

                    case 1:
                        AddRates();
                        Response.Redirect("~/Forwarding/Master/FwdChargeList.aspx");
                        break;

                    case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076");
                        break;
                    }
                }
            }
        }
コード例 #11
0
        protected void dgChargeRates_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (ViewState["ChargeRates"] == null)
            {
                ViewState["ChargeRates"] = Rates;
            }
            else
            {
                Rates = (List <IChargeRate>)ViewState["ChargeRates"];
            }


            #region Save
            if (e.CommandArgument == "Save")
            {
                //if (hdnChargeID.Value != "0")
                //{
                oChargeBLL = new ChargeBLL();
                GridViewRow Row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);


                DropDownList ddlFTerminal = (DropDownList)Row.FindControl("ddlFTerminal");
                DropDownList ddlType      = (DropDownList)Row.FindControl("ddlType");
                DropDownList ddlSize      = (DropDownList)Row.FindControl("ddlSize");


                TextBox txtRateperUnit = (TextBox)Row.FindControl("txtRateperUnit");
                TextBox txtRatePerDoc  = (TextBox)Row.FindControl("txtRatePerDoc");
                TextBox txtRatePerCBM  = (TextBox)Row.FindControl("txtRatePerCBM");
                TextBox txtRatePerTON  = (TextBox)Row.FindControl("txtRatePerTON");


                HiddenField hdnFId   = (HiddenField)Row.FindControl("hdnFId");
                HiddenField hdnId    = (HiddenField)Row.FindControl("hdnId");
                HiddenField hdnFSlno = (HiddenField)Row.FindControl("hdnFSlno");


                oEntity           = new ChargeRateEntity();
                oEntity.ChargesID = Convert.ToInt32(hdnChargeID.Value);

                if (ddlFTerminal.Items.Count > 0 && ddlFTerminal.SelectedIndex >= 0)
                {
                    oEntity.TerminalId = Convert.ToInt32(ddlFTerminal.SelectedValue);
                }

                if (ddlType.Items.Count > 0 && ddlType.SelectedIndex >= 0)
                {
                    oEntity.Type = Convert.ToInt32(ddlType.SelectedValue);
                }

                if (ddlSize.Items.Count > 0 && ddlSize.SelectedIndex >= 0)
                {
                    oEntity.Size = ddlSize.SelectedValue;
                }

                oEntity.RateActive = true;

                oEntity.RatePerUnit = Convert.ToDecimal(string.IsNullOrEmpty(txtRateperUnit.Text) == false ? txtRateperUnit.Text : "0.00");
                oEntity.RatePerDoc  = Convert.ToDecimal(string.IsNullOrEmpty(txtRatePerDoc.Text) == false ? txtRatePerDoc.Text : "0.00");
                oEntity.RatePerCBM  = Convert.ToDecimal(string.IsNullOrEmpty(txtRatePerCBM.Text) == false ? txtRatePerCBM.Text : "0.00");
                oEntity.RatePerTON  = Convert.ToDecimal(string.IsNullOrEmpty(txtRatePerTON.Text) == false ? txtRatePerTON.Text : "0.00");



                if (Convert.ToInt32(hdnFSlno.Value) >= 0)
                {
                    oEntity.ChargesRateID = Convert.ToInt32(hdnFId.Value);
                    Rates.RemoveAt(Convert.ToInt32(hdnFSlno.Value));
                    Rates.Insert(Convert.ToInt32(hdnFSlno.Value), oEntity);
                    lblMessage.Text = string.Empty;

                    //IEnumerable<IChargeRate> cr = RangeValidationCheck(Convert.ToInt32(ddlHeaderLocation.SelectedValue), Convert.ToInt32(ddlFTerminal.SelectedValue), Convert.ToInt32(hdnFId.Value));
                    //if (cr.Count() <= 0)
                    //{
                    //    Rates.RemoveAt(Convert.ToInt32(hdnFSlno.Value));
                    //    Rates.Insert(Convert.ToInt32(hdnFSlno.Value), oEntity);
                    //    lblMessage.Text = string.Empty;
                    //}
                    //else
                    //{
                    //    lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00079");
                    //    return;
                    //}
                }
                else
                {
                    Rates.Add(oEntity);
                }


                ViewState["ChargeRates"] = Rates;
                FillRates();
                DisableAllField();
                //ShowHideControlofFooter(ddlChargeType);
            }

            #endregion

            #region Edit
            if (e.CommandArgument == "Edit")
            {
                GridViewRow HeaderRow = dgChargeRates.HeaderRow;

                DropDownList ddlType = (DropDownList)HeaderRow.FindControl("ddlType");


                DropDownList ddlFTerminal   = (DropDownList)HeaderRow.FindControl("ddlFTerminal");
                DropDownList ddlSize        = (DropDownList)HeaderRow.FindControl("ddlSize");
                TextBox      txtRateperUnit = (TextBox)HeaderRow.FindControl("txtRateperUnit");
                TextBox      txtRatePerDoc  = (TextBox)HeaderRow.FindControl("txtRatePerDoc");
                TextBox      txtRatePerCBM  = (TextBox)HeaderRow.FindControl("txtRatePerCBM");
                TextBox      txtRatePerTON  = (TextBox)HeaderRow.FindControl("txtRatePerTON");
                HiddenField  hdnFId         = (HiddenField)HeaderRow.FindControl("hdnFId");
                HiddenField  hdnFSlno       = (HiddenField)HeaderRow.FindControl("hdnFSlno");


                GridViewRow ItemRow       = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                HiddenField hdnTerminalId = (HiddenField)ItemRow.FindControl("hdnTerminalId");
                HiddenField hdnTypeId     = (HiddenField)ItemRow.FindControl("hdnTypeId");
                HiddenField hdnId         = (HiddenField)ItemRow.FindControl("hdnId");


                Label lblSize        = (Label)ItemRow.FindControl("lblSize");
                Label lblRatePerUnit = (Label)ItemRow.FindControl("lblRatePerUnit");
                Label lblRatePerDoc  = (Label)ItemRow.FindControl("lblRatePerDoc");
                Label lblRatePerCBM  = (Label)ItemRow.FindControl("lblRatePerCBM");
                Label lblRatePerTON  = (Label)ItemRow.FindControl("lblRatePerTON");

                //ddlType.SelectedIndex = ddlType.Items.IndexOf(ddlType.Items.FindByValue(hdnTypeId.Value));
                ddlType.SelectedValue = hdnTypeId.Value;

                ddlFTerminal.SelectedIndex = ddlFTerminal.Items.IndexOf(ddlFTerminal.Items.FindByValue(hdnTerminalId.Value));
                ddlSize.SelectedIndex      = ddlSize.Items.IndexOf(ddlSize.Items.FindByValue(lblSize.Text));

                txtRateperUnit.Text = lblRatePerUnit.Text;
                txtRatePerTON.Text  = lblRatePerTON.Text;
                txtRatePerDoc.Text  = lblRatePerDoc.Text;
                txtRatePerCBM.Text  = lblRatePerCBM.Text;

                hdnFId.Value   = hdnId.Value;
                hdnFSlno.Value = ItemRow.RowIndex.ToString();
                //UpdatePanel1.Update();
            }
            #endregion

            #region Delete
            if (e.CommandArgument == "Delete")
            {
                GridViewRow Row = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                Rates = (List <IChargeRate>)ViewState["ChargeRates"];
                Rates.RemoveAt(Row.RowIndex);
                ViewState["ChargeRates"] = Rates;
                FillRates();
                //ShowHideControlofFooter(ddlChargeType);
            }
            #endregion

            #region Cancel
            if (e.CommandArgument == "Cancel")
            {
                GridViewRow Row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);


                DropDownList ddlType      = (DropDownList)Row.FindControl("ddlType");
                DropDownList ddlFTerminal = (DropDownList)Row.FindControl("ddlFTerminal");
                DropDownList ddlSize      = (DropDownList)Row.FindControl("ddlSize");

                TextBox txtRateperUnit = (TextBox)Row.FindControl("txtRateperUnit");
                TextBox txtRatePerDoc  = (TextBox)Row.FindControl("txtRatePerDoc");
                TextBox txtRatePerCBM  = (TextBox)Row.FindControl("txtRatePerCBM");
                TextBox txtRatePerTON  = (TextBox)Row.FindControl("txtRatePerTON");

                HiddenField hdnFId   = (HiddenField)Row.FindControl("hdnFId");
                HiddenField hdnFSlno = (HiddenField)Row.FindControl("hdnFSlno");

                ddlType.SelectedIndex      = 0;
                ddlFTerminal.SelectedIndex = 0;
                //if (ddlFTerminal.Items.Count > 0)
                //{
                //    ddlFTerminal.Items.Clear();
                //}


                txtRateperUnit.Text = String.Empty; // "0.00";
                txtRatePerDoc.Text  = String.Empty; //"0.00";
                txtRatePerCBM.Text  = String.Empty; //"0.00";
                txtRatePerTON.Text  = String.Empty; //"0.00";

                hdnFId.Value   = "0";
                hdnFSlno.Value = "-1";
                //ShowHideControlofFooter(ddlChargeType);
            }
            #endregion


            //WashingSelection(rdbWashing);
            ////ShowHideControlofFooter(ddlChargeType);
            ////DisableAllField();
        }