protected void row_Click(object sender, DirectEventArgs e) { string vs_RowID = e.ExtraParams["vs_RowID"]; string RowID = e.ExtraParams["RowID"].ToString() == "" ? "0" : e.ExtraParams["RowID"]; DataFactory dal = new DataFactory(); DataSet ds = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_OceanImport_Vessel_SP", new List <IFields>() { dal.CreateIFields().Append("Option", "GetList").Append("voy_ROWID", RowID) .Append("vs_RowID", vs_RowID) }).GetList(); if (ds != null && ds.Tables[0].Rows.Count > 0) { hidVesselID.Text = ds.Tables[0].Rows[0]["vs_ROWID"].ToString(); txtVessel.Text = ds.Tables[0].Rows[0]["vs_Vessel"].ToString(); CmbCarrier.setValue(ds.Tables[0].Rows[0]["voy_Carrier"].ToString()); //CmbCarrierName.SelectedItem.Value = ds.Tables[0].Rows[0]["voy_Carrier"].ToString(); chkActive.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["vs_Active"]); lblVoyage.Text = ds.Tables[0].Rows[0]["voy_Voyage"].ToString(); lblPOL.Text = ds.Tables[0].Rows[0]["voy_POL"].ToString(); lblPOD.Text = ds.Tables[0].Rows[0]["voy_POD"].ToString(); lblOnboard.Text = ds.Tables[0].Rows[0]["voy_Onboard"].ToString() == "" ? "" : Convert.ToDateTime(ds.Tables[0].Rows[0]["voy_Onboard"].ToString()).ToString("dd/MM/yyyy HH:mm").Replace("-", "/"); lblETD.Text = ds.Tables[0].Rows[0]["voy_ETD"].ToString() == "" ? "" : Convert.ToDateTime(ds.Tables[0].Rows[0]["voy_ETD"].ToString()).ToString("dd/MM/yyyy HH:mm").Replace("-", "/"); lblETA.Text = ds.Tables[0].Rows[0]["voy_ETA"].ToString() == "" ? "" : Convert.ToDateTime(ds.Tables[0].Rows[0]["voy_ETA"].ToString()).ToString("dd/MM/yyyy HH:mm").Replace("-", "/"); lblCFS.Text = ds.Tables[0].Rows[0]["voy_CFS"].ToString() == "" ? "" : Convert.ToDateTime(ds.Tables[0].Rows[0]["voy_CFS"].ToString()).ToString("dd/MM/yyyy HH:mm").Replace("-", "/"); lblCY.Text = ds.Tables[0].Rows[0]["voy_CY"].ToString() == "" ? "" : Convert.ToDateTime(ds.Tables[0].Rows[0]["voy_CY"].ToString()).ToString("dd/MM/yyyy HH:mm").Replace("-", "/"); string[] statlist = string.IsNullOrEmpty(ds.Tables[0].Rows[0]["StatList"].ToString()) ? new string[] { } : ds.Tables[0].Rows[0]["StatList"].ToString().Split(','); CheckGroupClear(); foreach (string str in statlist) { for (int i = 0; i < tblChkGroup.Items.Count(); ++i) { if (tblChkGroup.Items[i].Tag.ToString().Trim().ToUpper() == str.Trim().ToUpper()) { tblChkGroup.Items[i].Checked = true; break; } } } } txtVessel.Focus(); }
protected void btnSave_Click(object sender, EventArgs e) { string strStat = ""; for (int i = 0; i < tblChkGroup.Items.Count(); ++i) { if (!tblChkGroup.Items[i].Checked) { strStat += tblChkGroup.Items[i].Tag.Trim() + ","; } } strStat = strStat.Length > 0 ? strStat.Substring(0, strStat.Length - 1) : strStat; if (string.IsNullOrEmpty(txtVessel.Text)) { txtVessel.Focus(); return; } DataFactory dal = new DataFactory(); DataTable dt = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_OceanImport_Vessel_SP", new List <IFields>() { dal.CreateIFields().Append("Option", "Update") .Append("vs_Vessel", txtVessel.Text.Trim().ToUpper()) .Append("vs_Active", chkActive.Checked?"1":"0") .Append("vs_Carrier", CmbCarrier.Value) .Append("vs_ROWID", hidVesselID.Text) .Append("stat", FSecurityHelper.CurrentUserDataGET()[12]) .Append("statstr", strStat) .Append("dept", FSecurityHelper.CurrentUserDataGET()[28].ToUpper()) }).GetTable(); if (dt.Rows.Count > 0) { hidVesselID.Text = dt.Rows[0][0].ToString(); if (i == 1) { DataBinder(); hidVesselID.Text = ""; txtVessel.Text = ""; CmbCarrier.setValue(""); txtVessel.Focus(); CheckGroupChecked(); lblVoyage.Text = ""; //用于清空VOYAGE GRACE lblPOD.Text = ""; lblPOL.Text = ""; lblOnboard.Text = ""; lblETA.Text = ""; lblETD.Text = ""; lblCFS.Text = ""; lblCY.Text = ""; return; } else if (i == 2) { X.AddScript("windowshow();"); X.Redirect("../voyage/list.aspx?vessel=" + hidVesselID.Text + "&vstext=" + txtVessel.Text + "&carrier=" + CmbCarrier.Value + "&cartext=" + CmbCarrier.Text); return; } else { X.Msg.Alert("status", " Saved successfully").Show(); } } else { X.Msg.Alert("status", " Save failed ").Show(); } DataBinder(); txtVessel.Focus(); }