You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
5.4 KiB
C#
144 lines
5.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.Entity.Validation;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Web.Mvc;
|
|
using Common.Logging;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
using Microsoft.Office.Interop.Excel;
|
|
using NPOI.SS.Formula.Functions;
|
|
using System.Data.Entity;
|
|
using System.Text;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Headers;
|
|
using DSWeb.Common.Helper;
|
|
using System.Net;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.Common.DbContexts;
|
|
using DSWeb.Common.DbContexts.Model;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
/// <summary>
|
|
/// yunzong
|
|
/// </summary>
|
|
|
|
public class MsOpSeaeNewYZController : Controller
|
|
{
|
|
public OpSeaePxDbContenxt Contenxt = new OpSeaePxDbContenxt();
|
|
public ActionResult Index()
|
|
{
|
|
ViewData["force"] = Contenxt.TrackYarDID.OrderBy(p=>p.YARDID).ToList();
|
|
ViewData["shipName"]= BasicDataRefDAL.GetVesselList("");
|
|
ViewData["shipCom"] = Contenxt.InfoClient.Select(p =>new { p.SHORTNAME,p.CODENAME}).OrderBy(p=>p.CODENAME).ToList().Select(p=>new InfoClient { SHORTNAME=p.SHORTNAME,CODENAME=p.CODENAME}).ToList();
|
|
return View();
|
|
}
|
|
[HttpGet]
|
|
public ActionResult NewAddSubscription(string dataArry)
|
|
{
|
|
try
|
|
{
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
//if (userid == "" || userid == null)
|
|
//{
|
|
// var jsonRespose2 = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
// return new ContentResult() { Content = Helper.JsonConvert.Serialize(jsonRespose2) };
|
|
//}
|
|
var data = dataArry.Split('/');
|
|
if (string.IsNullOrEmpty(data[0]))
|
|
{
|
|
return Json(new {code=0,msg= "请先添加订阅内容!" },JsonRequestBehavior.AllowGet);
|
|
}
|
|
var MBLNStr = "";
|
|
var userId= Convert.ToString(Session["USERID"]);
|
|
foreach (var item in data)
|
|
{
|
|
var lis = item.Substring(0, item.Length - 1).Split(',');
|
|
MBLNStr += "'"+lis[0] + "',";
|
|
}
|
|
var repet= Contenxt.OpSeaeBilltrackDy.SqlQuery("select * from op_seae_billtrack_dy where MBLNO in("+MBLNStr.Substring(0,MBLNStr.Length-1)+ ") and UserID='"+ Convert.ToString(Session["USERID"])+"'").ToList();
|
|
if (repet.Count()>0)
|
|
{
|
|
return Json(new { code = 0, msg = "提单号" + repet[0].MBLNO + "已被订阅暂不支持多次订阅!" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
foreach (var item in data)
|
|
{
|
|
var lis = item.Substring(0, item.Length - 1).Split(',');
|
|
OpSeaeBilltrackDy dy = new OpSeaeBilltrackDy();
|
|
dy.GID = getGUID();
|
|
dy.MBLNO = lis[0];
|
|
dy.UserID = userId;
|
|
dy.CARRIERID = lis[1];
|
|
dy.YARD = lis[2];
|
|
dy.CreateTime = Convert.ToDateTime( DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
|
|
dy.EMAIL =0;
|
|
dy.WX =0;
|
|
Contenxt.OpSeaeBilltrackDy.Add(dy);
|
|
}
|
|
var stase = Contenxt.SaveChanges();
|
|
if (stase<=0)
|
|
{
|
|
return Json(new { code = 0, msg = "目前访问人数过多,请稍后再试!" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
return Json(new { code = 1, msg = "订阅成功!" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Json(new { code = 0, msg = ex.ToString() }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
public ActionResult DropSubscription(string idstr)
|
|
{
|
|
try
|
|
{
|
|
var idarray = idstr.Split(',');
|
|
foreach (var item in idarray)
|
|
{
|
|
OpSeaeBilltrackDy dy = new OpSeaeBilltrackDy { GID=item};
|
|
Contenxt.Entry(dy).State = System.Data.Entity.EntityState.Deleted;
|
|
}
|
|
var s= Contenxt.SaveChanges();
|
|
if (s>0)
|
|
{
|
|
return Json(new { code = 1, msg = "删除成功" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
return Json(new { code = 0, msg = "当前网络繁忙,请稍后再试" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Json(new { code = 0, msg = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
public ActionResult GetTabPage()
|
|
{
|
|
try
|
|
{
|
|
string sql = "";
|
|
|
|
var data=Contenxt.OpSeaeBillmanage.SqlQuery(sql);
|
|
return Json("",JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Json("", JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
private string getGUID()
|
|
{
|
|
System.Guid guid = new Guid();
|
|
guid = Guid.NewGuid();
|
|
string str = guid.ToString();
|
|
return str;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|