コード例 #1
0
        /// <summary>
        /// Loads the lookups and the category tree
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManageItems_Load(object sender, EventArgs e)
        {
            PopulateCatTree(_selectedType);

            var rec   = new DisposalReasons();
            var dtDis = rec.GetAvailableReasons();

            //object[] objRec = { 0, "All Reasons", "" };
            //dtDis.Rows.Add(objRec);
            cboReasons.Properties.DataSource    = dtDis;
            cboReasons.Properties.DisplayMember = "Reason";
            cboReasons.Properties.ValueMember   = "ID";
            //  cboReasons.ItemIndex = 0;

            //cboStores.ItemIndex = 0;

            dtDate.Value        = DateTime.Now;
            dtDate.CustomFormat = "MM/dd/yyyy";
            DateTime dtCur = ConvertDate.DateConverter(dtDate.Text);
            int      month = dtCur.Month;
            int      year;

            if (month < 11)
            {
                year = dtCur.Year;
            }
            else
            {
                year = dtCur.Year + 1;
            }

            DataTable dtyears = Items.AllYears();

            cmbYear.Properties.DataSource = dtyears;
            cmbYear.EditValue             = year;
            if (cmbYear.Properties.Columns.Count > 0)
            {
                cmbYear.Properties.Columns[0].Alignment = DevExpress.Utils.HorzAlignment.Near;
            }
            //cmbYear.EditValue
            var stor = new Stores();

            stor.GetActiveStores();
            cboStores.Properties.DataSource        = stor.DefaultView;
            cboStores.ItemIndex                    = 0;
            lkCommodityTypes.Properties.DataSource = BLL.Type.GetAllTypes();
            lkCommodityTypes.ItemIndex             = 0;
        }
コード例 #2
0
ファイル: ExpiredProductsReport.cs プロジェクト: HCMISFE/FE
        /// <summary>
        /// Loads the lookups and the category tree
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManageItems_Load(object sender, EventArgs e)
        {
            PopulateCatTree(_selectedType);

            var rec   = new DisposalReasons();
            var dtDis = rec.GetAvailableReasons();

            //object[] objRec = { 0, "All Reasons", "" };
            //dtDis.Rows.Add(objRec);
            cboReasons.Properties.DataSource    = dtDis;
            cboReasons.Properties.DisplayMember = "Reason";
            cboReasons.Properties.ValueMember   = "ID";
            //  cboReasons.ItemIndex = 0;

            //cboStores.ItemIndex = 0;

            dtDate.Value        = DateTime.Now;
            dtDate.CustomFormat = "MM/dd/yyyy";
            DateTime dtCur = ConvertDate.DateConverter(dtDate.Text);
            int      month = dtCur.Month;
            int      year;

            if (month < 11)
            {
                year = dtCur.Year;
            }
            else
            {
                year = dtCur.Year + 1;
            }

            //DataTable dtyears = Items.AllYears();
            //cmbYear.Properties.DataSource = dtyears;
            //cmbYear.EditValue = year;
            DataView dv = Items.AllFiscalYears().DefaultView;

            dv.Sort = "year desc";
            DataTable sortedDT = dv.ToTable();

            cmbYear.Properties.DataSource = sortedDT;
            //  cboYear.EditValue = curYear;
            cmbYear.ItemIndex = 0;
            if (cmbYear.Properties.Columns.Count > 0)
            {
                cmbYear.Properties.Columns[0].Alignment = DevExpress.Utils.HorzAlignment.Near;
            }
            //cmbYear.EditValue

            var stor = new Stores();

            stor.GetActiveStores();
            cboStores.Properties.DataSource = stor.DefaultView;
            cboStores.ItemIndex             = 0;
            DataTable table = BLL.Type.GetAllTypes();
            DataRow   row   = table.NewRow();

            row["ID"]   = "0";
            row["Name"] = "All";
            table.Rows.InsertAt(row, 0);

            lkCommodityTypes.Properties.DataSource = table;
            lkCommodityTypes.ItemIndex             = 0;

            gridItemListView.Columns["InternalDrugCode"].Visible = Convert.ToBoolean(chkIntDrugCode.EditValue);
        }
コード例 #3
0
        /// <summary>
        /// Prepare all lookups
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManageItems_Load(object sender, EventArgs e)
        {
            var stor = new Stores();

            stor.GetActiveStores();
            cboStores.Properties.DataSource = stor.DefaultView;
            cboStores.ItemIndex             = 0;

            var rec   = new DisposalReasons();
            var dtDis = rec.GetAvailableReasons();

            cboReasons.Properties.DataSource = dtDis.DefaultView;
            reasonBindingSource.DataSource   = dtDis.DefaultView;
            // cboReasons.ItemIndex = 0;

            var itemunit = new ItemUnit();
            var units    = itemunit.GetAllUnits();

            unitbindingSource.DataSource = units.DefaultView;

            var unitcolumn = ((GridView)gridAdjustments.MainView).Columns[10];

            switch (VisibilitySetting.HandleUnits)
            {
            case 1:
                unitcolumn.Visible = false;
                break;

            case 2:
                unitcolumn.Visible = true;
                break;

            default:
                unitcolumn.Visible = true;
                break;
            }
            try
            {
                //CALENDAR:
                var dtDate = new CalendarLib.DateTimePickerEx
                {
                    CustomFormat = "MM/dd/yyyy",
                    Value        = DateTime.Now
                };
                var dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.Nodes[0].FirstNode);
                if (dr == null)
                {
                    return;
                }

                var disp = new Disposal();
                if (dr["ParentID"] == DBNull.Value)
                {
                    var dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1);
                    var dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1);
                    dtRec           = disp.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2);
                    lblAdjDate.Text = dr["RefNo"].ToString();
                }
                else
                {
                    dtRec           = disp.GetDocumentByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString());
                    lblAdjDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy");
                }
                gridAdjustments.DataSource = dtRec;
            }
            catch (Exception ex)
            {
            }
        }