private void SetDefault() { Filler.FillData <IContainerType>(ddlContainerType, CommonBLL.GetContainerType(), "ContainerAbbr", "ContainerTypeID", "--Container Type--"); Filler.FillData(ddlOperator, ExpSlotCostBLL.GetSlotOperatorList(new SearchCriteria() { StringParams = new List <string>() { "0", "", "", "" } }), "SlotOperatorName", "pk_SlotOperatorID", "--Operator--"); // Filler.FillData(ddlMovOrigin, ExpSlotCostBLL.GetMovementType(), "MovTypeName", "pk_MovTypeID", "--Movement Origin--"); //Filler.FillData(ddlMovDestination, ExpSlotCostBLL.GetMovementType(), "MovTypeName", "pk_MovTypeID", "--Movement Destination--"); Filler.FillData(ddlLineCode, new DBInteraction().GetNVOCCLine(-1, "").Tables[0], "NVOCCName", "pk_NVOCCID", "--Line--"); IList <SlotCost> lst = null; if (ViewState["SlotCostId"] != null) { var temp = ExpSlotCostBLL.GetSlotCost(Hid); if (temp != null) { txtLoadPort.Text = string.Empty; txtDestinationPort.Text = string.Empty; hdnLoadPort.Value = temp.Slot.PORTLOADING.ToString(); hdnDestinationPort.Value = temp.Slot.PORTDISCHARGE.ToString(); txtEffectiveDate.Text = temp.Slot.EFFECTIVEDATE.Value.ToShortDateString(); txtPodTerminal.Text = temp.Slot.PODTERMINAL; ddlOperator.SelectedValue = temp.Slot.OPERATOR.ToString(); ddlMovOrigin.SelectedValue = temp.Slot.MOVORIGIN.ToString(); //ddlMovDestination.SelectedValue = temp.Slot.MOVDESTINATION.ToString(); ddlLineCode.SelectedValue = temp.Slot.LINE.ToString(); txtLoadPort.Text = temp.Slot.PORTLOADINGNAME; txtDestinationPort.Text = temp.Slot.PORTDISCHARGENAME; GetSlotCost = temp.SlotCostList; lst = temp.SlotCostList; } } else { lst = new List <SlotCost>(); } Filler.GridDataBind(lst, gvwSlotCost); }
protected void btnSave_Click(object sender, EventArgs e) { var lst = GetSlotCost; SlotCostModel slotCostModel = new SlotCostModel { CompanyID = 1, UserId = user.Id, Slot = new Slot { EFFECTIVEDATE = Convert.ToDateTime(txtEffectiveDate.Text.Trim()), LINE = Convert.ToInt64(ddlLineCode.SelectedValue), //MOVDESTINATION = Convert.ToInt32(ddlMovDestination.SelectedValue), MOVORIGIN = Convert.ToInt32(ddlMovOrigin.SelectedValue), OPERATOR = Convert.ToInt32(ddlOperator.SelectedValue), PODTERMINAL = txtPodTerminal.Text, PORTDISCHARGE = Convert.ToInt64(hdnDestinationPort.Value), PORTLOADING = Convert.ToInt64(hdnLoadPort.Value), SLOTID = 0 }, SlotCostList = GetSlotCost }; var retrunVal = 0; if (ViewState["SlotCostId"] != null) { slotCostModel.Slot.SLOTID = Convert.ToInt64(ViewState["SlotCostId"]); retrunVal = ExpSlotCostBLL.UpdateSlotCost(slotCostModel); } else { retrunVal = ExpSlotCostBLL.SaveSlotCost(slotCostModel); } if (retrunVal > 0) { Session.Remove("lstslotcost"); ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Saved successfully.');", true); Response.Redirect("~/MasterModule/ExpSlotCostList.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Error! Please try again.')", true); } }