Beispiel #1
0
        public List <ComboBoxDTO> GetAllCancelOrder()
        {
            StringBuilder SQL = new StringBuilder();

            SQL.AppendLine(@"   SELECT 
                                    * 
                                FROM so_sales_order_head head
                                WHERE EXISTS (
		                                SELECT 
			                                'x' 
		                                FROM so_sales_order_detail detail 
		                                WHERE detail.sales_order_head_id = head.sales_order_head_id
			                                AND detail.is_cancel = 1) "            );
            List <SaleOrderHeader> listSaleOrderHeader = base.ExecuteQuery <SaleOrderHeader>(SQL.ToString()).ToList();
            List <ComboBoxDTO>     lstComboBox         = new List <ComboBoxDTO>();

            foreach (SaleOrderHeader entity in listSaleOrderHeader)
            {
                ComboBoxDTO dto = new ComboBoxDTO();
                dto.Value   = entity.sales_order_head_id.Value.ToString();
                dto.Display = entity.order_no;
                lstComboBox.Add(dto);
            }
            lstComboBox.SetPleaseSelect();
            return(lstComboBox);
        }
Beispiel #2
0
        private void SetInitialControl()
        {
            List <Supplier>    lstSupplier            = ServiceProvider.SupplierService.FindAll(false).ToList();
            List <ComboBoxDTO> lstComboBoxDTOSupplier = new List <ComboBoxDTO>();

            foreach (Supplier supplier in lstSupplier)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value   = supplier.supplier_id.ToString();
                DTO.Display = supplier.supplier_name;
                lstComboBoxDTOSupplier.Add(DTO);
            }
            lstComboBoxDTOSupplier.SetPleaseSelect();
            ddlSupplier.DataSource    = lstComboBoxDTOSupplier;
            ddlSupplier.ValueMember   = "Value";
            ddlSupplier.DisplayMember = "Display";

            List <WareHouse>   lstWarehouse   = ServiceProvider.WareHouseService.FindAll(false).ToList();
            List <ComboBoxDTO> lstComboBoxDTO = new List <ComboBoxDTO>();

            foreach (WareHouse warehouse in lstWarehouse)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value   = warehouse.warehouse_id.ToString();
                DTO.Display = warehouse.warehouse_name;
                lstComboBoxDTO.Add(DTO);
            }
            lstComboBoxDTO.SetPleaseSelect();
            ddlWarehouse.DataSource    = lstComboBoxDTO;
            ddlWarehouse.ValueMember   = "Value";
            ddlWarehouse.DisplayMember = "Display";
        }
Beispiel #3
0
        public List <ComboBoxDTO> GetOpenPeriod(long PeriodGroupID)
        {
            StringBuilder SQL = new StringBuilder();

            SQL.AppendFormat(" SELECT * FROM {0} WHERE 1=1 ", base.EntityTableName);
            SQL.AppendFormat(" AND ISNULL(period_status,'{0}') = @period_status ", INPeriodStatus.Open);
            SQL.AppendLine(" AND period_group_id = @PeriodGroupID ");

            DbParameter param  = base.CreateParameter("period_status", INPeriodStatus.Open);
            DbParameter param1 = base.CreateParameter("PeriodGroupID", PeriodGroupID);

            List <Period>      lstPeriod      = base.ExecuteQuery <Period>(SQL.ToString(), param, param1).ToList();
            List <ComboBoxDTO> lstComboBoxDTO = new List <ComboBoxDTO>();

            foreach (Period period in lstPeriod)
            {
                ComboBoxDTO dto = new ComboBoxDTO();
                dto.Value   = period.period_id.ToString();
                dto.Display = period.period_code + ":" + DateTime.Parse(period.period_date.ToString()).ConvertDateToDisplay();
                lstComboBoxDTO.Add(dto);
            }

            lstComboBoxDTO.SetPleaseSelect();

            return(lstComboBoxDTO);
        }
Beispiel #4
0
        public List <ComboBoxDTO> GetReasonComboBoxDTOByDocumentTypeID(long DocumentTypeID, long?ReasonID = null)
        {
            List <Reason>      lstEntity      = new List <Reason>();
            List <ComboBoxDTO> lstComboBoxDTO = new List <ComboBoxDTO>();

            lstEntity = base.FindAll(false).Where(w => w.active && w.document_type_id == DocumentTypeID).ToList();

            if (ReasonID != null && lstEntity.Where(w => w.reason_id == ReasonID.Value).Count() == 0)
            {
                Reason entity = new Reason()
                {
                    reason_id = ReasonID.Value
                };
                entity = base.FindByKeys(entity, false);
                lstEntity.Add(entity);
            }

            foreach (Reason child in lstEntity)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value   = child.reason_id.ToString();
                DTO.Display = child.reason_name;
                lstComboBoxDTO.Add(DTO);
            }
            lstComboBoxDTO = lstComboBoxDTO.OrderBy(o => o.Display).ToList();
            lstComboBoxDTO.SetPleaseSelect();
            return(lstComboBoxDTO);
        }
Beispiel #5
0
        public List<ComboBoxDTO> GetBillOfMaterialHeadComboBoxDTOByID(long? billOfMaterialHeadID)
        {

            List<BillOfMaterialHead> lstEntity = new List<BillOfMaterialHead>();
            List<ComboBoxDTO> lstComboBoxDTO = new List<ComboBoxDTO>();
            lstComboBoxDTO.SetPleaseSelect();

            if (billOfMaterialHeadID != null)
            {
                BillOfMaterialHead entity = new BillOfMaterialHead() { bill_of_material_head_id = billOfMaterialHeadID.Value };
                entity = base.FindByKeys(entity, false);
                lstEntity.Add(entity);
            }
            else
            {
                lstEntity = base.FindAll(false).ToList();
            }

            foreach (BillOfMaterialHead child in lstEntity)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value = child.bill_of_material_head_id.ToString();
                DTO.Display = child.bill_of_material_head_name;
                lstComboBoxDTO.Add(DTO);
            }

            return lstComboBoxDTO;
        }
Beispiel #6
0
        private void SetInitialControl()
        {
            List <UOM>         lstUOM = ServiceProvider.UOMService.FindAll(false).ToList();
            List <ComboBoxDTO> lstComboBoxDTOUOMReceive = new List <ComboBoxDTO>();
            List <ComboBoxDTO> lstComboBoxDTOUOMCount   = new List <ComboBoxDTO>();
            List <ComboBoxDTO> lstComboBoxDTOUOMUse     = new List <ComboBoxDTO>();

            foreach (UOM uom in lstUOM)
            {
                if (uom.active)
                {
                    ComboBoxDTO DTO = new ComboBoxDTO();
                    DTO.Value   = uom.uom_id.ToString();
                    DTO.Display = uom.uom_name;
                    lstComboBoxDTOUOMReceive.Add(DTO);
                    lstComboBoxDTOUOMCount.Add(DTO);
                    lstComboBoxDTOUOMUse.Add(DTO);
                }
            }
            lstComboBoxDTOUOMReceive.SetPleaseSelect();
            cboUOMReceive.DataSource    = lstComboBoxDTOUOMReceive;
            cboUOMReceive.ValueMember   = "Value";
            cboUOMReceive.DisplayMember = "Display";

            lstComboBoxDTOUOMCount.SetPleaseSelect();
            cboUOMCount.DataSource    = lstComboBoxDTOUOMCount;
            cboUOMCount.ValueMember   = "Value";
            cboUOMCount.DisplayMember = "Display";

            lstComboBoxDTOUOMUse.SetPleaseSelect();
            cboUOMUse.DataSource    = lstComboBoxDTOUOMUse;
            cboUOMUse.ValueMember   = "Value";
            cboUOMUse.DisplayMember = "Display";

            List <MaterialGroup> lstMatGroup            = ServiceProvider.MaterialGroupService.FindAll(false).ToList();
            List <ComboBoxDTO>   lstComboBoxDTOMatGroup = new List <ComboBoxDTO>();

            foreach (MaterialGroup matGroup in lstMatGroup)
            {
                if (matGroup.active)
                {
                    ComboBoxDTO DTO = new ComboBoxDTO();
                    DTO.Value   = matGroup.material_group_id.ToString();
                    DTO.Display = matGroup.material_group_name;
                    lstComboBoxDTOMatGroup.Add(DTO);
                }
            }
            lstComboBoxDTOMatGroup.SetPleaseSelect();
            cboMaterailGroup.DataSource    = lstComboBoxDTOMatGroup;
            cboMaterailGroup.ValueMember   = "Value";
            cboMaterailGroup.DisplayMember = "Display";
        }
 private void btnSelect_Click(object sender, EventArgs e)
 {
     if (ddlWarehouse.SelectedIndex != 0)
     {
         ComboBoxDTO dto = new ComboBoxDTO();
         dto.Display = this.ddlWarehouse.Text.Substring(this.ddlWarehouse.Text.LastIndexOf(":") + 1); ;
         dto.Value = this.ddlWarehouse.SelectedValue.ToString();                
         this.ClosePopup(dto);
     }
     else
     {
         ValidationResults results = new ValidationResults();
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Warehouse"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
         base.ShowErrorMessage(new ValidationException(results));
     }
 }
Beispiel #8
0
        private void SetInitialControl()
        {
            List <PeriodGroup> lstSupplier            = ServiceProvider.PeriodGroupService.FindAll(false).ToList();
            List <ComboBoxDTO> lstComboBoxDTOSupplier = new List <ComboBoxDTO>();

            foreach (PeriodGroup periodGroup in lstSupplier)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value   = periodGroup.period_group_id.ToString();
                DTO.Display = periodGroup.period_group_name;
                lstComboBoxDTOSupplier.Add(DTO);
            }
            lstComboBoxDTOSupplier.SetPleaseSelect();
            ddlPeriodGroup.DataSource    = lstComboBoxDTOSupplier;
            ddlPeriodGroup.ValueMember   = "Value";
            ddlPeriodGroup.DisplayMember = "Display";
        }
Beispiel #9
0
 private void btnSelect_Click(object sender, EventArgs e)
 {
     if (ddlWarehouse.SelectedIndex != 0)
     {
         ComboBoxDTO dto = new ComboBoxDTO();
         dto.Display = this.ddlWarehouse.Text.Substring(this.ddlWarehouse.Text.LastIndexOf(":") + 1);;
         dto.Value   = this.ddlWarehouse.SelectedValue.ToString();
         this.ClosePopup(dto);
     }
     else
     {
         ValidationResults results = new ValidationResults();
         ValidationResult  result  = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Warehouse"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
         base.ShowErrorMessage(new ValidationException(results));
     }
 }
Beispiel #10
0
        public List <ComboBoxDTO> GetMenuComboBoxDTO()
        {
            List <SOMenu>      lstEntity      = new List <SOMenu>();
            List <ComboBoxDTO> lstComboBoxDTO = new List <ComboBoxDTO>();

            lstComboBoxDTO.SetPleaseSelect();

            lstEntity = base.FindAll(false).Where(w => w.active).ToList();

            foreach (SOMenu child in lstEntity)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value   = child.menu_id.Value.ToString();
                DTO.Display = child.menu_name;
                lstComboBoxDTO.Add(DTO);
            }
            return(lstComboBoxDTO);
        }
Beispiel #11
0
        public List <ComboBoxDTO> GetMaterialComboBoxDTO()
        {
            List <Material>    lstEntity      = new List <Material>();
            List <ComboBoxDTO> lstComboBoxDTO = new List <ComboBoxDTO>();

            lstComboBoxDTO.SetPleaseSelect();

            lstEntity = base.FindAll(false).ToList();

            foreach (Material child in lstEntity)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value   = child.material_id.ToString();
                DTO.Display = child.material_code + ":" + child.material_name;
                lstComboBoxDTO.Add(DTO);
            }

            return(lstComboBoxDTO);
        }
Beispiel #12
0
        public List <ComboBoxDTO> GetBillOfMaterialGroupComboBoxDTO()
        {
            List <BillOfMaterialGroup> lstEntity      = new List <BillOfMaterialGroup>();
            List <ComboBoxDTO>         lstComboBoxDTO = new List <ComboBoxDTO>();

            lstComboBoxDTO.SetStringEmpty();

            lstEntity = base.FindAll(false).ToList();

            foreach (BillOfMaterialGroup child in lstEntity)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value   = child.bill_of_material_group_id.ToString();
                DTO.Display = child.bill_of_material_group_code + ":" + child.bill_of_material_group_name;
                lstComboBoxDTO.Add(DTO);
            }

            return(lstComboBoxDTO);
        }
Beispiel #13
0
        private void SetInitialControl()
        {
            List <PeriodGroup> lstPeriodGroup            = ServiceProvider.PeriodGroupService.FindAll(false).ToList();
            List <ComboBoxDTO> lstComboBoxDTOPeriodGroup = new List <ComboBoxDTO>();

            foreach (PeriodGroup periodGr in lstPeriodGroup)
            {
                if (periodGr.active)
                {
                    ComboBoxDTO DTO = new ComboBoxDTO();
                    DTO.Value   = periodGr.period_group_id.ToString();
                    DTO.Display = periodGr.period_group_name;
                    lstComboBoxDTOPeriodGroup.Add(DTO);
                }
            }
            lstComboBoxDTOPeriodGroup.SetPleaseSelect();
            cboPeriodGr.DataSource    = lstComboBoxDTOPeriodGroup;
            cboPeriodGr.ValueMember   = "Value";
            cboPeriodGr.DisplayMember = "Display";
        }
Beispiel #14
0
        private void grdBase_onSelectedDataRow(object sender, Control.GridView.RowEventArgs e)
        {
            object result = base.OpenPopup <InPopupSelectWarehouse>();

            if (result != null)
            {
                Dictionary <string, object> dataKey = (Dictionary <string, object>)sender;
                PortfolioHead entity = new PortfolioHead();
                entity.portfolio_head_id = dataKey[DataKeyID].ToLong();
                DataSet     dsPortfolioDetail = ServiceProvider.PortfolioDetailService.GetGridPortfolioDetail(entity);
                ComboBoxDTO dto = (ComboBoxDTO)result;
                if (dsPortfolioDetail.Tables.Count > 0)
                {
                    foreach (DataRow dr in dsPortfolioDetail.Tables[0].Rows)
                    {
                        dr["warehouse_id"]   = dto.Value.ToLong();
                        dr["warehouse_name"] = dto.Display;
                    }
                }
                this.ClosePopup(dsPortfolioDetail);
            }
        }
Beispiel #15
0
        private void LoadHeadData()
        {
            StockHead entity = new StockHead();

            if (base.FormMode == ObjectState.Edit && !string.IsNullOrEmpty(base.FormKeyCode))
            {
                entity.stock_head_id = Converts.ParseLong(base.FormKeyCode);
                entity = ServiceProvider.StockHeadService.FindByKeys(entity, true);
                Period periodEntity = new Period()
                {
                    period_id = entity.period_id
                };
                periodEntity = ServiceProvider.PeriodService.FindByKeys(periodEntity, false);

                PeriodGroup periodGroupEntity = new PeriodGroup()
                {
                    period_group_id = periodEntity.period_group_id
                };

                ddlPeriodGroup.DataSource    = ServiceProvider.PeriodGroupService.FindByActiveOrID(periodGroupEntity);
                ddlPeriodGroup.ValueMember   = "Value";
                ddlPeriodGroup.DisplayMember = "Display";

                ddlPeriodGroup.SelectedValue = periodGroupEntity.period_group_id.ToString();

                DataSet            ds             = ServiceProvider.PeriodService.FindDataSetByParentKey(periodEntity);
                List <ComboBoxDTO> lstComboboxDTO = new List <ComboBoxDTO>();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    ComboBoxDTO dto = new ComboBoxDTO();
                    dto.Value   = dr["period_id"].ToString();
                    dto.Display = dr["period_code"].ToString() + ":" + DateTime.Parse(dr["period_date"].ToString()).ConvertDateToDisplay();
                    lstComboboxDTO.Add(dto);
                }
                lstComboboxDTO.SetPleaseSelect();

                ddlPeriod.DataSource    = lstComboboxDTO;
                ddlPeriod.ValueMember   = "Value";
                ddlPeriod.DisplayMember = "Display";

                ddlPeriod.SelectedValue = entity.period_id.ToString();

                ddlWarehouse.DataSource = ServiceProvider.WareHouseService.FindByActiveOrID(new WareHouse()
                {
                    warehouse_id = entity.warehouse_id
                });
                ddlWarehouse.ValueMember   = "Value";
                ddlWarehouse.DisplayMember = "Display";

                ddlWarehouse.SelectedValue = entity.warehouse_id.ToString();

                txtRemark.Text       = entity.remark;
                lblDocumentNo.Text   = entity.transaction_no;
                lblDocumentDate.Text = entity.transaction_date.ConvertDateToDisplay();
                lblStatus.Text       = (entity.transaction_status == TransactionStatus.IN.FinalCode) ? TransactionStatus.IN.FinalText : TransactionStatus.IN.NormalText;
                this._documentStatus = entity.transaction_status;
            }
            else
            {
                ddlPeriodGroup.DataSource    = ServiceProvider.PeriodGroupService.FindByActiveOrID();
                ddlPeriodGroup.ValueMember   = "Value";
                ddlPeriodGroup.DisplayMember = "Display";

                List <ComboBoxDTO> lstCombobox = new List <ComboBoxDTO>();
                lstCombobox.SetPleaseSelect();

                ddlPeriod.DataSource    = lstCombobox;
                ddlPeriod.ValueMember   = "Value";
                ddlPeriod.DisplayMember = "Display";

                ddlWarehouse.DataSource    = ServiceProvider.WareHouseService.FindByActiveOrID();
                ddlWarehouse.ValueMember   = "Value";
                ddlWarehouse.DisplayMember = "Display";

                txtRemark.Text       = string.Empty;
                lblDocumentNo.Text   = GeneralMessage.AutoRunningDocumentNo;
                lblDocumentDate.Text = DateTime.Now.ConvertDateToDisplay();
                lblStatus.Text       = TransactionStatus.IN.FinalText;
            }

            InitialDetailData();
            EnableModeHead();
            EnableModeDetail();
        }
        private void SetInitialControl()
        {
            List<Supplier> lstSupplier = ServiceProvider.SupplierService.FindAll(false).ToList();
            List<ComboBoxDTO> lstComboBoxDTOSupplier = new List<ComboBoxDTO>();
            foreach (Supplier supplier in lstSupplier)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value = supplier.supplier_id.ToString();
                DTO.Display = supplier.supplier_name;
                lstComboBoxDTOSupplier.Add(DTO);
            }
            lstComboBoxDTOSupplier.SetPleaseSelect();
            ddlSupplier.DataSource = lstComboBoxDTOSupplier;
            ddlSupplier.ValueMember = "Value";
            ddlSupplier.DisplayMember = "Display";

            List<WareHouse> lstWarehouse = ServiceProvider.WareHouseService.FindAll(false).ToList();
            List<ComboBoxDTO> lstComboBoxDTO = new List<ComboBoxDTO>();
            foreach (WareHouse warehouse in lstWarehouse)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value = warehouse.warehouse_id.ToString();
                DTO.Display = warehouse.warehouse_name;
                lstComboBoxDTO.Add(DTO);
            }
            lstComboBoxDTO.SetPleaseSelect();
            ddlWarehouse.DataSource = lstComboBoxDTO;
            ddlWarehouse.ValueMember = "Value";
            ddlWarehouse.DisplayMember = "Display";
        }
 private void SetInitialControl()
 {
     List<PeriodGroup> lstPeriodGroup = ServiceProvider.PeriodGroupService.FindAll(false).ToList();
     List<ComboBoxDTO> lstComboBoxDTOPeriodGroup = new List<ComboBoxDTO>();
     foreach (PeriodGroup periodGr in lstPeriodGroup)
     {
         if (periodGr.active)
         {
             ComboBoxDTO DTO = new ComboBoxDTO();
             DTO.Value = periodGr.period_group_id.ToString();
             DTO.Display = periodGr.period_group_name;
             lstComboBoxDTOPeriodGroup.Add(DTO);
         }
     }
     lstComboBoxDTOPeriodGroup.SetPleaseSelect();
     cboPeriodGr.DataSource = lstComboBoxDTOPeriodGroup;
     cboPeriodGr.ValueMember = "Value";
     cboPeriodGr.DisplayMember = "Display";
 }
        private void SetInitialControl()
        {
            List<UOM> lstUOM = ServiceProvider.UOMService.FindAll(false).ToList();
            List<ComboBoxDTO> lstComboBoxDTOUOMReceive = new List<ComboBoxDTO>();
            List<ComboBoxDTO> lstComboBoxDTOUOMCount = new List<ComboBoxDTO>();
            List<ComboBoxDTO> lstComboBoxDTOUOMUse = new List<ComboBoxDTO>();
            foreach (UOM uom in lstUOM)
            {
                if (uom.active)
                {
                    ComboBoxDTO DTO = new ComboBoxDTO();
                    DTO.Value = uom.uom_id.ToString();
                    DTO.Display = uom.uom_name;
                    lstComboBoxDTOUOMReceive.Add(DTO);
                    lstComboBoxDTOUOMCount.Add(DTO);
                    lstComboBoxDTOUOMUse.Add(DTO);
                }
            }
            lstComboBoxDTOUOMReceive.SetPleaseSelect();
            cboUOMReceive.DataSource = lstComboBoxDTOUOMReceive;
            cboUOMReceive.ValueMember = "Value";
            cboUOMReceive.DisplayMember = "Display";

            lstComboBoxDTOUOMCount.SetPleaseSelect();
            cboUOMCount.DataSource = lstComboBoxDTOUOMCount;
            cboUOMCount.ValueMember = "Value";
            cboUOMCount.DisplayMember = "Display";

            lstComboBoxDTOUOMUse.SetPleaseSelect();
            cboUOMUse.DataSource = lstComboBoxDTOUOMUse;
            cboUOMUse.ValueMember = "Value";
            cboUOMUse.DisplayMember = "Display";

            List<MaterialGroup> lstMatGroup = ServiceProvider.MaterialGroupService.FindAll(false).ToList();
            List<ComboBoxDTO> lstComboBoxDTOMatGroup= new List<ComboBoxDTO>();
            foreach (MaterialGroup matGroup in lstMatGroup)
            {
                if (matGroup.active)
                {
                    ComboBoxDTO DTO = new ComboBoxDTO();
                    DTO.Value = matGroup.material_group_id.ToString();
                    DTO.Display = matGroup.material_group_name;
                    lstComboBoxDTOMatGroup.Add(DTO);
                }
            }
            lstComboBoxDTOMatGroup.SetPleaseSelect();
            cboMaterailGroup.DataSource = lstComboBoxDTOMatGroup;
            cboMaterailGroup.ValueMember = "Value";
            cboMaterailGroup.DisplayMember = "Display";
        }
Beispiel #19
0
        public List <ComboBoxDTO> FindByActiveOrID(TEntity entity = null)
        {
            PropertyInfo PropertyInfoComboBoxDisplay = typeof(TEntity).GetTaggedPropertyInfos <EntityScalarPropertyAttribute>("ComboBoxDisplay", true, true).FirstOrDefault();
            PropertyInfo PropertyInfoComboBoxValue   = typeof(TEntity).GetTaggedPropertyInfos <EntityScalarPropertyAttribute>("ComboBoxValue", true, true).FirstOrDefault();
            PropertyInfo PropertyInfoComboBoxCode    = typeof(TEntity).GetTaggedPropertyInfos <EntityScalarPropertyAttribute>("DataCode", true, true).FirstOrDefault();

            if (PropertyInfoComboBoxDisplay == null)
            {
                PropertyInfoComboBoxDisplay = typeof(TEntity).GetProperties().Where(w => w.Name.Contains("name")).FirstOrDefault();
            }
            if (PropertyInfoComboBoxValue == null)
            {
                PropertyInfoComboBoxValue = typeof(TEntity).GetTaggedPropertyInfos <EntityScalarPropertyAttribute>("IdentityKey", true, true).FirstOrDefault();
            }
            if (PropertyInfoComboBoxCode == null)
            {
                PropertyInfoComboBoxCode = typeof(TEntity).GetProperties().Where(w => w.Name.Contains("code")).FirstOrDefault();
            }

            List <TEntity>     lstEntity      = new List <TEntity>();
            List <ComboBoxDTO> lstComboBoxDTO = new List <ComboBoxDTO>();

            if (typeof(TEntity).GetInterfaces().Contains(typeof(POS.BL.Entities.IEntityMasterBase)))
            {
                lstEntity = base.FindAll(false).Where(w => ((POS.BL.Entities.IEntityMasterBase)w).active).ToList();

                if (entity != null)
                {
                    TEntity Entity = base.FindByKeys(entity, false);
                    lstEntity.Add(Entity);
                }

                foreach (TEntity child in lstEntity)
                {
                    ComboBoxDTO    DTO        = new ComboBoxDTO();
                    PropertyInfo[] properties = child.GetType().GetProperties();
                    string         Code       = string.Empty;
                    string         Display    = string.Empty;
                    foreach (PropertyInfo property in properties)
                    {
                        if (property.Name == PropertyInfoComboBoxDisplay.Name)
                        {
                            Display = property.GetValue(child, null).ToString();
                        }
                        else if (property.Name == PropertyInfoComboBoxValue.Name)
                        {
                            DTO.Value = property.GetValue(child, null).ToString();
                        }
                        else if (property.Name == PropertyInfoComboBoxCode.Name)
                        {
                            Code = property.GetValue(child, null).ToString();
                        }
                    }
                    DTO.Display = Code + ":" + Display;
                    if (lstComboBoxDTO.Where(w => w.Value == DTO.Value).Count() == 0)
                    {
                        lstComboBoxDTO.Add(DTO);
                    }
                }
            }
            lstComboBoxDTO = lstComboBoxDTO.OrderBy(o => o.Display).ToList();
            lstComboBoxDTO.SetPleaseSelect();
            return(lstComboBoxDTO);
        }
Beispiel #20
0
        private void SetInitialControl()
        {
            List<PeriodGroup> lstSupplier = ServiceProvider.PeriodGroupService.FindAll(false).ToList();
            List<ComboBoxDTO> lstComboBoxDTOSupplier = new List<ComboBoxDTO>();
            foreach (PeriodGroup periodGroup in lstSupplier)
            {
                ComboBoxDTO DTO = new ComboBoxDTO();
                DTO.Value = periodGroup.period_group_id.ToString();
                DTO.Display = periodGroup.period_group_name;
                lstComboBoxDTOSupplier.Add(DTO);
            }
            lstComboBoxDTOSupplier.SetPleaseSelect();
            ddlPeriodGroup.DataSource = lstComboBoxDTOSupplier;
            ddlPeriodGroup.ValueMember = "Value";
            ddlPeriodGroup.DisplayMember = "Display";

        }
        private void LoadHeadData()
        {
            StockHead entity = new StockHead();

            if (base.FormMode == ObjectState.Edit && !string.IsNullOrEmpty(base.FormKeyCode))
            {
                entity.stock_head_id = Converts.ParseLong(base.FormKeyCode);
                entity = ServiceProvider.StockHeadService.FindByKeys(entity, true);
                Period periodEntity = new Period() { period_id = entity.period_id };
                periodEntity = ServiceProvider.PeriodService.FindByKeys(periodEntity, false);

                PeriodGroup periodGroupEntity = new PeriodGroup() { period_group_id = periodEntity.period_group_id };

                ddlPeriodGroup.DataSource = ServiceProvider.PeriodGroupService.FindByActiveOrID(periodGroupEntity);
                ddlPeriodGroup.ValueMember = "Value";
                ddlPeriodGroup.DisplayMember = "Display";

                ddlPeriodGroup.SelectedValue = periodGroupEntity.period_group_id.ToString();
                
                DataSet ds = ServiceProvider.PeriodService.FindDataSetByParentKey(periodEntity);
                List<ComboBoxDTO> lstComboboxDTO = new List<ComboBoxDTO>();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    ComboBoxDTO dto = new ComboBoxDTO();
                    dto.Value = dr["period_id"].ToString();
                    dto.Display = dr["period_code"].ToString() + ":" + DateTime.Parse(dr["period_date"].ToString()).ConvertDateToDisplay();
                    lstComboboxDTO.Add(dto);

                }
                lstComboboxDTO.SetPleaseSelect();

                ddlPeriod.DataSource = lstComboboxDTO;
                ddlPeriod.ValueMember = "Value";
                ddlPeriod.DisplayMember = "Display";

                ddlPeriod.SelectedValue = entity.period_id.ToString();

                ddlWarehouse.DataSource = ServiceProvider.WareHouseService.FindByActiveOrID(new WareHouse() { warehouse_id = entity.warehouse_id });
                ddlWarehouse.ValueMember = "Value";
                ddlWarehouse.DisplayMember = "Display";

                ddlWarehouse.SelectedValue = entity.warehouse_id.ToString();

                txtRemark.Text = entity.remark;
                lblDocumentNo.Text = entity.transaction_no;
                lblDocumentDate.Text = entity.transaction_date.ConvertDateToDisplay();
                lblStatus.Text = (entity.transaction_status == TransactionStatus.IN.FinalCode) ? TransactionStatus.IN.FinalText : TransactionStatus.IN.NormalText;
                this._documentStatus = entity.transaction_status;
            }
            else
            {
                ddlPeriodGroup.DataSource = ServiceProvider.PeriodGroupService.FindByActiveOrID();
                ddlPeriodGroup.ValueMember = "Value";
                ddlPeriodGroup.DisplayMember = "Display";

                List<ComboBoxDTO> lstCombobox = new List<ComboBoxDTO>();
                lstCombobox.SetPleaseSelect();

                ddlPeriod.DataSource = lstCombobox;
                ddlPeriod.ValueMember = "Value";
                ddlPeriod.DisplayMember = "Display";

                ddlWarehouse.DataSource = ServiceProvider.WareHouseService.FindByActiveOrID();
                ddlWarehouse.ValueMember = "Value";
                ddlWarehouse.DisplayMember = "Display";

                txtRemark.Text = string.Empty;
                lblDocumentNo.Text = GeneralMessage.AutoRunningDocumentNo;
                lblDocumentDate.Text = DateTime.Now.ConvertDateToDisplay();
                lblStatus.Text = TransactionStatus.IN.FinalText;
            }

            InitialDetailData();
            EnableModeHead();
            EnableModeDetail();
        }