private void FillGeneralTab() { ShipName.Text = selectedShip.Name; FlagImage.Load(Commons.GetFlagURL(selectedShip.Country)); FlagImage.Tag = selectedShip.Country; ShipImage.Load(selectedShip.Images.Small); DescriptionBox.Text = selectedShip.Description; lblPremium.Text = "Premium: " + Commons.TranslateTrueFalse(selectedShip.Premium);; lblDemo.Text = "Demo: " + Commons.TranslateTrueFalse(selectedShip.DemoProfile); lblID.Text = "ID: " + selectedShip.ID.ToString() + " (" + selectedShip.ShipId + ")"; lblCostCredits.Text = "Cost: " + selectedShip.PriceCredits.ToString(); lblCostGold.Text = "Cost (gold): " + selectedShip.PriceGold.ToString(); lblSlots.Text = "Number of slots: " + selectedShip.NumberOfSlots.ToString(); lblSpecial.Text = "Special: " + Commons.TranslateTrueFalse(selectedShip.Special); lblTier.Text = "Tier: " + selectedShip.Tier.ToString(); lblShipType.Text = "Shiptype: " + selectedShip.ShipType; lblTurningRadius.Text = "Turning Radius: " + selectedShip.Profile.Mobility.TurningRadius.ToString() + " m"; lblTurningSpeed.Text = "Ruddershift: " + selectedShip.Profile.Mobility.RudderTime.ToString() + " sec"; lblAirDet.Text = selectedShip.Profile.Concealment.AirDetection.ToString() + " km"; lblSurfaceDet.Text = selectedShip.Profile.Concealment.SurfaceDetection.ToString() + " km"; addConsumablesImages(selectedShip); }
private void RandomizeShip() { Ship ThisShip = GetRandomShip(); if (ThisShip != null) { RandomizedShip = ThisShip; FlagImage.Load(Commons.GetFlagURL(ThisShip.Country)); ShipImage.Load(ThisShip.Images.Small); SetShipName(ThisShip.Name); SetDescription(ThisShip.Description); ShipLoaded = true; if (ThisShip.Premium) { ShipImage.BackColor = SystemColors.Info; } else { ShipImage.BackColor = SystemColors.Control; } AlreadyRandomizedShips.Add(ThisShip.ID); } else { ShipLoaded = false; } }
protected void Page_Load(object sender, EventArgs e) { //身份校验 if (!InterfaceTool.IdentityVerify(Request)) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo()); return; } //船图列表 string strShipImageList = Request.Params["ShipImageList"]; AppLog log = new AppLog(Request); log.strBehavior = "上传已修改贝船图数据"; log.strBehaviorURL = "/Ship/UploadShipImages.aspx"; try { if (strShipImageList == null) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,上传已修改贝船图数据失败!").DicInfo()); return; } List <ShipImage> list = JsonConvert.DeserializeObject <List <ShipImage> >(strShipImageList); log.strAccount = list[0].modifier; List <string> containerNoList = new List <string>(); for (int i = 0; i < list.Count; i++) { ShipImage shipImage = list[i]; string strTempContainerNo = shipImage.container_no; string strTempBaynum = shipImage.baynum; //箱号不能为空 if (!string.IsNullOrWhiteSpace(strTempContainerNo) && !string.IsNullOrWhiteSpace(strTempBaynum) && !strTempBaynum.Equals("null") && containerNoList.IndexOf(strTempContainerNo) == -1) { //遍历是否有重复箱号的数据 int j; for (j = i + 1; j < list.Count; j++) { if (strTempContainerNo.Equals(list[j].container_no) && list[j].bayno != null && !list[j].bayno.Equals("null") && !list[j].bayno.Equals("")) { if (!string.IsNullOrWhiteSpace(shipImage.baynum) && !shipImage.baynum.Equals("null")) { if (Convert.ToInt16(shipImage.baynum) > Convert.ToInt16(list[j].baynum)) { shipImage = list[j]; } } } } if (i == list.Count - 1) { shipImage = list[i]; } containerNoList.Add(shipImage.container_no); string strOperareName = string.Empty; string strSql = string.Format(@"select distinct name from SYSTEM_USER_TABLE where user_id='{0}'", shipImage.modifier); var dt = new Leo.SqlServer.DataAccess(RegistryKey.KeyPathTallySqlServer).ExecuteTable(strSql); if (dt.Rows.Count > 0) { strOperareName = dt.Rows[0]["name"].ToString(); } strSql = string.Format(@"select MOVED,BAYNO,OLDBAYNO,USER_NAME,SIZE_CON,WORK_NO from CON_IMAGE where SHIP_ID='{0}' and CONTAINER_NO='{1}'", shipImage.ship_id, shipImage.container_no); dt = da.ExecuteTable(strSql); if (dt.Rows.Count <= 0) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "暂无数据!").DicInfo()); log.LogCatalogFailure(string.Format("上传已修改贝船图数据发生异常。航次'{0}'、箱号'{1}'不存在", shipImage.ship_id, shipImage.container_no)); return; } string strBayno = string.Empty; string strOldbayno = string.Empty; string strUserName = string.Empty; if (shipImage.bayno != null && !shipImage.bayno.Equals("null")) { strBayno = shipImage.bayno; } if (dt.Rows[0]["BAYNO"].ToString() != null && !dt.Rows[0]["BAYNO"].ToString().Equals("null")) { strOldbayno = dt.Rows[0]["BAYNO"].ToString(); } if (strOperareName != null && !strOperareName.Equals("null")) { strUserName = strOperareName; } //保留原船图数据记录 strSql = string.Format(@"insert into TB_APP_TALLY_LOG (SHIP_ID,CONTAINER_NO,BAYNO,OLDBAYNO,MOVED,USER_NAME,BAY_OPERNAME,BAY_OPERTIME,SIZE_CON,WORK_NO,MOVEDBAYNO) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}',to_date('{7}','yyyy-mm-dd HH24:mi:ss'),'{8}','{9}','{10}')", shipImage.ship_id, shipImage.container_no, dt.Rows[0]["BAYNO"].ToString(), dt.Rows[0]["OLDBAYNO"].ToString(), dt.Rows[0]["MOVED"].ToString(), dt.Rows[0]["USER_NAME"].ToString(), shipImage.modifier, shipImage.modifytime, dt.Rows[0]["SIZE_CON"].ToString(), dt.Rows[0]["WORK_NO"].ToString(), strBayno); da.ExecuteNonQuery(strSql); //更新 strSql = string.Format(@"update CON_IMAGE set BAYNO='{0}',OLDBAYNO='{1}',BAY_OPERNAME='{2}',BAY_OPERTIME=to_date('{3}', 'yyyy-mm-dd HH24:mi:ss'),USER_NAME='{4}' where SHIP_ID='{5}' and CONTAINER_NO='{6}'", strBayno, strOldbayno, shipImage.modifier, shipImage.modifytime, strUserName, shipImage.ship_id, shipImage.container_no); da.ExecuteNonQuery(strSql); } } da.CommitTransaction(); Json = JsonConvert.SerializeObject(new DicPackage(true, null, "上传成功!").DicInfo()); log.LogCatalogSuccess(); } catch (Exception ex) { da.RollbackTransaction(); Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:上传已修改贝船图数据发生异常。{1}", ex.Source, ex.Message)).DicInfo()); log.LogCatalogFailure(string.Format("{0}:上传已修改贝船图数据发生异常。{1}", ex.Source, ex.Message)); } }