Esempio n. 1
0
        void cmb_nma_SelectedIndexChanged(object sender, EventArgs e)
        {
            var    target = (EasyCompletionComboBox)sender;
            int    x      = Convert.ToInt32(target.Name.Substring(8));
            int    harga  = 0;
            string q      = @"select item_price from tbl_item where item_name='" + target.Items[target.SelectedIndex].ToString() + "'";
            var    jlh    = (TextBox)panel_item.Controls.Find("txt_jlh_" + x.ToString(), true)[0];

            //jlh.Text = jumlah.ToString();
            harga = Convert.ToInt32(lite.get_datacell(q));
            var hrg = (TextBox)panel_item.Controls.Find("txt_hrg_" + x.ToString(), true)[0];

            hrg.Text = harga.ToString();
        }
Esempio n. 2
0
 private void txt_nama_TextChanged(object sender, EventArgs e)
 {
     reset_field();
     if (lite.get_datacell(@"select item_name from tbl_item where item_name='" + txt_nama_adv.Text + "'") != null)
     {
         DataTable T = lite.get_dataset(@"select * from tbl_item where item_name='" + txt_nama_adv.Text + "'").Tables[0];
         combo_jenis_adv.SelectedIndex = combo_jenis_adv.Items.IndexOf(T.Rows[0].ItemArray[1]);
         txt_level.Text             = T.Rows[0].ItemArray[3].ToString();
         txt_c_level.Text           = T.Rows[0].ItemArray[4].ToString();
         txt_c_exp.Text             = T.Rows[0].ItemArray[5].ToString();
         txt_c_batch.Text           = T.Rows[0].ItemArray[6].ToString();
         txt_harga_adv.Text         = T.Rows[0].ItemArray[7].ToString();
         txt_tree.Text              = T.Rows[0].ItemArray[8].ToString();
         combo_c_able.SelectedIndex = combo_c_able.Items.IndexOf(T.Rows[0].ItemArray[2]);
         btn_simpan.Text            = "Update";
     }
     else
     {
         btn_simpan.Text = "Simpan";
     }
 }
Esempio n. 3
0
        public void item_check()
        {
            string q    = @"select item_name from tbl_item where item_name='" + cmb_name.Text + "'";
            object name = lite.get_datacell(q);

            if (name != null)
            {
                ds = lite.get_dataset(@"select * from tbl_item where item_name='" + cmb_name.Text + "'");
                int index = cmb_type.Items.IndexOf(ds.Tables[0].Rows[0].ItemArray[1]);
                if (index != cmb_type.SelectedIndex)
                {
                    cmb_type.SelectedIndex = index;
                }
                index = cmb_craftable.Items.IndexOf(ds.Tables[0].Rows[0].ItemArray[2]);
                cmb_craftable.SelectedIndex = index;
                if (ds.Tables[0].Rows[0].ItemArray[2].ToString() == "yes")
                {
                    check_craft();
                }
                else
                {
                    this.Size = new System.Drawing.Size(this.Size.Width, 286);
                }
                txt_level.Text       = ds.Tables[0].Rows[0].ItemArray[3].ToString();
                txt_craft_level.Text = ds.Tables[0].Rows[0].ItemArray[4].ToString();
                txt_craft_exp.Text   = ds.Tables[0].Rows[0].ItemArray[5].ToString();
                txt_craft_batch.Text = ds.Tables[0].Rows[0].ItemArray[6].ToString();
                txt_price.Text       = ds.Tables[0].Rows[0].ItemArray[7].ToString();
                progressBar1.Value   = 0;
                btn_save.Text        = "Update";
            }
            else
            {
                form_reset();
            }
        }
Esempio n. 4
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     if (combo_name.SelectedIndex > -1)
     {
         int count = 0;
         foreach (Control c in panel_data.Controls)
         {
             if (c.GetType() == typeof(TextBox))
             {
                 count += 1;
             }
         }
         if (count > 0)
         {
             var      list_txt      = new List <TextBox>();
             string   recipe        = "";
             string[] item          = new string[count];
             bool     recipe_status = false;
             for (int i = 0; i < count; i++)
             {
                 var cmb = (EasyCompletionComboBox)panel_data.Controls.Find("cmb_add_" + i.ToString(), true)[0];
                 if (cmb.SelectedIndex < 0)
                 {
                     MessageBox.Show("Silahkan pilih recipe item", "Informasi", MessageBoxButtons.OK);
                     recipe_status = false;
                     break;
                 }
                 else
                 {
                     recipe_status = true;
                 }
                 var txt = (TextBox)panel_data.Controls.Find("txt_add_" + i.ToString(), true)[0];
                 if (txt.Text == "" || txt.Text == "0")
                 {
                     MessageBox.Show("Silahkan isi jumlah item", "Informasi", MessageBoxButtons.OK);
                     recipe_status = false;
                     break;
                 }
                 else
                 {
                     recipe_status = true;
                 }
                 item[i] = cmb.Items[cmb.SelectedIndex].ToString() + "(" + txt.Text + ")";
             }
             if (recipe_status)
             {
                 recipe = string.Join(",", item);
                 string target_item = combo_name.Items[combo_name.SelectedIndex].ToString();
                 if (target_item == lite.get_datacell(@"select recipe_name from tbl_recipe where recipe_name ='" + target_item + "'", conn).ToString())
                 {
                     MessageBox.Show("Recipe item sudah ada", "Informasi", MessageBoxButtons.OK);
                 }
                 else
                 {
                     string query = @"insert into tbl_recipe values ('" + target_item + "','" + recipe + "')";
                     MessageBox.Show(lite.insert_data(query, conn).ToString() + " Data telah tersimpan", "Informasi", MessageBoxButtons.OK);
                 }
             }
         }
         else
         {
             MessageBox.Show("Silahkan isi kombinasi item", "Informasi", MessageBoxButtons.OK);
         }
     }
     else
     {
         MessageBox.Show("Silahkan pilih item", "Informasi", MessageBoxButtons.OK);
     }
 }