示例#1
0
        private void submit()
        {
            RosterInfo vRoster = new RosterInfo(APConfig.Conn);

            vRoster.Conditions = vRoster.getCondition(RosterInfo.ncConditions.main.ToString(), txtMain.Text);
            if (!vRoster.load())
            {
                APConfig.SweetAlert(ShowBoxType.alert, "查無此主要號碼");
            }
            else
            {
                this.Hide();
                TradeEdit form = new TradeEdit(mode.Add, "", vRoster);
                form.ShowDialog();
                this.Close();
            }
        }
示例#2
0
        private void memberLoadData(int pageNum)
        {
            int total = 0;

            dgvMember.Rows.Clear();
            DataGridViewRowCollection rows = dgvMember.Rows;
            RosterInfo vRoster             = new RosterInfo(APConfig.Conn);

            vRoster.Conditions = " 1=1 ";
            if (!string.IsNullOrEmpty(txtMemberName.Text))
            {
                vRoster.Conditions += " AND " + vRoster.getCondition(RosterInfo.ncConditions.name.ToString(), txtMemberName.Text);
            }
            if (!string.IsNullOrEmpty(txtMemberTel.Text))
            {
                vRoster.Conditions += " AND " + vRoster.getCondition(RosterInfo.ncConditions.phoneLike.ToString(), txtMemberTel.Text);
            }
            if (!string.IsNullOrEmpty(txtMemberAddr.Text))
            {
                vRoster.Conditions += " AND " + vRoster.getCondition(RosterInfo.ncConditions.address.ToString(), txtMemberAddr.Text);
            }
            if (!string.IsNullOrEmpty(txtMemberNo.Text))
            {
                vRoster.Conditions += " AND " + vRoster.getCondition(RosterInfo.ncConditions.noLike.ToString(), txtMemberNo.Text);
            }
            if (!string.IsNullOrEmpty(dpkMemberOrderSDTTM.Value.ToString()) && ckbMemberOrderDTTM.Checked)
            {
                vRoster.Conditions += " AND " + vRoster.getCondition(RosterInfo.ncConditions.orderSDTTM.ToString(), dpkMemberOrderSDTTM.Value.ToString("yyyy/MM/dd"));
            }
            if (!string.IsNullOrEmpty(dpkMemberOrderEDTTM.Value.ToString()) && ckbMemberOrderDTTM.Checked)
            {
                vRoster.Conditions += " AND " + vRoster.getCondition(RosterInfo.ncConditions.orderEDTTM.ToString(), dpkMemberOrderEDTTM.Value.ToString("yyyy/MM/dd"));
            }
            //組排序指令
            if (dgvMember.SortedColumn == null)
            {
                vRoster.OrderBy = vRoster.getOptionOrderBy(RosterInfo.ncSort.Default.ToString());
            }
            else
            {
                string sortname = dgvMember.SortedColumn.Name;
                string sortmode = APConfig.GetValueFromDescription <SortMode>(dgvMember.SortOrder.ToString()).ToString();
                vRoster.OrderBy = string.Format("{0} {1}", vRoster.getOptionOrderBy(sortname), sortmode);
            }
            //查詢頁數初始化且自動跳轉至第一頁
            if (pageNum == 0)
            {
                APConfig.loadPage(ddlMemberPage, vRoster.calculatePage(APConfig.PageCount));
                return;
            }
            //塞入資料
            lblMemberTotal.Text = vRoster.calculateCount().ToString();
            DataSet ds = APConfig.GoPage(vRoster.SQLStatement, pageNum);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                rows.Add(new Object[] { dr.ItemArray[0], dr.ItemArray[1], dr.ItemArray[2], dr.ItemArray[4], dr.ItemArray[5], dr.ItemArray[3], dr.ItemArray[6], dr.ItemArray[10], dr.ItemArray[11], dr.ItemArray[12] });
            }

            //計算總金額
            vRoster.load();
            while (!vRoster.IsEof)
            {
                total += vRoster.RST_AMOUNT;
                vRoster.next();
            }
            lblMemberAMTTotal.Text = string.Format("{0} 元", total.ToString());
        }
示例#3
0
 private void initView()
 {
     if (mode == mode.Add)
     {
         btnOK.ButtonText      = "新增";
         btnOK.IdleFillColor   = Color.FromArgb(33, 166, 117);
         btnOK.IdleLineColor   = Color.FromArgb(33, 166, 117);
         btnOK.ActiveFillColor = Color.FromArgb(33, 166, 117);
         btnOK.ActiveLineColor = Color.FromArgb(33, 166, 117);
         dpkOrderDTTM.Value    = DateTime.Today;
     }
     else if (mode == mode.Edit)
     {
         btnOK.ButtonText      = "修改";
         btnOK.IdleFillColor   = Color.FromArgb(255, 161, 0);
         btnOK.IdleLineColor   = Color.FromArgb(255, 161, 0);
         btnOK.ActiveFillColor = Color.FromArgb(255, 161, 0);
         btnOK.ActiveLineColor = Color.FromArgb(255, 161, 0);
         btnItemAdd.Visible    = false;
         btnItemDel.Visible    = false;
         btnClear.Visible      = false;
         lblTotalCount.Visible = false;
         btnGetAddress.Visible = false;
         RosterInfo view = new RosterInfo(APConfig.Conn);
         view.Conditions  = " 1=1 ";
         view.Conditions += " AND " + view.getCondition(RosterInfo.ncConditions.serno.ToString(), serno);
         view.load();
         if (view.load())
         {
             txtNo.Text         = view.RST_NO;
             txtName.Text       = view.RST_NAME;
             txtPhone.Text      = view.RST_PHONE;
             txtMobile1.Text    = view.RST_MOBILE1;
             txtMobile2.Text    = view.RST_MOBILE2;
             txtAmount.Text     = view.RST_AMOUNT.ToString();
             txtAddr.Text       = view.RST_ADDR;
             txtComment1.Text   = view.RST_COMMENT1;
             txtComment2.Text   = view.RST_COMMENT2;
             txtComment3.Text   = view.RST_COMMENT3;
             dpkOrderDTTM.Value = view.RST_ORDERDTTM;
         }
     }
     else if (mode == mode.View)
     {
         DisableControls();
         btnOK.ButtonText      = "確認";
         btnItemAdd.Visible    = false;
         btnItemDel.Visible    = false;
         btnClear.Visible      = false;
         lblTotalCount.Visible = false;
         btnGetAddress.Visible = false;
         RosterInfo view = new RosterInfo(APConfig.Conn);
         view.Conditions  = " 1=1 ";
         view.Conditions += " AND " + view.getCondition(RosterInfo.ncConditions.serno.ToString(), serno);
         view.load();
         if (view.load())
         {
             txtNo.Text         = view.RST_NO;
             txtName.Text       = view.RST_NAME;
             txtPhone.Text      = view.RST_PHONE;
             txtMobile1.Text    = view.RST_MOBILE1;
             txtMobile2.Text    = view.RST_MOBILE2;
             txtAmount.Text     = view.RST_AMOUNT.ToString();
             txtAddr.Text       = view.RST_ADDR;
             txtComment1.Text   = view.RST_COMMENT1;
             txtComment2.Text   = view.RST_COMMENT2;
             txtComment3.Text   = view.RST_COMMENT3;
             dpkOrderDTTM.Value = view.RST_ORDERDTTM;
         }
     }
 }
示例#4
0
 private void initView()
 {
     if (mode == mode.Add)
     {
         btnOK.ButtonText           = "新增";
         btnOK.IdleFillColor        = Color.FromArgb(33, 166, 117);
         btnOK.IdleLineColor        = Color.FromArgb(33, 166, 117);
         btnOK.ActiveFillColor      = Color.FromArgb(33, 166, 117);
         btnOK.ActiveLineColor      = Color.FromArgb(33, 166, 117);
         panelInfo.Visible          = false;
         ddlPrinciple.SelectedIndex = 0;
         ddlSex.SelectedIndex       = 0;
     }
     else if (mode == mode.Edit)
     {
         btnOK.ButtonText      = "修改";
         btnOK.IdleFillColor   = Color.FromArgb(255, 161, 0);
         btnOK.IdleLineColor   = Color.FromArgb(255, 161, 0);
         btnOK.ActiveFillColor = Color.FromArgb(255, 161, 0);
         btnOK.ActiveLineColor = Color.FromArgb(255, 161, 0);
         txtMain.Enabled       = false;
         panelInfo.Visible     = true;
         RosterInfo vRoster = new RosterInfo(APConfig.Conn);
         vRoster.Conditions  = " 1=1 ";
         vRoster.Conditions += " AND " + vRoster.getCondition(RosterInfo.ncConditions.serno.ToString(), serno);
         if (vRoster.load())
         {
             txtName.Text               = vRoster.RST_NAME;
             txtMain.Text               = vRoster.RST_MAIN;
             txtPhone1.Text             = vRoster.RST_PHONE1;
             txtPhone2.Text             = vRoster.RST_PHONE2;
             txtMobile.Text             = vRoster.RST_MOBILE;
             txtFax.Text                = vRoster.RST_FAX;
             txtAddr.Text               = vRoster.RST_ADDR;
             txtComment.Text            = vRoster.RST_COMMENT;
             ddlSex.SelectedIndex       = APConfig.getSelectIndex(ddlSex, vRoster.RST_SEX);
             ddlPrinciple.SelectedIndex = APConfig.getSelectIndex(ddlPrinciple, vRoster.RST_PRINCIPAL);
             lblInsertBy.Text           = vRoster.RST_INSERTBY;
             lblInsertDTTM.Text         = vRoster.RST_INSERTDTTM.ToString();
             lblModifyBy.Text           = vRoster.RST_MODIFIEDBY;
             lblModifyDTTM.Text         = vRoster.RST_MODIFIEDDTTM.ToString();
         }
     }
     else if (mode == mode.View)
     {
         DisableControls();
         btnOK.ButtonText      = "確認";
         txtMobile.Enabled     = false;
         btnGetAddress.Visible = false;
         panelInfo.Visible     = true;
         RosterInfo vRoster = new RosterInfo(APConfig.Conn);
         vRoster.Conditions  = " 1=1 ";
         vRoster.Conditions += " AND " + vRoster.getCondition(RosterInfo.ncConditions.serno.ToString(), serno);
         vRoster.load();
         txtName.Text               = vRoster.RST_NAME;
         txtMain.Text               = vRoster.RST_MAIN;
         txtPhone1.Text             = vRoster.RST_PHONE1;
         txtPhone2.Text             = vRoster.RST_PHONE2;
         txtMobile.Text             = vRoster.RST_MOBILE;
         txtFax.Text                = vRoster.RST_FAX;
         txtAddr.Text               = vRoster.RST_ADDR;
         txtComment.Text            = vRoster.RST_COMMENT;
         ddlSex.SelectedIndex       = APConfig.getSelectIndex(ddlSex, vRoster.RST_SEX);
         ddlPrinciple.SelectedIndex = APConfig.getSelectIndex(ddlPrinciple, vRoster.RST_PRINCIPAL);
         lblInsertBy.Text           = vRoster.RST_INSERTBY;
         lblInsertDTTM.Text         = vRoster.RST_INSERTDTTM.ToString();
         lblModifyBy.Text           = vRoster.RST_MODIFIEDBY;
         lblModifyDTTM.Text         = vRoster.RST_MODIFIEDDTTM.ToString();
     }
 }