Пример #1
0
        private void GetSQLData(SqlCeDataReader getdata)
        {
            try
            {
                dl_array.Clear();
                dt.Clear();
                while (getdata.Read())
                {
                    DailyLossFormTS insert = new DailyLossFormTS();
                    Object[]        array  = new Object[10];

                    insert.itemno = getdata["ItemNo"].ToString();
                    array[0]      = getdata["ItemNo"].ToString();

                    insert.entrytype = getdata["EntryType"].ToString();
                    array[1]         = getdata["Description"].ToString();
                    //getdata["EntryType"].ToString();

                    insert.location = getdata["Location"].ToString();
                    array[2]        = getdata["EntryType"].ToString();
                    //getdata["Location"].ToString();
                    insert.bincode = getdata["BinCode"].ToString();
                    array[3]       = getdata["Location"].ToString();
                    //getdata["BinCode"].ToString();

                    insert.quantity = getdata["Quantity"].ToString();
                    array[4]        = getdata["BinCode"].ToString();
                    //getdata["Quantity"].ToString();
                    insert.staffdimension = getdata["StaffDimension"].ToString();
                    array[5] = getdata["Quantity"].ToString();
                    //getdata["StaffDimension"].ToString();

                    insert.postdate = getdata["PostingDate"].ToString();
                    array[6]        = getdata["StaffDimension"].ToString();
                    //Convert.ToDateTime(getdata["PostingDate"]);

                    insert.description = getdata["Description"].ToString();
                    array[7]           = getdata["PostingDate"].ToString();
                    //getdata["Description"].ToString();

                    array[8] = Convert.ToInt32(getdata["LineNo"]);

                    array[9]         = getdata["EmptyTank"];
                    insert.EmptyTank = Convert.ToBoolean(getdata["EmptyTank"]);

                    dl_array.Add(insert);
                    dt.Rows.Add(array);
                }
                lblCount.Text = dt.Rows.Count.ToString();
                CallBindGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        public ItemLists(string staffname, string staffdim, string stafflevel, List <DailyLossFormTS> RDL_Array, DailyLossFormTS currentdts)
        {
            InitializeComponent();
            tocheckItemName = currentdts.itemno;
            Rname           = staffname;
            Rstaffdimen     = staffdim;
            Rslevel         = stafflevel;
            CurrentArray    = RDL_Array;
            currentRds      = currentdts;
            BindListControl();

            Cursor.Current = Cursors.Default;
        }
Пример #3
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            // dl_array // Current Status

            Cursor.Current = Cursors.WaitCursor;

            DailyLossFormTS dts = new DailyLossFormTS();

            dts.itemno    = txtItemNo.Text;
            dts.bincode   = txtBinCode.Text;
            dts.location  = txtLocation.Text;
            dts.postdate  = txtPostingDate.Text;
            dts.quantity  = txtQuantity.Text;
            dts.entrytype = cboEntryType.SelectedItem.ToString();

            ItemLists itemlst = new ItemLists(staffname, staffdim, stafflevel, dl_array, dts);

            itemlst.Show();
        }
Пример #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (cboEntryType.SelectedText.Equals("Positive Adjmt.") && chkEmpty.Checked == true)
                {
                    MessageBox.Show("PDA: You cannot now allow to empty the bin in positive state.");
                }
                else
                {
                    if (count == 0)
                    {
                        if (!string.IsNullOrEmpty(txtItemNo.Text.Trim()) && !string.IsNullOrEmpty(txtBinCode.Text.Trim()) && !string.IsNullOrEmpty(txtLocation.Text.Trim()) && !string.IsNullOrEmpty(txtQuantity.Text.Trim()) && !txtQuantity.Text.Trim().Equals("0"))
                        //if (!txtItemNo.Text.Equals("") && !txtBinCode.Text.Equals("") && !txtLocation.Text.Equals("") && !txtQuantity.Text.Equals(""))
                        {
                            bool isNum = IsItNumber(txtQuantity.Text.Trim());

                            if (isNum)
                            {
                                bool flagLocation = LocationValidating();

                                bool flagItem = ItemValidating();

                                if (flagLocation == true && flagItem == true)
                                {
                                    DailyLossFormTS insert = new DailyLossFormTS();
                                    Object[]        array  = new Object[9];

                                    insert.itemno         = txtItemNo.Text.Trim();
                                    array[0]              = txtItemNo.Text.Trim();
                                    insert.entrytype      = cboEntryType.Text.Trim();
                                    array[1]              = txtDescription.Text.Trim();
                                    insert.description    = txtDescription.Text.Trim();
                                    array[2]              = cboEntryType.Text.Trim();
                                    insert.location       = txtLocation.Text.Trim();
                                    array[3]              = txtLocation.Text.Trim();
                                    insert.bincode        = txtBinCode.Text.Trim();
                                    array[4]              = txtBinCode.Text.Trim();
                                    insert.quantity       = txtQuantity.Text.Trim();
                                    array[5]              = txtQuantity.Text.Trim();
                                    insert.staffdimension = staffdim;
                                    array[6]              = staffdim;
                                    insert.postdate       = txtPostingDate.Text.Trim();
                                    array[7]              = Convert.ToDateTime(txtPostingDate.Text.Trim());
                                    if (chkEmpty.Checked)
                                    {
                                        array[8] = true;
                                    }
                                    else
                                    {
                                        array[8] = false;
                                    }
                                    dl_array.Add(insert);
                                    dt.Rows.Add(array);
                                    lblCount.Text = dt.Rows.Count.ToString();

                                    //tempthu
                                    CompactSQL comsql = new CompactSQL();
                                    comsql.InsertRecord("ChangeSize", array);

                                    getdata = comsql.SelectRecord("ChangeSize"); //test3
                                    GetSQLData(getdata);                         //test3
                                    CallBindGrid();
                                    //tempthu
                                    //CompactSQL comsql = new CompactSQL();
                                    //comsql.InsertRecord("ChangeSize", array);
                                }
                                else
                                {
                                    if (flagLocation == false)
                                    {
                                        BinQH.BinQH_Service binservice = new QHMobile.BinQH.BinQH_Service();
                                        binservice.Url         = WebServiceInstants.GetURL(ServiceType.BinQH);
                                        binservice.Credentials = nc;

                                        List <BinQH.BinQH_Filter> filterArr = new List <QHMobile.BinQH.BinQH_Filter>();

                                        BinQH.BinQH_Filter bincodefilter = new QHMobile.BinQH.BinQH_Filter();
                                        bincodefilter.Field    = QHMobile.BinQH.BinQH_Fields.Code;
                                        bincodefilter.Criteria = txtBinCode.Text.Trim();

                                        filterArr.Add(bincodefilter);


                                        BinQH.BinQH[] binqhget = binservice.ReadMultiple(filterArr.ToArray(), null, 3);

                                        if (binqhget.Length == 0)
                                        {
                                            MessageBox.Show("Location and Bin is not found.");
                                            txtItemNo.SelectAll();
                                            txtItemNo.Focus();
                                        }
                                        else
                                        {
                                            DailyLossFormTS insert = new DailyLossFormTS();
                                            Object[]        array  = new Object[9];

                                            insert.itemno         = txtItemNo.Text.Trim();
                                            array[0]              = txtItemNo.Text.Trim();
                                            insert.entrytype      = cboEntryType.Text.Trim();
                                            array[1]              = txtDescription.Text.Trim();
                                            insert.description    = txtDescription.Text.Trim();
                                            array[2]              = cboEntryType.Text.Trim();
                                            insert.location       = txtLocation.Text.Trim();
                                            array[3]              = txtLocation.Text.Trim();
                                            insert.bincode        = txtBinCode.Text.Trim();
                                            array[4]              = txtBinCode.Text.Trim();
                                            insert.quantity       = txtQuantity.Text.Trim();
                                            array[5]              = txtQuantity.Text.Trim();
                                            insert.staffdimension = staffdim;
                                            array[6]              = staffdim;
                                            insert.postdate       = txtPostingDate.Text.Trim();
                                            array[7]              = Convert.ToDateTime(txtPostingDate.Text.Trim());
                                            if (chkEmpty.Checked)
                                            {
                                                array[8] = true;
                                            }
                                            else
                                            {
                                                array[8] = false;
                                            }
                                            dl_array.Add(insert);
                                            dt.Rows.Add(array);
                                            lblCount.Text = dt.Rows.Count.ToString();

                                            //tempthu
                                            CompactSQL comsql = new CompactSQL();
                                            comsql.InsertRecord("ChangeSize", array);

                                            getdata = comsql.SelectRecord("ChangeSize"); //test3
                                            GetSQLData(getdata);                         //test3
                                            CallBindGrid();
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("All fields are required to enter.");
                        }

                        count = count + 1;
                        txtItemNo.SelectAll();
                        txtItemNo.Focus();
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(txtItemNo.Text.Trim()) && !string.IsNullOrEmpty(txtBinCode.Text.Trim()) && !string.IsNullOrEmpty(txtLocation.Text.Trim()) && !string.IsNullOrEmpty(txtQuantity.Text.Trim()) && !txtQuantity.Text.Trim().Equals("0"))
                        {
                            bool isNum = IsItNumber(txtQuantity.Text.Trim());

                            if (isNum)
                            {
                                // bool flagLocation = LocationValidating();

                                bool flagItem = ItemValidating();

                                if (flagItem == true)
                                {
                                    count = 0;

                                    DailyLossFormTS insert = new DailyLossFormTS();
                                    Object[]        array  = new Object[9];

                                    insert.itemno         = txtItemNo.Text.Trim();
                                    array[0]              = txtItemNo.Text.Trim();
                                    insert.entrytype      = cboEntryType.Text.Trim();
                                    array[1]              = txtDescription.Text.Trim();
                                    insert.description    = txtDescription.Text.Trim();
                                    array[2]              = cboEntryType.Text.Trim();
                                    insert.location       = txtLocation.Text.Trim();
                                    array[3]              = txtLocation.Text.Trim();
                                    insert.bincode        = txtBinCode.Text.Trim();
                                    array[4]              = txtBinCode.Text.Trim();
                                    insert.quantity       = txtQuantity.Text.Trim();
                                    array[5]              = txtQuantity.Text.Trim();
                                    insert.staffdimension = staffdim;
                                    array[6]              = staffdim;
                                    insert.postdate       = txtPostingDate.Text.Trim();
                                    array[7]              = Convert.ToDateTime(txtPostingDate.Text.Trim());
                                    if (chkEmpty.Checked)
                                    {
                                        array[8] = true;
                                    }
                                    else
                                    {
                                        array[8] = false;
                                    }

                                    dl_array.Add(insert);
                                    dt.Rows.Add(array);
                                    lblCount.Text = dt.Rows.Count.ToString();
                                    CallBindGrid();

                                    //CompactSQL comsql = new CompactSQL();
                                    //comsql.InsertRecord("ChangeSize", array);

                                    //tempthu
                                    CompactSQL comsql = new CompactSQL();
                                    comsql.InsertRecord("ChangeSize", array);

                                    getdata = comsql.SelectRecord("ChangeSize"); //test3
                                    GetSQLData(getdata);                         //test3
                                    CallBindGrid();
                                    //tempthu
                                }
                                else
                                {
                                    if (flagItem == false)
                                    {
                                        MessageBox.Show("Item is not found.");
                                        txtItemNo.Focus();
                                    }
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("All fields are required to enter.");
                        }
                    }

                    if (count == 1)
                    {
                        // txtBinCode.Enabled = false;
                        //txtItemNo.Enabled = true;
                        txtLocation.Enabled = false;
                        cboEntryType.Text   = cboEntryType.Items[0].ToString();
                    }
                    else
                    {
                        txtBinCode.Enabled  = true;
                        txtBinCode.Text     = "";
                        txtItemNo.Enabled   = true;
                        txtItemNo.Text      = "";
                        txtLocation.Enabled = true;
                        txtLocation.Text    = "";
                        txtQuantity.Text    = "";
                        txtBinCode.Focus();
                        cboEntryType.Text = cboEntryType.Items[1].ToString();
                    }
                    Cursor.Current = Cursors.Default;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Cursor.Current = Cursors.Default;
            }
        }
Пример #5
0
        public DailyLossTS(string usname, string staffdimen, string uslevel, List <DailyLossFormTS> rebindArray, DailyLossFormTS currentControl)
        {
            try
            {
                InitializeComponent();
                staffname  = usname;
                stafflevel = uslevel;
                staffdim   = staffdimen;

                string[] tempstr = currentControl.itemno.Split('~');

                txtItemNo.Text            = tempstr[0].ToString();
                txtBinCode.Text           = currentControl.bincode;
                txtLocation.Text          = currentControl.location;
                cboEntryType.SelectedItem = currentControl.entrytype;
                txtPostingDate.Text       = currentControl.postdate.ToString();
                txtQuantity.Text          = currentControl.quantity;
                txtDescription.Text       = tempstr[1].ToString();

                lblStaffName.Text = staffdim + "/Role:" + uslevel;

                RebindToGrid(rebindArray);

                CompactSQL comsql = new CompactSQL();
                getdata = comsql.SelectRecord("ChangeSize");
                GetSQLData(getdata);
                ///
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }