示例#1
0
        /// <summary>
        /// 绑定combox
        /// </summary>
        private void InitCombox()
        {
            try
            {
                #region clear combox
                this.cmbDistrict.Items.Clear();
                //this.cmpApproveStatus.Items.Clear();
                #endregion

                #region bind district
                string msg = string.Empty;
                //Provinces[] Provinces = PharmacyDatabaseService.AllProvinces(out msg);
                District[] districts = PharmacyDatabaseService.AllDistricts(out msg);
                this.cmbDistrict.DataSource    = districts;
                this.cmbDistrict.DisplayMember = "Name";
                this.cmbDistrict.ValueMember   = "Id";
                foreach (District district in districts)
                {
                    dicDistrict.Add(district.Id, district.Name);
                }

                #endregion
                _ListUnitType = PharmacyDatabaseService.AllUnitTypes(out msg).ToList();
                this.cmbUnitType.DataSource    = _ListUnitType.OrderBy(d => d.Code).ToList();
                this.cmbUnitType.DisplayMember = "Name";
                this.cmbUnitType.ValueMember   = "Id";


                #region bind ApproveStatus
                //this.cmpApproveStatus.Items.Add(new ListItem(ApprovalStatus.Waitting.ToString(), "待审"));
                //this.cmpApproveStatus.Items.Add(new ListItem(ApprovalStatus.Approvaled.ToString(), "已审"));
                //this.cmpApproveStatus.Items.Add(new ListItem(BugsBox.Pharmacy.AppClient.PS.ApprovalStatus.Reject.ToString(), "审查未通过"));
                //this.cmpApproveStatus.Items.Add(new ListItem(BugsBox.Pharmacy.AppClient.PS.ApprovalStatus.Abate.ToString(), "失效"));
                //this.cmpApproveStatus.Items.Add(new ListItem(BugsBox.Pharmacy.AppClient.PS.ApprovalStatus.Canceled.ToString(), "取消"));
                #endregion
                //string msg = string.Empty;

                //#region bind UnitType
                //GetUnitType();
                ////this.cmbUnitType.DataSource = _ListUnitType;
                ////this.cmbUnitType.DisplayMember = "Name";
                ////this.cmbUnitType.ValueMember = "Id";
                //#endregion
            }
            catch (Exception ex)
            {
                //MessageBox.Show("初始化数据失败", "系统错误", MessageBoxButtons.OK);
                //Log.Error(ex);
            }
        }
        private void InitData()
        {
            try
            {
                string message;
                SupplyUnits = PharmacyDatabaseService.AllSupplyUnits(out message)
                              .ToList();
                switch (RunMode)
                {
                case FormRunMode.Add:
                    Entity                = new SupplyUnitSalesman();
                    Entity.Birthday       = TypesDefaultValues.MinDateTime;
                    Entity.BusinessScopes = string.Empty;
                    Entity.CreateTime     = DateTime.Now;
                    Entity.CreateUserId   = AppClientContext.CurrentUser.Id;
                    Entity.Deleted        = false;
                    Entity.Enabled        = true;
                    Entity.Gender         = "男";
                    Entity.IsOutDate      = false;
                    Entity.OutDate        = TypesDefaultValues.MaxDateTime;
                    Entity.UpdateTime     = DateTime.Now;
                    Entity.UpdateUserId   = AppClientContext.CurrentUser.Id;
                    //string message;
                    //GSPLicense = PharmacyDatabaseService.GetGSPLicense(out message, gMSPLicenseId);
                    //if (GMSPLicenseBusinessScopes == null)
                    //{
                    //    GMSPLicenseBusinessScopes = thisAllBusinessScopes(out message);
                    //}
                    break;

                case FormRunMode.Edit:
                    break;

                case FormRunMode.Browse:
                    break;

                case FormRunMode.Search:
                    break;

                case FormRunMode.Delete:
                    break;

                default:
                    break;
                }

                //初始化字典数据
                SupplyUnits.Insert(0, new SupplyUnit {
                    Id = Guid.Empty, Name = "请您选择..."
                });
                Districts = PharmacyDatabaseService.AllDistricts(out message).ToList();
                Districts.Insert(0, new District {
                    Id = Guid.Empty, Name = "请您选择..."
                });
                Genders = new List <ListItem>();
                Genders.Add(new ListItem {
                    ID = "-1", Name = "未知"
                });
                Genders.Add(new ListItem {
                    ID = "1", Name = "男"
                });
                Genders.Add(new ListItem {
                    ID = "0", Name = "女"
                });
            }
            catch (Exception ex)
            {
                ex = new Exception("初始化数据失败", ex);
                Log.Error(ex);
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void InitData()
        {
            try
            {
                string message;
                switch (RunMode)
                {
                case FormRunMode.Add:
                    Entity              = new PurchaseUnitBuyer();
                    Entity.Birthday     = TypesDefaultValues.MinDateTime;
                    Entity.CreateTime   = DateTime.Now;
                    Entity.CreateUserId = AppClientContext.CurrentUser.Id;
                    Entity.Deleted      = false;
                    Entity.Enabled      = true;
                    Entity.Gender       = "男";
                    Entity.OutDate      = TypesDefaultValues.MaxDateTime;
                    Entity.UpdateTime   = DateTime.Now;
                    Entity.UpdateUserId = AppClientContext.CurrentUser.Id;
                    break;

                case FormRunMode.Edit:
                    break;

                case FormRunMode.Browse:
                    break;

                case FormRunMode.Search:
                    break;

                case FormRunMode.Delete:
                    break;

                default:
                    break;
                }

                //初始化字典数据
                PurchaseUnits = PharmacyDatabaseService.AllPurchaseUnits(out message).ToList();
                PurchaseUnits.Insert(0, new PurchaseUnit {
                    Id = Guid.Empty, Name = "请您选择..."
                });
                Districts = PharmacyDatabaseService.AllDistricts(out message).ToList();
                Districts.Insert(0, new District {
                    Id = Guid.Empty, Name = "请您选择..."
                });
                Genders = new List <ListItem>();
                Genders.Add(new ListItem {
                    ID = "-1", Name = "未知"
                });
                Genders.Add(new ListItem {
                    ID = "1", Name = "男"
                });
                Genders.Add(new ListItem {
                    ID = "0", Name = "女"
                });
                PurchaseLimitTypes = EnumHelper <PurchaseLimitType> .GetMapKeyValues();
            }
            catch (Exception ex)
            {
                ex = new Exception("初始化数据失败", ex);
                Log.Error(ex);
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }