Beispiel #1
0
        private string SaveCustLoadAction(ITT_CUST_LOAD model)
        {
            try
            {
                ITT_CUST_LOAD_VALICATION validation = new ITT_CUST_LOAD_VALICATION(model);
                string msg = validation.ValidationAction();
                if (!string.IsNullOrEmpty(msg))
                {
                    return(msg);
                }

                if (model.BND_OUT_DATE != null && model.NBND_ARRIVAL_DATE == null)
                {
                    M_CALENDAR_BLL calBLL = new M_CALENDAR_BLL();
                    model.NBND_ARRIVAL_DATE = calBLL.GetArrivalDateFromOutDate(model.BND_OUT_DATE.Value);
                }

                model.LOADED_BY = Session[CHubConstValues.SessionUser].ToString();
                model.LOAD_DATE = DateTime.Now;
                ITT_CUST_LOAD_BLL tranBLL = new ITT_CUST_LOAD_BLL();
                tranBLL.Save(model);
                return(string.Empty);
            }
            catch (Exception ex)
            {
                return(string.Format("Fail Saved:{0}", ex.Message));
            }
        }
Beispiel #2
0
        public ActionResult SaveCustLoad(ITT_CUST_LOAD model)
        {
            try
            {
                if (model.WILL_BILL_NO == null)
                {
                    return(Json(new RequestResult(false, "WillBillNo can't be empty")));
                }

                ITT_CUST_LOAD_BLL ctBLL = new ITT_CUST_LOAD_BLL();
                if (ctBLL.ExistCustLoad(model.WILL_BILL_NO, model.TC_GROUP))
                {
                    ITT_CUST_LOAD temp = ctBLL.GetCustLoadbyConstraint(model.WILL_BILL_NO, model.TC_GROUP);
                    if (model.LOAD_BATCH_TOKEN != temp.LOAD_BATCH_TOKEN)
                    {
                        return(Json(new RequestResult(false, "Exist same wayBillNO and TC Group Items")));
                    }
                }

                string msg = SaveCustLoadAction(model);
                if (!string.IsNullOrEmpty(msg))
                {
                    return(Json(new RequestResult(false, msg)));
                }

                return(Json(new RequestResult(true, null, model.LOAD_BATCH_TOKEN)));
            }
            catch (Exception ex)
            {
                //this.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                //return Content(ex.Message);
                return(Json(new RequestResult(false, ex.Message)));
            }
        }
Beispiel #3
0
 public void Save(ITT_CUST_LOAD model)
 {
     if (model.LOAD_BATCH_TOKEN == 0 && !dal.ExistCustLoad(model.WILL_BILL_NO, model.TC_GROUP))
     {
         model.LOAD_BATCH_TOKEN = dal.GetCustLoadSqeNextVal();
         dal.Add(model);
     }
     else
     {
         ITT_CUST_LOAD existCL = dal.GetCustLoadbyConstraint(model.WILL_BILL_NO, model.TC_GROUP);
         model.LOAD_BATCH_TOKEN = existCL.LOAD_BATCH_TOKEN;
         if (existCL.HasChanges(model))
         {
             existCL.DO_RELEASE_DATE   = model.DO_RELEASE_DATE != null ? model.DO_RELEASE_DATE : existCL.DO_RELEASE_DATE;
             existCL.BND_ARRIVAL_DATE  = model.BND_ARRIVAL_DATE != null ? model.BND_ARRIVAL_DATE : existCL.BND_ARRIVAL_DATE;
             existCL.BND_OUT_DATE      = model.BND_OUT_DATE != null ? model.BND_OUT_DATE : existCL.BND_OUT_DATE;
             existCL.NBND_ARRIVAL_DATE = model.NBND_ARRIVAL_DATE != null ? model.NBND_ARRIVAL_DATE : existCL.NBND_ARRIVAL_DATE;
             existCL.NOTE      = !string.IsNullOrEmpty(model.NOTE) ? model.NOTE : existCL.NOTE;
             existCL.LOADED_BY = model.LOADED_BY;
             existCL.LOAD_DATE = model.LOAD_DATE;
             dal.Update(existCL);
         }
     }
 }
Beispiel #4
0
        public void Delete(string token)
        {
            ITT_CUST_LOAD model = dal.GetCustLoad(decimal.Parse(token));

            dal.Delete(model);
        }
Beispiel #5
0
 public ITT_CUST_LOAD_VALICATION(ITT_CUST_LOAD custLoad)
 {
     this.model = custLoad;
 }