示例#1
0
 protected void grid_Transport_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (e.Parameters.Equals("save"))
     {
         gridView_save(sender, e);
     }
     if (e.Parameters.Equals("borrow"))
     {
         ASPxGridView   grd    = (sender as ASPxGridView) as ASPxGridView;
         ASPxLabel      txt_Id = grd.FindEditFormTemplateControl("lb_Id") as ASPxLabel;
         C2.CtmMastData data   = C2.Manager.ORManager.GetObject <C2.CtmMastData>(SafeValue.SafeInt(txt_Id.Text, 0));
         if (data != null)
         {
             C2.CtmMastDataLog.addBorrow(data);
             e.Result = "success";
         }
     }
     if (e.Parameters.Equals("return"))
     {
         ASPxGridView   grd    = (sender as ASPxGridView) as ASPxGridView;
         ASPxLabel      txt_Id = grd.FindEditFormTemplateControl("lb_Id") as ASPxLabel;
         C2.CtmMastData data   = C2.Manager.ORManager.GetObject <C2.CtmMastData>(SafeValue.SafeInt(txt_Id.Text, 0));
         if (data != null)
         {
             C2.CtmMastDataLog.addReturn(data);
             e.Result = "success";
         }
     }
 }
示例#2
0
    protected void grid0_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string p = e.Parameters;

        //get informations from arinvoice
        e.Result = "";
        if (p == "B")
        {
            string   tr_no   = S.Text(txt_TrailerNo.Text).Trim();         //.Trim();
            string   br_from = S.Text(txt_BorrowFrom.Text).Trim();
            DateTime dt1     = date_BorrowDate.Date;
            DateTime dt2     = date_ReturnBy.Date;

            C2.CtmMastData rec = new C2.CtmMastData();
            rec.Type   = "Chessis";
            rec.Type1  = "Active";
            rec.Code   = S.Text(txt_TrailerNo.Text);
            rec.Name   = rec.Code;
            rec.Remark = S.Text(cmb_TrailerSize.Value);
            rec.Note1  = "";
            rec.Note2  = "N";
            rec.Note3  = "BORROW";
            rec.Note4  = S.Text(txt_BorrowFrom.Value);
            rec.Note5  = S.Text(txt_BorrowRemark.Value);;
            rec.Note6  = "";
            rec.Note7  = "";
            rec.Note8  = "";
            rec.Date6  = dt1;
            rec.Date7  = dt2;
            rec.Date1  = new DateTime(1990, 1, 1);
            rec.Date2  = new DateTime(1990, 1, 1);
            rec.Date3  = new DateTime(1990, 1, 1);
            rec.Date4  = new DateTime(1990, 1, 1);
            rec.Date5  = new DateTime(1990, 1, 1);
            rec.Date8  = new DateTime(1990, 1, 1);
            C2.Manager.ORManager.StartTracking(rec, Wilson.ORMapper.InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(rec);
            e.Result = "Trailer Borrowed";
        }
        if (p == "R")
        {
            string   tr_no      = S.Text(txt_TrailerNo2.Text).Trim();
            string   br_from    = S.Text(txt_BorrowFrom2.Text).Trim();
            string   rtn_Remark = S.Text(txt_ReturnRemark.Text).Replace("'", "");
            DateTime dt1        = date_BorrowDate2.Date;
            DateTime dt2        = date_ReturnBy2.Date;
            DateTime dt3        = date_ReturnDate.Date;
            string   ret_sql    = string.Format(@"Update Ctm_MastData set Date8='{2:yyyy-MM-dd}', Type1='InActive', Note6='{3}' where Code='{0}' and Date6='{1:yyyy-MM-dd}' and Type1='Active' ", tr_no, dt1, dt3, rtn_Remark);
            D.Exec(ret_sql);

            e.Result = "Trailer Returned";
            // set it
        }
    }
示例#3
0
    private void gridView_save(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
    {
        ASPxGridView grd           = (sender as ASPxGridView) as ASPxGridView;
        ASPxLabel    txt_Id        = grd.FindEditFormTemplateControl("lb_Id") as ASPxLabel;
        ASPxTextBox  txt_Code      = grd.FindEditFormTemplateControl("txt_Code") as ASPxTextBox;
        ASPxTextBox  txt_Size      = grd.FindEditFormTemplateControl("txt_Size") as ASPxTextBox;
        ASPxComboBox cbb_Status    = grd.FindEditFormTemplateControl("cbb_Status") as ASPxComboBox;
        ASPxComboBox cbb_self      = grd.FindEditFormTemplateControl("cbb_self") as ASPxComboBox;
        ASPxTextBox  txt_finance   = grd.FindEditFormTemplateControl("txt_finance") as ASPxTextBox;
        ASPxMemo     txt_Remark    = grd.FindEditFormTemplateControl("txt_Remark") as ASPxMemo;
        ASPxDateEdit ASPxDateEdit1 = grd.FindEditFormTemplateControl("ASPxDateEdit1") as ASPxDateEdit;
        ASPxDateEdit ASPxDateEdit2 = grd.FindEditFormTemplateControl("ASPxDateEdit2") as ASPxDateEdit;
        ASPxDateEdit ASPxDateEdit3 = grd.FindEditFormTemplateControl("ASPxDateEdit3") as ASPxDateEdit;
        ASPxDateEdit ASPxDateEdit4 = grd.FindEditFormTemplateControl("ASPxDateEdit4") as ASPxDateEdit;
        ASPxDateEdit ASPxDateEdit5 = grd.FindEditFormTemplateControl("ASPxDateEdit5") as ASPxDateEdit;

        C2.CtmMastData data  = C2.Manager.ORManager.GetObject <C2.CtmMastData>(SafeValue.SafeInt(txt_Id.Text, 0));
        bool           isNew = false;

        if (data == null)
        {
            data      = new C2.CtmMastData();
            data.Type = "chessis";
            isNew     = true;
        }
        data.Code   = txt_Code.Text;
        data.Name   = data.Code;
        data.Remark = txt_Size.Text;
        data.Type1  = (SafeValue.SafeString(cbb_Status.Text) == "InActive" ? "InActive" : "Active");
        data.Note2  = (SafeValue.SafeString(cbb_self.Text) == "N" ? "N" : "Y");
        data.Note3  = txt_finance.Text;
        data.Note1  = txt_Remark.Text;
        data.Date1  = SafeValue.SafeDate(ASPxDateEdit1.Date, DateTime.Now);
        data.Date2  = SafeValue.SafeDate(ASPxDateEdit2.Date, DateTime.Now);
        data.Date3  = SafeValue.SafeDate(ASPxDateEdit3.Date, DateTime.Now);
        data.Date4  = SafeValue.SafeDate(ASPxDateEdit4.Date, DateTime.Now);
        data.Date5  = SafeValue.SafeDate(ASPxDateEdit5.Date, DateTime.Now);
        if (isNew)
        {
            C2.Manager.ORManager.StartTracking(data, Wilson.ORMapper.InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(data);
        }
        else
        {
            C2.Manager.ORManager.StartTracking(data, Wilson.ORMapper.InitialState.Updated);
            C2.Manager.ORManager.PersistChanges(data);
        }
        e.Result = "success";
    }
示例#4
0
        public static bool addReturn(CtmMastData mast)
        {
            bool           res  = true;
            CtmMastDataLog data = new C2.CtmMastDataLog();

            data.EventDate = DateTime.Now;
            data.MastId    = mast.Id;
            //======== is self
            if (mast.Note2.Equals("N"))
            {
                data.EventCode = "BorrowReturn";
                mast.Type1     = "InActive";
                C2.Manager.ORManager.StartTracking(mast, Wilson.ORMapper.InitialState.Updated);
                C2.Manager.ORManager.PersistChanges(mast);
            }
            else
            {
                data.EventCode = "LendReturn";
            }
            C2.Manager.ORManager.StartTracking(data, Wilson.ORMapper.InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(data);
            return(res);
        }