예제 #1
0
 private void InitializeData()
 {
     if (!Common.IsNew)
     {
         PeopleManageBll bll = new PeopleManageBll();
         DataTable       dt  = bll.GetItemById(Common.Id);
         if (dt != null && dt.Rows.Count > 0)
         {
             txtCardNum.Text = Common.Id;
             txtName.Text    = dt.Rows[0]["name"].ToString();
             txtTeam.Text    = dt.Rows[0]["team"].ToString();
             txtRemark.Text  = dt.Rows[0]["remark"].ToString();
         }
     }
 }
예제 #2
0
        //分布绑定
        private void bindPager()
        {
            int count = 0;

            switch (Common.NowMobule)
            {
            case "peoplemanage":
                PeopleManageBll bll = new PeopleManageBll();
                count = bll.GetTotalCount(((ToolStripTextBox)this.tools.Items["peopleName"]).Text);
                break;

            case "machinemanage":
                MachineManageBll machineBll = new MachineManageBll();
                count = machineBll.GetTotalCount();
                break;

            case "materialmanage":
                MaterialManageBll materialBll = new MaterialManageBll();
                count = materialBll.GetTotalCount(((ToolStripTextBox)this.tools.Items["material_num"]).Text, ((ToolStripTextBox)this.tools.Items["material_name"]).Text);
                break;

            case "tunnelmanage":
                TunnelManageBll tunnelBll = new TunnelManageBll();
                count = tunnelBll.GetTotalCount(((ToolStripTextBox)this.tools.Items["machine_num"]).Text);
                break;

            case "materialrecord":
                MaterialRecordBll materialRecordBll = new MaterialRecordBll();
                count = materialRecordBll.GetTotalCount(((ToolStripTextBox)this.tools.Items["card_num"]).Text, ((ToolStripTextBox)this.tools.Items["material_num"]).Text, Convert.ToDateTime(this.tools.Items[5].Text));
                break;
            }


            ((ToolStripLabel)this.pager.Items["totalCount"]).Text = count.ToString();
            int nowPageSize = Convert.ToInt32(((ToolStripComboBox)this.pager.Items["pageSize"]).SelectedItem);
            int totalPage   = 0;

            if (count % nowPageSize == 0)
            {
                totalPage = count / nowPageSize;
            }
            else
            {
                totalPage = (int)Math.Ceiling((double)count / nowPageSize);
            }

            ((ToolStripLabel)this.pager.Items["totalPage"]).Text = totalPage.ToString();
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtCardNum.Text))
            {
                MessageBox.Show("卡号不能为空");
                return;
            }

            PeopleManageBll bll    = new PeopleManageBll();
            int             result = bll.CreatePeople(txtCardNum.Text, txtName.Text, txtTeam.Text, txtRemark.Text);

            if (result > 0)
            {
                this.Hide();
                f1.callBack();
            }
        }
예제 #4
0
        //数据绑定
        private void bindData()
        {
            gv.Columns.Clear();
            DataTable dt = new DataTable();

            switch (Common.NowMobule)
            {
            case "peoplemanage":
                PeopleManageBll bll = new PeopleManageBll();
                dt = bll.GetAll(((ToolStripTextBox)this.tools.Items["peopleName"]).Text, Convert.ToInt32(((ToolStripLabel)this.pager.Items["pageIndex"]).Text), Convert.ToInt32(((ToolStripComboBox)this.pager.Items["pageSize"]).SelectedItem));
                break;

            case "machinemanage":
                MachineManageBll machineBll = new MachineManageBll();
                dt = machineBll.GetAll(Convert.ToInt32(((ToolStripLabel)this.pager.Items["pageIndex"]).Text), Convert.ToInt32(((ToolStripComboBox)this.pager.Items["pageSize"]).SelectedItem));
                break;

            case "materialmanage":
                MaterialManageBll materialBll = new MaterialManageBll();
                dt = materialBll.GetAll(((ToolStripTextBox)this.tools.Items["material_num"]).Text, ((ToolStripTextBox)this.tools.Items["material_name"]).Text, Convert.ToInt32(((ToolStripLabel)this.pager.Items["pageIndex"]).Text), Convert.ToInt32(((ToolStripComboBox)this.pager.Items["pageSize"]).SelectedItem));
                break;

            case "tunnelmanage":
                TunnelManageBll tunnelBll = new TunnelManageBll();
                dt = tunnelBll.GetAll(((ToolStripTextBox)this.tools.Items["machine_num"]).Text, Convert.ToInt32(((ToolStripLabel)this.pager.Items["pageIndex"]).Text), Convert.ToInt32(((ToolStripComboBox)this.pager.Items["pageSize"]).SelectedItem));
                break;

            case "materialrecord":
                MaterialRecordBll materialRecordBll = new MaterialRecordBll();
                dt = materialRecordBll.GetAll(((ToolStripTextBox)this.tools.Items["card_num"]).Text, ((ToolStripTextBox)this.tools.Items["material_num"]).Text, Convert.ToDateTime(this.tools.Items[5].Text), Convert.ToInt32(((ToolStripLabel)this.pager.Items["pageIndex"]).Text), Convert.ToInt32(((ToolStripComboBox)this.pager.Items["pageSize"]).SelectedItem));
                break;
            }

            gv.DataSource = dt;
            gvGenerate();
        }