Exemple #1
0
        public void SaveSummon(ShowSummon ss)
        {
            if (ss.tbQUANTITY.Value == 0)
            {
                MessageBox.Show("Введите количество изделий!");
                return;
            }
            if (ss.cbCustDept.SelectedValue == null)
            {
                MessageBox.Show("Добавьте отдел заказчика!");
                return;
            }
            DBSummon dbs = new DBSummon();
            SummonVO SVO = new SummonVO();

            SVO     = SummonVO.SummonVOByID(ss.SVO.ID);
            SVO.ID  = ss.SVO.ID;
            SVO.IDS = ss.tbIDS.Text;
            //SVO.ACCEPTANCE = ss.cbAccept.Text;
            SVO.CONTRACT       = ss.tbCONTRACT.Text;
            SVO.CREATED        = ss.SVO.CREATED;
            SVO.DELIVERY       = ss.tbDELIVERY.Text;
            SVO.IDCUSTOMER     = ss.cbCustomers.SelectedValue.ToString();
            SVO.IDCUSTOMERDEPT = (int)ss.cbCustDept.SelectedValue;
            SVO.PAYSTATUS      = ss.tbPayStatus.Text;
            SVO.IDSTATUS       = 1;//тута просто фейковую единичку ставим, потом при занесении в базу проставится нормальный статус
            SVO.PTIME          = ss.dtpPTIME.Value;
            SVO.QUANTITY       = (int)ss.tbQUANTITY.Value;
            SVO.SHIPPING       = ss.tbSHIPPING.Text;

            if (ss.cbSISP.SelectedIndex == 0)
            {
                SVO.SISP = false;
            }
            else
            {
                SVO.SISP = true;
            }
            SVO.IDACCEPT  = (int)ss.cbAccept.SelectedValue;
            SVO.IDPACKING = (int)ss.cbPacking.SelectedValue;

            /*SVO.IDMOUNTINGKIT = (int)ss.cbMountingKit.SelectedValue;
             * if (ss.chbDeterm.Checked)
             * {
             *  SVO.PASSDATE = null;
             * }
             * else
             * {
             *  SVO.PASSDATE = ss.dtpAPPROX.Value;
             * }*/
            SVO.BILLPAYED    = ss.chbBillPayed.Checked;
            SVO.DOCSREADY    = ss.chbDocsRdy.Checked;
            SVO.VIEWED       = true;
            SVO.CONTRACTTYPE = ss.cbCONTRACTTYPE.Text;
            SVO.PLANKA       = (ss.pfPLANKA.FullPath == "<нет>") ? null : ss.pfPLANKA.FullPath;
            SVO.PLANKAREQ    = ss.pfPLANKA.Required;
            SVO.SERIAL       = (ss.pfSERIAL.FullPath == "<нет>") ? null : ss.pfSERIAL.FullPath;
            SVO.SERIALREQ    = ss.pfSERIAL.Required;
            SVO.BILLNUMBER   = ss.tbBillNumber.Text;

            SVO.PASSPORT       = (ss.pfPASSPORT.FullPath == "<нет>") ? null : ss.pfPASSPORT.FullPath;
            SVO.PASSPORTREQ    = ss.pfPASSPORT.Required;
            SVO.MANUAL         = (ss.pfMANUAL.FullPath == "<нет>") ? null : ss.pfMANUAL.FullPath;
            SVO.MANUALREQ      = ss.pfMANUAL.Required;
            SVO.PACKINGLIST    = (ss.pfPACKINGLIST.FullPath == "<нет>") ? null : ss.pfPACKINGLIST.FullPath;
            SVO.PACKINGLISTREQ = ss.pfPACKINGLIST.Required;
            //SVO.LENGTH = ss.tbLENGTH.Text;
            //SVO.WIDTH = ss.tbWIDTH.Text;
            //SVO.HEIGHT = ss.tbHEIGHT.Text;
            //SVO.WEIGHT = ss.tbWEIGHT.Text;

            dbs.SaveSummon(SVO);
            ss.SVO = SVO;

            /*if (ss.dtpApproxAtLoad != SVO.PASSDATE)
             * {
             *  dbs.PassDateChanged(SVO.ID);
             * }*/
            MessageBox.Show("Извещение успешно сохранено!");
        }
Exemple #2
0
        }//эта невиртуальная потому что для всех ролей одинаковый код

        protected void LoadSummon(ShowSummon ss)
        {
            ss.tbIDS.Text = ss.SVO.IDS;

            DBCustomer dbc = new DBCustomer();

            ss.cbCustomers.ValueMember   = "ID";
            ss.cbCustomers.DisplayMember = "CNAME";
            ss.cbCustomers.DataSource    = dbc.GetAllCustomers();
            ss.cbCustomers.SelectedValue = ss.SVO.IDCUSTOMER;

            if (ss.SVO.SISP)
            {
                ss.cbSISP.SelectedIndex = 1;
            }
            else
            {
                ss.cbSISP.SelectedIndex = 0;
            }

            DBAccept dbacc = new DBAccept();

            ss.cbAccept.ValueMember   = "ID";
            ss.cbAccept.DisplayMember = "ANAME";
            ss.cbAccept.DataSource    = dbacc.GetAllAccept();
            ss.cbAccept.SelectedValue = ss.SVO.IDACCEPT;

            DBPacking dbp = new DBPacking();

            ss.cbPacking.ValueMember   = "ID";
            ss.cbPacking.DisplayMember = "PNAME";
            ss.cbPacking.DataSource    = dbp.GetAll();
            ss.cbPacking.SelectedValue = ss.SVO.IDPACKING;

            //DBMountingKit dbmk = new DBMountingKit();
            //ss.cbMountingKit.ValueMember = "ID";
            //ss.cbMountingKit.DisplayMember = "MOUNTINGKITNAME";
            //ss.cbMountingKit.DataSource = dbmk.GetAllDBMountingKitNames();
            //ss.cbMountingKit.SelectedValue = ss.SVO.IDMOUNTINGKIT;


            ss.tbCONTRACT.Text   = ss.SVO.CONTRACT;
            ss.tbDELIVERY.Text   = ss.SVO.DELIVERY;
            ss.tbQUANTITY.Value  = ss.SVO.QUANTITY;
            ss.tbSHIPPING.Text   = ss.SVO.SHIPPING;
            ss.dtpCREATED.Value  = ss.SVO.CREATED;
            ss.dtpPTIME.Value    = ss.SVO.PTIME;
            ss.tbPayStatus.Text  = ss.SVO.PAYSTATUS;
            ss.tbBillNumber.Text = ss.SVO.BILLNUMBER;

            /*if (ss.SVO.PASSDATE == null)
             * {
             *  ss.chbDeterm.Checked = true;
             *  ss.dtpAPPROX.Enabled = false;
             * }
             * else
             * {
             *  ss.chbDeterm.Checked = false;
             *  ss.dtpAPPROX.Enabled = false;
             *  ss.dtpAPPROX.Value = (DateTime)ss.SVO.PASSDATE;
             * }*/
            ss.tbStatus.Text        = ss.SVO.STATUSNAME;
            ss.tbSubStatus.Text     = ss.SVO.SUBSTATUSNAME;
            ss.chbBillPayed.Checked = ss.SVO.BILLPAYED;
            ss.chbDocsRdy.Checked   = ss.SVO.DOCSREADY;

            if ((ss.Tag != null) && (ss.Tag.ToString() == "finished"))

            {
                ss.summonTransfer1.Visible = false;
                ss.summonTransfer2.Visible = false;
            }
            else
            {
                ss.summonNotes1.Init(ss.SVO.ID, this, ss.SVO);
                ss.summonNotes1.Reload();

                ss.summonTransfer1.Init(ss.SVO, this, ss);
                if ((ss.SVO.ProductVO.GetProductType() == WPTYPE.CABLELIST) || (ss.SVO.ProductVO.GetProductType() == WPTYPE.ZHGUTLIST))
                {
                    ss.summonTransfer2.Visible = false;
                }
                ss.summonTransfer2.InitSub(ss.SVO, this, ss);
            }
            ss.wpNameView1.Init(ss.SVO.ProductVO.GetID(), ss.SVO.ProductVO.GetProductType(), this, ss.SVO);

            ss.cbCustDept.ValueMember   = "ID";
            ss.cbCustDept.DisplayMember = "DEPTNAME";
            ss.cbCustDept.DataSource    = dbc.GetDeptsByIDCustomer(ss.cbCustomers.SelectedValue.ToString());
            ss.cbCustDept.SelectedValue = ss.SVO.IDCUSTOMERDEPT;
            if (ss.SVO.STATUSNAME != "Завершено")
            {
                if ((ss.Tag == null))
                {
                    DBSummon dbs = new DBSummon();
                    dbs.AddSummonView(ss.SVO, this);
                }
            }
            //ss.dtpApproxAtLoad = ss.SVO.PASSDATE;

            ss.cbCONTRACTTYPE.Text = ss.SVO.CONTRACTTYPE;



            //pfMETAL.IsPath = true;
        }//эта тоже