Пример #1
0
    private void auto_add_trailer_trip(string jobNo, string jobType)
    {
        if (jobType == "WGR" || jobType == "WDO" || jobType == "TPT")
        {
            C2.CtmJobDet1 det1 = new C2.CtmJobDet1();
            det1.JobNo             = jobNo;
            det1.ScheduleDate      = DateTime.Today;
            det1.StatusCode        = "New";
            det1.CfsStatus         = "Pending";
            det1.ScheduleStartDate = DateTime.Today;
            det1.ContainerNo       = "";

            C2.Manager.ORManager.StartTracking(det1, Wilson.ORMapper.InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(det1);

            string tripType = "";
            if (jobType == "WGR")
            {
                tripType = "LOC";
            }
            if (jobType == "WDO")
            {
                tripType = "SHF";
            }

            //C2.CtmJobDet2 det2 = new C2.CtmJobDet2();
            //det2.Det1Id = det1.Id;
            //det2.TripCode = tripType;
            //det2.ContainerNo = det1.ContainerNo;
            //det2.JobNo = jobNo;
            //C2.Manager.ORManager.StartTracking(det2, Wilson.ORMapper.InitialState.Inserted);
            //C2.Manager.ORManager.PersistChanges(det2);
        }
    }
Пример #2
0
 private void updated_Status_changed_email(string user)
 {
     if (trip.Statuscode == "C")
     {
         CtmJob     job  = Manager.ORManager.GetObject(new Wilson.ORMapper.OPathQuery <CtmJob>("JobNo='" + trip.JobNo + "'"));
         CtmJobDet1 det1 = Manager.ORManager.GetObject <CtmJobDet1>(trip.Det1Id);
         if (job != null)
         {
             //EmailTemplateBiz emailBz = new EmailTemplateBiz();
             //EmailTemplate temp = null;
             //temp = emailBz.getTempalte(job.ClientId, "Trip"+trip.TripCode, job.EmailAddress);
             //if (temp != null)
             //{
             //    string contNo = "";
             //    string sealNo = "";
             //    if (det1 != null)
             //    {
             //        contNo = det1.ContainerNo;
             //        sealNo = det1.SealNo;
             //    }
             //    if (emailBz.sendEmail(job.ClientRefNo, contNo, sealNo, job.Vessel, job.Voyage, job.EtaDate, job.Pod,job.Pol, temp).status)
             //    {
             //        CtmJobEventLog l = new CtmJobEventLog();
             //        l.Controller = user;
             //        l.JobNo = trip.JobNo;
             //        l.Platform = "Web";
             //        l.Note1Type = "Email";
             //        l.Remark = "TripComplete email to:" + temp.EmailTo;
             //        l.log();
             //    }
             //}
         }
     }
 }
Пример #3
0
 public CtmJobDet1Biz(int id)
 {
     if (id > 0)
     {
         CtmJobDet1 par = Manager.ORManager.GetObject <CtmJobDet1>(id);
         setData(par);
     }
 }
Пример #4
0
    public void FSL_Container_ReadyReturn(string info)
    {
        JObject job      = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        int     contId   = SafeValue.SafeInt(job["contId"], 0);
        string  Time     = SafeValue.SafeString(job["Time"]);
        string  Location = SafeValue.SafeString(job["Location"]);
        string  user     = SafeValue.SafeString(job["user"]);

        C2.CtmJobDet1Biz det1Bz  = new C2.CtmJobDet1Biz(contId);
        C2.CtmJobDet1    det1    = det1Bz.getData();
        bool             status  = false;
        string           context = Common.StringToJson("");

        if (det1 != null)
        {
            try
            {
                det1.WhsReadyInd      = "Y";
                det1.WhsReadyTime     = Time;
                det1.WhsReadyLocation = Location;
                C2.Manager.ORManager.StartTracking(det1, Wilson.ORMapper.InitialState.Updated);
                C2.Manager.ORManager.PersistChanges(det1);
                status = true;
                #region lot alert
                string sql = string.Format(@"select ClientId,EmailAddress 
from CTM_JobDet1 as det1
left outer join CTM_Job as job on det1.JobNo=job.JobNo
where det1.Id=@contId");
                List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();
                list.Add(new ConnectSql_mb.cmdParameters("@contId", contId, SqlDbType.Int));
                string    client       = "";
                string    EmailAddress = "";
                DataTable dt           = ConnectSql_mb.GetDataTable(sql, list);
                if (dt.Rows.Count > 0)
                {
                    client       = SafeValue.SafeString(dt.Rows[0]["ClientId"]);
                    EmailAddress = SafeValue.SafeString(dt.Rows[0]["EmailAddress"]);
                }
                C2.CtmJobEventLog log = new C2.CtmJobEventLog();
                log.Platform_isMobile();
                log.Controller = user;
                log.ActionLevel_isCONT(contId);
                log.isAlert(client);
                log.setRemark(CtmJobEventLogRemark.Level.Container, -1, user + " set ready to return [" + Time + "]");
                log.log();
                #endregion

                C2.Email.SendEmail(EmailAddress, "[email protected],[email protected]", "", "TSL Customer Alert", "Dear Customer:Container:[" + det1.ContainerNo + "] is ready to return.", "");


                context = "{\"Client\":\"" + client + "\",\"text\":\"" + det1.ContainerNo + " ready to return\"}";
            }
            catch { }
        }


        Common.WriteJsonP(status, context);
    }
Пример #5
0
        private bool inserting_verify(BizResult bzR, string user, CtmJobDet1 par)
        {
            bool   res  = false;
            string role = SafeValue.SafeString(ConnectSql.ExecuteScalar(string.Format("select role from [user] where Name='{0}'", user)));
            CtmJob job  = Manager.ORManager.GetObject(new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "JobNo='" + par.JobNo + "'")) as CtmJob;

            if (job == null)
            {
                bzR.context = "Can not find this job";
            }
            else
            {
                if (role.ToLower() == "client")
                {
                    switch (job.JobStatus)
                    {
                    case "Booked":
                        res = true;
                        break;

                    case "Cancel":
                        bzR.context = "This job have been cancel";
                        break;

                    case "Reject":
                    case "Confirmed":
                    case "Completed":
                    case "Closed":
                    default:
                        bzR.context = "No permission";
                        break;
                    }
                }
                else
                {
                    switch (job.JobStatus)
                    {
                    case "Booked":
                    case "Cancel":
                        bzR.context = "Requair confirm this job";
                        break;

                    case "Completed":
                    case "Closed":
                        bzR.context = "This Job have completed";
                        break;

                    default:
                        res = true;
                        break;
                    }
                }
            }
            return(res);
        }
Пример #6
0
        private void updated_to_container(string user)
        {
            CtmJobDet1Biz det1Bz = new CtmJobDet1Biz(trip.Det1Id);
            CtmJobDet1    det1   = det1Bz.getData();

            if (det1 != null)
            {
                bool canSave = false;
                canSave = canSave || updated_to_container_contNo(det1);
                canSave = canSave || updated_to_container_status(det1);
                if (canSave)
                {
                    det1Bz.update(user);
                }
            }
        }
Пример #7
0
        private bool updated_to_container_status(CtmJobDet1 det1)
        {
            bool res = false;

            if (oldv_StatusCode != trip.Statuscode)
            {
                if (trip.Statuscode == "C")
                {
                    if (trip.TripCode.Equals("RET") || trip.TripCode.Equals("EXP"))
                    {
                        det1.StatusCode = "Completed";
                        res             = true;
                    }
                }
            }
            return(res);
        }
Пример #8
0
    public void ContainerDetail_readyExport(string info)
    {
        JObject job      = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        bool    status   = false;
        string  context  = "";
        string  user     = SafeValue.SafeString(job["user"]);
        int     contId   = SafeValue.SafeInt(job["contId"], 0);
        decimal wt       = SafeValue.SafeDecimal(job["wt"], 0);
        string  remark   = SafeValue.SafeString(job["remark"]);
        string  mobileNo = SafeValue.SafeString(job["mobileNo"]);

        if (contId > 0)
        {
            C2.CtmJobDet1Biz bz   = new C2.CtmJobDet1Biz(contId);
            C2.CtmJobDet1    det1 = bz.getData();

            if (det1 != null)
            {
                det1.Weight            = wt;
                det1.StatusCode        = "Customer-LD";
                det1.CfsStatus         = "Completed";
                det1.ScheduleStartDate = DateTime.Now;
                det1.ScheduleStartTime = DateTime.Now.ToString("HH:mm");
                det1.CompletionDate    = det1.ScheduleStartDate;
                det1.CompletionTime    = det1.ScheduleStartTime;
                det1.Remark2           = remark;
                C2.BizResult result = bz.update("skip");
                if (result.status)
                {
                    status = true;
                    C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
                    elog.Platform_isWeb();
                    elog.Controller = user;
                    elog.setActionLevel(det1.Id, CtmJobEventLogRemark.Level.Container, -1, "Container Ready Export [" + mobileNo + "]: " + (remark.Length > 0 ? " :" + remark : ""));
                    elog.log();
                }
            }
        }
        else
        {
            context = "Data Error";
        }
        Common.WriteJsonP(status, Common.StringToJson(context));
    }
Пример #9
0
        private bool updated_to_container_contNo(CtmJobDet1 det1)
        {
            bool res = false;

            if (det1 != null)
            {
                if (oldv_containerNo != trip.ContainerNo)
                {
                    det1.ContainerNo = trip.ContainerNo;
                    res = true;
                }
                if (trip.TripCode.Equals("COL") || trip.TripCode.Equals("IMP"))
                {
                    det1.ScheduleDate = trip.FromDate;
                    det1.ScheduleTime = trip.FromTime;
                    res = true;
                }
            }
            return(res);
        }
Пример #10
0
    private void create_cont(string jobNo, string contNo, DateTime date)
    {
        C2.CtmJobDet1 det1 = new C2.CtmJobDet1();
        det1.JobNo        = jobNo;
        det1.ContainerNo  = contNo;
        det1.StatusCode   = "New";
        det1.ScheduleDate = date;

        C2.Manager.ORManager.StartTracking(det1, Wilson.ORMapper.InitialState.Inserted);
        C2.Manager.ORManager.PersistChanges(det1);


        C2.CtmJobDet2 det2 = new C2.CtmJobDet2();
        det2.JobNo       = jobNo;
        det2.ContainerNo = contNo;
        det2.Det1Id      = det1.Id;
        det2.TripCode    = "EXP";
        det2.Statuscode  = "S";
        C2.Manager.ORManager.StartTracking(det2, Wilson.ORMapper.InitialState.Inserted);
        C2.Manager.ORManager.PersistChanges(det2);
    }
Пример #11
0
        public BizResult insert(string user, CtmJobDet1 par)
        {
            setData(null);
            if (par == null)
            {
                throw new Exception("data is null");
            }
            BizResult res = new BizResult();

            if (inserting_verify(res, user, par))
            {
                par.ScheduleDate      = SafeValue_mb.DateTime_ClearTime(par.ScheduleDate);
                par.ScheduleTime      = SafeValue_mb.convertTimeFormat(par.ScheduleTime);
                par.ScheduleStartDate = SafeValue_mb.DateTime_ClearTime(par.ScheduleStartDate);
                par.ServiceType       = (SafeValue.SafeString(par.ServiceType).Equals("") ? default_ServiceType : par.ServiceType);
                Manager.ORManager.StartTracking(par, Wilson.ORMapper.InitialState.Inserted);
                Manager.ORManager.PersistChanges(par);
                res.status = true;
                det1       = par;
                updated_Status_changed(user);

                resetOldValues();
                oldv_ServiceType = "";//==== update trips by service type.
                inserted_auto_CreateTrip(user);
                updated_to_trip();
                resetOldValues();


                C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
                elog.Platform_isBackend();
                elog.Controller = user;
                elog.setActionLevel(det1.Id, CtmJobEventLogRemark.Level.Container, 1);
                elog.log();
            }
            return(res);
        }
Пример #12
0
    private void container_new()
    {
        C2.CtmJob job = C2.Manager.ORManager.GetObject(new Wilson.ORMapper.OPathQuery <C2.CtmJob>("JobNo='" + txt_JobNo.Text + "'"));
        if (job != null)
        {
            string           user   = HttpContext.Current.User.Identity.Name;
            C2.CtmJobDet1Biz det1Bz = new C2.CtmJobDet1Biz(0);
            C2.CtmJobDet1    det1   = new C2.CtmJobDet1();
            det1.JobNo          = job.JobNo;
            det1.RequestDate    = DateTime.Now;
            det1.CfsInDate      = DateTime.Now;
            det1.CfsOutDate     = DateTime.Now;
            det1.YardPickupDate = DateTime.Now;
            det1.YardReturnDate = DateTime.Now;
            det1.CdtDate        = DateTime.Now;
            det1.YardExpiryDate = DateTime.Now;
            det1.F5Ind          = "N";
            det1.UrgentInd      = "N";
            det1.StatusCode     = "New";
            //det1.YardCode = job.YardCode;
            //det1.YardAddress = job.YardRef;

            #region container sss
            string values = "";
            if (btn_ContNo.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo.Text;
                det1.ContainerType = txt_ContType.Text;
                det1.SealNo        = txt_SealNo.Text;
                det1.YardAddress   = btn_YardAddress.Text;
                det1.Remark        = txt_Remark.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType.Value);
                det1.UrgentInd     = txt_Urgent.Text;
                det1.Permit        = txt_Permit.Text;
                det1.DgClass       = txt_dg.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo1.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo1.Text;
                det1.ContainerType = txt_ContType1.Text;
                det1.SealNo        = txt_SealNo1.Text;
                det1.YardAddress   = btn_YardAddress1.Text;
                det1.Remark        = txt_Remark1.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry1.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time1.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight1.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType1.Value);
                det1.UrgentInd     = txt_Urgent1.Text;
                det1.Permit        = txt_Permit1.Text;
                det1.DgClass       = txt_dg1.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo2.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo2.Text;
                det1.ContainerType = txt_ContType2.Text;
                det1.SealNo        = txt_SealNo2.Text;
                det1.YardAddress   = btn_YardAddress2.Text;
                det1.Remark        = txt_Remark2.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry2.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time2.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight2.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType2.Value);
                det1.UrgentInd     = txt_Urgent2.Text;
                det1.Permit        = txt_Permit2.Text;
                det1.DgClass       = txt_dg2.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo3.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo3.Text;
                det1.ContainerType = txt_ContType3.Text;
                det1.SealNo        = txt_SealNo3.Text;
                det1.YardAddress   = btn_YardAddress3.Text;
                det1.Remark        = txt_Remark3.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry3.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time3.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight3.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType3.Value);
                det1.UrgentInd     = txt_Urgent3.Text;
                det1.Permit        = txt_Permit3.Text;
                det1.DgClass       = txt_dg3.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo4.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo4.Text;
                det1.ContainerType = txt_ContType4.Text;
                det1.SealNo        = txt_SealNo4.Text;
                det1.YardAddress   = btn_YardAddress4.Text;
                det1.Remark        = txt_Remark4.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry4.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time4.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight4.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType4.Value);
                det1.UrgentInd     = txt_Urgent4.Text;
                det1.Permit        = txt_Permit4.Text;
                det1.DgClass       = txt_dg4.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo5.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo5.Text;
                det1.ContainerType = txt_ContType5.Text;
                det1.SealNo        = txt_SealNo5.Text;
                det1.YardAddress   = btn_YardAddress5.Text;
                det1.Remark        = txt_Remark5.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry5.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time5.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight5.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType5.Value);
                det1.UrgentInd     = txt_Urgent5.Text;
                det1.Permit        = txt_Permit5.Text;
                det1.DgClass       = txt_dg5.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo6.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo6.Text;
                det1.ContainerType = txt_ContType6.Text;
                det1.SealNo        = txt_SealNo6.Text;
                det1.YardAddress   = btn_YardAddress6.Text;
                det1.Remark        = txt_Remark6.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry6.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time6.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight6.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType6.Value);
                det1.UrgentInd     = txt_Urgent6.Text;
                det1.Permit        = txt_Permit6.Text;
                det1.DgClass       = txt_dg6.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo7.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo7.Text;
                det1.ContainerType = txt_ContType7.Text;
                det1.SealNo        = txt_SealNo7.Text;
                det1.YardAddress   = btn_YardAddress7.Text;
                det1.Remark        = txt_Remark7.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry7.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time7.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight7.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType7.Value);
                det1.UrgentInd     = txt_Urgent7.Text;
                det1.Permit        = txt_Permit7.Text;
                det1.DgClass       = txt_dg7.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo8.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo8.Text;
                det1.ContainerType = txt_ContType8.Text;
                det1.SealNo        = txt_SealNo8.Text;
                det1.YardAddress   = btn_YardAddress8.Text;
                det1.Remark        = txt_Remark8.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry8.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time8.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight8.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType8.Value);
                det1.UrgentInd     = txt_Urgent8.Text;
                det1.Permit        = txt_Permit8.Text;
                det1.DgClass       = txt_dg8.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }
            if (btn_ContNo9.Text.Trim().Length > 0)
            {
                det1.ContainerNo   = btn_ContNo9.Text;
                det1.ContainerType = txt_ContType9.Text;
                det1.SealNo        = txt_SealNo9.Text;
                det1.YardAddress   = btn_YardAddress9.Text;
                det1.Remark        = txt_Remark9.Text;
                det1.ScheduleDate  = SafeValue.SafeDate(date_YardExpiry9.Date, new DateTime(1990, 1, 1));
                det1.ScheduleTime  = txt_time9.Text;
                det1.Weight        = SafeValue.SafeDecimal(txt_Weight9.Text);
                det1.ServiceType   = SafeValue.SafeString(cmb_ServiceType9.Value);
                det1.UrgentInd     = txt_Urgent9.Text;
                det1.Permit        = txt_Permit9.Text;
                det1.DgClass       = txt_dg9.Text;
                det1.JobType       = job.JobType;
                det1.Br            = job.CarrierBkgNo;
                C2.BizResult bRes = det1Bz.insert(user, det1);
                if (!bRes.status)
                {
                    values = bRes.context;
                }
            }

            if (values.Length == 0)
            {
                values = "Success";
            }
            Response.Write("<script>parent.Popup_ContainerBatchAdd_callback('" + values + "');</script>");
            #endregion
        }
    }
Пример #13
0
    public static DataSet PrintImpHaulier(string orderNo)
    {
        DataSet     set    = new DataSet();
        ObjectQuery query  = new ObjectQuery(typeof(C2.CtmJob), "JobNo='" + orderNo + "'", "");
        ObjectSet   objSet = C2.Manager.ORManager.GetObjectSet(query);

        if (objSet.Count == 0 || objSet[0] == null)
        {
            return(set);
        }
        C2.CtmJob obj = objSet[0] as C2.CtmJob;

        ObjectQuery query1  = new ObjectQuery(typeof(C2.CtmJobDet1), "JobNo='" + orderNo + "'", "ContainerNo");
        ObjectSet   objSet1 = C2.Manager.ORManager.GetObjectSet(query1);

        #region init column
        DataTable mast = new DataTable("Mast");
        DataTable det  = new DataTable("Det");

        mast.Columns.Add("JobOrderNo");
        mast.Columns.Add("Haulier");
        mast.Columns.Add("OceanBl");
        mast.Columns.Add("Yard");
        mast.Columns.Add("Carrier");
        mast.Columns.Add("CrNo");
        mast.Columns.Add("Contact1");
        mast.Columns.Add("Contact2");
        mast.Columns.Add("Tel1");
        mast.Columns.Add("Fax1");
        mast.Columns.Add("Terminal");
        mast.Columns.Add("Permit");
        mast.Columns.Add("LastDate");
        mast.Columns.Add("Portnet");
        mast.Columns.Add("Ft20");
        mast.Columns.Add("Ft40");
        mast.Columns.Add("Ft45");
        mast.Columns.Add("DeliveryTo");
        mast.Columns.Add("VesselNo");
        mast.Columns.Add("VoyNo");
        mast.Columns.Add("Etd");
        mast.Columns.Add("Eta");
        mast.Columns.Add("PortLoad");
        mast.Columns.Add("ByWho");
        mast.Columns.Add("ImpRefNo");
        mast.Columns.Add("CustName");
        mast.Columns.Add("AgentName");
        mast.Columns.Add("UserData2");
        mast.Columns.Add("UserData3");
        mast.Columns.Add("UserData4");
        mast.Columns.Add("Outside");
        mast.Columns.Add("Note1");
        mast.Columns.Add("Note2");
        mast.Columns.Add("StampUser");

        det.Columns.Add("Idx");
        det.Columns.Add("JobOrderNo");
        det.Columns.Add("ContNo");
        det.Columns.Add("SealNo");
        det.Columns.Add("FtSize");
        det.Columns.Add("FtRemark");
        det.Columns.Add("FtType");
        det.Columns.Add("FtKgs");
        det.Columns.Add("FtQty");
        det.Columns.Add("FtPack");
        det.Columns.Add("FtTruckIn");
        det.Columns.Add("FtCbm");
        det.Columns.Add("FtNom");

        #endregion

        DataRow   row         = mast.NewRow();
        string    sql_haulier = "select Name,CrNo,Contact1,Contact2,Tel1,Fax1 from xxparty where partyid='" + obj.HaulierId + "'";
        DataTable tab_hauler  = Helper.Sql.List(sql_haulier);
        row["Haulier"]  = "";
        row["CrNo"]     = "";
        row["Contact1"] = "";
        row["Contact2"] = "";
        row["Tel1"]     = "";
        row["Fax1"]     = "";
        if (tab_hauler.Rows.Count > 0)
        {
            row["Haulier"]  = tab_hauler.Rows[0]["Name"];
            row["CrNo"]     = tab_hauler.Rows[0]["CrNo"].ToString();
            row["Contact1"] = tab_hauler.Rows[0]["Contact1"].ToString();
            row["Contact2"] = tab_hauler.Rows[0]["Contact2"].ToString();
            row["Tel1"]     = tab_hauler.Rows[0]["Tel1"].ToString();
            row["Fax1"]     = tab_hauler.Rows[0]["Fax1"].ToString();
        }

        row["JobOrderNo"] = orderNo;
        row["VesselNo"]   = obj.Vessel;
        row["VoyNo"]      = obj.Voyage;
        row["DeliveryTo"] = Helper.Sql.One(string.Format(@"select Address from xxparty where PartyId='{0}'", obj.ClientId));
        row["Ft20"]       = 0;
        row["Ft40"]       = 0;
        row["Ft45"]       = 0;

        string sql = "select name from xxparty where partyid='" + SafeValue.SafeInt(obj.ClientId, 0) + "'";
        row["CustName"] = SafeValue.SafeString(Helper.Sql.One(sql), "");

        sql = "select name from xxparty where partyid='" + SafeValue.SafeInt(obj.CarrierId, 0) + "'";
        row["AgentName"] = SafeValue.SafeString(Helper.Sql.One(sql), "");

        row["Etd"]      = obj.EtdDate.ToString("dd/MM/yyyy");
        row["Eta"]      = obj.EtaDate.ToString("dd/MM/yyyy");
        sql             = "select name from [XXPort] where code='" + SafeValue.SafeString(obj.Pol, "") + "'";
        row["PortLoad"] = SafeValue.SafeString(Helper.Sql.One(sql), obj.Pol);

        row["Carrier"]   = obj.CarrierId;
        row["OceanBl"]   = "";
        row["Yard"]      = obj.YardRef;
        row["ByWho"]     = obj.CreateBy;
        row["ImpRefNo"]  = obj.ClientRefNo;
        row["UserData2"] = "";
        row["Note1"]     = obj.SpecialInstruction;
        row["StampUser"] = obj.CreateBy;

        mast.Rows.Add(row);

        for (int i = 0; i < objSet1.Count; i++)
        {
            C2.CtmJobDet1 cont     = objSet1[i] as C2.CtmJobDet1;
            DataRow       row1     = det.NewRow();
            string        contType = cont.ContainerType;
            row1["JobOrderNo"] = orderNo;
            row1["ContNo"]     = cont.ContainerNo;
            row1["SealNo"]     = cont.SealNo;
            string ftSize = "";
            if (contType.Substring(0, 2) == "20")
            {
                ftSize = "20";
            }
            if (contType.Substring(0, 2) == "40")
            {
                ftSize += "40";
            }
            if (contType.Substring(0, 2) == "45")
            {
                ftSize += "45";
            }
            row1["FtSize"] = ftSize;
            row1["FtType"] = "";

            row1["FtQty"]     = cont.Qty;
            row1["FtKgs"]     = cont.Weight.ToString("0");
            row1["FtCbm"]     = cont.Volume.ToString("#,##0.00");
            row1["FtTruckIn"] = "TRUCK-IN:" + cont.ScheduleDate.ToString("dd-MMM");
            det.Rows.Add(row1);
        }
        set.Tables.Add(mast);
        set.Tables.Add(det);
        set.Relations.Add("", mast.Columns["JobOrderNo"], det.Columns["JobOrderNo"]);
        return(set);
    }
Пример #14
0
    public static DataSet PrintHaulier(string orderNo, string jobType)
    {
        DataSet     set    = new DataSet();
        ObjectQuery query  = new ObjectQuery(typeof(C2.CtmJob), "JobNo='" + orderNo + "'", "");
        ObjectSet   objSet = C2.Manager.ORManager.GetObjectSet(query);

        if (objSet.Count == 0 || objSet[0] == null)
        {
            return(set);
        }
        C2.CtmJob obj = objSet[0] as C2.CtmJob;

        ObjectQuery query1  = new ObjectQuery(typeof(C2.CtmJobDet1), "JobNo='" + orderNo + "'", "");
        ObjectSet   objSet1 = C2.Manager.ORManager.GetObjectSet(query1);


        #region init column
        DataTable mast = new DataTable("Mast");
        DataTable det  = new DataTable("Det");

        mast.Columns.Add("JobNo");
        mast.Columns.Add("JobType");
        mast.Columns.Add("Haulier");
        mast.Columns.Add("Attn");
        mast.Columns.Add("DeliveryTo");
        mast.Columns.Add("OceanBl");
        mast.Columns.Add("Yard");
        mast.Columns.Add("Carrier");
        mast.Columns.Add("CrNo");
        mast.Columns.Add("Contact1");
        mast.Columns.Add("Contact2");
        mast.Columns.Add("Tel1");
        mast.Columns.Add("Fax1");
        mast.Columns.Add("Terminal");
        mast.Columns.Add("Permit");
        mast.Columns.Add("LastDate");
        mast.Columns.Add("Portnet");
        mast.Columns.Add("Ft20");
        mast.Columns.Add("Ft40");
        mast.Columns.Add("Ft45");

        mast.Columns.Add("Vessel");
        mast.Columns.Add("Voyage");
        mast.Columns.Add("Etd");
        mast.Columns.Add("Eta");
        mast.Columns.Add("Pol");
        mast.Columns.Add("ByWho");
        mast.Columns.Add("ClientRefNo");
        mast.Columns.Add("CustName");
        mast.Columns.Add("AgentName");
        mast.Columns.Add("UserData2");
        mast.Columns.Add("UserData3");
        mast.Columns.Add("UserData4");
        mast.Columns.Add("Outside");
        mast.Columns.Add("Note1");
        mast.Columns.Add("Note2");
        mast.Columns.Add("StampUser");
        mast.Columns.Add("Remark");
        mast.Columns.Add("SpecialInstruction");

        det.Columns.Add("Idx");
        det.Columns.Add("JobNo");
        det.Columns.Add("ContNo");
        det.Columns.Add("SealNo");
        det.Columns.Add("FtSize");
        det.Columns.Add("FtRemark");
        det.Columns.Add("FtType");
        det.Columns.Add("FtKgs");
        det.Columns.Add("FtQty");
        det.Columns.Add("FtPack");
        det.Columns.Add("FtTruckIn");
        det.Columns.Add("FtCbm");
        det.Columns.Add("FtNom");

        #endregion

        DataRow   row         = mast.NewRow();
        string    sql_haulier = "select Name,CrNo,Contact1,Contact2,Tel1,Fax1 from xxparty where partyid='" + obj.ClientId + "'";
        DataTable tab_hauler  = Helper.Sql.List(sql_haulier);
        row["Attn"]       = obj.Terminalcode;
        row["DeliveryTo"] = obj.DeliveryTo;
        row["CrNo"]       = "";
        row["Contact1"]   = "";
        row["Contact2"]   = "";
        row["Tel1"]       = "";
        row["Fax1"]       = "";
        if (tab_hauler.Rows.Count > 0)
        {
            row["Haulier"]  = tab_hauler.Rows[0]["Name"];
            row["CrNo"]     = tab_hauler.Rows[0]["CrNo"].ToString();
            row["Contact1"] = tab_hauler.Rows[0]["Contact1"].ToString();
            row["Contact2"] = tab_hauler.Rows[0]["Contact2"].ToString();
            row["Tel1"]     = tab_hauler.Rows[0]["Tel1"].ToString();
            row["Fax1"]     = tab_hauler.Rows[0]["Fax1"].ToString();
        }

        row["JobNo"]   = orderNo;
        row["JobType"] = obj.JobType;
        row["Vessel"]  = obj.Vessel;
        row["Voyage"]  = obj.Voyage;
        row["Permit"]  = obj.PermitNo;

        string sql = "select name from xxparty where partyid='" + obj.ClientId + "'";
        row["CustName"] = SafeValue.SafeString(ConnectSql.ExecuteScalar(sql), "");


        row["Etd"]                = obj.EtdDate.ToString("dd/MM/yyyy");
        row["Eta"]                = obj.EtaDate.ToString("dd/MM/yyyy");
        sql                       = "select name from [XXPort] where code='" + SafeValue.SafeString(obj.Pol, "") + "'";
        row["Pol"]                = SafeValue.SafeString(Helper.Sql.One(sql), "");
        sql                       = "select name from xxparty where partyid='" + obj.CarrierId + "'";
        row["Carrier"]            = SafeValue.SafeString(Helper.Sql.One(sql), "");
        row["OceanBl"]            = obj.CarrierBlNo;
        row["Yard"]               = obj.YardRef;
        row["ByWho"]              = "";
        row["ClientRefNo"]        = obj.ClientRefNo;
        row["UserData2"]          = "";
        row["SpecialInstruction"] = obj.SpecialInstruction;
        row["Remark"]             = obj.Remark;
        row["StampUser"]          = HttpContext.Current.User.Identity.Name;
        int ft20 = 0;
        int ft40 = 0;
        int ft45 = 0;


        for (int i = 0; i < objSet1.Count; i++)
        {
            C2.CtmJobDet1 cont = objSet1[i] as C2.CtmJobDet1;
            DataRow       row1 = det.NewRow();
            row1["Idx"]    = i + 1;
            row1["JobNo"]  = orderNo;
            row1["ContNo"] = cont.ContainerNo;
            row1["SealNo"] = cont.SealNo;
            string ftSize = "";
            //int index = cont.ContainerType.IndexOf("FT", 2);
            if (cont.ContainerType.IndexOf("20", 0) == 0)
            {
                ft20++;
            }
            if (cont.ContainerType.IndexOf("40", 0) == 0)
            {
                ft40++;
            }
            if (cont.ContainerType.IndexOf("45", 0) == 0)
            {
                ft45++;
            }
            row1["FtSize"] = ftSize;
            row1["FtType"] = cont.ContainerType;

            row1["FtQty"]     = cont.Qty;
            row1["FtKgs"]     = cont.Weight.ToString("0");
            row1["FtCbm"]     = cont.Volume.ToString("#,##0.00");
            row1["FtTruckIn"] = "TRUCK-IN:" + cont.ScheduleDate.ToString("dd-MMM");
            det.Rows.Add(row1);
        }
        row["Ft20"] = ft20;
        row["Ft40"] = ft40;
        row["Ft45"] = ft45;
        mast.Rows.Add(row);

        set.Tables.Add(mast);
        set.Tables.Add(det);

        return(set);
    }
Пример #15
0
 public void setData(CtmJobDet1 par)
 {
     det1 = par;
     resetOldValues();
 }
Пример #16
0
        private bool updating_verify(BizResult bzR, string user, CtmJobDet2 par)
        {
            bool   res  = false;
            string role = SafeValue.SafeString(ConnectSql.ExecuteScalar(string.Format("select role from [user] where Name='{0}'", user)));

            if (role.ToLower() == "client")
            {
                bzR.context = "No permission";
                return(res);
            }
            if (role.ToLower().Equals("driver"))
            {
                if (trip.DriverCode.Equals(user) || trip.DriverCode2.Equals(user) || trip.DriverCode11.Equals(user) || trip.DriverCode12.Equals(user))
                {
                }
                else
                {
                    bzR.context = "No permission";
                    return(res);
                }
            }

            CtmJobDet1 det1 = Manager.ORManager.GetObject <CtmJobDet1>(par.Det1Id);
            CtmJob     job  = Manager.ORManager.GetObject(new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "JobNo='" + par.JobNo + "'")) as CtmJob;

            if (job == null)
            {
                bzR.context = "Mast data is empty";
            }
            else
            {
                switch (job.StatusCode)
                {
                case "CLS":
                    bzR.context = "This Job have been completed";
                    break;

                case "CNL":
                    bzR.context = "This Job have been Canceled";
                    break;

                default:
                    break;
                }
                //switch (job.JobStatus)
                //{
                //    case "Booked":
                //        bzR.context = "Requair confirm job";
                //        break;
                //    case "Cancel":
                //        bzR.context = "This job have been cancel";
                //        break;
                //    case "Reject":
                //        bzR.context = "This job have been Reject";
                //        break;
                //    case "Completed":
                //    case "Closed":
                //        bzR.context = "This job have been Completed";
                //        break;
                //    default:
                //        break;
                //}
                if (det1 != null)
                {
                    //if (det1.StatusCode == "Completed")
                    //{
                    //    bzR.context = "This container have been Completed";
                    //}
                }

                updating_verify_diffJobType_tripType(bzR, job, par);


                if (bzR.context.Length == 0)
                {
                    res = true;
                }
            }

            return(res);
        }