Exemplo n.º 1
0
        void Pagers()
        {
            int  sortNum = 0;
            bool a       = int.TryParse(TxtSortNum.Text, out sortNum);

            list = new List <TaskDetail>();
            list = UnPokeClass.GetDataAll(pageNum, out count, sortNum, TxtRegionCode.Text, TxtCusID.Text);
            if (count == 0)
            {
                lblCount.Text     = "共0条记录";
                lblPageCount.Text = "共0页";
                TxtIndex.Text     = "";
                BtnFirst.Enabled  = false;
                BtnEnd.Enabled    = false;
                BtnPre.Enabled    = false;
                BtnNext.Enabled   = false;
                BtnJump.Enabled   = false;
                TxtIndex.ReadOnly = true;
            }
            else
            {
                BtnFirst.Enabled  = true;
                BtnEnd.Enabled    = true;
                BtnPre.Enabled    = true;
                BtnNext.Enabled   = true;
                BtnJump.Enabled   = true;
                TxtIndex.ReadOnly = false;
                lblCount.Text     = "共" + count + "条记录";
                pageCount         = (int)Math.Ceiling(count / 50.0);
                lblPageCount.Text = "共" + pageCount + "页";
                TxtIndex.Text     = pageNum.ToString();
                Bind(list);
            }
        }
Exemplo n.º 2
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            DialogResult MsgBoxResult = MessageBox.Show("确定要更新任务?",                       //对话框的显示内容
                                                        "操作提示",                           //对话框的标题
                                                        MessageBoxButtons.YesNo,          //定义对话框的按钮,这里定义了YSE和NO两个按钮
                                                        MessageBoxIcon.Question,          //定义对话框内的图表式样,这里是一个黄色三角型内加一个感叹号
                                                        MessageBoxDefaultButton.Button2); //定义对话框的按钮式样

            if (MsgBoxResult == DialogResult.Yes)
            {
                string txtStart = TxtStartNum.Text;
                string txtEnd   = TxtEndNum.Text;
                int    status   = 10;
                if (string.IsNullOrWhiteSpace(TxtEndNum.Text))//如果只输入第一个任号务 则其修改
                {
                    txtEnd = txtStart;
                }
                else if (string.IsNullOrWhiteSpace(TxtStartNum.Text))//如果只输入第一个任号务 则其修改
                {
                    txtStart = txtEnd;
                }
                else if (Convert.ToDecimal(TxtStartNum.Text) > Convert.ToDecimal(TxtEndNum.Text)) //防止任务号输反
                {
                    string tmp = txtStart;
                    txtStart = txtEnd;
                    txtEnd   = tmp;
                }
                switch (CmbState.SelectedIndex)
                {
                case 0:
                    status = 10;    //新增
                    break;

                case 1:
                    status = 15;    //已发送
                    break;

                case 2:
                    status = 20;    //已完成
                    break;
                }
                decimal start = 0;
                decimal end   = 0;
                if (decimal.TryParse(txtStart, out start) && decimal.TryParse(txtEnd, out end))
                {
                    UnPokeClass.UpdateTask(start, end, status);
                    WriteLog.GetLog().Write("任务号从:" + txtStart + "任务号到:" + txtEnd + ",修改状态为:" + status + ",修改包装机为" + ",任务更新完成!");

                    int  sortNum = 0;
                    bool a       = int.TryParse(TxtSortNum.Text, out sortNum);

                    list              = UnPokeClass.GetDataAll(pageNum, out count, sortNum, TxtRegionCode.Text, TxtCusID.Text);
                    lblCount.Text     = "共" + count + "条记录";
                    pageCount         = (int)Math.Floor(count / 50.0);
                    lblPageCount.Text = "共" + pageCount + "页";
                    Bind(list);
                }
                else
                {
                    MessageBox.Show("输入错误!!!");
                }
            }
        }