Exemplo n.º 1
0
        public ActionResult GetTranLoadList(string willBillNo)
        {
            ITT_TRAN_LOAD_BLL    tranBLL = new ITT_TRAN_LOAD_BLL();
            List <ITT_TRAN_LOAD> result  = tranBLL.GetTranLoadList(willBillNo);

            foreach (var item in result)
            {
                if (item.LOAD_DATE == null)
                {
                    item.LOAD_DATE = DateTime.Now;
                }
            }
            return(Json(result));
        }
Exemplo n.º 2
0
 public ActionResult DeleteTranLoad(string token)
 {
     try
     {
         if (string.IsNullOrEmpty(token))
         {
             return(Json(new RequestResult(false, "token is empty")));
         }
         ITT_TRAN_LOAD_BLL tranBLL = new ITT_TRAN_LOAD_BLL();
         tranBLL.Delete(token);
         return(Json(new RequestResult(true)));
     }
     catch (Exception ex)
     {
         return(Json(new RequestResult(false, ex.Message)));
     }
 }
Exemplo n.º 3
0
        public string ValidationAction()
        {
            if (model == null)
            {
                return("Data is null");
            }
            if (string.IsNullOrEmpty(model.WILL_BILL_NO))
            {
                return("No Way Bill No");
            }

            ITT_TRAN_LOAD_BLL tlBLL = new ITT_TRAN_LOAD_BLL();

            if (!tlBLL.ExistWayBillNo(model.WILL_BILL_NO))
            {
                return("WillBillNo doesn't exist in Transportation");
            }

            if (model.NBND_ARRIVAL_DATE != null && model.BND_OUT_DATE != null)
            {
                if (DateTime.Compare(model.NBND_ARRIVAL_DATE.Value, model.BND_OUT_DATE.Value) < 0)
                {
                    return("Arrival Date(305) need no less than out Date(300)");
                }
            }

            if (model.BND_OUT_DATE != null && model.BND_ARRIVAL_DATE != null)
            {
                if (DateTime.Compare(model.BND_OUT_DATE.Value, model.BND_ARRIVAL_DATE.Value) < 0)
                {
                    return("Out Date(300) need no less than Arrival Date(300)");
                }
            }

            if (model.BND_ARRIVAL_DATE != null && model.DO_RELEASE_DATE != null)
            {
                if (DateTime.Compare(model.BND_ARRIVAL_DATE.Value, model.DO_RELEASE_DATE.Value) < 0)
                {
                    return("Arrival Date(300) need no less than Do Release Date");
                }
            }

            return(string.Empty);
        }
Exemplo n.º 4
0
        private string SaveTranLoadAction(ITT_TRAN_LOAD model)
        {
            try
            {
                ITT_TRAN_LOAD_VALIDATION validation = new ITT_TRAN_LOAD_VALIDATION(model);
                string msg = validation.ValidationAction();
                if (!string.IsNullOrEmpty(msg))
                {
                    return(msg);
                }

                model.LOADED_BY = Session[CHubConstValues.SessionUser].ToString();
                model.LOAD_DATE = DateTime.Now;
                ITT_TRAN_LOAD_BLL tranBLL = new ITT_TRAN_LOAD_BLL();
                tranBLL.Save(model);
                return(string.Empty);
            }
            catch (Exception ex)
            {
                return(string.Format("Fail Saved:{0}", ex.Message));
            }
        }