private void DeleteTransaction(int TranId) { ContainerTranBLL oBll = new ContainerTranBLL(); oBll.DeleteTransaction(TranId); LoadContainer(0, _userLocation); ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00006") + "');</script>", false); }
void fillContainer(int EmptyYardId) { ContainerTranBLL oContainerTranBLL = new ContainerTranBLL(); dtFilteredContainer = oContainerTranBLL.GetContainerTransactionListFiltered(Convert.ToInt16(ddlFromStatus.SelectedValue), EmptyYardId, Convert.ToDateTime(txtDate.Text), Convert.ToInt16(ddlLine.SelectedValue)); ViewState["Container"] = dtFilteredContainer; gvContainer.DataSource = dtFilteredContainer; gvContainer.DataBind(); }
//private int _reqfield = 0; protected void Page_Load(object sender, EventArgs e) { RetriveParameters(); _userId = UserBLL.GetLoggedInUserId(); _userLocation = UserBLL.GetUserLocation(); //Get user permission. UserBLL.GetUserPermission(out _canAdd, out _canEdit, out _canDelete, out _canView); //_userId = EMS.BLL.UserBLL.GetLoggedInUserId(); if (!Page.IsPostBack) { string strProcessScript = "this.value='Processing...';this.disabled=true;"; btnSave.Attributes.Add("onclick", strProcessScript + ClientScript.GetPostBackEventReference(btnSave, "").ToString()); fillAllDropdown(); CheckUserAccess(hdnContainerTransactionId.Value); //if (lblTranCode.Text == string.Empty && hdnContainerTransactionId.Value == "0") if (hdnTranCode.Value == string.Empty && hdnContainerTransactionId.Value == "0") { DataTable Dt = CreateDataTable(); DataRow dr = Dt.NewRow(); dr["Editable"] = true; Dt.Rows.Add(dr); gvSelectedContainer.DataSource = Dt; gvSelectedContainer.DataBind(); txtDate.Text = DateTime.Now.ToShortDateString(); } else { btnShow.Visible = false; txtDate.Attributes.Add("onchange", "ChangeActivityDate(this);"); ContainerTranBLL oContainerTranBLL = new ContainerTranBLL(); SearchCriteria searchCriteria = new SearchCriteria(); DataSet ds = new DataSet(); if (!string.IsNullOrEmpty(hdnContainerTransactionId.Value)) { ds = oContainerTranBLL.GetContainerTransactionList(searchCriteria, Convert.ToInt32(hdnContainerTransactionId.Value), _userLocation); } //else if(!string.IsNullOrEmpty(lblTranCode.Text)) else if (!string.IsNullOrEmpty(hdnTranCode.Value)) { searchCriteria.StringOption4 = hdnTranCode.Value; ds = oContainerTranBLL.GetContainerTransactionList(searchCriteria, 0, _userLocation); } FillHeaderDetail(ds.Tables[0]); DisableHeaderSection(); FillContainers(ds.Tables[1]); } } //CheckUserAccess(hdnContainerTransactionId.Value); }
private void PopulateBookingNo(int Loc, int Line, int EmptyYard) { DataTable dt = ContainerTranBLL.GetBookingList(Loc, Line, EmptyYard); if (!ReferenceEquals(dt, null)) { ddlBookingNo.DataValueField = "BookingId"; ddlBookingNo.DataTextField = "BookingNo"; ddlBookingNo.DataSource = dt; ddlBookingNo.DataBind(); ddlBookingNo.Items.Insert(0, new ListItem(Constants.DROPDOWNLIST_DEFAULT_TEXT, Constants.DROPDOWNLIST_DEFAULT_VALUE)); } }
//public string[] GetBLNoList(string prefixText, int count,int Location, int Line) public string[] GetExpBLNoList(string prefixText, int count) { //int Location = Convert.ToInt32(contextKey.Split('|')[0].ToString()); //int Line = Convert.ToInt32(contextKey.Split('|')[1].ToString()); ContainerTranBLL oExpContBLL = new ContainerTranBLL(); DataTable dt = oExpContBLL.GetExpBLno(prefixText); string[] BlNos = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { BlNos[i] = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(Convert.ToString(dt.Rows[i]["BLNo"]), Convert.ToString(dt.Rows[i]["BLID"])); } return(BlNos); }
private void LoadContainer(int MovementId, int Locationid) { 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(); ContainerTranBLL oContainerTranBLL = new ContainerTranBLL(); gvwContainerTran.PageIndex = searchCriteria.PageIndex; if (searchCriteria.PageSize > 0) { gvwContainerTran.PageSize = searchCriteria.PageSize; } gvwContainerTran.DataSource = oContainerTranBLL.GetContainerTransactionList(searchCriteria, MovementId, Locationid).Tables[0]; gvwContainerTran.DataBind(); } } }
protected void btnSave_Click(object sender, EventArgs e) { Int32 bkID; Int32 doID; if (Page.IsValid) { foreach (GridViewRow gvRow in gvSelectedContainer.Rows) { //HiddenField hdnLMDT = (HiddenField)gvRow.FindControl("hdnLMDT"); HiddenField hdnCDT = (HiddenField)gvRow.Cells[0].FindControl("hdnCDT"); DateTime dt = Convert.ToDateTime(hdnCDT.Value); if (dt > Convert.ToDateTime(txtDate.Text)) { lblMessage.Text = "Activity date can not be greater than last movement date"; return; } } ContainerTranBLL oContainerTranBLL = new ContainerTranBLL(); string TranCode = string.Empty; if (ViewState["Container"] != null) { dtFilteredContainer = (DataTable)ViewState["Container"]; } if (dtFilteredContainer.Rows.Count <= 0) { lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00078"); hdnTranCode.Value = string.Empty; return;; } if (String.IsNullOrEmpty(txtTeus.Text)) { txtTeus.Text = "0"; } if (String.IsNullOrEmpty(txtFEUs.Text)) { txtFEUs.Text = "0"; } int FLocation = Convert.ToInt32(ddlFromLocation.SelectedValue); int TLocation = Convert.ToInt32(ddlTolocation.SelectedValue); int EYard = 0; if (ddlEmptyYard.SelectedIndex > -1) { EYard = Convert.ToInt32(ddlEmptyYard.SelectedValue); } if (ddlBookingNo.SelectedValue == "") { bkID = 0; } else { bkID = Convert.ToInt32(ddlBookingNo.SelectedValue); } if (ddlDONo.SelectedValue == "") { doID = 0; } else { doID = Convert.ToInt32(ddlDONo.SelectedValue); } int Result = oContainerTranBLL.AddEditContainerTransaction(out TranCode, hdnTranCode.Value, GenerateContainerXMLString(), Convert.ToInt32(ddlToStatus.SelectedValue), Convert.ToInt32(txtTeus.Text), Convert.ToInt32(txtFEUs.Text), Convert.ToDateTime(txtDate.Text), Convert.ToString(txtNarration.Text), FLocation, TLocation, EYard, _userId, DateTime.Now.Date, _userId, DateTime.Now.Date, bkID, doID); switch (Result) { case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR000078"); break; case 1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00009"); if (string.IsNullOrEmpty(hdnTranCode.Value)) { lblTranCode.Text = TranCode; ClearAll(); } else { Response.Redirect("container-movement.aspx"); } break; case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011"); break; } } }
protected void btnProceed_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); int BalQty = 0; int i; int j; bool RecFound = false; // desabling all controls ddlBookingNo.Enabled = false; ddlDONo.Enabled = false; ddlEmptyYard.Enabled = false; ddlFromLocation.Enabled = false; ddlFromStatus.Enabled = false; ddlLine.Enabled = false; ddlTolocation.Enabled = false; ddlToStatus.Enabled = false; txtDate.Enabled = false; txtNarration.Enabled = false; lblMessage.Text = string.Empty; //Checking for container requirement for SNTS with DO and Booking if (ddlDONo.SelectedIndex != -1 && ddlBookingNo.SelectedIndex != -1) { if ((ddlFromStatus.SelectedItem.Text == "RCVE") || (ddlToStatus.SelectedItem.Text == "SNTS")) { //if (ddlDONo.SelectedIndex == 0 || ddlBookingNo.SelectedIndex == 0) //{ // lblMessage.Text = "Do and Booking is compulsory"; // return; //} // Get Balance Containers string[] ContTypeSize = new string[0]; string FindCont = ""; int[] CntrNos = new int[0]; int cIndex = -1; int Ind = 0; foreach (GridViewRow Row in gvContainer.Rows) { CheckBox chkContainer = (CheckBox)Row.FindControl("chkContainer"); if (chkContainer.Checked == true) { // check in the array Label lblContainerSize = (Label)Row.FindControl("lblContainerSize"); Label lblContainerType = (Label)Row.FindControl("lblContainerType"); FindCont = lblContainerType.Text + lblContainerSize.Text; Ind = Array.IndexOf(ContTypeSize, FindCont); if (Ind == -1) { Array.Resize(ref ContTypeSize, ContTypeSize.Length + 1); Array.Resize(ref CntrNos, CntrNos.Length + 1); cIndex++; ContTypeSize[cIndex] = FindCont; CntrNos[cIndex]++; } else { cIndex = Ind; CntrNos[cIndex]++; } //string[] myArray = new string[10]; //Array.Resize(ref myArray, myArray.Length + 1); //string value2 = Array.Find(myArray, element => element.Equals("abc", StringComparison.Ordinal)); //int ind1 = Array.IndexOf(myArray, "banana"); //Label lblContainerSize = (Label)Row.FindControl("lblContainerSize"); //Label lblContainerType = (Label)Row.FindControl("lblContainerType"); //if (ContSize[i] == lblContainerSize.Text && ContType[i] == lblContainerType.Text) //{ // QtyEntered += 1; //} //else // SaveRec = false; } } ContainerTranBLL oContainerTranBLL = new ContainerTranBLL(); ds = oContainerTranBLL.GetPendingDOList(Convert.ToInt32(ddlDONo.SelectedValue)); string cst = ""; for (i = 0; i < CntrNos.Length; i++) { RecFound = false; for (j = 0; j < ds.Tables[0].Rows.Count; j++) { cst = ds.Tables[0].Rows[j]["ContainerType"].ToString() + ds.Tables[0].Rows[j]["CntrSize"].ToString(); BalQty = ds.Tables[0].Rows[j]["DOQty"].ToInt() - ds.Tables[0].Rows[j]["DelQty"].ToInt(); if (cst == ContTypeSize[i]) { RecFound = true; if (CntrNos[i] > BalQty) { RecFound = false; } } } if (RecFound == false) { break; } } if (RecFound == false) { lblMessage.Text = "Currenty qty > Required balance"; return; } } //if (ds.Tables[0].Rows.Count > 0) //{ // cst = ds.Tables[0].Rows[i]["ContainerType"].ToString() + ds.Tables[0].Rows[i]["CntrSize"].ToString(); // for (i=0; i < ds.Tables[0].Rows.Count; i++) // string[] ContSize = new string[ds.Tables[0].Rows.Count]; // string[] ContType = new string[ds.Tables[0].Rows.Count]; // for (i = 0; i < ds.Tables[0].Rows.Count; i++) // { // ContSize[i] = ds.Tables[0].Rows[i]["CntrSize"].ToString(); // ContType[i] = ds.Tables[0].Rows[i]["ContainerType"].ToString(); // } // for (i = 0; i < ds.Tables[0].Rows.Count; i++) // { // BalQty = ds.Tables[0].Rows[i]["DOQty"].ToInt() - ds.Tables[0].Rows[i]["DelQty"].ToInt(); // QtyEntered = 0; // foreach (GridViewRow Row in gvContainer.Rows) // { // CheckBox chkContainer = (CheckBox)Row.FindControl("chkContainer"); // if (chkContainer.Checked == true) // { // // check in the array // string[] myArray = new string[10]; // Array.Resize(ref myArray, myArray.Length + 1); // string value2 = Array.Find(myArray, element => element.Equals("abc", StringComparison.Ordinal)); // int ind1 = Array.IndexOf(myArray, "banana"); // Label lblContainerSize = (Label)Row.FindControl("lblContainerSize"); // Label lblContainerType = (Label)Row.FindControl("lblContainerType"); // if (ContSize[i] == lblContainerSize.Text && ContType[i] == lblContainerType.Text) // { // QtyEntered += 1; // } // else // SaveRec = false; // } // } // if (QtyEntered > BalQty) // { // SaveRec = false; // } // } //} //else // SaveRec = false; //if (SaveRec == false) //{ // lblMessage.Text = "Currenty qty > Required balance"; // return; //} } DataTable Dt = CreateDataTable(); foreach (GridViewRow Row in gvContainer.Rows) { DataRow dr = Dt.NewRow(); CheckBox chkContainer = (CheckBox)Row.FindControl("chkContainer"); if (chkContainer.Checked == true) { HiddenField hdnOldTransactionId = (HiddenField)Row.FindControl("hdnOldTransactionId"); HiddenField hdnStatus = (HiddenField)Row.FindControl("hdnStatus"); HiddenField hdnLandingDate = (HiddenField)Row.FindControl("hdnLandingDate"); HiddenField hdnLMDT = (HiddenField)Row.FindControl("hdnLMDT"); Label lblContainerNo = (Label)Row.FindControl("lblContainerNo"); Label lblContainerSize = (Label)Row.FindControl("lblContainerSize"); Label lblContainerType = (Label)Row.FindControl("lblContainerType"); dr["OldTransactionId"] = hdnOldTransactionId.Value; dr["NewTransactionId"] = "0"; dr["ContainerNo"] = lblContainerNo.Text; dr["FromStatus"] = hdnStatus.Value; dr["LandingDate"] = hdnLandingDate.Value; dr["ToStatus"] = ddlToStatus.SelectedItem.Text; dr["ChangeDate"] = txtDate.Text; dr["LMDT"] = hdnLMDT.Value; dr["Editable"] = true; Dt.Rows.Add(dr); } } gvSelectedContainer.DataSource = Dt; gvSelectedContainer.DataBind(); ViewState["Container"] = Dt; }