Exemple #1
0
    protected void Save()
    {
        ASPxComboBox com_Code       = grid.FindEditFormTemplateControl("cbPort") as ASPxComboBox;
        ASPxMemo     me_Description = grid.FindEditFormTemplateControl("me_Description") as ASPxMemo;
        string       code           = SafeValue.SafeString(com_Code.Text, "");

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(XXPartyGroup), "Code='" + code + "'");
        XXPartyGroup group  = C2.Manager.ORManager.GetObject(query) as XXPartyGroup;
        bool         action = false;

        if (group == null)
        {
            group  = new XXPartyGroup();
            action = true;
        }
        group.Code        = code;
        group.Description = me_Description.Text;
        if (action)
        {
            Manager.ORManager.StartTracking(group, Wilson.ORMapper.InitialState.Inserted);
            Manager.ORManager.PersistChanges(group);
        }
        else
        {
            Manager.ORManager.StartTracking(group, Wilson.ORMapper.InitialState.Updated);
            Manager.ORManager.PersistChanges(group);
        }
    }
    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;
    }
    protected void grid_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
    {
        int    id    = SafeValue.SafeInt(Request.QueryString["id"], 0);
        string jobNo = SafeValue.SafeString(Request.QueryString["no"]);

        Wilson.ORMapper.OPathQuery job = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id='" + id + "'");
        C2.JobHouse house = C2.Manager.ORManager.GetObject(job) as C2.JobHouse;
        e.NewValues["HouseId"]     = id;
        e.NewValues["Qty"]         = 1;
        e.NewValues["ProcessQty1"] = 0;
        e.NewValues["ProcessQty2"] = 0;
        e.NewValues["ProcessQty3"] = 0;
        e.NewValues["JobNo"]       = jobNo;
        e.NewValues["DateEntry"]   = DateTime.Now;
        e.NewValues["DatePlan"]    = DateTime.Now;
        //e.NewValues["DateInspect"] = DateTime.Now;
        //e.NewValues["DateProcess"] = DateTime.Now;
        e.NewValues["ProcessType"]   = "";
        e.NewValues["ProcessStatus"] = "Pending";
        e.NewValues["LotNo"]         = house.BookingNo;
        e.NewValues["LocationCode"]  = "";
        e.NewValues["Specs1"]        = "";
        e.NewValues["Specs2"]        = "";
        e.NewValues["Specs3"]        = "";
        e.NewValues["Specs4"]        = "";
        e.NewValues["Remark1"]       = "";
        e.NewValues["Remark2"]       = "";
    }
Exemple #4
0
    public string CreateSO(string id)
    {
        string userId = HttpContext.Current.User.Identity.Name;
        string doNo   = "";

        doNo = C2Setup.GetNextNo("", "SaleOrders", DateTime.Now);
        string sql = string.Format(@"insert into Wh_Trans (DoNo,DoDate,PartyId,PartyName,Pic,PartyAdd,Currency,DoType,DoStatus,ExRate,SalesId,CreateBy,CreateDateTime,UpdateBy,UpdateDateTime
,AgentId,AgentName,AgentAdd,AgentContact,NotifyId,NotifyName)
select top 1 '{1}',GETDATE(),wh.PartyId,PartyName,PartyContact,PartyAdd,'SGD','SO','Draft',1,SalesId,'{2}',GETDATE(),'{2}',GETDATE()
,DoctorId,doc.Name,doc.Address,doc.Contact,Patient,pat.Name
from Wh_Schedule as wh
left outer join Ref_PersonInfo as doc on wh.DoctorId=doc.PartyId and doc.Type='Doctor'
left outer join Ref_PersonInfo as pat on wh.Patient=pat.ICNo and pat.Type='Patient'
where wh.Id='{0}'", id, doNo, userId);

        SafeValue.SafeInt(ConnectSql.ExecuteSql(sql), 0);
        C2Setup.SetNextNo("", "SaleOrders", doNo, DateTime.Now);

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhSchedule), "Id='" + id + "'");
        WhSchedule s = C2.Manager.ORManager.GetObject(query) as WhSchedule;

        s.DoNo = doNo;
        Manager.ORManager.StartTracking(s, Wilson.ORMapper.InitialState.Updated);
        Manager.ORManager.PersistChanges(s);

        return(doNo);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string jobNo     = SafeValue.SafeString(Request.QueryString["JobNo"]);
        string tripId    = SafeValue.SafeString(Request.QueryString["tripId"]);
        string tripIndex = SafeValue.SafeString(Request.QueryString["tripIndex"]);

        txt_JobNo.Text  = jobNo;
        lbl_TripId.Text = tripId;
        if (!IsPostBack)
        {
            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJobDet2), "Id='" + tripId + "'");
            C2.CtmJobDet2 trip = C2.Manager.ORManager.GetObject(query) as C2.CtmJobDet2;

            if (trip != null)
            {
                Session["CTM_Trip_" + tripId] = "Id='" + tripId + "'";
                this.dsTrip.FilterExpression  = Session["CTM_Trip_" + tripId].ToString();
                if (this.gv_tpt_trip.GetRow(0) != null)
                {
                    this.gv_tpt_trip.StartEdit(0);
                }
            }
        }

        if (Session["CTM_Trip_" + tripId] != null)
        {
            this.dsTrip.FilterExpression = Session["CTM_Trip_" + tripId].ToString();
            if (this.gv_tpt_trip.GetRow(0) != null)
            {
                this.gv_tpt_trip.StartEdit(0);
            }
        }
    }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        string    user = HttpContext.Current.User.Identity.Name;
        string    sql  = string.Format(@"select Id from Hr_PersonNews where Id='{0}'", SafeValue.SafeInt(txt_Id.Text, 0));
        DataTable tab  = C2.Manager.ORManager.GetDataSet(sql).Tables[0];

        if (tab.Rows.Count == 1)
        {
            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(HrPersonNews), "Id='" + txt_Id.Text + "'");
            HrPersonNews news = C2.Manager.ORManager.GetObject(query) as HrPersonNews;
            news.Title          = txt_Title.Text.Replace("'", "''");
            news.Note           = memo_Note.Text.Replace("'", "''");
            news.UpdateBy       = user;
            news.UpdateDateTime = DateTime.Now;
            news.ExpireDateTime = SafeValue.SafeDate(date_ExpireDateTime.Value, DateTime.Now);
            C2.Manager.ORManager.StartTracking(news, Wilson.ORMapper.InitialState.Updated);
            C2.Manager.ORManager.PersistChanges(news);
        }
        else
        {
            sql = string.Format(@"INSERT INTO dbo.Hr_PersonNews(Title,Note,CreateBy,CreateDateTime,ExpireDateTime) VALUES('{0}','{1}','{2}','{3}','{4}')", txt_Title.Text.Replace("'", "''"), memo_Note.Text.Replace("'", "''"), user, DateTime.Now, SafeValue.SafeDate(date_ExpireDateTime.Value, DateTime.Now));
            C2.Manager.ORManager.ExecuteCommand(sql);
            sql         = "select max(Id) from Hr_PersonNews";
            txt_Id.Text = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql));
        }
    }
Exemple #7
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 #8
0
    private string update_house(int id, DateTime shipDate, string shipIndex
                                , string portCode, string contIndex, object qty, object weight, object volume)
    {
        string result = "";

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id=" + id + "");
        C2.JobHouse house = C2.Manager.ORManager.GetObject(query) as C2.JobHouse;
        if (house != null)
        {
            #region

            house.ShipDate     = shipDate;
            house.ShipIndex    = SafeValue.SafeInt(shipIndex, 0);
            house.ShipPortCode = portCode;
            house.ContIndex    = contIndex;
            house.QtyOrig      = SafeValue.SafeDecimal(qty);
            house.WeightOrig   = SafeValue.SafeDecimal(weight);
            house.VolumeOrig   = SafeValue.SafeDecimal(volume);
            C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Updated);
            C2.Manager.ORManager.PersistChanges(house);
            result = "Save Success!";
            #endregion
        }

        return(result);
    }
Exemple #9
0
		/// <summary>
		/// Parses an OPath query into an ObjectExpression using the mappings from the specified ObjectSpace.
		/// </summary>
		/// <param name="query">OPathQuery to be processed.</param>
		/// <param name="os">ObjectSpaces containing the mappings to use.</param>
		/// <returns>ObjectExpression containing the parser results, which are ready to be compiled.</returns>
		public static ObjectExpression Parse(OPathQuery query, ObjectSpace os)
		{
			if( query == null ) throw new ArgumentNullException("query");
			if( os == null ) throw new ArgumentNullException("os");

			return Parse(query, os.context.Mappings);
		}
Exemple #10
0
    protected void grid1_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
    {
        try
        {
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    int id = list[i].id;
                    Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobRate), "Id=" + id + "");
                    C2.JobRate rate = C2.Manager.ORManager.GetObject(query) as C2.JobRate;

                    if (rate != null)
                    {
                        rate.ClientId = btn_ClientId.Text;
                        rate.Price    = list[i].amt;
                        Manager.ORManager.StartTracking(rate, Wilson.ORMapper.InitialState.Inserted);
                        Manager.ORManager.PersistChanges(rate);
                    }
                }
                e.Result = "Success";
            }
            else
            {
                e.Result = "Pls Select at least one Rate";
            }
        }
        catch { }
    }
 private void Save()
 {
     try
     {
         ASPxPageControl            pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
         ASPxTextBox                txtId       = pageControl.FindControl("txt_Id") as ASPxTextBox;
         string                     id          = SafeValue.SafeString(txtId.Text, "");
         Wilson.ORMapper.OPathQuery query       = new Wilson.ORMapper.OPathQuery(typeof(WhContract), "Id='" + id + "'");
         WhContract                 contract    = C2.Manager.ORManager.GetObject(query) as WhContract;
         bool   isNew      = false;
         string contractNo = "";
         if (contract == null)
         {
             contract   = new WhContract();
             isNew      = true;
             contractNo = C2Setup.GetNextNo("Contract");
         }
         ASPxButtonEdit txt_PartyId = pageControl.FindControl("txt_PartyId") as ASPxButtonEdit;
         contract.PartyId = txt_PartyId.Text;
         ASPxDateEdit txt_Date = pageControl.FindControl("txt_Date") as ASPxDateEdit;
         contract.ContractDate = txt_Date.Date;
         ASPxDateEdit txt_StartDate = pageControl.FindControl("txt_StartDate") as ASPxDateEdit;
         contract.StartDate = txt_StartDate.Date;
         ASPxDateEdit txt_ExpireDate = pageControl.FindControl("txt_ExpireDate") as ASPxDateEdit;
         contract.ExpireDate = txt_ExpireDate.Date;
         ASPxButtonEdit txt_WarehouseId = pageControl.FindControl("txt_WarehouseId") as ASPxButtonEdit;
         contract.WhCode = txt_WarehouseId.Text;
         ASPxButtonEdit txt_SalesmanId = pageControl.FindControl("txt_SalesmanId") as ASPxButtonEdit;
         ASPxComboBox   cmb_Type       = pageControl.FindControl("cmb_Type") as ASPxComboBox;
         contract.StorageType = cmb_Type.Text;
         ASPxMemo txt_Remark = pageControl.FindControl("txt_Remark") as ASPxMemo;
         contract.Remark = txt_Remark.Text;
         string userId = HttpContext.Current.User.Identity.Name;
         if (isNew)
         {
             contract.CreateBy       = userId;
             contract.CreateDateTime = DateTime.Now;
             contract.ContractNo     = contractNo.ToString();
             contract.StatusCode     = "USE";
             Manager.ORManager.StartTracking(contract, Wilson.ORMapper.InitialState.Inserted);
             Manager.ORManager.PersistChanges(contract);
             C2Setup.SetNextNo("Contract", contractNo);
         }
         else
         {
             contract.UpdateBy       = userId;
             contract.UpdateDateTime = DateTime.Now;
             Manager.ORManager.StartTracking(contract, Wilson.ORMapper.InitialState.Updated);
             Manager.ORManager.PersistChanges(contract);
         }
         Session["ContractWhere"]           = "ContractNo='" + contract.ContractNo + "'";
         this.dsWhContract.FilterExpression = Session["ContractWhere"].ToString();
         if (this.grid.GetRow(0) != null)
         {
             this.grid.StartEdit(0);
         }
     }
     catch { }
 }
    protected void SaveJob()
    {
        try
        {
            ASPxGridView g = this.grid_Marking;


            ASPxTextBox houseId = g.FindEditFormTemplateControl("txt_Id") as ASPxTextBox;
            int         Id      = SafeValue.SafeInt(houseId.Text, 0);
            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(SeaExportMkg), "SequenceId='" + Id + "'");
            SeaExportMkg mkg   = C2.Manager.ORManager.GetObject(query) as SeaExportMkg;
            bool         isNew = false;
            if (Id == 0)
            {
                isNew = true;
                mkg   = new SeaExportMkg();
            }
            ASPxDateEdit polEta = g.FindEditFormTemplateControl("date_PolEta") as ASPxDateEdit;
            mkg.PolEta = polEta.Date;
            ASPxDateEdit polClearDate = g.FindEditFormTemplateControl("date_PolClearDate") as ASPxDateEdit;
            mkg.PolClearDate = polClearDate.Date;
            ASPxDateEdit polReturnDate = g.FindEditFormTemplateControl("date_PolReturnDate") as ASPxDateEdit;
            mkg.PolReturnDate = polReturnDate.Date;
            ASPxDateEdit podEta = g.FindEditFormTemplateControl("date_PodEta") as ASPxDateEdit;
            mkg.PodEta = podEta.Date;
            ASPxDateEdit podClearDate = g.FindEditFormTemplateControl("date_PodClearDate") as ASPxDateEdit;
            mkg.PodClearDate = podClearDate.Date;
            ASPxDateEdit podReturnDate = g.FindEditFormTemplateControl("date_PodReturnDate") as ASPxDateEdit;
            mkg.PodReturnDate = podReturnDate.Date;
            ASPxMemo polRemark = g.FindEditFormTemplateControl("memo_PolRemark") as ASPxMemo;
            mkg.PolRemark = polRemark.Text;
            ASPxMemo podRemark = g.FindEditFormTemplateControl("memo_PodRemark") as ASPxMemo;
            mkg.PodRemark = podRemark.Text;



            if (isNew)
            {
                C2.Manager.ORManager.StartTracking(mkg, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(mkg);
                houseId.Text = mkg.SequenceId.ToString();
                //this.txt_JobNo.Text = tpt1.JobNo;
                Session["TptWhere"]             = "SequenceId='" + mkg.SequenceId + "'";
                this.dsMarking.FilterExpression = Session["TptWhere"].ToString();
                if (this.grid_Marking.GetRow(0) != null)
                {
                    this.grid_Marking.StartEdit(0);
                }
            }
            else
            {
                C2.Manager.ORManager.StartTracking(mkg, Wilson.ORMapper.InitialState.Updated);
                C2.Manager.ORManager.PersistChanges(mkg);
            }
        }
        catch (Exception ex)
        { throw new Exception(ex.Message + ex.StackTrace); }
    }
Exemple #13
0
    private string update_cont(int id, string jobNo, string contNo, string sealNo, string contType, DateTime schedule, string contIndex
                               , string clearStatus, DateTime clearDate, string verify, DateTime verifyDate, string remark, DateTime valiDate, DateTime scheduleStartDate)
    {
        string result = "";

        #region list
        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "JobNo='" + jobNo + "' and ContNo='" + contIndex + "'");
        ObjectSet objSet = C2.Manager.ORManager.GetObjectSet(query);
        if (objSet.Count > 0)
        {
            #region
            for (int j = 0; j < objSet.Count; j++)
            {
                C2.JobHouse house = objSet[j] as C2.JobHouse;

                house.ContNo      = contNo;
                house.OpsType     = "Export";
                house.CargoStatus = "C";

                C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Updated);
                C2.Manager.ORManager.PersistChanges(house);
            }
            #endregion
        }
        string sql = "";
        List <ConnectSql_mb.cmdParameters> cmd = new List <ConnectSql_mb.cmdParameters>();

        sql = string.Format(@"update ctm_jobdet1 set ContainerNo=@ContainerNo,SealNo=@SealNo,
ContainerType=@ContainerType,ScheduleDate=@ScheduleDate,StatusCode=@StatusCode,CustomsClearDate=@CustomsClearDate,
CustomsClearStatus=@CustomsClearStatus,CustomsVerifyInd=@CustomsVerifyInd,CustomsVerifyDate=@CustomsVerifyDate,CustomsRemark=@CustomsRemark,ValiDate=@ValiDate,ScheduleStartDate=@ScheduleStartDate 
where JobNo=@JobNo and ContainerNo=@ContNo");
        cmd = new List <ConnectSql_mb.cmdParameters>();
        cmd.Add(new ConnectSql_mb.cmdParameters("@ContainerNo", contNo, SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@SealNo", sealNo, SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@ContainerType", contType, SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@JobNo", jobNo, SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@ContNo", contIndex, SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@StatusCode", "Export", SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@ScheduleDate", schedule, SqlDbType.DateTime));
        cmd.Add(new ConnectSql_mb.cmdParameters("@CustomsClearDate", clearDate, SqlDbType.DateTime));
        cmd.Add(new ConnectSql_mb.cmdParameters("@CustomsClearStatus", clearStatus, SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@CustomsVerifyInd", verify, SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@CustomsVerifyDate", verifyDate, SqlDbType.DateTime));
        cmd.Add(new ConnectSql_mb.cmdParameters("@CustomsRemark", remark, SqlDbType.NVarChar));
        cmd.Add(new ConnectSql_mb.cmdParameters("@ValiDate", valiDate, SqlDbType.DateTime));
        cmd.Add(new ConnectSql_mb.cmdParameters("@ScheduleStartDate", scheduleStartDate, SqlDbType.DateTime));
        ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteNonQuery(sql, cmd);
        if (res.status)
        {
            result = "Save Success!";
        }

        #endregion
        return(result);
    }
    protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string paras = e.Parameters;

        if (paras == "Assign")
        {
            ASPxSpinEdit spin_Qty         = grid.FindRowCellTemplateControl(0, null, "spin_Qty") as ASPxSpinEdit;
            ASPxSpinEdit spin_Weight      = grid.FindRowCellTemplateControl(0, null, "spin_Weight") as ASPxSpinEdit;
            ASPxSpinEdit spin_Volume      = grid.FindRowCellTemplateControl(0, null, "spin_Volume") as ASPxSpinEdit;
            ASPxDateEdit date_ShipDate    = grid.FindRowCellTemplateControl(0, null, "date_ShipDate") as ASPxDateEdit;
            ASPxComboBox cbb_ShipIndex    = grid.FindRowCellTemplateControl(0, null, "cbb_ShipIndex") as ASPxComboBox;
            ASPxTextBox  txt_ShipPortCode = grid.FindRowCellTemplateControl(0, null, "txt_ShipPortCode") as ASPxTextBox;
            ASPxComboBox cbb_ContIndex    = grid.FindRowCellTemplateControl(0, null, "cbb_ContIndex") as ASPxComboBox;

            DateTime now   = DateTime.Now;
            string   jobNo = "";
            string   refNo = "";
            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id=" + lbl_Id.Text + "");
            C2.JobHouse house = C2.Manager.ORManager.GetObject(query) as C2.JobHouse;
            if (house != null)
            {
                #region
                refNo = house.JobNo;
                C2.CtmJob job = new CtmJob();
                jobNo          = C2Setup.GetNextNo("", "CTM_Job_WDO", DateTime.Now);
                job.JobNo      = jobNo;
                job.JobDate    = DateTime.Now;
                job.ClientId   = house.ConsigneeInfo;
                job.DeliveryTo = "";
                C2.Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(job);
                C2Setup.SetNextNo("", "CTM_Job_WDO", jobNo, now);

                house.LineId       = SafeValue.SafeInt(lbl_Id.Text, 0);
                job.JobType        = "WDO";
                house.JobNo        = jobNo;
                house.RefNo        = refNo;
                house.CargoType    = "OUT";
                house.CargoStatus  = "P";
                house.QtyOrig      = SafeValue.SafeDecimal(spin_Qty.Value);
                house.WeightOrig   = SafeValue.SafeDecimal(spin_Weight.Value);
                house.VolumeOrig   = SafeValue.SafeDecimal(spin_Volume.Value);
                house.ShipDate     = date_ShipDate.Date;
                house.ShipIndex    = SafeValue.SafeInt(cbb_ShipIndex.Value, 0);
                house.ShipPortCode = txt_ShipPortCode.Text;
                house.ContIndex    = SafeValue.SafeString(cbb_ContIndex.Value);
                C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(house);

                #endregion
            }
            e.Result = "Action Success! No is " + jobNo;
        }
    }
Exemple #15
0
		internal static ObjectExpression Parse(OPathQuery query, Mappings maps)
		{
			OPath opath = new OPath(maps);

			int paramCount;
			Expression exp = opath.Parse(query.ObjectType, query.WhereExpression, query.SortExpression, out paramCount);
			ObjectExpression oe = new ObjectExpression(query.ObjectType, exp, maps, paramCount);
			oe.baseQuery = query;

			return oe;
		}
Exemple #16
0
    protected void SaveAndUpdate()
    {
        try
        {
            ASPxTextBox txt_Id = ASPxGridView1.FindEditFormTemplateControl("txt_Oid") as ASPxTextBox;
            string      Id     = SafeValue.SafeString(txt_Id.Text, "");
            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(HrInterview), "Id='" + Id + "'");
            HrInterview itv    = C2.Manager.ORManager.GetObject(query) as HrInterview;
            bool        action = false;

            if (itv == null)
            {
                action = true;
                itv    = new HrInterview();
            }

            ASPxComboBox department = ASPxGridView1.FindEditFormTemplateControl("cmb_Department") as ASPxComboBox;
            itv.Department = department.Text;
            ASPxTextBox interviewPic = ASPxGridView1.FindEditFormTemplateControl("txt_InterviewPic") as ASPxTextBox;
            itv.Pic = interviewPic.Text;
            ASPxDateEdit interviewDay = ASPxGridView1.FindEditFormTemplateControl("date_InterviewDay") as ASPxDateEdit;
            itv.Date = interviewDay.Date;
            ASPxMemo remark = ASPxGridView1.FindEditFormTemplateControl("memo_InterviewRemark") as ASPxMemo;
            itv.Remark = remark.Text;
            ASPxMemo remark1 = ASPxGridView1.FindEditFormTemplateControl("memo_InterviewJoiner") as ASPxMemo;
            itv.Remark1 = remark1.Text;
            ASPxComboBox status = ASPxGridView1.FindEditFormTemplateControl("cmb_Status") as ASPxComboBox;
            itv.StatusCode = status.Text;

            if (action)
            {
                itv.CreateBy       = HttpContext.Current.User.Identity.Name;
                itv.CreateDateTime = DateTime.Now;
                Manager.ORManager.StartTracking(itv, Wilson.ORMapper.InitialState.Inserted);
                Manager.ORManager.PersistChanges(itv);
            }
            else
            {
                itv.UpdateBy       = HttpContext.Current.User.Identity.Name;
                itv.UpdateDateTime = DateTime.Now;
                Manager.ORManager.StartTracking(itv, Wilson.ORMapper.InitialState.Updated);
                Manager.ORManager.PersistChanges(itv);
            }
            Session["Interview"] = "Id='" + itv.Id + "'";
            this.dsInterview.FilterExpression = Session["Interview"].ToString();
            if (this.ASPxGridView1.GetRow(0) != null)
            {
                this.ASPxGridView1.StartEdit(0);
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
    protected void SaveAndUpdate()
    {
        try
        {
            ASPxTextBox txt_Id = ASPxGridView1.FindEditFormTemplateControl("txt_Oid") as ASPxTextBox;
            string      Id     = SafeValue.SafeString(txt_Id.Text, "");
            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(HrRecruitment), "Id='" + Id + "'");
            HrRecruitment recruit            = C2.Manager.ORManager.GetObject(query) as HrRecruitment;
            bool          action             = false;

            if (recruit == null)
            {
                action  = true;
                recruit = new HrRecruitment();
            }

            ASPxComboBox department = ASPxGridView1.FindEditFormTemplateControl("cmb_Department") as ASPxComboBox;
            recruit.Department = department.Text;
            ASPxTextBox recruitPic = ASPxGridView1.FindEditFormTemplateControl("txt_RecruitPic") as ASPxTextBox;
            recruit.Pic = recruitPic.Text;
            ASPxDateEdit recruitDay = ASPxGridView1.FindEditFormTemplateControl("date_RecruitDay") as ASPxDateEdit;
            recruit.Date = recruitDay.Date;
            ASPxMemo remark1 = ASPxGridView1.FindEditFormTemplateControl("memo_RecruitWork") as ASPxMemo;
            recruit.Remark1 = remark1.Text;
            ASPxMemo remark2 = ASPxGridView1.FindEditFormTemplateControl("memo_RecruitSalary") as ASPxMemo;
            recruit.Remark2 = remark2.Text;
            ASPxComboBox status = ASPxGridView1.FindEditFormTemplateControl("cmb_Status") as ASPxComboBox;
            recruit.StatusCode = status.Text;

            if (action)
            {
                recruit.CreateBy       = HttpContext.Current.User.Identity.Name;
                recruit.CreateDateTime = DateTime.Now;
                Manager.ORManager.StartTracking(recruit, Wilson.ORMapper.InitialState.Inserted);
                Manager.ORManager.PersistChanges(recruit);
            }
            else
            {
                recruit.UpdateBy       = HttpContext.Current.User.Identity.Name;
                recruit.UpdateDateTime = DateTime.Now;
                Manager.ORManager.StartTracking(recruit, Wilson.ORMapper.InitialState.Updated);
                Manager.ORManager.PersistChanges(recruit);
            }
            Session["Recruitment"] = "Id='" + recruit.Id + "'";
            this.dsRecruitment.FilterExpression = Session["Recruitment"].ToString();
            if (this.ASPxGridView1.GetRow(0) != null)
            {
                this.ASPxGridView1.StartEdit(0);
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
Exemple #18
0
    protected void AddOrUpdate()
    {
        ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
        ASPxTextBox     txt_pId     = pageControl.FindControl("txt_Id") as ASPxTextBox;
        string          pId         = SafeValue.SafeString(txt_pId.Text, "");

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhInventory), "Id='" + pId + "'");
        WhInventory obj         = C2.Manager.ORManager.GetObject(query) as WhInventory;
        bool        action      = false;
        string      inventoryNo = "";

        if (obj == null)
        {
            action      = true;
            obj         = new WhInventory();
            inventoryNo = C2Setup.GetNextNo("Inventory");
        }

        ASPxTextBox txt_InventoryNo = pageControl.FindControl("txt_InventoryNo") as ASPxTextBox;

        obj.InventoryNo = txt_InventoryNo.Text.Trim();
        ASPxDateEdit date_InventoryDate = pageControl.FindControl("date_InventoryDate") as ASPxDateEdit;

        obj.InventoryDate = date_InventoryDate.Date;

        ASPxTextBox txt_InventoryUser = pageControl.FindControl("txt_InventoryUser") as ASPxTextBox;

        obj.InventoryUser = txt_InventoryUser.Text;

        if (action)
        {
            obj.InventoryNo    = inventoryNo;
            obj.CreateBy       = HttpContext.Current.User.Identity.Name;
            obj.CreateDateTime = DateTime.Now;
            C2Setup.SetNextNo("Inventory", inventoryNo);
            Manager.ORManager.StartTracking(obj, Wilson.ORMapper.InitialState.Inserted);
            Manager.ORManager.PersistChanges(obj);
            Session["NameWhere"] = "InventoryNo='" + inventoryNo + "'";
            this.dsWhInventory.FilterExpression = Session["NameWhere"].ToString();
            if (this.grid.GetRow(0) != null)
            {
                this.grid.StartEdit(0);
            }
        }
        else
        {
            obj.UpdateBy       = HttpContext.Current.User.Identity.Name;
            obj.UpdateDateTime = DateTime.Now;
            Manager.ORManager.StartTracking(obj, Wilson.ORMapper.InitialState.Updated);
            Manager.ORManager.PersistChanges(obj);
        }
    }
Exemple #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string sn = "";
        string id = "";

        if (Request.QueryString["sn"] != null && Request.QueryString["id"] != null)
        {
            sn = Request.QueryString["sn"].ToString();
            id = Request.QueryString["id"].ToString();
            if (!IsPostBack)
            {
                this.dsCont.FilterExpression     = "JobNo='" + sn + "'";
                this.dsContTrip.FilterExpression = "JobNo='" + sn + "'";
                Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmAttachment), "Id='" + id + "'");
                C2.CtmAttachment           obj   = C2.Manager.ORManager.GetObject(query) as C2.CtmAttachment;
                DataTable tab = new DataTable();
                tab.Columns.Add("RefNo");
                tab.Columns.Add("ContainerNo");
                tab.Columns.Add("TripId");
                tab.Columns.Add("FileName");
                tab.Columns.Add("FileNote");

                tab.Columns.Add("FilePath");
                tab.Columns.Add("ImgPath");
                string path       = obj.FilePath;
                string filePath   = obj.FilePath;
                string imgPath    = obj.ImgPath;
                string uploadType = obj.FileType;
                string url        = Request.Url.ToString().Replace("http://", "");
                //if (url.IndexOf("192.168") == -1)
                //imgPath = "http://" + url.Substring(0, url.IndexOf("/")) + imgPath.ToLower().Replace(".jpg", "_thumb.jpg");
                if (uploadType.ToLower() != "image")
                {
                    imgPath = "http://" + url.Substring(0, url.IndexOf("/")) + "/Images/LOGO.jpg";
                }
                //filePath = "http://" + url.Substring(0, url.IndexOf("/")) + filePath;
                DataRow row = tab.NewRow();
                row["RefNo"]       = sn;
                row["ContainerNo"] = obj.ContainerNo;
                row["TripId"]      = obj.TripId;
                row["FileName"]    = obj.FileName;
                row["FileNote"]    = obj.FileNote;
                row["ImgPath"]     = imgPath;
                row["FilePath"]    = filePath;
                tab.Rows.Add(row);

                this.grid.DataSource = tab;
                this.grid.DataBind();
            }
            OnLoad(sn);
        }
    }
		internal CompiledQuery(ObjectExpression oe)
		{
			_objectExpression = oe;
			_objectType = oe.ObjectType;
			this.baseQuery = oe.baseQuery;
			this.parameterCount = oe.ParameterCount;

			OPathCompiler compiler = new OPathCompiler();
			compiler.Compile(oe);

			_sqlQuery = compiler.SqlQuery;
			this.parameterTable = compiler.ParameterTable;
		}
Exemple #21
0
    private void insert_data(string jobNo, string refNo, int id, int shipIndex, DateTime shipDate, string postCode, string contIndex, decimal qty, decimal weight, decimal volume)
    {
        string contNo = "C_" + contIndex;
        string sql    = string.Format(@"select count(*) from ctm_jobdet1 where JobNo='{0}' and ContainerNo='{1}'", jobNo, contNo);
        int    n      = SafeValue.SafeInt(ConnectSql_mb.ExecuteScalar(sql), 0);

        if (n == 0)
        {
            create_cont(jobNo, contNo, shipDate);
        }
        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id=" + id + "");
        C2.JobHouse house = C2.Manager.ORManager.GetObject(query) as C2.JobHouse;
        if (house != null)
        {
            #region
            refNo              = house.JobNo;
            house.OpsType      = "Export";
            house.LineId       = id;
            house.JobType      = "EXP";
            house.JobNo        = jobNo;
            house.RefNo        = refNo;
            house.CargoType    = "OUT";
            house.CargoStatus  = "P";
            house.QtyOrig      = qty;
            house.WeightOrig   = weight;
            house.VolumeOrig   = volume;
            house.ShipDate     = shipDate;
            house.ShipIndex    = shipIndex;
            house.ShipPortCode = postCode;
            house.ContIndex    = contNo;
            house.ContNo       = house.ContIndex;
            C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(house);

            #endregion
        }
        ObjectQuery query1 = new ObjectQuery(typeof(C2.JobStock), "OrderId=" + id + "", "");
        ObjectSet   objSet = C2.Manager.ORManager.GetObjectSet(query1);
        if (objSet.Count > 0)
        {
            for (int j = 0; j < objSet.Count; j++)
            {
                C2.JobStock s = objSet[j] as C2.JobStock;
                s.OrderId = house.Id;
                s.LineId  = id;
                C2.Manager.ORManager.StartTracking(s, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(s);
            }
        }
    }
Exemple #22
0
        internal CompiledQuery(ObjectExpression oe)
        {
            _objectExpression   = oe;
            _objectType         = oe.ObjectType;
            this.baseQuery      = oe.baseQuery;
            this.parameterCount = oe.ParameterCount;

            OPathCompiler compiler = new OPathCompiler();

            compiler.Compile(oe);

            _sqlQuery           = compiler.SqlQuery;
            this.parameterTable = compiler.ParameterTable;
        }
Exemple #23
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);
    }
Exemple #24
0
    public void AddFile(string type, string code, string _name, string desc)
    {
        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(CtmAttachment), "Id='" + code + "'");
        CtmAttachment photo = C2.Manager.ORManager.GetObject(query) as CtmAttachment;

        photo.FileName = _name;
        photo.RefNo    = code;
        //photo.conterno = cmb_ContNo.Text;
        photo.JobNo          = "";
        photo.FileNote       = desc;
        photo.FileType       = type;
        photo.FilePath       = GetFilePath(this.txt_Sn.Text, this.cmb_ContNo.Text, this.cmb_DoNo.Text) + _name;
        photo.UpdateBy       = HttpContext.Current.User.Identity.Name;
        photo.UpdateDateTime = DateTime.Now.ToLocalTime();
        Manager.ORManager.StartTracking(photo, Wilson.ORMapper.InitialState.Updated);
        Manager.ORManager.PersistChanges(photo);
    }
    private string AddPurchase(DataTable tab, string doNo, string partyId, string partyName, string wh)
    {
        string poNo = "";
        string pId  = "";

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhTrans), "Id='" + pId + "'");
        WhTrans whTrans = C2.Manager.ORManager.GetObject(query) as WhTrans;

        whTrans                = new WhTrans();
        poNo                   = C2Setup.GetNextNo("", "PurchaseOrders", DateTime.Now);
        whTrans.DoNo           = poNo;
        whTrans.DoType         = "PO";
        whTrans.PartyId        = partyId;
        whTrans.PartyName      = partyName;
        whTrans.CreateBy       = EzshipHelper.GetUserName();
        whTrans.CreateDateTime = DateTime.Now;
        whTrans.DoDate         = DateTime.Now;
        whTrans.ExpectedDate   = DateTime.Today.AddDays(14);
        whTrans.Currency       = "SGD";
        whTrans.DoStatus       = "Draft";
        whTrans.ExRate         = SafeValue.SafeDecimal(1.000000);
        whTrans.WareHouseId    = wh;
        whTrans.BlanketNo      = txt_DoNo.Text;
        Manager.ORManager.StartTracking(whTrans, Wilson.ORMapper.InitialState.Inserted);
        Manager.ORManager.PersistChanges(whTrans);
        C2Setup.SetNextNo("", "PurchaseOrders", poNo, DateTime.Now);


        for (int i = 0; i < tab.Rows.Count; i++)
        {
            string  sku      = SafeValue.SafeString(tab.Rows[i]["ProductCode"]);
            string  lotNo    = SafeValue.SafeString(tab.Rows[i]["LotNo"]);
            int     qty      = SafeValue.SafeInt(tab.Rows[i]["Qty1"], 0);
            decimal price    = SafeValue.SafeDecimal(tab.Rows[i]["Price"]);
            string  location = SafeValue.SafeString(tab.Rows[i]["LocationCode"]);
            string  sql      = @"Insert Into Wh_TransDet(DoNo,ProductCode,DoType,Qty1,Price,LotNo,Uom1,Uom2,Uom3,Uom4,[QtyPackWhole],[QtyWholeLoose],[QtyLooseBase],[CreateBy],[CreateDateTime],[UpdateBy],[UpdateDateTime],Att1,Att2,Att3,Att4,Att5,Att6,Des1,Packing,LocationCode)";
            sql += string.Format(@"select '{0}'as DoNo, '{1}' as Sku,'PO','{2}' as Qty1,'{3}','{5}',p.UomPacking,p.UomWhole,p.UomLoose,p.UomBase,p.QtyPackingWhole,p.QtyWholeLoose,p.QtyLooseBase,'{4}' as CreateBy,getdate() as CreateDateTime,
'{4}' as UpdateBy,getdate() as UpdateDateTime
,P.att4,P.att5,P.att6,P.att7,P.att8,P.att9,p.Description,p.Att1,'{6}'
from (select '{1}' as Sku) as tab
left join ref_product p on tab.Sku=p.Code", poNo, sku, 0, price, EzshipHelper.GetUserName(), lotNo, location);
            ConnectSql.ExecuteSql(sql);
        }
        return(poNo);
    }
    protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        if (Request.QueryString["id"] != null && Request.QueryString["typ"] != null)
        {
            string ItvRec = Request.QueryString["typ"].ToString();
            int    mastId = SafeValue.SafeInt(Request.QueryString["id"], 0);


            for (int i = 0; i < list.Count; i++)
            {
                try
                {
                    int detId = list[i].detId;

                    string sql = "";

                    sql = string.Format(@"select Id from Hr_Person where Id='{0}'", detId);
                    DataTable tab = C2.Manager.ORManager.GetDataSet(sql).Tables[0];
                    if (tab.Rows.Count == 1)
                    {
                        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(HrPerson), "Id='" + detId + "'");
                        HrPerson person      = C2.Manager.ORManager.GetObject(query) as HrPerson;
                        string   newItvRecId = "<" + mastId + ">";

                        if (ItvRec.ToLower() == "recruitment" && !person.RecruitId.Contains(newItvRecId))
                        {
                            person.RecruitId = person.RecruitId + newItvRecId;
                        }
                        if (ItvRec.ToLower() == "interview" && !person.InterviewId.Contains(newItvRecId))
                        {
                            person.InterviewId = person.InterviewId + newItvRecId;
                        }
                        C2.Manager.ORManager.StartTracking(person, Wilson.ORMapper.InitialState.Updated);
                        C2.Manager.ORManager.PersistChanges(person);
                    }
                }
                catch { }
            }
        }
        else
        {
            e.Result = "Error, Pls refresh your Interview and Recruitment";
        }
    }
    protected void grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        //e.NewValues["PartyName"] = SafeValue.SafeString(e.NewValues["PartyName"]);
        //e.NewValues["TransportName"] = SafeValue.SafeString(e.NewValues["TransportName"]);
        //e.NewValues["TransportStatus"] = SafeValue.SafeString(e.NewValues["TransportStatus"]);
        //e.NewValues["DriverName"] = SafeValue.SafeString(e.NewValues["DriverName"]);
        //e.NewValues["DriverIC"] = SafeValue.SafeString(e.NewValues["DriverIC"]);
        //e.NewValues["DriverTel"] = SafeValue.SafeString(e.NewValues["DriverTel"]);
        //e.NewValues["TptJobNo"] = SafeValue.SafeString(e.NewValues["TptJobNo"]);
        //e.NewValues["TransportStart"] = SafeValue.SafeDate(e.NewValues["TransportStart"],DateTime.Today);
        //e.NewValues["Remarks"] = SafeValue.SafeString(e.NewValues["Remarks"]);

        string      userId = HttpContext.Current.User.Identity.Name;
        ASPxTextBox txt_Id = grid.FindEditRowCellTemplateControl(null, "txt_Id") as ASPxTextBox;

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhDo), "Id='" + txt_Id.Text + "'");
        WhDo whDo = C2.Manager.ORManager.GetObject(query) as WhDo;

        ASPxComboBox txt_TransportStatus = grid.FindEditRowCellTemplateControl(null, "txt_TransportStatus") as ASPxComboBox;
        ASPxTextBox  txt_DriveName       = grid.FindEditRowCellTemplateControl(null, "txt_DriveName") as ASPxTextBox;
        ASPxTextBox  txt_DriverIC        = grid.FindEditRowCellTemplateControl(null, "txt_DriverIC") as ASPxTextBox;
        ASPxTextBox  txt_DriverTel       = grid.FindEditRowCellTemplateControl(null, "txt_DriverTel") as ASPxTextBox;
        ASPxTextBox  txt_VechicleNo      = grid.FindEditRowCellTemplateControl(null, "txt_VechicleNo") as ASPxTextBox;
        ASPxTextBox  txt_TptJobNo        = grid.FindEditRowCellTemplateControl(null, "txt_TptJobNo") as ASPxTextBox;
        ASPxDateEdit date_TransportStart = grid.FindEditRowCellTemplateControl(null, "date_TransportStart") as ASPxDateEdit;
        ASPxMemo     meno_Remark         = grid.FindEditRowCellTemplateControl(null, "meno_Remark") as ASPxMemo;

        whDo.TransportStatus = SafeValue.SafeString(txt_TransportStatus.Text);
        whDo.DriverName      = SafeValue.SafeString(txt_DriveName.Text);
        whDo.DriverIC        = SafeValue.SafeString(txt_DriverIC.Text);
        whDo.DriverTel       = SafeValue.SafeString(txt_DriverTel.Text);
        whDo.VehicleNo       = SafeValue.SafeString(txt_VechicleNo.Text);
        whDo.TptJobNo        = SafeValue.SafeString(txt_TptJobNo.Text);
        whDo.TransportStart  = SafeValue.SafeDate(txt_TransportStatus.Text, DateTime.Today);
        whDo.Remarks         = SafeValue.SafeString(meno_Remark.Text);
        whDo.UpdateBy        = userId;
        whDo.UpdateDateTime  = DateTime.Now;

        Manager.ORManager.StartTracking(whDo, Wilson.ORMapper.InitialState.Updated);
        Manager.ORManager.PersistChanges(whDo);

        btn_search_Click(null, null);
    }
Exemple #28
0
    protected void btn_Create_Command(object sender, CommandEventArgs e)
    {
        int id = SafeValue.SafeInt(e.CommandArgument, 0);

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhSchedule), "Id='" + id + "'");
        WhSchedule s = C2.Manager.ORManager.GetObject(query) as WhSchedule;

        if (s != null)
        {
            //    //string value = "Product:" + s.Product + "  LotNo:" + s.LotNo + " Set:" + s.Location + " " + "\\n Qty:"
            //    //    + s.Qty + " Price:" + s.Price + " TotalAmt:" + SafeValue.ChinaRound(s.Qty * s.Price, 0);
            //    //string script = string.Format("<script type='text/javascript' >function Vali(){if(confirm({0})){grid.GetValuesOnCustomCallback(OK,{1});}}</script>", value, SafeValue.SafeString(id));
            //    //Response.Clear();
            //    //Response.Write(script);


            string soNo = CreateSO(SafeValue.SafeString(id));
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type=\"text/javascript\">parent.navTab.openTab(\"" + soNo + "\",\"/Modules/WareHouse/Job/PoEdit.aspx?no=" + soNo + "\"" + ",{title:\"" + soNo + "\", fresh:false, external:true});</script>");
        }
    }
    protected void grid1_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
    {
        if (Request.QueryString["quoteNo"] != null)
        {
            try
            {
                if (list.Count > 0)
                {
                    string jobNo = SafeValue.SafeString(Request.QueryString["quoteNo"]);
                    for (int i = 0; i < list.Count; i++)
                    {
                        int     id    = list[i].id;
                        decimal price = list[i].price;
                        decimal qty   = list[i].qty;
                        string  unit  = list[i].unit;

                        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobRate), "Id=" + id + "");
                        C2.JobRate rate = C2.Manager.ORManager.GetObject(query) as C2.JobRate;

                        if (rate != null)
                        {
                            rate.JobNo    = jobNo;
                            rate.Qty      = qty;
                            rate.Price    = price;
                            rate.Unit     = unit;
                            rate.LineType = "QUOTED";
                            Manager.ORManager.StartTracking(rate, Wilson.ORMapper.InitialState.Inserted);
                            Manager.ORManager.PersistChanges(rate);
                        }
                    }
                    e.Result = "Success";
                }
                else
                {
                    e.Result = "Pls Select at least one Rate";
                }
            }
            catch { }
        }
    }
    private string update_house(int id, DateTime deliveryDate, object qty, object weight, object volume, object sendMode)
    {
        string result = "";

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id=" + id + "");
        C2.JobHouse house = C2.Manager.ORManager.GetObject(query) as C2.JobHouse;
        if (house != null)
        {
            #region
            //house.DeliveryDate = deliveryDate;
            house.QtyOrig    = SafeValue.SafeDecimal(qty);
            house.WeightOrig = SafeValue.SafeDecimal(weight);
            house.VolumeOrig = SafeValue.SafeDecimal(volume);
            //house.SendMode = SafeValue.SafeString(sendMode);
            C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Updated);
            C2.Manager.ORManager.PersistChanges(house);
            result = "Success";
            #endregion
        }

        return(result);
    }
Exemple #31
0
 private void Update_Det(XAApPayment inv, int index, decimal price, string code, string cntNo, string jobNo, string tripId)
 {
     try
     {
         string sql = string.Format(@"select SequenceId from XAApPaymentDet where Remark1='{0}'", code);
         int    id  = SafeValue.SafeInt(Helper.Sql.One(sql), 0);
         Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.XAApPaymentDet), "SequenceId=" + id + "");
         C2.XAApPaymentDet          det   = C2.Manager.ORManager.GetObject(query) as C2.XAApPaymentDet;
         if (det != null)
         {
             det.DocDate   = new DateTime(1900, 1, 1);
             det.PayId     = inv.SequenceId;
             det.PayNo     = inv.DocNo;
             det.DocType   = inv.DocType;
             det.PayLineNo = index;
             det.AcCode    = System.Configuration.ConfigurationManager.AppSettings["DefaultCash"];
             det.AcSource  = "DB";
             det.Remark1   = code;
             det.Remark2   = "";
             det.Remark3   = cntNo;
             det.MastRefNo = jobNo;
             det.JobRefNo  = tripId;
             det.Currency  = System.Configuration.ConfigurationManager.AppSettings["Currency"];
             det.ExRate    = 1;
             det.DocAmt   += price;
             if (det.ExRate == 0)
             {
                 det.ExRate = 1;
             }
             det.LocAmt = price;
             C2.Manager.ORManager.StartTracking(det, Wilson.ORMapper.InitialState.Updated);
             C2.Manager.ORManager.PersistChanges(det);
         }
     }
     catch
     {
     }
 }
    private MemoryStream PrintHaulierSub(string orderNo, string jobType, string haulierCode)
    {
        XtraReport rpt = new XtraReport();

        rpt.LoadLayout(Server.MapPath(@"~\PagesContTrucking\Report\repx\HaulierTruckingAdviceSub.repx"));
        rpt.DataSource = DocPrint.PrintHaulierSub(orderNo, jobType, haulierCode);


        QR q = new QR();

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "JobNo='" + orderNo + "'");
        C2.CtmJob job  = C2.Manager.ORManager.GetObject(query) as C2.CtmJob;
        string    text = string.Format(@"JobNo:" + orderNo + ",JobDate:" + job.JobDate.ToString("dd/MM/yyyy"));
        Bitmap    bt   = q.Create_QR(text);
        string    path = MapPath("~/files/barcode/");

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        string fileName = orderNo + ".png";
        string filePath = path + fileName;

        if (File.Exists(filePath))
        {
            File.Delete(filePath);
        }
        bt.Save(Server.MapPath("~/files/barcode/") + fileName);
        DevExpress.XtraReports.UI.XRPictureBox qr_code = rpt.Report.FindControl("barcode", true) as DevExpress.XtraReports.UI.XRPictureBox;
        if (qr_code != null)
        {
            qr_code.ImageUrl = "/files/barcode/" + fileName;
        }

        System.IO.MemoryStream str = new MemoryStream();
        rpt.ExportToPdf(str);
        return(str);
    }
    protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string par = e.Parameters;

        if (par == "Save")
        {
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    string no = SafeValue.SafeString(Request.QueryString["no"]);
                    int    id = list[i].id;
                    Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "Id='" + id + "'");
                    C2.CtmJob ctmJob = C2.Manager.ORManager.GetObject(query) as C2.CtmJob;

                    ctmJob.BillingRefNo    = no;
                    ctmJob.ShowInvoice_Ind = SafeValue.SafeString(cmb_IsShow.Value);
                    C2.Manager.ORManager.StartTracking(ctmJob, Wilson.ORMapper.InitialState.Updated);
                    C2.Manager.ORManager.PersistChanges(ctmJob);
                }
                e.Result = "Action Success!";
            }
        }
    }