public void Review_In_Save(string info)
    {
        string  info_ = HttpUtility.UrlDecode(Server.UrlDecode(info));
        JObject job   = (JObject)JsonConvert.DeserializeObject(info_);

        string status  = "0";
        string context = Common.StringToJson("");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        //string sql = string.Format(@"update job_receipt set StatusCode=@StatusCode,ReceiveDate=getdate(),UserId=@UserId where row_id=@row_id");
        string sql = string.Format(@"update job_house set CargoStatus=@StatusCode,EntryDate=getdate() where Id=@row_id");

        list.Add(new ConnectSql_mb.cmdParameters("@row_id", SafeValue.SafeInt(job["Oid"], 0), SqlDbType.Int));
        list.Add(new ConnectSql_mb.cmdParameters("@StatusCode", job["StatusCode"], SqlDbType.NVarChar, 30));
        list.Add(new ConnectSql_mb.cmdParameters("@UserId", job["UserId"], SqlDbType.NVarChar, 100));
        if (ConnectSql_mb.ExecuteNonQuery(sql, list).context.Equals("1"))
        {
            status = "1";

            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller = SafeValue.SafeString(job["user"]);
            lg.Lat        = SafeValue.SafeString(job["Lat"]);
            lg.Lng        = SafeValue.SafeString(job["Lng"]);
            //lg.ActionLevel_isCARGO(SafeValue.SafeInt(job["Oid"], 0));
            //lg.Remark = "Cargo status change:" + job["StatusCode"];
            lg.setActionLevel(SafeValue.SafeInt(job["Oid"], 0), CtmJobEventLogRemark.Level.Cargo, 4, ":" + job["StatusCode"]);
            lg.log();
        }

        Common.WriteJsonP(status, context);
    }
Exemple #2
0
    public BizResult unVoidJob(string user)
    {
        BizResult res = new BizResult();

        if (this.job != null && this.job.Id > 0)
        {
            this.job.StatusCode = "USE";
            this.job.JobStatus  = "Confirmed";

            Manager.ORManager.StartTracking(this.job, Wilson.ORMapper.InitialState.Updated);
            Manager.ORManager.PersistChanges(this.job);
            C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
            elog.Platform_isWeb();
            elog.Controller = user;
            elog.ActionLevel_isJOB(this.job.Id);
            elog.setActionLevel(this.job.Id, CtmJobEventLogRemark.Level.Job, 8);
            elog.log();
            res.status = true;
        }
        else
        {
            res.context = "error: data empty";
        }
        return(res);
    }
Exemple #3
0
    public void EGL_Driver_SaveDetail(string info)
    {
        JObject job     = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        string  status  = "0";
        string  context = Common.StringToJson("");

        int    Id            = SafeValue.SafeInt(job["Id"], 0);
        string Code          = job["Code"].ToString();
        string Name          = job["Name"].ToString();
        string Tel           = job["Tel"].ToString();
        string ICNo          = job["ICNo"].ToString();
        string Remark        = job["Remark"].ToString();
        string Isstaff       = job["Isstaff"].ToString();
        string TowheaderCode = job["TowheaderCode"].ToString();
        string ServiceLevel  = job["ServiceLevel"].ToString();
        string StatusCode    = job["StatusCode"].ToString();
        string TeamNo        = job["TeamNo"].ToString();
        string LicenseExpiry = job["LicenseExpiry"].ToString();

        string sql = "";

        sql = string.Format(@"update ctm_driver set 
Code=@Code,Name=@Name,Tel=@Tel,ICNo=@ICNo,Remark=@Remark,Isstaff=@Isstaff,TowheaderCode=@TowheaderCode,ServiceLevel=@ServiceLevel,StatusCode=@StatusCode,TeamNo=@TeamNo,LicenseExpiry=@LicenseExpiry 
where Id=@Id");
        if (Id == 0)
        {
            sql = string.Format(@"insert into ctm_driver (Code,Name,Tel,ICNo,Remark,Isstaff,TowheaderCode,ServiceLevel,StatusCode,TeamNo,LicenseExpiry) 
values (@Code,@Name,@Tel,@ICNo,@Remark,@Isstaff,@TowheaderCode,@ServiceLevel,@StatusCode,@TeamNo,@LicenseExpiry)");
        }
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@Id", Id, SqlDbType.Int));
        list.Add(new ConnectSql_mb.cmdParameters("@Code", Code, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@Name", Name, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@Tel", Tel, SqlDbType.NVarChar, 30));
        list.Add(new ConnectSql_mb.cmdParameters("@ICNo", ICNo, SqlDbType.NVarChar, 50));
        list.Add(new ConnectSql_mb.cmdParameters("@Remark", Remark, SqlDbType.NVarChar, 300));
        list.Add(new ConnectSql_mb.cmdParameters("@Isstaff", Isstaff, SqlDbType.NVarChar, 10));
        list.Add(new ConnectSql_mb.cmdParameters("@TowheaderCode", TowheaderCode, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ServiceLevel", ServiceLevel, SqlDbType.NVarChar, 30));
        list.Add(new ConnectSql_mb.cmdParameters("@StatusCode", StatusCode, SqlDbType.NVarChar, 30));
        list.Add(new ConnectSql_mb.cmdParameters("@TeamNo", TeamNo, SqlDbType.NVarChar, 10));
        list.Add(new ConnectSql_mb.cmdParameters("@LicenseExpiry", LicenseExpiry, SqlDbType.NVarChar, 8));
        if (ConnectSql_mb.ExecuteNonQuery(sql, list).context.Equals("1"))
        {
            status = "1";

            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller  = SafeValue.SafeString(job["user"]);
            lg.Lat         = SafeValue.SafeString(job["Lat"]);
            lg.Lng         = SafeValue.SafeString(job["Lng"]);
            lg.ActionLevel = "Driver";
            lg.ActionId    = Id;
            lg.Remark      = "Driver Save";
            lg.log();
        }
        Common.WriteJsonP(status, context);
    }
    public void Cost_Delete_ById(string info)
    {
        JObject job    = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        int     No     = SafeValue.SafeInt(job["No"], 0);
        bool    status = false;

        //===========log
        C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
        lg.Platform_isMobile();
        lg.Controller = SafeValue.SafeString(job["user"]);
        lg.Lat        = SafeValue.SafeString(job["Lat"]);
        lg.Lng        = SafeValue.SafeString(job["Lng"]);
        lg.setActionLevel(No, CtmJobEventLogRemark.Level.Invoice, 6);

        string sql = string.Format(@"delete from job_cost where Id=@No");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@No", No, SqlDbType.Int));
        ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteNonQuery(sql, list);
        if (res.status && res.context == "1")
        {
            status = true;
            lg.log();
        }
        Common.WriteJsonP(status, Common.StringToJson(""));
    }
    public void Attachment_Delete(string info)
    {
        JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));

        string status       = "0";
        string context      = Common.StringToJson("");
        int    attachmentId = SafeValue.SafeInt(job["Id"], 0);

        C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
        lg.Platform_isMobile();
        lg.Controller = SafeValue.SafeString(job["user"]);
        lg.Lat        = SafeValue.SafeString(job["Lat"]);
        lg.Lng        = SafeValue.SafeString(job["Lng"]);
        //lg.fixActionInfo_ByAttachmentId(attachmentId);
        //lg.Remark = "Attachment delete file";
        lg.setActionLevel(attachmentId, CtmJobEventLogRemark.Level.Attachment, 2);

        string sql = string.Format(@"delete from CTM_Attachment where Id=@attachmentId");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@attachmentId", attachmentId, SqlDbType.Int));

        ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteNonQuery(sql, list);
        if (result.status)
        {
            status = "1";

            //===========log
            lg.log();
        }

        Common.WriteJsonP(status, context);
    }
Exemple #6
0
    public void ContainerTrips_ChangeStatus(string info)
    {
        JObject job     = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        string  context = Common.StringToJson("");

        string sql = string.Format(@"update ctm_jobdet1 set StatusCode=@StatusCode where Id=@contId");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@contId", SafeValue.SafeInt(job["contId"], 0), SqlDbType.Int));
        list.Add(new ConnectSql_mb.cmdParameters("@StatusCode", job["StatusCode"], SqlDbType.NVarChar, 100));
        bool status = ConnectSql_mb.ExecuteNonQuery(sql, list).status;

        if (status)
        {
            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller = SafeValue.SafeString(job["user"]);
            lg.Lat        = SafeValue.SafeString(job["Lat"]);
            lg.Lng        = SafeValue.SafeString(job["Lng"]);
            //lg.ActionLevel_isCONT(SafeValue.SafeInt(job["contId"], 0));
            //lg.Remark = "Container change status:" + job["StatusCode"];
            lg.setActionLevel(SafeValue.SafeInt(job["contId"], 0), CtmJobEventLogRemark.Level.Container, 4, " :" + job["StatusCode"]);
            lg.log();
        }
        Common.WriteJsonP(status, context);
    }
Exemple #7
0
    public void ContainerTrip_Detail_Save(string info)
    {
        JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));

        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@Id", SafeValue.SafeInt(job["Id"], 0), SqlDbType.Int));
        list.Add(new ConnectSql_mb.cmdParameters("@DriverCode", job["DriverCode"], SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ChessisCode", job["ChessisCode"], SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ToParkingLot", job["ToParkingLot"], SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@Remark", job["Remark"], SqlDbType.NVarChar, 300));
        list.Add(new ConnectSql_mb.cmdParameters("@ToCode", job["ToCode"], SqlDbType.NVarChar, 300));
        list.Add(new ConnectSql_mb.cmdParameters("@FromDate", job["FromDate_e"], SqlDbType.NVarChar, 10));

        string sql    = string.Format(@"update CTM_JobDet2 set DriverCode=@DriverCode,ChessisCode=@ChessisCode,ToParkingLot=@ToParkingLot,Remark=@Remark,ToCode=@ToCode,FromDate=@FromDate  
where Id=@Id");
        bool   status = ConnectSql_mb.ExecuteNonQuery(sql, list).status;

        if (status)
        {
            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller = SafeValue.SafeString(job["user"]);
            lg.Lat        = SafeValue.SafeString(job["Lat"]);
            lg.Lng        = SafeValue.SafeString(job["Lng"]);
            //lg.ActionLevel_isTRIP(SafeValue.SafeInt(job["Id"], 0));
            //lg.Remark = "Trip Update";
            lg.setActionLevel(SafeValue.SafeInt(job["Id"], 0), CtmJobEventLogRemark.Level.Trip, 3);
            lg.log();
        }
        Common.WriteJsonP(status, Common.StringToJson(""));
    }
    private void Trip_Delete(object sender, ASPxGridViewCustomDataCallbackEventArgs e, string tripId)
    {
        C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
        elog.Platform_isWeb();
        elog.Controller = HttpContext.Current.User.Identity.Name;
        elog.ActionLevel_isTRIP(SafeValue.SafeInt(tripId, 0));
        elog.Remark = "Trip delete";
        elog.log();
        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJobDet2), "Id='" + tripId + "'");
        C2.CtmJobDet2 trip = C2.ManagerEdi.ORManager.GetObject(query) as C2.CtmJobDet2;
        C2.ManagerEdi.ORManager.ExecuteDelete(typeof(C2.CtmJobDet2), "Id='" + tripId + "'");
        //C2.Manager.ORManager.StartTracking(trip, Wilson.ORMapper.InitialState.Updated);
        //C2.Manager.ORManager.PersistChanges(trip);

        //EGL_JobTrip_AfterEndTrip("", SafeValue.SafeString(trip.Det1Id, "0"));

        string sql = string.Format(@"delete from job_cost where TripNo='{0}'", tripId);

        C2.ManagerEdi.ORManager.ExecuteScalar(sql);


        string re = HttpContext.Current.User.Identity.Name + "," + trip.Id + "," + trip.DriverCode;

        e.Result = re;
    }
Exemple #9
0
    protected void gv_tpt_trip_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string action = e.Parameters;

        if (action.Equals("Save"))
        {
            Trip_Update(sender, e, "");
            Job_Save(sender, e);
        }
        if (action.Equals("Complete"))
        {
            string tripId = SafeValue.SafeString(lbl_TripId.Text, "");

            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJobDet2), "Id='" + tripId + "'");
            C2.CtmJobDet2 trip = C2.Manager.ORManager.GetObject(query) as C2.CtmJobDet2;
            trip.Statuscode = "C";
            trip.FromDate   = trip.BookingDate;
            trip.FromTime   = trip.BookingTime;
            trip.ToDate     = trip.BookingDate;
            trip.ToTime     = trip.BookingTime;
            C2.Manager.ORManager.StartTracking(trip, Wilson.ORMapper.InitialState.Updated);
            C2.Manager.ORManager.PersistChanges(trip);

            C2.CtmJobDet2.tripStatusChanged(trip.Id);

            C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
            elog.Platform_isWeb();
            elog.Controller = HttpContext.Current.User.Identity.Name;
            elog.Remark     = "Update Trip";
            elog.ActionLevel_isTRIP(trip.Id);
            elog.log();
            e.Result = "Success";
        }
    }
Exemple #10
0
    public void Performance_EditSave(string info)
    {
        JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        JArray  jar = (JArray)JsonConvert.DeserializeObject(job["selectedList"].ToString());

        string fromName = job["user"].ToString();
        string toName   = job["Name"].ToString();

        string sql = "";
        List <ConnectSql_mb.cmdParameters> list = null;
        DataTable dt = null;

        for (int i = 0; i < jar.Count; i++)
        {
            int itemId     = SafeValue.SafeInt(jar[i]["Id"], 0);
            int valueIndex = SafeValue.SafeInt(jar[i]["value"], 0);
            if (valueIndex > 0 && valueIndex <= 5)
            {
                sql  = string.Format(@"select type_id,cate_id,Id as item_id,0 as case_id,pts_value1,pts_value2,pts_value3,pts_value4,pts_value5 from pts_item where Id=@Id");
                list = new List <ConnectSql_mb.cmdParameters>();
                list.Add(new ConnectSql_mb.cmdParameters("@Id", itemId, SqlDbType.Int));
                dt = ConnectSql_mb.GetDataTable(sql, list);
                if (dt.Rows.Count > 0)
                {
                    int     type_id   = SafeValue.SafeInt(dt.Rows[0]["type_id"], 0);
                    int     cate_id   = SafeValue.SafeInt(dt.Rows[0]["cate_id"], 0);
                    int     item_id   = itemId;
                    int     case_id   = SafeValue.SafeInt(dt.Rows[0]["case_id"], 0);
                    decimal pts_value = SafeValue.SafeDecimal(dt.Rows[0]["pts_value" + valueIndex]);

                    sql = string.Format(@"insert into pts_record (type_id,cate_id,item_id,case_id,pts_index,pts_value,review_time,review_user,pts_user)
values (@type_id,@cate_id,@item_id,@case_id,@pts_index,@pts_value,getdate(),@review_user,@pts_user)
select @@Identity");
                    list.Add(new ConnectSql_mb.cmdParameters("@type_id", type_id, SqlDbType.Int));
                    list.Add(new ConnectSql_mb.cmdParameters("@cate_id", cate_id, SqlDbType.Int));
                    list.Add(new ConnectSql_mb.cmdParameters("@item_id", item_id, SqlDbType.Int));
                    list.Add(new ConnectSql_mb.cmdParameters("@case_id", case_id, SqlDbType.Int));
                    list.Add(new ConnectSql_mb.cmdParameters("@pts_index", valueIndex, SqlDbType.Int));
                    list.Add(new ConnectSql_mb.cmdParameters("@pts_value", pts_value, SqlDbType.Decimal));
                    list.Add(new ConnectSql_mb.cmdParameters("@review_user", fromName, SqlDbType.NVarChar, 100));
                    list.Add(new ConnectSql_mb.cmdParameters("@pts_user", toName, SqlDbType.NVarChar, 100));

                    ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteScalar(sql, list);

                    if (res.status)
                    {
                        //===========log
                        C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
                        lg.Platform_isMobile();
                        lg.Controller = SafeValue.SafeString(job["user"]);
                        lg.Lat        = SafeValue.SafeString(job["Lat"]);
                        lg.Lng        = SafeValue.SafeString(job["Lng"]);
                        lg.setActionLevel(SafeValue.SafeInt(res.context, 0), CtmJobEventLogRemark.Level.Performance, 1);
                        lg.log();
                    }
                }
            }
        }
        Common.WriteJsonP(true, Common.StringToJson(""));
    }
    private void Event_Log(string jobNo, string level, int c, int id, string status)
    {
        string userId = HttpContext.Current.User.Identity.Name;

        C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
        elog.Platform_isWeb();
        elog.Controller = userId;
        if (level == "JOB")
        {
            elog.ActionLevel_isJOB(id);
            elog.setActionLevel(id, CtmJobEventLogRemark.Level.Job, c, status);
        }
        if (level == "QUOTATION")
        {
            elog.ActionLevel_isJOB(id);
            elog.setActionLevel(id, CtmJobEventLogRemark.Level.Quotation, c, status);
        }
        if (level == "CONT")
        {
            elog.ActionLevel_isCONT(id);
            elog.setActionLevel(id, CtmJobEventLogRemark.Level.Container, c, status);
        }
        if (level == "TRIP")
        {
            elog.ActionLevel_isTRIP(id);
            elog.setActionLevel(id, CtmJobEventLogRemark.Level.Trip, c, status);
        }
        elog.log_edi();
    }
 protected void grid_Transport_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (e.Parameters == "OK")
     {
         int    update_error_rowcount = 0;
         string user = HttpContext.Current.User.Identity.Name;
         for (int i = 0; i < list.Count; i++)
         {
             try
             {
                 Record r = list[i];
                 List <ConnectSql_mb.cmdParameters> par_list = new List <ConnectSql_mb.cmdParameters>();
                 par_list.Add(new ConnectSql_mb.cmdParameters("@Id", r.Id, SqlDbType.Int));
                 par_list.Add(new ConnectSql_mb.cmdParameters("@DriverCode", r.driver, SqlDbType.NVarChar, 100));
                 par_list.Add(new ConnectSql_mb.cmdParameters("@TptDate", r.TptDate, SqlDbType.NVarChar, 10));
                 par_list.Add(new ConnectSql_mb.cmdParameters("@TptTime", r.TptTime, SqlDbType.NVarChar, 10));
                 par_list.Add(new ConnectSql_mb.cmdParameters("@Statuscode", r.progress_new, SqlDbType.NVarChar, 10));
                 string sql_where = "";
                 if (r.progress_new == "P" || r.progress_new == "S")
                 {
                     sql_where = ",FromDate=@TptDate,FromTime=@TptTime";
                 }
                 if (r.progress_new == "C")
                 {
                     sql_where = ",ToDate=@TptDate,ToTime=@TptTime";
                 }
                 string sql = string.Format(@"update CTM_JobDet2 set DriverCode=@DriverCode,Statuscode=@Statuscode{0} where Id=@Id", sql_where);
                 // string.Format(@"update tpt_job set Driver='{1}',VehicleNo='{2}' where Id='{0}'", id, driver, progress);
                 //if (r.progress.Length == 0 && r.driver.Length > 0 && r.progress_new.Length == 0)
                 //{
                 //    sql = string.Format(@"update tpt_job set Driver='{1}',JobProgress='Confirmed',DeliveryIndex='{2}',TptTime='{3}',TptDate='{4}' where Id='{0}'", r.Id, r.driver, r.index, r.TptTime, r.TptDate);
                 //}
                 //else
                 //{
                 //    sql = string.Format(@"update tpt_job set Driver='{1}',DeliveryIndex='{2}',TptTime='{3}',JobProgress='{4}',TptDate='{5}' where Id='{0}'", r.Id, r.driver, r.index, r.TptTime, r.progress_new, r.TptDate);
                 //}
                 ConnectSql_mb.ExecuteNonQuery(sql, par_list);
                 C2.CtmJobDet2.tripStatusChanged(SafeValue.SafeInt(r.Id, 0));
                 C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
                 lg.Platform_isWeb();
                 lg.Controller = user;
                 lg.setActionLevel(SafeValue.SafeInt(r.Id, 0), CtmJobEventLogRemark.Level.Trip, 4, ":" + r.progress_new);
                 lg.log();
             }
             catch
             {
                 update_error_rowcount++;
             }
         }
         if (update_error_rowcount > 0)
         {
             e.Result = update_error_rowcount + " Rows Save Error";
         }
         else
         {
             btn_Search_Click(null, null);
         }
     }
 }
    public void EGL_Reporting_Attachment_Add(string info)
    {
        JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));

        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        ConnectSql_mb.cmdParameters cpar = null;
        string status  = "0";
        string context = Common.StringToJson("");

        string sql       = string.Format(@"insert into Vehicle_Reporting_Attachment (JobType,RefNo,ContainerNo,TripId,FileType,FileName,FilePath,CreateBy,CreateDateTime,FileNote) values(@JobType,@RefNo,@ContainerNo,@TripId,@FileType,@FileName,@FilePath,@CreateBy,Getdate(),@FileNote)
select @@Identity");
        string fileStart = System.Configuration.ConfigurationManager.AppSettings["MobileServerUrl"].ToString();

        if (fileStart == null)
        {
            fileStart = "";
        }
        string fileEnd = job["FilePath"].ToString();

        fileEnd = fileEnd.Substring(0, fileEnd.LastIndexOf('/')) + "/500/" + fileEnd.Substring(fileEnd.LastIndexOf('/') + 1);
        fileEnd = fileStart + fileEnd;

        cpar = new ConnectSql_mb.cmdParameters("@JobType", job["ContainerNo"], SqlDbType.NVarChar, 100);
        list.Add(cpar);
        cpar = new ConnectSql_mb.cmdParameters("@RefNo", job["JobNo"], SqlDbType.NVarChar, 100);
        list.Add(cpar);
        //cpar = new ConnectSql_mb.cmdParameters("@ContainerNo", job["ContainerNo"], SqlDbType.NVarChar, 100);
        //list.Add(cpar);
        cpar = new ConnectSql_mb.cmdParameters("@TripId", job["TripId"], SqlDbType.NVarChar, 100);
        list.Add(cpar);
        cpar = new ConnectSql_mb.cmdParameters("@FileType", job["FileType"], SqlDbType.NVarChar, 100);
        list.Add(cpar);
        cpar = new ConnectSql_mb.cmdParameters("@FileName", job["FileName"], SqlDbType.NVarChar, 100);
        list.Add(cpar);
        cpar = new ConnectSql_mb.cmdParameters("@FilePath", fileEnd, SqlDbType.NVarChar, 100);
        list.Add(cpar);
        cpar = new ConnectSql_mb.cmdParameters("@CreateBy", job["CreateBy"], SqlDbType.NVarChar, 100);
        list.Add(cpar);
        cpar = new ConnectSql_mb.cmdParameters("@FileNote", job["FileNote"], SqlDbType.NVarChar, 100);
        list.Add(cpar);

        ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteScalar(sql, list);
        if (result.status)
        {
            status = "1";

            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller = SafeValue.SafeString(job["user"]);
            lg.Lat        = SafeValue.SafeString(job["Lat"]);
            lg.Lng        = SafeValue.SafeString(job["Lng"]);
            lg.setActionLevel(SafeValue.SafeInt(result.context, 0), CtmJobEventLogRemark.Level.Attachment, 1, ":" + job["FileType"] + "[" + job["FileName"] + "]");
            lg.log();
        }

        Common.WriteJsonP(status, context);
    }
Exemple #14
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);
    }
    private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        DateTime date  = DateTime.Now;
        string   time4 = date.ToString("HHmm");

        string jobType   = SafeValue.SafeString(cbb_new_jobtype.Value, "IMP");
        string jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted");

        string jobType1 = jobType;

        string jobno       = "";
        string user        = HttpContext.Current.User.Identity.Name;
        string quoteNo     = "";
        string billingType = "None";

        if (jobType1 == "TPT")
        {
            billingType = "Job";
        }
        if (jobStatus == "Quoted")
        {
            quoteNo = C2Setup.GetNextNo("", "CTM_Job_" + jobStatus, date);
        }
        else
        {
            jobno   = C2Setup.GetNextNo("", "CTM_Job_" + jobType1, date);
            quoteNo = jobno;
        }
        string wh    = System.Configuration.ConfigurationManager.AppSettings["Warehosue"];
        string sql   = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,ClientId,YardRef,PickupFrom,DeliveryTo,Remark,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,BillingType) values ('{0}','{4}',getdate(),getdate(),getdate(),'USE','{1}',getdate(),'{1}',getdate(),'{2}','{2}','{3}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','Pending',getdate(),'{13}','{14}') select @@identity", jobno, user, time4, cbb_new_jobtype.Value, txt_new_JobDate.Date, btn_new_ClientId.Text, "", txt_FromAddress.Text, txt_ToAddress.Text, txt_new_remark.Text, "", jobStatus, quoteNo, wh, billingType);
        int    jobId = SafeValue.SafeInt(ConnectSql_mb.ExecuteScalar(sql), 0);

        if (jobId > 0)
        {
            string            userId = HttpContext.Current.User.Identity.Name;
            C2.CtmJobEventLog elog   = new C2.CtmJobEventLog();
            elog.Platform_isWeb();
            elog.Controller = userId;
            if (jobStatus == "Quoted")
            {
                elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Quotation, 1);
                elog.ActionLevel_isQuoted(jobId);
                C2Setup.SetNextNo("", "CTM_Job_" + jobStatus, quoteNo, date);
                //GetJobRate(quoteNo, btn_new_ClientId.Text, SafeValue.SafeString(cbb_new_jobtype.Value));
                e.Result = quoteNo;
            }
            else
            {
                elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Job, 1);
                elog.ActionLevel_isJOB(jobId);
                C2Setup.SetNextNo("", "CTM_Job_" + jobType1, jobno, date);
                e.Result = jobno;
            }
            elog.log();
        }
    }
Exemple #16
0
    private void Event_Log(string jobNo, string status, string note)
    {
        ASPxLabel Id     = this.grid_job.FindEditFormTemplateControl("lb_Id") as ASPxLabel;
        string    userId = HttpContext.Current.User.Identity.Name;
        int       jobId  = SafeValue.SafeInt(Id.Text, 0);

        C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
        elog.Platform_isWeb();
        elog.Controller = userId;
        elog.ActionLevel_isJOB(jobId);
        elog.Remark = note;
        elog.log();
    }
Exemple #17
0
    private void update_ContStatus_trip(int contId, string type, string statucCode)
    {
        string JobNo       = SafeValue.SafeString(Request.QueryString["JobNo"]);
        string isWarehouse = SafeValue.SafeString(Request.QueryString["isWarehouse"]);
        string sql         = "";
        string status      = "";

        if (isWarehouse == "Yes")
        {
            if (type == "IMP")
            {
                status = "WHS-LD";
            }
            if (type == "EXP")
            {
                status = "WHS-MT";
            }
            if (type == "RET")
            {
                status = "Return";
            }
            sql = string.Format(@"update ctm_jobdet1 set StatusCode='{1}' where Id={0}", contId, status);
            ConnectSql_mb.ExecuteNonQuery(sql);
        }
        if (isWarehouse == "No")
        {
            if (type == "IMP")
            {
                status = "Customer-LD";
            }
            if (type == "EXP")
            {
                status = "Customer-MT";
            }
            if (type == "RET")
            {
                status = "Return";
            }
            sql = string.Format(@"update ctm_jobdet1 set StatusCode='{1}' where Id={0}", contId, status);
            ConnectSql_mb.ExecuteNonQuery(sql);
        }
        string userId = HttpContext.Current.User.Identity.Name;

        C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
        elog.Platform_isWeb();
        elog.Controller = userId;
        elog.ActionLevel_isCONT(contId);
        elog.setActionLevel(contId, CtmJobEventLogRemark.Level.Container, 4, status);
        elog.log();
    }
Exemple #18
0
    public void ContainerTrip_Detail_Delete(string info)
    {
        JObject job    = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        int     status = 0;

        string deleteType = job["deleteType"].ToString();

        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@Id", SafeValue.SafeInt(job["Id"], 0), SqlDbType.Int));

        string    sql = string.Format(@"select StatusCode from CTM_JobDet2 where Id=@Id");
        DataTable dt  = ConnectSql_mb.GetDataTable(sql, list);

        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0]["StatusCode"].ToString() == "S")
            {
                status = 2;
                if (deleteType == "S")
                {
                    status = 0;
                }
            }
            if (status <= 0)
            {
                //===========log
                C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
                lg.Platform_isMobile();
                lg.Controller = SafeValue.SafeString(job["user"]);
                lg.Lat        = SafeValue.SafeString(job["Lat"]);
                lg.Lng        = SafeValue.SafeString(job["Lng"]);
                //lg.ActionLevel_isTRIP(SafeValue.SafeInt(job["Id"], 0));
                //lg.Remark = "Trip Delete";
                lg.setActionLevel(SafeValue.SafeInt(job["Id"], 0), CtmJobEventLogRemark.Level.Trip, 2);
                lg.log();
                sql = string.Format(@"delete from CTM_JobDet2 where Id=@Id");
                ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteNonQuery(sql, list);
                if (result.status)
                {
                    status = 1;
                }
            }
        }


        Common.WriteJsonP(status, Common.StringToJson(job["Id"].ToString()));
    }
Exemple #19
0
 private void updated_Status_changed(string user)
 {
     if (oldv_statusCode != det1.StatusCode)
     {
         if (det1.StatusCode == "Completed")
         {
             CtmJobEventLog lg = new CtmJobEventLog();
             lg.Controller  = user;
             lg.JobNo       = det1.JobNo;
             lg.ContainerNo = det1.ContainerNo;
             lg.Remark      = "ContComplete";
             lg.log();
         }
         updated_Status_changed_email(user);
     }
 }
Exemple #20
0
    private string Trip_New(string jobType, int tripId)
    {
        string no = SafeValue.SafeString(Request.QueryString["no"]);

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJobDet2), "Id='" + tripId + "'");
        C2.CtmJobDet2 trip = C2.Manager.ORManager.GetObject(query) as C2.CtmJobDet2;

        string sql = string.Format(@"select max(TripIndex) from CTM_JobDet2 where JobType=@JobType and JobNo=@JobNo");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@JobNo", no, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@JobType", jobType, SqlDbType.NVarChar, 100));
        string maxIdex  = SafeValue.SafeString(ConnectSql_mb.ExecuteScalar(sql, list).context, "//00");
        int    n        = SafeValue.SafeInt(maxIdex.Substring(maxIdex.LastIndexOf("/") + 1), 0) + 1;
        string str      = (100 + n).ToString().Substring(1);
        string fromCode = trip.ToCode;
        string toCode   = trip.FromCode;

        trip.BookingDate = DateTime.Today;
        trip.TripIndex   = no + "/" + jobType + "/" + str;
        trip.Self_Ind    = "No";
        trip.JobNo       = no;
        //trip.FromDate = DateTime.Today;
        //trip.ToDate = DateTime.Today;
        trip.CreateUser = HttpContext.Current.User.Identity.Name;
        trip.CreateTime = DateTime.Now;
        trip.UpdateUser = HttpContext.Current.User.Identity.Name;
        trip.UpdateTime = DateTime.Now;
        trip.JobType    = jobType;
        trip.TripCode   = jobType;
        trip.ReturnType = "Y";
        trip.ToCode     = toCode;
        trip.FromCode   = fromCode;
        trip.Statuscode = "P";
        C2.Manager.ORManager.StartTracking(trip, Wilson.ORMapper.InitialState.Inserted);
        C2.Manager.ORManager.PersistChanges(trip);

        string userId = HttpContext.Current.User.Identity.Name;

        C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
        elog.Platform_isWeb();
        elog.Controller = userId;
        elog.ActionLevel_isJOB(trip.Id);
        elog.setActionLevel(trip.Id, CtmJobEventLogRemark.Level.Trip, 1, "");

        return(trip.Id + "_" + trip.TripIndex);
    }
    public void Cost_AddNew(string info)
    {
        JObject job      = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        bool    status   = false;
        string  code     = job["code"].ToString();
        string  des      = job["name"].ToString();
        decimal value    = SafeValue.SafeDecimal(job["value"], 0);
        int     TripNo   = SafeValue.SafeInt(job["TripNo"], 0);
        string  LineType = job["LineType"].ToString();

        string sql = string.Format(@"select det2.Id,job.JobNo,job.JobType,det1.ContainerNo,det1.ContainerType
from ctm_jobdet2 as det2
left outer join CTM_JobDet1 as det1 on det2.Det1Id=det1.Id
left outer join CTM_Job as job on det2.JobNo=job.JobNo
where det2.Id=@TripNo");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@TripNo", TripNo, SqlDbType.Int));
        DataTable dt = ConnectSql_mb.GetDataTable(sql, list);

        sql = string.Format(@"insert into job_cost (LineId,LineType,JobNo,JobType,ContNo,ContType,TripNo,VendorId,ChgCode,ChgCodeDes,Remark,Qty,Price,CurrencyId,ExRate,DocAmt,LocAmt,CompanyId)
values((select count(*) from job_cost where JobNo=@JobNo),@LineType,@JobNo,@JobType,@ContNo,@ContType,@TripNo,'',@ChgCode,@ChgCodeDes,'',1,@Price,'SGD',1,0,0,0)
select @@Identity");
        list.Add(new ConnectSql_mb.cmdParameters("@JobNo", dt.Rows[0]["JobNo"], SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@LineType", LineType, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@JobType", dt.Rows[0]["JobType"], SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ContNo", dt.Rows[0]["ContainerNo"], SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ContType", dt.Rows[0]["ContainerType"], SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ChgCode", code, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ChgCodeDes", des, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@Price", value, SqlDbType.Decimal));
        ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteScalar(sql, list);
        if (res.status)
        {
            status = true;
            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller = SafeValue.SafeString(job["user"]);
            lg.Lat        = SafeValue.SafeString(job["Lat"]);
            lg.Lng        = SafeValue.SafeString(job["Lng"]);
            lg.setActionLevel(SafeValue.SafeInt(res.context, 0), CtmJobEventLogRemark.Level.Invoice, 5);
            lg.log();
        }
        Common.WriteJsonP(status, Common.StringToJson(""));
    }
Exemple #22
0
    public void EGL_DriverCash_SaveDetail(string info)
    {
        JObject job     = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));
        string  status  = "0";
        string  context = Common.StringToJson("");

        int     Id          = SafeValue.SafeInt(job["Id"], 0);
        string  DriverCode  = job["DriverCode"].ToString();
        string  EventDate   = job["EventDate"].ToString();
        string  EventType   = job["EventType"].ToString();
        decimal TotalAmount = SafeValue.SafeDecimal(job["TotalAmount"].ToString(), 0);
        string  Description = job["Description"].ToString();

        string sql = "";

        sql = string.Format(@"update Ref_DriverCash set DriverCode=@DriverCode,EventDate=@EventDate,EventType=@EventType,TotalAmount=@TotalAmount,Description=@Description where Id=@Id");
        if (Id == 0)
        {
            sql = string.Format(@"insert into Ref_DriverCash (DriverCode,EventDate,EventType,TotalAmount,Description) values(@DriverCode,@EventDate,@EventType,@TotalAmount,@Description)");
        }
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@Id", Id, SqlDbType.Int));
        list.Add(new ConnectSql_mb.cmdParameters("@DriverCode", DriverCode, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@EventDate", EventDate, SqlDbType.NVarChar, 10));
        list.Add(new ConnectSql_mb.cmdParameters("@EventType", EventType, SqlDbType.NVarChar, 20));
        list.Add(new ConnectSql_mb.cmdParameters("@TotalAmount", TotalAmount, SqlDbType.Decimal));
        list.Add(new ConnectSql_mb.cmdParameters("@Description", Description, SqlDbType.NVarChar, 300));
        if (ConnectSql_mb.ExecuteNonQuery(sql, list).context.Equals("1"))
        {
            status = "1";

            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller  = SafeValue.SafeString(job["user"]);
            lg.Lat         = SafeValue.SafeString(job["Lat"]);
            lg.Lng         = SafeValue.SafeString(job["Lng"]);
            lg.ActionLevel = "DriverCash";
            lg.ActionId    = Id;
            lg.Remark      = "Driver Cash Save";
            lg.log();
        }
        Common.WriteJsonP(status, context);
    }
    private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        DateTime date      = DateTime.Now;
        string   time4     = date.ToString("HHmm");
        string   jobType   = SafeValue.SafeString(cbb_new_jobtype.Value, "CRA");
        string   jobType1  = jobType;
        string   jobno     = "";
        string   jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted");
        string   user      = HttpContext.Current.User.Identity.Name;
        string   quoteNo   = "";

        if (jobStatus == "Quoted")
        {
            quoteNo = C2Setup.GetNextNo("", "CTM_Job_" + jobStatus, date);
        }
        else
        {
            jobno   = C2Setup.GetNextNo("", "CTM_Job_" + jobType1, date);
            quoteNo = jobno;
        }
        string wh  = System.Configuration.ConfigurationManager.AppSettings["Warehosue"];
        string sql = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,ClientId,YardRef,PickupFrom,DeliveryTo,Remark,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,IsAdhoc) values ('{0}','{4}',getdate(),getdate(),getdate(),'USE','{1}',getdate(),'{1}',getdate(),'{2}','{2}','{3}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','Pending',getdate(),'{13}','Yes')", jobno, user, time4, cbb_new_jobtype.Value, txt_new_JobDate.Date, btn_new_ClientId.Text, "", "", txt_ToAddress.Text, txt_new_remark.Text, "", jobStatus, quoteNo, wh);
        int    i   = ConnectSql_mb.ExecuteNonQuery(sql);

        if (i == 1)
        {
            if (jobStatus == "Quoted")
            {
                C2Setup.SetNextNo("", "CTM_Job_" + jobStatus, quoteNo, date);
                //GetJobRate(quoteNo, btn_new_ClientId.Text, SafeValue.SafeString(cbb_new_jobtype.Value));
                e.Result = quoteNo;
            }
            else
            {
                C2Setup.SetNextNo("", "CTM_Job_" + jobType1, jobno, date);
                e.Result = jobno;
                C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
                elog.Platform_isWeb();
                elog.Controller = HttpContext.Current.User.Identity.Name;
                elog.fixActionInfo_ByJobNo(jobno);
                elog.Remark = "New Job";
                elog.log();
            }
        }
    }
Exemple #24
0
 private void updated_Status_changed(string user)
 {
     if (oldv_StatusCode != trip.Statuscode)
     {
         updated_Status_changed_to_containerTrips(user);
         if (trip.Statuscode == "C")
         {
             CtmJobEventLog lg = new CtmJobEventLog();
             lg.Controller  = user;
             lg.JobNo       = trip.JobNo;
             lg.ContainerNo = trip.ContainerNo;
             lg.Trip        = SafeValue.SafeString(trip.Id);
             lg.Remark      = "TripComplete";
             lg.log();
         }
         updated_Status_changed_email(user);
     }
 }
Exemple #25
0
    public void Attendance_EditSave(string info)
    {
        JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info)));

        string user   = job["user"].ToString();
        string action = job["action"].ToString();

        string sql = string.Format(@"insert into pts_attendance (createdate,record_type,record_user,record_note) 
values(getdate(),@record_type,@record_user,@record_note)
select @@Identity");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@record_type", action, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@record_user", user, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@record_note", "", SqlDbType.NVarChar, 300));
        ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteScalar(sql, list);
        if (result.status && action.ToLower().IndexOf("in") >= 0)
        {
            sql  = string.Format(@"insert into pts_record (type_id,cate_id,item_id,case_id,pts_index,pts_value,review_time,review_user,pts_user)
values (@type_id,@cate_id,@item_id,@case_id,@pts_index,@pts_value,getdate(),@review_user,@pts_user)");
            list = new List <ConnectSql_mb.cmdParameters>();
            list.Add(new ConnectSql_mb.cmdParameters("@type_id", 0, SqlDbType.Int));
            list.Add(new ConnectSql_mb.cmdParameters("@cate_id", 0, SqlDbType.Int));
            list.Add(new ConnectSql_mb.cmdParameters("@item_id", 0, SqlDbType.Int));
            list.Add(new ConnectSql_mb.cmdParameters("@case_id", 0, SqlDbType.Int));
            list.Add(new ConnectSql_mb.cmdParameters("@pts_index", 0, SqlDbType.Int));
            list.Add(new ConnectSql_mb.cmdParameters("@pts_value", 10, SqlDbType.Decimal));
            list.Add(new ConnectSql_mb.cmdParameters("@review_user", user, SqlDbType.NVarChar, 100));
            list.Add(new ConnectSql_mb.cmdParameters("@pts_user", user, SqlDbType.NVarChar, 100));
            ConnectSql_mb.ExecuteNonQuery(sql, list);


            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller = SafeValue.SafeString(job["user"]);
            lg.Lat        = SafeValue.SafeString(job["Lat"]);
            lg.Lng        = SafeValue.SafeString(job["Lng"]);
            lg.setActionLevel(SafeValue.SafeInt(result.context, 0), CtmJobEventLogRemark.Level.Attendance, 1);
            lg.log();
        }

        Common.WriteJsonP(true, Common.StringToJson(""));
    }
Exemple #26
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));
    }
Exemple #27
0
    public void UserLogin_Login_auto(string info)
    {
        string  info_   = HttpUtility.UrlDecode(Server.UrlDecode(info));
        JObject jo      = (JObject)JsonConvert.DeserializeObject(info_);
        bool    status  = false;
        string  context = Common.StringToJson("");
        string  account = jo["account"].ToString();
        string  pw      = jo["password"].ToString();

        if (account == null || account.Length <= 0)
        {
            context = Common.StringToJson("Request Account");
        }
        else
        {
            List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();
            ConnectSql_mb.cmdParameters        cpar = null;
            string sql = string.Format(@"select top 1 * from [user] where IsActive=1 and Tel=@Tel and Pwd=@Pwd and Role='Client'");
            cpar = new ConnectSql_mb.cmdParameters("@Tel", account, SqlDbType.NVarChar, 100);
            list.Add(cpar);
            cpar = new ConnectSql_mb.cmdParameters("@Pwd", pw, SqlDbType.NVarChar, 100);
            list.Add(cpar);
            DataTable dt = ConnectSql_mb.GetDataTable(sql, list);
            if (dt.Rows.Count > 0)
            {
                status  = true;
                context = Common.DataRowToJson(dt);
                //===========log
                C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
                lg.Platform_isMobile();
                lg.Controller  = dt.Rows[0]["Name"].ToString();
                lg.Remark      = dt.Rows[0]["Name"] + " Login";
                lg.ActionLevel = "USER";
                lg.ActionType  = "Login";
                lg.log();
            }
            else
            {
                context = Common.StringToJson("Password error");
            }
        }
        Common.WriteJsonP(status, context);
    }
Exemple #28
0
    private string job_void()
    {
        ASPxLabel Id  = this.grid_job.FindEditFormTemplateControl("lb_Id") as ASPxLabel;
        string    sql = "update CTM_Job set StatusCode=case when StatusCode='CNL' then 'USE' else 'CNL' end where Id=" + Id.Text;

        if (ConnectSql.ExecuteSql(sql) > 0)
        {
            string            userId = HttpContext.Current.User.Identity.Name;
            int               jobId  = SafeValue.SafeInt(Id.Text, 0);
            C2.CtmJobEventLog elog   = new C2.CtmJobEventLog();
            elog.Platform_isWeb();
            elog.Controller = userId;
            elog.ActionLevel_isJOB(jobId);
            elog.Remark = "Job Void";
            elog.log();
            return("");
        }

        return("error");
    }
    public void Review_Detail_Save(string info)
    {
        string  info_ = HttpUtility.UrlDecode(Server.UrlDecode(info));
        JObject job   = (JObject)JsonConvert.DeserializeObject(info_);

        bool   status  = false;
        string context = Common.StringToJson("");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@Oid", SafeValue.SafeInt(job["Oid"], 0), SqlDbType.Int));
        list.Add(new ConnectSql_mb.cmdParameters("@Qty", SafeValue.SafeInt(job["Qty"], 0), SqlDbType.Decimal));
        list.Add(new ConnectSql_mb.cmdParameters("@Weight", SafeValue.SafeDecimal(job["Weight"]), SqlDbType.Decimal));
        list.Add(new ConnectSql_mb.cmdParameters("@M3", SafeValue.SafeDecimal(job["M3"]), SqlDbType.Decimal));
        list.Add(new ConnectSql_mb.cmdParameters("@PackType", job["PackType"], SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@Markings", job["Markings"], SqlDbType.NVarChar, 300));
        list.Add(new ConnectSql_mb.cmdParameters("@Contents", job["Contents"], SqlDbType.NVarChar, 300));

        //string sql = string.Format(@"update job_receipt set Qty=@Qty,Weight=@Weight,M3=@M3,PackType=@PackType,Markings=@Markings,Contents=@Contents where row_id=@Oid");
        string sql = string.Format(@"update job_house set QtyOrig=@Qty,WeightOrig=@Weight,VolumeOrig=@M3,PackTypeOrig=@PackType,Marking1=@Markings,Remark1=@Contents where Id=@Oid");

        ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteNonQuery(sql, list);
        if (result.status)
        {
            status  = true;
            context = Common.StringToJson(result.context);


            //===========log
            C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
            lg.Platform_isMobile();
            lg.Controller = SafeValue.SafeString(job["user"]);
            lg.Lat        = SafeValue.SafeString(job["Lat"]);
            lg.Lng        = SafeValue.SafeString(job["Lng"]);
            //lg.ActionLevel_isCARGO(SafeValue.SafeInt(job["Oid"], 0));
            //lg.Remark = "Cargo update";
            lg.setActionLevel(SafeValue.SafeInt(job["Oid"], 0), CtmJobEventLogRemark.Level.Cargo, 3);
            lg.log();
        }

        Common.WriteJsonP(status, context);
    }
Exemple #30
0
        public BizResult delete(string user)
        {
            BizResult res = new BizResult();

            if (det1 == null || det1.Id == 0)
            {
                res.context = "Data is empty";
            }
            else
            {
                if (updating_verify(res, user, det1))
                {
                    string sql = string.Format(@"delete from ctm_jobdet1 where Id=@Id");
                    List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();
                    list.Add(new ConnectSql_mb.cmdParameters("@Id", det1.Id, SqlDbType.Int));
                    ConnectSql_mb.sqlResult sqlRes = ConnectSql_mb.ExecuteNonQuery(sql, list);
                    if (sqlRes.status)
                    {
                        res.status = true;
                        CtmJobEventLog lg = new CtmJobEventLog();
                        lg.Platform_isBackend();
                        lg.Controller = user;
                        //lg.JobNo = det1.JobNo;
                        //lg.ContainerNo = det1.ContainerNo;
                        //lg.Remark = "ContDelete";
                        lg.setActionLevel(det1.Id, CtmJobEventLogRemark.Level.Container, 2);
                        lg.log();
                        System.Collections.ObjectModel.Collection <C2.CtmJobDet2> det2 = C2.Manager.ORManager.GetCollection <C2.CtmJobDet2>("det1Id=" + det1.Id);
                        C2.CtmJobDet2Biz det2Bz = new CtmJobDet2Biz(0);
                        foreach (C2.CtmJobDet2 temp in det2)
                        {
                            det2Bz.setData(temp);
                            det2Bz.delete(user);
                        }
                        //sql = string.Format(@"delete from ctm_jobdet2 where det1Id=@Id");
                        //ConnectSql_mb.ExecuteNonQuery(sql, list);
                    }
                }
            }
            return(res);
        }