示例#1
0
        public SysNewDetectFishery()
        {
            InitializeComponent();
            ProvinceCityTable = PubClass.ProvinceCityTable;
            DataTable table = operationContract.GetDeptProvinceCity(deptid);

            DataRow[] rows;
            if (table.Rows.Count == 0)
            {
                rows = ProvinceCityTable.Select("pid = '0001'");
            }
            else
            {
                rows = table.Select();
            }

            //获取样品编号
            SampleNoTable = operationContract.GetComboSampleNo("f", userId);

            //画面初始化-新增检测单画面
            ComboboxTool.InitComboboxSource(_province, rows, "lr");
            _province.SelectionChanged += new SelectionChangedEventHandler(_province_SelectionChanged);

            //查找登录者部门所属的省份
            string proviceid = operationContract.GetProvince(deptid);
            int    i         = 1;

            foreach (DataRow row in rows)
            {
                if (row["cityId"].ToString() == proviceid)
                {
                    _province.SelectedIndex = i;
                }
                i = i + 1;
            }

            ComboboxTool.InitComboboxSource(_source_company, operationContract.GetComboUserCompany(userId), "lr");
            ComboboxTool.InitComboboxSource(_sample_no, SampleNoTable, "lr");
            _sample_no.SelectionChanged += new SelectionChangedEventHandler(_sample_no_SelectionChanged);
            ComboboxTool.InitComboboxSource(_detect_sample, operationContract.GetComboDetSample("f"), "lr");
            ComboboxTool.InitComboboxSource(_detect_object, operationContract.GetComboDetObjectFishery(), "lr");
            ComboboxTool.InitComboboxSource(_detect_item, operationContract.GetComboDetItemFishery(), "lr");
            _detect_item.SelectionChanged += new SelectionChangedEventHandler(_detect_item_SelectionChanged);
            ComboboxTool.InitComboboxSource(_detect_method, operationContract.GetComboDetReagentFishery(), "lr");
            ComboboxTool.InitComboboxSource(_detect_result, operationContract.GetComboDetResult(), "lr");
            _entering_datetime.Text           = string.Format("{0:g}", System.DateTime.Now);
            _source_company.SelectionChanged += new SelectionChangedEventHandler(_source_company_SelectionChanged);
            _detect_person.Text = PubClass.userInfo.ShowName;
            _detect_site.Text   = sysSetContract.GetDeptName(PubClass.userInfo.DepartmentID);
        }
        public NewDetectAnimal(string sample_no, string object_id, string sample_id)
        {
            InitializeComponent();

            this.sampleNo = sample_no;
            this.sampleId = sample_id;
            this.objectId = object_id;

            ProvinceCityTable = PubClass.ProvinceCityTable;
            DataTable table = operationContract.GetDeptProvinceCity(deptid);

            DataRow[] rows;
            if (table.Rows.Count == 0)
            {
                rows = ProvinceCityTable.Select("pid = '0001'");
            }
            else
            {
                rows = table.Select();
            }

            //画面初始化-新增检测单画面
            ComboboxTool.InitComboboxSource(_province, rows, "lr");
            _province.SelectionChanged += new SelectionChangedEventHandler(_province_SelectionChanged);

            //查找登录者部门所属的省份
            string proviceid = operationContract.GetProvince(deptid);
            int    i         = 1;

            foreach (DataRow row in rows)
            {
                if (row["cityId"].ToString() == proviceid)
                {
                    _province.SelectedIndex = i;
                }
                i = i + 1;
            }

            ComboboxTool.InitComboboxSource(_source_company, operationContract.GetComboUserCompany(userId), "lr");
            ComboboxTool.InitComboboxSource(_sample_no, operationContract.GetComboSampleNo("a", userId), "lr");
            ComboboxTool.InitComboboxSource(_detect_sample, operationContract.GetComboDetSample("a"), "lr");
            ComboboxTool.InitComboboxSource(_detect_object, operationContract.GetComboDetObjectAnimal(), "lr");
            ComboboxTool.InitComboboxSource(_detect_item, operationContract.GetComboDetItemAnimal(), "lr");
            _detect_item.SelectionChanged += new SelectionChangedEventHandler(_detect_item_SelectionChanged);
            ComboboxTool.InitComboboxSource(_detect_method, operationContract.GetComboDetReagentAnimal(), "lr");
            ComboboxTool.InitComboboxSource(_detect_result, operationContract.GetComboDetResult(), "lr");
            _entering_datetime.Text           = string.Format("{0:g}", System.DateTime.Now);
            _source_company.SelectionChanged += new SelectionChangedEventHandler(_source_company_SelectionChanged);
            _detect_person.Text = PubClass.userInfo.ShowName;
            _detect_site.Text   = sysSetContract.GetDeptName(PubClass.userInfo.DepartmentID);

            //赋值样品编号、样品名称、样品分类
            for (int j = 0; j < _sample_no.Items.Count; j++)
            {
                if ((_sample_no.Items[j] as Label).Tag.ToString() == sampleNo)
                {
                    _sample_no.SelectedItem = _sample_no.Items[j];
                    break;
                }
            }

            for (int j = 0; j < _detect_sample.Items.Count; j++)
            {
                if ((_detect_sample.Items[j] as Label).Tag.ToString() == sampleId)
                {
                    _detect_sample.SelectedItem = _detect_sample.Items[j];
                    break;
                }
            }

            for (int j = 0; j < _detect_object.Items.Count; j++)
            {
                if ((_detect_object.Items[j] as Label).Tag.ToString() == objectId)
                {
                    _detect_object.SelectedItem = _detect_object.Items[j];
                    break;
                }
            }
        }