Exemplo n.º 1
0
        public ActionResult Init()
        {
            //if (Session[CHubConstValues.SessionUser] == null)
            //    return RedirectToAction("Login", "Account");

            using (CHubEntities db = new CHubEntities())
            {
                string appUser = Session[CHubConstValues.SessionUser].ToString();
                //add recent page data
                APP_RECENT_PAGES_BLL rpBLL = new APP_RECENT_PAGES_BLL(db);
                rpBLL.Add(appUser, PageNameEnum.qkord.ToString(), this.Request.Url.AbsoluteUri);

                APP_CUST_ALIAS_BLL    acaBLL  = new APP_CUST_ALIAS_BLL(db);
                List <ExAppCustAlias> acaList = acaBLL.GetAppCustAliasByAppUser(appUser);

                APP_ORDER_TYPE_BLL    aotBLL  = new APP_ORDER_TYPE_BLL(db);
                List <APP_ORDER_TYPE> aotList = aotBLL.GetValidOrderType();
                foreach (var item in aotList)
                {
                    item.TS_OR_HEADER = null;
                }

                var obj = new
                {
                    custAlias        = acaList,
                    orderType        = aotList,
                    defaultOrderType = CHubConstValues.DefaultOrderType
                };

                return(Json(obj));
            }
        }
Exemplo n.º 2
0
        public ActionResult SearchAddrs(string shipName, string addr, string aliasName, bool isSpecialShip, string destName, long?destLocation)
        {
            try
            {
                List <ExVAliasAddr> list = new List <ExVAliasAddr>();
                CHubEntities        db   = new CHubEntities();
                if (isSpecialShip)
                {
                    V_ALIAS_ADDR_SPL_BLL bll = new V_ALIAS_ADDR_SPL_BLL();
                    list = bll.GetAliasAddrSPL(shipName.Trim(), addr.Trim(), destName.Trim(), destLocation, aliasName);
                }
                else
                {
                    V_ALIAS_ADDR_DFLT_BLL bll = new V_ALIAS_ADDR_DFLT_BLL();
                    list = bll.GetAliasAddrDFLT(aliasName);
                }

                //Get from parameter table***
                if (list.Count > 20)
                {
                    return(Json(new RequestResult(false, string.Format("Result has {0} items, Make Condition more strict", list.Count.ToString()))));
                }
                if (list.Count == 0)
                {
                    return(Json(new RequestResult(false, "No result")));
                }

                return(Json(new RequestResult(list)));
            }
            catch (Exception ee)
            {
                return(Json(new RequestResult(false, ee.Message)));
            }
        }
Exemplo n.º 3
0
        private bool SaveMPart(M_PART mPart)
        {
            using (CHubEntities db = new CHubEntities())
            {
                M_PART_BLL mPartBLL = new M_PART_BLL();
                if (mPartBLL.Exist(mPart.PART_NO))
                {
                    //must exist in m_part otherwise error
                    if (mPart != null && !string.IsNullOrEmpty(mPart.TC_CATEGORY_BY_MAN))
                    {
                        M_PART currMpart = mPartBLL.GetMPartByPartNo(mPart.PART_NO);
                        currMpart.TC_CATEGORY_BY_MAN = mPart.TC_CATEGORY_BY_MAN;
                        mPartBLL.Update(currMpart);
                    }

                    return(true);
                }
                else
                {
                    //error part
                    LogHelper.WriteErrorLog(string.Format("Fail Save Action, reason: Wrong partNo {0}", mPart.PART_NO));
                    return(false);
                }
            }
        }
Exemplo n.º 4
0
 private string GetPartNoFromCustPartNo(string custPartNo, string customerNo)
 {
     if (string.IsNullOrEmpty(custPartNo))
     {
         return(string.Empty);
     }
     using (CHubEntities db = new CHubEntities())
     {
         G_CATALOG_CUSTOMER_PART_BLL custBLL = new G_CATALOG_CUSTOMER_PART_BLL(db);
         string PartNo = custBLL.GetPartNoFromCustPartNo(custPartNo, customerNo);
         if (string.IsNullOrEmpty(PartNo))
         {
             G_PART_DESCRIPTION_BLL partBLL = new G_PART_DESCRIPTION_BLL(db);
             if (partBLL.IsPartNoExist(custPartNo))
             {
                 return(custPartNo);
             }
             else
             {
                 return(string.Empty);
             }
         }
         return(PartNo);
     }
 }
Exemplo n.º 5
0
        public ActionResult GetInvSnapShotData(string partNo)
        {
            try
            {
                using (CHubEntities db = new CHubEntities())
                {
                    V_INV_PDC_BLL    pdcBLL  = new V_INV_PDC_BLL(db);
                    List <V_INV_PDC> pdcList = pdcBLL.GetPDCData(partNo);


                    V_INV_RDC_BLL    rdcBLL  = new V_INV_RDC_BLL(db);
                    List <V_INV_RDC> rdcList = rdcBLL.GetRDCData(partNo);


                    M_INV_BLL    miBLL        = new M_INV_BLL();
                    List <M_INV> interPDCList = miBLL.GetInterPDCData(partNo);


                    var obj = new
                    {
                        pdcList      = pdcList,
                        rdcList      = rdcList,
                        interPDCList = interPDCList
                    };

                    return(Json(new RequestResult(obj)));
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("GetSnapShot", ex);
                return(Json(new RequestResult(false, ex.Message)));
            }
        }
Exemplo n.º 6
0
        public bool SaveTCPartData(TC_PART_HS partHS, M_PART mPart)
        {
            using (CHubEntities db = new CHubEntities())
            {
                M_PART_BLL mPartBLL = new M_PART_BLL();
                if (mPartBLL.Exist(partHS.PART_NO))
                {
                    //must exist in m_part otherwise error
                    if (mPart != null && !string.IsNullOrEmpty(mPart.TC_CATEGORY_BY_MAN))
                    {
                        M_PART currMpart = mPartBLL.GetMPartByPartNo(partHS.PART_NO);
                        currMpart.TC_CATEGORY_BY_MAN = mPart.TC_CATEGORY_BY_MAN;
                        mPartBLL.Update(currMpart);
                    }
                    if (partHS != null)
                    {
                        TC_PART_HS_BLL pHSBLL = new TC_PART_HS_BLL(db);
                        if (pHSBLL.Exist(partHS.PART_NO))
                        {
                            //update
                            TC_PART_HS    existModel = pHSBLL.GetTCPartHS(partHS.PART_NO);
                            List <string> skipList   = new List <string>();
                            skipList.Add("PART_NO");
                            skipList.Add("CREATED_BY");
                            skipList.Add("CREATE_DATE");
                            skipList.Add("UPDATED_BY");
                            skipList.Add("RECORD_DATE");

                            ClassConvert.DrawObj(partHS, existModel, skipList);

                            existModel.UPDATED_BY  = Session[CHubConstValues.SessionUser].ToString();
                            existModel.RECORD_DATE = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                            pHSBLL.update(existModel, false);
                        }
                        else
                        {
                            //add
                            partHS.CREATED_BY  = Session[CHubConstValues.SessionUser].ToString();
                            partHS.CREATE_DATE = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                            partHS.UPDATED_BY  = Session[CHubConstValues.SessionUser].ToString();
                            partHS.RECORD_DATE = partHS.CREATE_DATE;
                            pHSBLL.Add(partHS, false);
                        }
                    }
                    db.SaveChanges();
                    return(true);
                }
                else
                {
                    //error part
                    LogHelper.WriteErrorLog(string.Format("Fail Save Action, reason: Wrong partNo {0}", partHS.PART_NO));
                    return(false);
                }
            }
        }
Exemplo n.º 7
0
        public ActionResult InitDraft()
        {
            //if (Session[CHubConstValues.SessionUser] == null)
            //    return RedirectToAction("Login", "Account");

            string appUser = Session[CHubConstValues.SessionUser].ToString();

            CHubEntities              db         = new CHubEntities();
            TS_OR_HEADER_STAGE_BLL    hStageBLL  = new TS_OR_HEADER_STAGE_BLL();
            List <TS_OR_HEADER_STAGE> hStageList = hStageBLL.GetHeaderStageByUser(appUser);

            return(Json(hStageList));
        }
Exemplo n.º 8
0
        public ActionResult QueryAction(string partNo, string hsCode, string declrName, string element, int currentPage, int pageSize)
        {
            CHubEntities     db        = new CHubEntities();
            V_TC_MDM_ALL_BLL mdmBLL    = new V_TC_MDM_ALL_BLL(db);
            int totalCount             = 0;
            List <V_TC_MDM_ALL> result = mdmBLL.GetTCMDMList(partNo, hsCode, declrName, element, currentPage, pageSize, out totalCount);

            var obj = new
            {
                result     = result,
                totalCount = totalCount
            };

            return(Json(obj));
        }
Exemplo n.º 9
0
        public ActionResult DeleteDraft(decimal orderSeq, decimal shipFrom)
        {
            try
            {
                CHubEntities           db        = new CHubEntities();
                TS_OR_HEADER_STAGE_BLL hStageBLL = new TS_OR_HEADER_STAGE_BLL();
                hStageBLL.DeleteDraft(orderSeq, shipFrom);

                return(Content("Success"));
            }
            catch (Exception ee)
            {
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                return(Content(ee.Message));
            }
        }
Exemplo n.º 10
0
        public ActionResult DownLoadOrder(decimal?orderSeq, decimal shipFrom = 0)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                if (orderSeq == null || orderSeq == 0)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return(Content("No order seq data"));
                }

                CHubEntities         db    = new CHubEntities();
                V_O_DOWNLOAD_HDR_BLL hBLL  = new V_O_DOWNLOAD_HDR_BLL(db);
                V_O_DOWNLOAD_HDR     hData = hBLL.GetSpecfyHDRData(orderSeq.Value, shipFrom);
                if (hData == null)
                {
                    throw new Exception("No Header Data");
                }

                V_O_DOWNLOAD_DTL_BLL    dBLL  = new V_O_DOWNLOAD_DTL_BLL(db);
                List <V_O_DOWNLOAD_DTL> dList = dBLL.GetDTLList(orderSeq.Value, shipFrom);

                if (dList == null || dList.Count == 0)
                {
                    throw new Exception("No Lines Data");
                }


                sb.AppendLine(hData.TXT);
                foreach (var item in dList)
                {
                    sb.AppendLine(item.TXT);
                }

                byte[] buffer = Encoding.UTF8.GetBytes(sb.ToString());

                return(File(buffer, "text/csv", hData.FILE_NAME));
            }
            catch (Exception ee)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Content(ee.Message));
            }
        }
Exemplo n.º 11
0
        public ActionResult QueryAction(decimal?orderSeq, string custAlias, string poNum, int currentPage, int pageSize)
        {
            if (Session[CHubConstValues.SessionUser] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            int                 totalCount = 0;
            CHubEntities        db         = new CHubEntities();
            TS_OR_HEADER_BLL    hBLL       = new TS_OR_HEADER_BLL(db);
            List <TS_OR_HEADER> result     = hBLL.GetHeaders(orderSeq, custAlias, poNum, currentPage, pageSize, out totalCount);

            var obj = new
            {
                result     = result,
                totalCount = totalCount
            };

            return(Json(obj));
        }
Exemplo n.º 12
0
 public ActionResult GetStrictAddrs(string shipName, string addr, string aliasName, bool isSpecialShip)
 {
     try
     {
         List <ExVAliasAddr> list = new List <ExVAliasAddr>();
         CHubEntities        db   = new CHubEntities();
         if (isSpecialShip)
         {
             V_ALIAS_ADDR_SPL_BLL bll = new V_ALIAS_ADDR_SPL_BLL();
             list = bll.GetStrictAliasAddrSPL(shipName.Trim(), addr.Trim(), aliasName);
         }
         else
         {
             V_ALIAS_ADDR_DFLT_BLL bll = new V_ALIAS_ADDR_DFLT_BLL();
             list = bll.GetStrictAliasAddrDFLT(shipName.Trim(), addr.Trim(), aliasName);
         }
         return(Json(list));
     }
     catch (Exception ee)
     {
         Response.StatusCode = (int)HttpStatusCode.InternalServerError;
         return(Content(ee.Message));
     }
 }
Exemplo n.º 13
0
 public V_ITT_SHIPPING_ALLIN1_DAL(CHubEntities db)
     : base(db)
 {
 }
Exemplo n.º 14
0
 public TC_PART_HS_AUDIT_BLL(CHubEntities db)
 {
     dal = new TC_PART_HS_AUDIT_DAL(db);
 }
Exemplo n.º 15
0
 public V_RP_PACK_D_BASE_BLL(CHubEntities db)
 {
     dal = new V_RP_PACK_D_BASE_DAL(db);
 }
Exemplo n.º 16
0
 public V_USER_NAV_ALL_BLL(CHubEntities db)
 {
     dal = new V_USER_NAV_ALL_DAL(db);
 }
Exemplo n.º 17
0
 public RP_WAYBILL_BASICINFO_DAL(CHubEntities db)
     : base(db)
 {
 }
Exemplo n.º 18
0
 public RP_PRINTER_BLL(CHubEntities db)
 {
     dal = new RP_PRINTER_DAL(db);
 }
Exemplo n.º 19
0
 public RP_CUST_PACK_TYPE_DAL(CHubEntities db)
     : base(db)
 {
 }
Exemplo n.º 20
0
 public RP_LABEL_TYPE_BLL(CHubEntities db)
 {
     dal = new RP_LABEL_TYPE_DAL(db);
 }
Exemplo n.º 21
0
 public ITT_TRAN_TYPE_DAL(CHubEntities db)
     : base(db)
 {
 }
Exemplo n.º 22
0
 public V_OPEN_QTY_PO_RDC_DAL(CHubEntities db)
     : base(db)
 {
 }
Exemplo n.º 23
0
 public ITT_SHIPPING_D_SNAP_DAL(CHubEntities db)
     : base(db)
 {
 }
Exemplo n.º 24
0
 public EW_MESSAGE_BLL(CHubEntities db)
 {
     dal = new EW_MESSAGE_DAL(db);
 }
Exemplo n.º 25
0
 public V_SHIPMENT_H_RP_ALL_BLL(CHubEntities db)
 {
     dal = new V_SHIPMENT_H_RP_ALL_DAL(db);
 }
Exemplo n.º 26
0
 public M_APPS_BLL(CHubEntities db)
 {
     dal = new M_APPS_DAL(db);
 }
Exemplo n.º 27
0
 public ITT_SHIPPING_H_BLL(CHubEntities db)
 {
     dal = new ITT_SHIPPING_H_DAL(db);
 }
Exemplo n.º 28
0
 public V_TC_MDM_ALL_BLL(CHubEntities db)
 {
     dal = new V_TC_MDM_ALL_DAL(db);
 }
Exemplo n.º 29
0
 public RP_WAYBILL_TYPE_DAL(CHubEntities db)
     : base(db)
 {
 }
Exemplo n.º 30
0
 public RP_STATION_BLL(CHubEntities db)
 {
     dal = new RP_STATION_DAL(db);
 }