예제 #1
0
        private void treeList1_Click(object sender, EventArgs e)
        {
            TreeList        tree = sender as TreeList;
            TreeListHitInfo hi   = tree.CalcHitInfo(tree.PointToClient(MousePosition));

            if (hi.Node != null)
            {
                //Reset
                lblCreateBy.Text   = "";
                lblCreateDate.Text = "";
                lblModifyBy.Text   = "";
                lblModifyDate.Text = "";
                //Renew
                if (!string.IsNullOrEmpty(hi.Node.GetDisplayText("CreateDate")))
                {
                    lblCreateDate.Text = UtilityFunction.DateTimeToString(Convert.ToDateTime(hi.Node.GetDisplayText("CreateDate")));
                }
                lblCreateBy.Text = hi.Node.GetDisplayText("CreateBy");
                if (!string.IsNullOrEmpty(hi.Node.GetDisplayText("ModifyDate")))
                {
                    lblModifyDate.Text = UtilityFunction.DateTimeToString(Convert.ToDateTime(hi.Node.GetDisplayText("ModifyDate")));
                }
                lblModifyBy.Text = hi.Node.GetDisplayText("ModifyBy");
            }
        }
예제 #2
0
        private void gridView2_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            Staff staff = gridUtility2.GetSelectedItem <Staff>();

            if (staff == null)
            {
                return;
            }

            PictureUtility.BindImage(ptAvatar, staff.Avatar);
            PictureUtility.BindImage(ptSignature, staff.SignaturePhoto);
            txtCreatedBy.Text = staff.CreateBy;

            txtCreatedDate.Text = staff.CreateDate != null?UtilityFunction.DateTimeToString(staff.CreateDate.Value) : "";

            txtModifiedBy.Text   = staff.ModifyBy;
            txtModifiedDate.Text = staff.ModifyDate != null?UtilityFunction.DateTimeToString((DateTime)staff.ModifyDate) : "";
        }
예제 #3
0
 public void InsertOrUpdate(Payment pay, CRUD crud)
 {
     if (crud == CRUD.Insert)
     {
         TreeListNode rooTree = null;
         find(ref rooTree, pay.POId.ToString(), treeList1.Nodes.ToList());
         if (rooTree != null)
         {
             treeList1.AppendNode(CreateObject(2, pay, null, null), rooTree);
         }
         //update
         rooTree.SetValue("Paid", SummarizePaidMoneyPO((Guid)pay.POId));
         rooTree.ParentNode.SetValue("Paid", SummarizePaidMoneyCompany(new Company {
             CompanyId = (int)pay.CusId
         }));
     }
     else
     {
         TreeListNode node = treeList1.Selection[0];
         node.SetValue("PaymentId", pay.PaymentId);
         node.SetValue("PaymentCode", pay.PaymentCode);
         node.SetValue("PaymentName", pay.PaymentName);
         node.SetValue("POId", pay.POId);
         node.SetValue("CusId", pay.CusId);
         node.SetValue("Paid", pay.Paid);
         node.SetValue("StaffId", pay.StaffId);
         node.SetValue("Staff.StaffName", pay.Staff.StaffName);
         node.SetValue("PaidDate", UtilityFunction.DateTimeToString((DateTime)pay.PaidDate));
         node.SetValue("PaymentMethodId", pay.PaymentMethodId);
         node.SetValue("PaymentMethod.Name", pay.PaymentMethod.Name);
         node.SetValue("BankId", pay.BankId);
         node.SetValue("Bank.BankName", pay.Bank.BankName);
         node.SetValue("Note", pay.Note);
         node.SetValue("CreateDate", pay.CreateDate);
         node.SetValue("CreateBy", pay.CreateBy);
         node.SetValue("ModifyBy", pay.ModifyBy);
         node.SetValue("ModifyDate", pay.ModifyDate);
         //
         node.ParentNode.SetValue("Paid", SummarizePaidMoneyPO((Guid)pay.POId));
         node.ParentNode.ParentNode.SetValue("Paid", SummarizePaidMoneyCompany(new Company {
             CompanyId = (int)pay.CusId
         }));
     }
 }
예제 #4
0
 private void frmIncomeExpenseMain_Load(object sender, System.EventArgs e)
 {
     labelNotify1.Text = "";
     loadDB(DateTime.Now);
     label3.Text = UtilityFunction.DateTimeToString(DateTime.Now);
 }
예제 #5
0
        private object CreateObject(int level, Payment s, Po p, Company com)
        {
            object obj;

            if (level == 0) //Company
            {
                if (com == null)
                {
                    return(null);
                }
                obj = new object[]
                {
                    null,                           //s.PaymentId,//id
                    null,                           //s.PaymentCode,//code
                    null,                           //s.PaymentName,//name
                    null,                           //poid
                    null,                           //pocode
                    com.CompanyId,                  //.CusId,
                    com.CompanyName,                //s.Company.CompanyName,
                    SummarizePaidMoneyCompany(com), //paid
                    null,                           //Staff id
                    null,                           //staff name
                    null,                           //paiddate
                    null,                           //paymentmethod id
                    null,                           //paymentmethod
                    null,                           //bank id
                    null,                           //bank name
                    com.Note,                       //s.Company.Note,
                    null,                           //com.CreateDate,//s.Company.CreateDate,
                    null,                           //com.CreateBy,//s.Company.CreateBy,
                    null,                           //com.ModifyDate,//s.Company.ModifyDate,
                    null,                           //com.ModifyBy,//s.Company.ModifyBy,
                    SummarizeTotalValue(com)
                };
            }
            else
            {
                if (level == 1) //Po
                {
                    if (p == null)
                    {
                        return(null);
                    }
                    obj = new object[]
                    {
                        null,                         //id
                        null,                         //code
                        null,                         //name
                        p.PoId,                       //poid
                        p.PoCode,                     //pocode
                        null,                         //s.CusId,
                        null,                         //s.Company.CompanyName,
                        SummarizePaidMoneyPO(p.PoId), //paid
                        null,                         //Staff id
                        null,                         //staff name
                        null,                         //paiddate
                        null,                         //paymentmethod id
                        null,                         //paymentmethod
                        null,                         //bank id
                        null,                         //bank name
                        p.Note,
                        null,                         //p.CreateDate,
                        null,                         //p.CreateBy,
                        null,                         //p.ModifyDate,
                        null,                         //p.ModifyBy,
                        p.TotalValue
                    };
                }
                else //Payment
                {
                    if (s == null)
                    {
                        return(null);
                    }
                    obj = new object[]
                    {
                        s.PaymentId,                                            //id
                        s.PaymentCode,                                          //code
                        s.PaymentName,                                          //name
                        s.POId,                                                 //poid
                        null,                                                   //pocode
                        s.CusId,                                                //s.CusId,
                        null,                                                   //s.Company.CompanyName,
                        s.Paid,                                                 //paid
                        s.StaffId,                                              //Staff id
                        s.Staff.StaffName,                                      //staff name
                        UtilityFunction.DateTimeToString((DateTime)s.PaidDate), //s.PaidDate,//paiddate
                        s.PaymentMethodId,                                      //paymentmethod id
                        s.PaymentMethod.Name,                                   //paymentmethod
                        s.BankId,                                               //bank id
                        s.Bank.BankName,                                        //bank name
                        s.Note,
                        s.CreateDate,
                        s.CreateBy,
                        s.ModifyDate,
                        s.ModifyBy,
                        null
                    };
                }
            }
            return(obj);
        }