62 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using FCOMMON;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Data;
 | |
| using System.Drawing;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| using System.Windows.Forms;
 | |
| 
 | |
| namespace Project.Dev
 | |
| {
 | |
|     public partial class fDisableItem : fBase
 | |
|     {
 | |
|         public fDisableItem()
 | |
|         {
 | |
|             InitializeComponent();
 | |
|         }
 | |
|         protected override void OnLoad(EventArgs e)
 | |
|         {
 | |
|             base.OnLoad(e);
 | |
|             EnsureVisibleAndUsableSize();
 | |
|         }
 | |
|         private void button1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             
 | |
| 
 | |
|             var lines = this.textBox1.Text.Replace("\r", "").Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
 | |
| 
 | |
|             var dlg = Util.MsgQ($"{lines.Length} 건의 아이템 비활성화를 진행 할까요?");
 | |
|             if (dlg != DialogResult.Yes) return;
 | |
| 
 | |
|             this.progressBar1.Minimum = 0;
 | |
|             this.progressBar1.Maximum = lines.Length;
 | |
|             this.progressBar1.Value = 0;
 | |
| 
 | |
|             var cn = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.gwcs);
 | |
|             var cmd = new System.Data.SqlClient.SqlCommand("", cn);
 | |
|             cn.Open();
 | |
|             var cnt = 0;
 | |
|             foreach(var item in lines)
 | |
|             {
 | |
|                 this.progressBar1.Value += 1;
 | |
|                 if (item.StartsWith("10") == false) continue;
 | |
|                 var sql = $"update items set [disable]= 1 where [sid] = '{item.Trim()}' and gcode = '{FCOMMON.info.Login.gcode}'";
 | |
|                 cmd.CommandText = sql;
 | |
|                 cnt += cmd.ExecuteNonQuery();
 | |
|                 if (this.progressBar1.Value % 50 == 0)
 | |
|                 {
 | |
|                     this.Text = $"{cnt}/{progressBar1.Maximum}";
 | |
|                     Application.DoEvents();
 | |
|                 }
 | |
|             }
 | |
|             cmd.Dispose();
 | |
|             cn.Close();
 | |
|             Util.MsgI("ok = " + cnt.ToString());
 | |
| 
 | |
|         }
 | |
|     }
 | |
| }
 | 
