Example #1
0
        private void btnSignin_Click(object sender, EventArgs e)
        {
            if (tbEmpNo.Text.Trim() != "" && tbPwd.Text.Trim() != "")
            {
                RememberMe(tbEmpNo.Text.Trim());

                CERPWS.Service1 svc = new CERPWS.Service1();
                StringReader sr = new StringReader(svc.Login(tbEmpNo.Text, tbPwd.Text));
                DataSet ds = new DataSet();
                DataTable dt = new DataTable("table");
                ds.ReadXml(sr);
                dt = ds.Tables[0];

                if (Convert.ToInt32(dt.Rows[0].ItemArray[0]) == 0)
                {
                    MessageBox.Show(dt.Rows[0].ItemArray[1].ToString());
                }
                else
                {
                    CERP.gUserID = Convert.ToInt32(dt.Rows[0].ItemArray[0].ToString());
                    CERP.gUserName = dt.Rows[0].ItemArray[2].ToString() + ", " + dt.Rows[0].ItemArray[1].ToString();
                    CERP.gRole = Convert.ToInt32(dt.Rows[0].ItemArray[3].ToString());

                    this.DialogResult = DialogResult.OK;
                }
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            string type;
            int terminalID;
            int srcTerminalID;
            int statusID;

            if (tbBarcode.Text != "" && tbTrckNo.Text != "" && tbMatLotNo.Text != "" && tbProdLotNo.Text != "" && Convert.ToDecimal(tbQty.Text) > 0)
            {
                CERPWS.Service1 svc = new CERPWS.Service1();

                if (rbIn.Checked)  // INPUT
                {
                    type = "INPUT";
                    terminalID = Properties.Settings.Default.TerminalID;
                    srcTerminalID = Convert.ToInt16(cbSrcTerminal.SelectedValue);
                    statusID = CERP.GetTerminalStatusCode(CERPProperties.TerminalID);
                }
                else
                {
                    type = "OUTPUT";
                    terminalID = CERP.GetTerminalOut(Properties.Settings.Default.TerminalID);
                    srcTerminalID = CERP.GetTerminalOut(Properties.Settings.Default.TerminalID);
                    statusID = Convert.ToInt16(cbOut.SelectedValue);
                }

                int x = Convert.ToInt16(cbSrcTerminal.SelectedValue);
                int y = CERP.GetTerminalStatusCode(CERPProperties.TerminalID);
                int z = Convert.ToInt16(cbOut.SelectedValue);

                int result = svc.AdjustProductionInventory(type,
                                                            CERPProperties.ItemID,
                                                            "MAT",
                                                            tbTrckNo.Text.Trim(),
                                                            tbProdLotNo.Text.Trim(),
                                                            tbMatLotNo.Text.Trim(),
                                                            srcTerminalID,
                                                            terminalID,
                                                            2, //device id
                                                            statusID,
                                                            Convert.ToDecimal(tbQty.Text.Trim()),
                                                            tbRemarks.Text.Trim());
                MessageBox.Show("Adjusted");
            }
        }
        private void LoadItemDetails(string _barcode)
        {
            CERPWS.Service1 svc = new CERPWS.Service1();

            string result = svc.GetItemDetails(_barcode.Trim());

            StringReader sr = new StringReader(result);
            DataSet ds = new DataSet();
            DataTable dt = new DataTable("table");
            ds.ReadXml(sr);
            dt = ds.Tables[0];

            if (dt.Rows[0].ItemArray[0].ToString() == "0")
            {
                MessageBox.Show(dt.Rows[0].ItemArray[1].ToString());

                //TODO: clear properties
            }
            else
            {
                CERPProperties.ItemID = Convert.ToInt16(dt.Rows[0].ItemArray[0]);
                CERPProperties.ItemCode = dt.Rows[0].ItemArray[1].ToString();
                CERPProperties.Description = dt.Rows[0].ItemArray[2].ToString();
                CERPProperties.ProdTerminalID = Convert.ToInt16(dt.Rows[0].ItemArray[3]);
                CERPProperties.UOM = dt.Rows[0].ItemArray[4].ToString();

                tbItemCode.Text = CERPProperties.ItemCode;
                tbDescription.Text = CERPProperties.Description;
                tbUOM.Text = CERPProperties.UOM;
            }
        }