public ActionResult Port_Update(PortInfo _obj) { decimal p_success = -1; try { p_success = PortBL.Port_Update(_obj); } catch (Exception ex) { Common.log.Error(ex.ToString()); } return(Json(new { success = p_success })); }
public ActionResult Port_Deleted(decimal _portId) { decimal p_success = -1; try { p_success = PortBL.Port_Delete(_portId); } catch (Exception ex) { Common.log.Error(ex.ToString()); } return(Json(new { success = p_success })); }
public ActionResult Port_View_Update(decimal _portId) { var _obj = new PortInfo(); try { _obj = PortBL.Port_GetByID(_portId); } catch (Exception ex) { Common.log.Error(ex.ToString()); } return(PartialView("_Port_Update", _obj)); }
public static List <PortInfo> Get_All_Port() { List <PortInfo> list = new List <PortInfo>(); try { list = PortBL.Port_GetAll(); list = list.Where(x => x.Type == Convert.ToInt16(NaviCommon.ATT_Enum.Port_Type.CangXuat)).ToList(); return(list); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(new List <PortInfo>()); } }
// GET: ModuleBaseData/Port public ActionResult Port_Getpage() { List <PortInfo> list = new List <PortInfo>(); try { int p_total_record = 0; list = PortBL.Port_Getpage("", 0, Common.constRecordOnPage, "", "", ref p_total_record); string htmlPaging = NaviCommon.CommonFuc.Get_HtmlPaging <PortInfo>((int)p_total_record, 1, "Cảng"); ViewBag.Paging = htmlPaging; ViewBag.SumRecord = p_total_record; } catch (Exception ex) { Common.log.Error(ex.ToString()); } return(View(list)); }
public ActionResult Shipment_GetViewToInsert(int contractType, int indexDetail = 0, int indexShipment = 0) { var portBl = new PortBL(); List <PortInfo> lstPort = new List <PortInfo>(); try { lstPort = PortBL.Port_GetAll(); ViewBag.ListPort = lstPort; ViewBag.ContractType = contractType; ViewBag.IndexDetail = indexDetail; ViewBag.IndexShipment = indexShipment; } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); } return(PartialView("~/Areas/ModuleImport/Views/Contract/_Partial_Shipment_Insert.cshtml")); }
public ActionResult Port_Search(string _portText, int _recordpage, int _currentpage) { try { int p_total_record = 0; _recordpage = _recordpage == 0 ? Common.constRecordOnPage : _recordpage; int _start = _recordpage * (_currentpage - 1) + 1; int _end = _recordpage * _currentpage; List <PortInfo> _lst = new List <PortInfo>(); _lst = PortBL.Port_Getpage(_portText, _start, _end, "", "", ref p_total_record); string htmlPaging = NaviCommon.CommonFuc.Get_HtmlPaging <PortInfo>((int)p_total_record, 1, "Cảng"); ViewBag.Paging = htmlPaging; ViewBag.SumRecord = p_total_record; return(PartialView("_Port_List", _lst)); } catch (Exception ex) { Common.log.Error(ex.ToString()); return(PartialView("_Port_List")); } }
const int LIMIT = 1; //5 concurrent clients private void StartListener() { List <PortBE> puertos = new List <PortBE>(); puertos = new PortBL().GetAllPorts(); foreach (PortBE puerto in puertos) { InitialLenght = Convert.ToInt32(ConfigurationManager.AppSettings["InitialLenght"]); FinalLenght = Convert.ToInt32(ConfigurationManager.AppSettings["FinalLenght"]); IPAddress localAddr = IPAddress.Parse(ConfigurationManager.AppSettings["ServerIP"]); TcpListener listener = new TcpListener(localAddr, Convert.ToInt32(puerto.puerto)); listener.Start(); #if DEBUG System.Diagnostics.Debug.WriteLine("Inicializando escucha desde puerto :" + puerto.puerto); #endif Util.Util.LogProceso("Inicializando escucha desde puerto: " + puerto.puerto); try { for (int i = 0; i < LIMIT; i++) { Thread t = new Thread(() => Service(listener)); t.Start(); } } catch (Exception exc) { #if DEBUG System.Diagnostics.Debug.WriteLine("Inicializando escucha desde puerto :" + puerto.puerto); #endif Util.Util.LogProceso("Excepción en StartListener: " + exc.Message); } } }
public Decimal Import_file_excel(HttpPostedFileBase fileImport) { try { DataSet _ds = new DataSet(); if (fileImport != null && fileImport.ContentLength > 0) { if (!fileImport.FileName.EndsWith(".xls") && !fileImport.FileName.EndsWith(".xlsx")) { return(-3); } else { Stream stream = fileImport.InputStream; IExcelDataReader reader = null; if (fileImport.FileName.EndsWith(".xls")) { reader = ExcelReaderFactory.CreateBinaryReader(stream); } else if (fileImport.FileName.EndsWith(".xlsx")) { reader = ExcelReaderFactory.CreateOpenXmlReader(stream); } _ds = reader.AsDataSet(); reader.Close(); } } if (_ds != null) { _ds.Tables[0].Rows[0].Delete();//xóa dòng title _ds.AcceptChanges(); if (_ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in _ds.Tables[0].Rows) { PortInfo _obj = new PortInfo(); _obj.Port_Code = dr[0] == null ? "" : dr[0].ToString(); _obj.Port_Name = dr[1] == null ? "" : dr[1].ToString(); _obj.Notes = dr[3] == null ? "" : dr[3].ToString(); string Type = dr[4] == null ? "" : dr[4].ToString(); if (Type != "") { _obj.Type = Convert.ToDecimal(Type); } if (_obj.Port_Code != "") { PortBL.Port_Insert(_obj); } } } else { return(-4);//không có dữ liệu } } return(1); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(-1); } }