Example #1
0
        public void LoadCustomerList(SalesmanList list)
        {
            string sql = "SELECT [SLSMCODE],[SLSMNAME],[SLSMADDRESS],[SLSMTELP],[SLSMSUPV],[SLSMPHOTO],[STAT] FROM [OTF_Invoice].[dbo].[SALESMAN]";

            DataSet dataSet = DataProvider.GetDataSet(sql);

            //Creaete variable for dataSet table
            DataTable customerTabel = dataSet.Tables[0];

            SalesmanItem nextCustomer = null;

            foreach (DataRow parentRow in customerTabel.Rows)
            {
                nextCustomer = new SalesmanItem();

                nextCustomer.SlsmCode    = parentRow["SLSMCODE"].ToString();
                nextCustomer.SlsmName    = parentRow["SLSMNAME"].ToString();
                nextCustomer.SlsmAddress = parentRow["SLSMADDRESS"].ToString();
                nextCustomer.SlsmTelp    = parentRow["SLSMTELP"].ToString();
                nextCustomer.SlsmSupv    = parentRow["SLSMSUPV"].ToString();
                nextCustomer.SlsmPhoto   = parentRow["SLSMPHOTO"].ToString();
                nextCustomer.Stat        = Convert.ToBoolean(parentRow["STAT"]);

                list.Add(nextCustomer);
            }

            dataSet.Dispose();
        }
Example #2
0
        private void salesmanItemBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (m_SalesmanList == null)
            {
                return;
            }

            SalesmanItem       item        = (SalesmanItem)salesmanItemBindingSource.Current;
            commandCRUSalesman cruSalesman = new commandCRUSalesman(item);

            m_AppController.ExecuteCommand(cruSalesman);
        }
Example #3
0
        private void browsePictureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog opd = new OpenFileDialog())
            {
                switch (opd.ShowDialog())
                {
                case DialogResult.Cancel:
                    break;

                case DialogResult.OK:
                    m_Item           = (SalesmanItem)salesmanItemBindingSource.Current;
                    m_Item.SlsmPhoto = opd.FileName;

                    salesmanItemBindingSource.ResetCurrentItem();
                    break;
                }
            }
        }
Example #4
0
        private void salesmanItemBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            if (m_SalesmanList == null)
            {
                return;
            }

            m_Item = (SalesmanItem)salesmanItemBindingSource.Current;
            if (m_Item == null)
            {
                return;
            }

            CommandGetOutletBySalesman getOutlet = new CommandGetOutletBySalesman(m_Item.SlsmCode);

            m_OutletList = (outletList)m_AppController.ExecuteCommand(getOutlet);

            outletItemBindingSource.DataSource = m_OutletList;
        }
Example #5
0
        private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            if (m_SalesmanList == null)
            {
                return;
            }
            m_Item = (SalesmanItem)salesmanItemBindingSource.Current;
            if (m_Item == null)
            {
                return;
            }

            var pesan = MessageBox.Show("Apakah Anda Yakin Ingin Menghapus " + m_Item.SlsmName + " ? ", "Penghapusan", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (pesan == DialogResult.Yes)
            {
                CommandDeleteSalesman deleteSalesman = new CommandDeleteSalesman(m_SalesmanList, m_Item);
                m_AppController.ExecuteCommand(deleteSalesman);
            }
        }
Example #6
0
        internal void CreateOrUpdateDatabase(SalesmanItem itemMaster)
        {
            try
            {
                //Create and open a connection
                SqlConnection connection = new SqlConnection(m_ConnectionString);
                connection.Open();

                //create and configure a command
                string     sql2    = "CRUSalesman";
                SqlCommand command = new SqlCommand(sql2, connection);

                //Adding value through parameter
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.Clear();
                command.Parameters.AddWithValue("@slsmCode", itemMaster.SlsmCode);
                command.Parameters.AddWithValue("@slsmName", itemMaster.SlsmName);
                command.Parameters.AddWithValue("@slsmAddress", itemMaster.SlsmAddress);
                command.Parameters.AddWithValue("@slsmTelp", itemMaster.SlsmTelp);
                command.Parameters.AddWithValue("@slsmSupv", itemMaster.SlsmSupv);
                command.Parameters.AddWithValue("@slsmPhoto", itemMaster.SlsmPhoto);
                command.Parameters.AddWithValue("@slsmStat", itemMaster.Stat);

                //execute the command
                command.ExecuteNonQuery();

                //Close and dispose
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
 public CommandDeleteSalesman(SalesmanList list, SalesmanItem item)
 {
     m_List = list;
     m_Item = item;
 }
 public commandCRUSalesman(SalesmanItem item)
 {
     m_Item = item;
 }