private void LogTransfer_Load(object sender, EventArgs e) { var stor = new Stores(); stor.GetActiveStores(); // lkFromStore.ItemIndex = 0; storeBindingSource.DataSource = stor.DefaultView; var itemunit = new ItemUnit(); var units = itemunit.GetAllUnits(); unitBindingSource.DataSource = units.DefaultView; // bind the supplier lookup for the grid. var unitcolumn = ((GridView)gridControl1.MainView).Columns[4]; switch (VisibilitySetting.HandleUnits) { case 1: unitcolumn.Visible = false; break; case 2: unitcolumn.Visible = true; break; default: unitcolumn.Visible = true; break; } lkToStore.Properties.DataSource = stor.DefaultView; lkToStore.ItemIndex = 0; // bind the current dates try { var dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.Nodes[0].FirstNode); if (dr == null) return; var rec = new Transfer(); if (dr["ParentID"] == DBNull.Value) { // int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); var dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1); var dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(lkToStore.EditValue), dt1, dt2); lblTransferedDate.Text = dr["RefNo"].ToString(); } else { dtRec = rec.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(lkToStore.EditValue), dr["Date"].ToString()); lblTransferedDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy"); } gridControl1.DataSource = dtRec; } catch (Exception ex) { } }
private void lstTree_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { var dtDate = new CalendarLib.DateTimePickerEx { CustomFormat = "MM/dd/yyyy", Value = DateTime.Now }; DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); var dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.FocusedNode); if (dr == null) return; var rec = new Transfer(); DataTable dtRec; if (dr["ParentID"] == DBNull.Value) { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); DateTime dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1); DateTime dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(lkToStore.EditValue), dt1, dt2); lblTransferedDate.Text = dr["RefNo"].ToString(); } else { dtRec = rec.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(lkToStore.EditValue), dr["Date"].ToString()); lblTransferedDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy"); } gridControl1.DataSource = dtRec; }