예제 #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            con = DBcontroller.Instance();
            con.Open();

            using (var cmd = new SqlCommand("SearchMember", con))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@phone", tboxPhone.Text);

                cmd.Parameters.AddWithValue("@pwd", DBNull.Value);
                var sdr = cmd.ExecuteReader();
                if (sdr.HasRows)
                {
                    while (sdr.Read())
                    {
                        tboxUPoint.Text = sdr["point"].ToString();
                        phone           = tboxPhone.Text;
                        selectflage     = true;
                    }
                }
                else
                {
                    MessageBox.Show("회원에 대한 정보가 없습니다");
                    selectflage = false;
                }
            }
            con.Close();
        }
예제 #2
0
 private void frmStoreInfo_Load(object sender, EventArgs e)
 {
     //로드가 되면 스토어정보를 다 띄어주고 변경 할 수 있게 만든다.
     con = DBcontroller.Instance();
     con.Open();
     using (var cmd = new SqlCommand("StoreInfo", con))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         var sdr = cmd.ExecuteReader();
         if (sdr.HasRows)
         {
             while (sdr.Read())
             {
                 tboxStoreNum.Text  = sdr["storeNum"].ToString();
                 tboxStoreName.Text = sdr["storeName"].ToString();
                 tboxMName.Text     = sdr["masterName"].ToString();
                 tboxAddr.Text      = sdr["address"].ToString();
                 tboxHomePhone.Text = sdr["homephone"].ToString();
             }
             con.Close();
         }
         else
         {
             MessageBox.Show("정보가 없습니다");
             con.Close();
             this.Dispose();
         }
     }
 }
예제 #3
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("정말 변경하시겠습니까?", "경고", MessageBoxButtons.YesNo,
                         MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         try
         {
             con = DBcontroller.Instance();
             con.Open();
             using (var cmd = new SqlCommand("UpdateSotreInfo", con))
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@storeNum", tboxStoreNum.Text);
                 cmd.Parameters.AddWithValue("@storeName", tboxStoreName.Text);
                 cmd.Parameters.AddWithValue("@MName", tboxMName.Text);
                 cmd.Parameters.AddWithValue("@addr", tboxAddr.Text);
                 cmd.Parameters.AddWithValue("@homephone", tboxHomePhone.Text);
                 cmd.ExecuteNonQuery();
                 con.Close();
                 MessageBox.Show("정보가 변경되었습니다");
                 this.Dispose();
             }
         }
         catch (Exception z)
         {
             con.Close();
             MessageBox.Show(z.Message);
         }
     }
 }
예제 #4
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                dgvProducts.Refresh();
                //데이터그리드뷰에 cate1, cate2와 일치하는 상품 띄워주면됨,

                int cate2 = int.Parse(cbCate2Temp.Items[cbCate2.SelectedIndex].ToString());
                //MessageBox.Show(cate2.ToString());
                con = DBcontroller.Instance();
                using (var cmd = new SqlCommand("OrderSearch", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@cate2", cate2);
                    con.Open();

                    adapter = new SqlDataAdapter(cmd);
                    ds      = new DataSet();
                    adapter.SelectCommand = cmd;
                    adapter.Fill(ds);

                    productTable = ds.Tables[0];

                    dgvProducts.DataSource = productTable;
                    //로딩시 셀선택 x
                    dgvProducts.CurrentCell = null;
                    dgvOrder.CurrentCell    = null;
                }
                con.Close();
            }
            catch (ArgumentOutOfRangeException)
            {
                return;
            }
        }
예제 #5
0
        private void RestsTwo()
        {
            var con = DBcontroller.Instance();

            using (var cmd = new SqlCommand("EventLoadTwo", con))
            {
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;

                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = cmd;
                ds = new DataSet();
                adapter.Fill(ds);
                this.dataGridView1.DataSource = ds.Tables[0];

                dataGridView1.Columns[0].HeaderText   = "바코드";
                dataGridView1.Columns[0].Width        = 150;
                dataGridView1.Columns[1].HeaderText   = "상품";
                dataGridView1.Columns[1].Width        = 230;
                dataGridView1.Columns[2].HeaderText   = "내용";
                dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dataGridView1.Columns[3].HeaderText   = "할인율";
                dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dataGridView1.Columns[4].HeaderText   = "시작날짜";
                dataGridView1.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dataGridView1.Columns[5].HeaderText   = "끝나는날짜";
                dataGridView1.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dataGridView1.Columns[6].HeaderText   = "이벤트번호";
                dataGridView1.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dataGridView1.Columns[7].HeaderText   = "그룹번호";
                dataGridView1.Columns[7].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                con.Close();
            }
        }
예제 #6
0
        private void frmAbanView_Load(object sender, EventArgs e)
        {
            AbanTableMaker();
            dgvAban.DataSource = abantable;
            con = DBcontroller.Instance();
            try
            {
                con.Open();
                using (var cmd = new SqlCommand("AbanCheck", con))
                {
                    SqlDataAdapter adapter = new SqlDataAdapter();
                    DataSet        ds      = new DataSet();

                    adapter.SelectCommand = cmd;
                    adapter.Fill(ds);

                    abantable          = ds.Tables[0];
                    dgvAban.DataSource = abantable;
                }
                con.Close();
            }
            catch (Exception msg)
            {
                con.Close();
                MessageBox.Show(msg.Message);
            }
        }
예제 #7
0
        private void btnPNameSearch_Click(object sender, EventArgs e)
        {
            if (txtProName.Text != "")
            {
                dgvProducts.Refresh();
                string proName = txtProName.Text;
                con = DBcontroller.Instance();
                using (var cmd = new SqlCommand("proSearch", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@proName", proName);

                    adapter = new SqlDataAdapter();
                    ds      = new DataSet();

                    adapter.SelectCommand = cmd;
                    adapter.Fill(ds);

                    productTable = ds.Tables[0];

                    dgvProducts.DataSource = productTable;
                    //로딩시 셀선택 x
                    dgvProducts.CurrentCell = null;
                    dgvOrder.CurrentCell    = null;
                }
            }
            else
            {
                return;
            }
        }
예제 #8
0
파일: frmNotice.cs 프로젝트: kimjw9302/GPos
        private void btnGo_Click(object sender, EventArgs e)
        {
            con = DBcontroller.Instance();
            con.Open();

            using (var cmd = new SqlCommand("SelectEmployees", con))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@empNum", empId);

                var sdr = cmd.ExecuteScalar();
                if (sdr.ToString() == "1")
                {
                    con.Close();
                    frmOrderRequest for1 = new frmOrderRequest(dataTable, empId);
                    this.Visible = false;
                    for1.ShowDialog();
                    this.Dispose();
                }
                else
                {
                    MessageBox.Show("접근이 불가능합니다.");
                    con.Close();
                }
            }
        }
예제 #9
0
        public void delete()
        {
            string Name   = tboxName.Text;
            var    con    = DBcontroller.Instance();
            var    result = MessageBox.Show("삭제하시겠습니까?", "알림", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (result == DialogResult.OK)
            {
                try
                {
                    using (var cmd = new SqlCommand("EmployeeDelete", con))
                    {
                        con.Open();
                        cmd.Parameters.AddWithValue("@empName", Name);
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
                catch (Exception msg)
                {
                    con.Close();
                    MessageBox.Show(msg.Message);
                    this.Dispose();
                }
            }
            textBox();
            frmEmployee_Load(null, null);
        }
예제 #10
0
        public void category()
        {
            var con = DBcontroller.Instance();

            using (var cmd = new SqlCommand("GetProRegInfo", con))
            {
                con.Open();
                adapter = new SqlDataAdapter(cmd);
                ds      = new DataSet();
                adapter.SelectCommand = cmd;
                adapter.Fill(ds);
                cate1Table = ds.Tables[0];
                c1Row      = cate1Table.Rows;
                foreach (DataRow item in c1Row)
                {
                    if (item[0].ToString() == "F")
                    {
                        cbCate1.Items.Add("식품");
                    }
                    else if (item[0].ToString() == "NF")
                    {
                        cbCate1.Items.Add("비식품");
                    }
                }
                cbCate1_SelectedIndexChanged(null, null);
                con.Close();
            }
            check = false;
        }
예제 #11
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            MessageBox.Show(tabControl1.SelectedTab.Text);
            var con = DBcontroller.Instance();

            if (tabControl1.SelectedTab.Text == "기간조회")
            {
                using (var cmd = new SqlCommand("SellDateSerch", con))
                {
                    con.Open();
                    cmd.Parameters.AddWithValue("@ADate", DateTime.Parse(dtpSellDate1.Value.ToShortDateString() + " 00:00:00"));
                    cmd.Parameters.AddWithValue("@BDate", DateTime.Parse(dtpSellDate2.Value.ToShortDateString() + " 23:59:59"));
                    cmd.CommandType = CommandType.StoredProcedure;
                    dataset(cmd);
                    con.Close();
                }
                return;
            }
            if (tabControl1.SelectedTab.Text == "영수증조회")
            {
                using (var cmd = new SqlCommand("SellReceiptNumView", con))
                {
                    con.Open();

                    cmd.Parameters.AddWithValue("@sellNum", tboxReceipt.Text);
                    cmd.CommandType = CommandType.StoredProcedure;
                    dataset(cmd);
                    con.Close();
                }
            }
        }
예제 #12
0
파일: frmWait.cs 프로젝트: kimjw9302/GPos
        private void btnOutCancel_Click(object sender, EventArgs e)
        {
            if (tboxpassword.Text == "")
            {
                MessageBox.Show("비밀번호가 틀립니다");
                tboxpassword.Text = "";
                tboxpassword.Focus();
                return;
            }

            SqlConnection con = DBcontroller.Instance();

            con.Open();
            using (var cmd = new SqlCommand("SelectStorePw", con))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@password", tboxpassword.Text);
                var flag = cmd.ExecuteScalar();
                if (flag.ToString() == "1")
                {
                    WriteLog.Start(EmpName, lblsc.Text + "동안 외출하기 기능을 이용하였습니다");
                    con.Close();
                    this.Dispose();
                }
                else
                {
                    MessageBox.Show("비밀번호가 틀립니다");
                    tboxpassword.Text = "";
                    tboxpassword.Focus();
                    con.Close();
                }
            }
        }
예제 #13
0
        public void submit()
        {
            string MemberNum = tboxMember.Text;
            string Name      = tboxName.Text;
            string Phone     = tboxPhone.Text;

            var con = DBcontroller.Instance();

            try
            {
                using (var cmd = new SqlCommand("MemberUpdate", con))
                {
                    con.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@memberNum", int.Parse(MemberNum));
                    cmd.Parameters.AddWithValue("@memberName", Name);
                    cmd.Parameters.AddWithValue("@phone", Phone);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("수정이 완료 되었습니다.");
                    textBox();
                    con.Close();
                }

                frmCustInquiry_Load(null, null);
            }
            catch (Exception msg)
            {
                con.Close();
                MessageBox.Show(msg.Message);
            }
        }
예제 #14
0
        public void search()
        {
            int MemberNum = int.Parse(tboxMember.Text);
            var con       = DBcontroller.Instance();

            try
            {
                using (var cmd = new SqlCommand("MemberSerch", con))
                {
                    con.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@MemberNum", MemberNum);
                    var sdr = cmd.ExecuteNonQuery();
                    if (sdr.ToString() != "0")
                    {
                        dataset(cmd);
                        //textBox();
                    }
                }
                con.Close();
            }
            catch (Exception msg)
            {
                con.Close();
                MessageBox.Show(msg.Message);
            }
            return;
        }
예제 #15
0
        private void btnView_Click(object sender, EventArgs e)
        {
            dgvWorkView.Refresh();
            con = DBcontroller.Instance();
            //tab 컨트롤 눌렀을 때마다 다른거 조회

            if (tabControl1.SelectedIndex == 0)
            {
                try
                {
                    using (var cmd = new SqlCommand("EmployeeSchedule", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@startDate", dtpStartDate.Value.ToShortDateString());
                        cmd.Parameters.AddWithValue("@endDate", dtpEndDate.Value.ToShortDateString());
                        con.Open();
                        adapter = new SqlDataAdapter(cmd);
                        ds      = new DataSet();
                        adapter.SelectCommand = cmd;
                        adapter.Fill(ds);

                        conditionView          = ds.Tables[0];
                        dgvWorkView.DataSource = conditionView;
                        dgvColor();
                    }
                    con.Close();
                }
                catch (Exception msg)
                {
                    con.Close();
                    MessageBox.Show(msg.Message);
                }
            }
            else if (tabControl1.SelectedIndex == 1)
            {
                try
                {
                    using (var cmd = new SqlCommand("EmpNameSchedule", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@empName", cbEmp.SelectedItem);

                        adapter = new SqlDataAdapter(cmd);
                        ds      = new DataSet();
                        adapter.SelectCommand = cmd;
                        adapter.Fill(ds);

                        conditionView = ds.Tables[0];

                        dgvWorkView.DataSource = conditionView;
                    }
                    con.Close();
                }
                catch (Exception msg)
                {
                    con.Close();
                    MessageBox.Show(msg.Message);
                }
            }
        }
예제 #16
0
        public void search()
        {
            string empName = tboxName.Text;
            var    con     = DBcontroller.Instance();

            try
            {
                using (var cmd = new SqlCommand("EmployeeSerch", con))
                {
                    con.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@empName", empName);
                    var sdr = cmd.ExecuteNonQuery();
                    if (sdr.ToString() != "0")
                    {
                        dataset(cmd);
                        textBox();
                    }
                    con.Close();
                    return;
                }
            }
            catch (Exception msg)
            {
                con.Close();
                MessageBox.Show(msg.Message);
            }
        }
예제 #17
0
파일: frmView.cs 프로젝트: kimjw9302/GPos
        private void btnRevenue_Click(object sender, EventArgs e)
        {
            try
            {
                con = DBcontroller.Instance();
                con.Open();

                using (var cmd = new SqlCommand("SelectEmployees", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@empNum", empId);

                    var sdr = cmd.ExecuteScalar();
                    if (sdr.ToString() == "1")
                    {
                        con.Close();
                        this.Visible = false;
                        new frmRevenue().ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("접근이 불가능합니다.");
                        con.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                con.Close();
                MessageBox.Show(ex.Message);
            }
        }
예제 #18
0
        public void submit()
        {
            string Name      = tboxName.Text;
            string Position  = tboxPosition.Text;
            string Phone     = tboxPhone.Text;
            int    houlyWage = int.Parse(tboxhourlyWage.Text);

            var con = DBcontroller.Instance();

            try
            {
                using (var cmd = new SqlCommand("EmployeeUpdate", con))
                {
                    con.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@empName", Name);
                    cmd.Parameters.AddWithValue("@empPostion", Position);
                    cmd.Parameters.AddWithValue("@phone", Phone);
                    cmd.Parameters.AddWithValue("@hourlyWage", houlyWage);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("수정이 완료 되었습니다.");
                    textBox();
                    con.Close();
                }

                frmEmployee_Load(null, null);
            }
            catch (Exception msg)
            {
                con.Close();
                MessageBox.Show(msg.Message);
            }
        }
예제 #19
0
        private void btnSpec_Click(object sender, EventArgs e)
        {
            dgvSpec.Refresh();
            detailTable.Rows.Clear();
            object cb = cbOrderNum.SelectedItem;

            if (cb != null)
            {
                con = DBcontroller.Instance();
                using (var cmd = new SqlCommand("OrderSpec", con))
                {
                    int i = 1;
                    con.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@orderNum", cbOrderNum.SelectedItem);

                    var er = cmd.ExecuteReader();

                    while (er.Read())
                    {
                        DataRow detailRow = detailTable.NewRow();

                        detailRow[0] = i;                 //순번
                        detailRow[1] = er.GetString(4);   //상품코드
                        detailRow[2] = er.GetString(5);   //품명
                        detailRow[3] = er.GetSqlInt32(6); //수량
                        detailRow[4] = er.GetDecimal(7);  //원가
                        detailRow[5] = er.GetDecimal(8);  //원가 합계
                        detailRow[6] = er.GetString(9);   //거래처
                        i++;

                        detailTable.Rows.Add(detailRow);
                        txtSum.Text  = er.GetDecimal(1).ToString();
                        txtName.Text = er.GetString(3);
                    }
                    er.Close();
                }
                dgvSpec.DataSource = detailTable;
                using (var cmd = new SqlCommand("StoreInfo", con))
                {
                    var st = cmd.ExecuteReader();

                    while (st.Read())
                    {
                        txtStoreNum.Text  = st.GetInt32(0).ToString();
                        txtStoreName.Text = st.GetString(1);

                        txtAddress.Text = st.GetString(3);
                        txtPhone.Text   = st.GetString(4);
                    }
                    st.Close();
                }

                con.Close();
            }
            else
            {
                MessageBox.Show(" 주문번호를 선택해주세요. ");
            }
        }
예제 #20
0
        private void EventCate()
        {
            var con = DBcontroller.Instance();

            using (var cmd = new SqlCommand("EventCate", con))
            {
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.ExecuteNonQuery();

                SqlDataAdapter sda = new SqlDataAdapter();
                sda.SelectCommand = cmd;
                DataSet ds = new DataSet();
                sda.Fill(ds);
                dt = ds.Tables[0];

                //MessageBox.Show(dt.Rows.Count.ToString());

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    comboBox1.Items.Add(dt.Rows[i][1]);
                    comboBox2.Items.Add(dt.Rows[i][2]);
                }
                con.Close();
            }
        }
예제 #21
0
        private void btnPSearch_Click(object sender, EventArgs e)
        {
            try
            {
                dgvProducts.Refresh();
                string place = cbPlace.SelectedItem.ToString();
                con = DBcontroller.Instance();
                using (var cmd = new SqlCommand("OrderPlaceSearch", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@place", place);
                    con.Open();

                    adapter = new SqlDataAdapter(cmd);
                    ds      = new DataSet();
                    adapter.SelectCommand = cmd;
                    adapter.Fill(ds);

                    productTable = ds.Tables[0];

                    dgvProducts.DataSource = productTable;
                    //로딩시 셀선택 x
                    dgvProducts.CurrentCell = null;
                    dgvOrder.CurrentCell    = null;
                }
                con.Close();
            }
            catch (NullReferenceException)
            {
                return;
            }
        }
예제 #22
0
        private void frmEmployeeSchedule_Load(object sender, EventArgs e)
        {
            TableMake();
            dtpStartDate.Value = DateTime.Now;
            dtpEndDate.Value   = DateTime.Now;

            con = DBcontroller.Instance();

            try
            {
                using (var cmd = new SqlCommand("GetEmployeeName", con))
                {
                    con.Open();
                    adapter = new SqlDataAdapter(cmd);
                    ds      = new DataSet();
                    adapter.SelectCommand = cmd;
                    adapter.Fill(ds);

                    emp  = ds.Tables[0];
                    rows = emp.Rows;

                    foreach (DataRow item in rows)
                    {
                        cbEmp.Items.Add(item[0]);
                    }
                }
                con.Close();
            }
            catch (Exception msg)
            {
                con.Close();
                MessageBox.Show(msg.Message);
            }
        }
예제 #23
0
파일: frmAban.cs 프로젝트: kimjw9302/GPos
        private void btnOk_Click(object sender, EventArgs e)
        {
            string barcodeShort = txtBarcode.Text.Substring(0, 13);
            string barcode      = txtBarcode.Text;
            // db
            frmAbanView abanView = (frmAbanView)Owner;

            if (abanView.abantable.Rows.Count > 0)
            {
                foreach (DataRow item in abanView.abantable.Rows)
                {
                    //바코드 13자리랑, 날짜 같으면 수량 증가
                    if (item[0].ToString() == barcode && item[6].ToString().Substring(0, 10) == DateTime.Now.ToShortDateString())
                    {
                        int qua = int.Parse(item[4].ToString());
                        qua++;

                        con = DBcontroller.Instance();
                        using (var cmd = new SqlCommand("AbandonsUpdate", con))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.AddWithValue("@barcode", barcodeShort);
                            cmd.Parameters.AddWithValue("@date", DateTime.Parse(DateTime.Now.ToShortDateString()));
                            cmd.Parameters.AddWithValue("@qua", qua);
                            con.Open();
                            int i = cmd.ExecuteNonQuery();
                            if (i == 2)
                            {
                                MessageBox.Show("등록 성공");
                                con.Close();
                                this.Close();
                                Owner.Close();
                            }
                            else
                            {
                                MessageBox.Show("등록 실패");
                                con.Close();
                                this.Close();
                                Owner.Close();
                            }
                        }
                    }
                    //다르면 추가
                    else
                    {
                        AbanTableAdd(barcodeShort, barcode);
                        this.Close();
                        return;
                    }
                }
            }
            else
            {
                AbanTableAdd(barcodeShort, barcode);
            }
        }
예제 #24
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (ValidityCheck() && CheckPK())
            {
                string memberNum  = txtUserNum.Text;
                string memberName = txtUserName.Text.Trim().Replace(" ", "");
                string birth      = cbYear.Text + "-" + cbMonth.Text + "-" + cbDay.Text;
                string phone      = cbPhone1.Text + "-" + txtPhone2.Text + "-" + txtPhone3.Text;
                string address    = txtAddress.Text + txtDetailAddress.Text;
                string passWord   = cbMonth.Text + cbDay.Text;
                string gender     = "남자";
                if (rbF.Checked == true)
                {
                    gender = "여자";
                }

                var con = DBcontroller.Instance();

                try
                {
                    using (var cmd = new SqlCommand("MemberRegister", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@memberNum", memberNum);
                        cmd.Parameters.AddWithValue("@memberName", memberName);
                        cmd.Parameters.AddWithValue("@birth", birth);
                        cmd.Parameters.AddWithValue("@phone", phone);
                        cmd.Parameters.AddWithValue("@address", address);
                        cmd.Parameters.AddWithValue("@password", passWord);
                        cmd.Parameters.AddWithValue("@gender", gender);

                        con.Open();

                        int i = cmd.ExecuteNonQuery();
                        if (i == 1)
                        {
                            MessageBox.Show("회원 등록 완료");
                            this.Close();
                            con.Close();
                            return;
                        }
                        else
                        {
                            MessageBox.Show("회원 등록 실패", "알림", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            con.Close();
                            return;
                        }
                    }
                }
                catch (Exception msg)
                {
                    con.Close();
                    MessageBox.Show(msg.Message);
                }
            }
        }
예제 #25
0
        //연령대별 차트
        private void GenderChart()
        {
            chartGender.Series["Gender"].Points.Clear();
            chartGender.Visible = true;
            con = DBcontroller.Instance();
            using (var cmd = new SqlCommand("MemberAgeSales", con))
            {
                string strDate = dtStart.Value.ToShortDateString() + " 00:00:00";
                string endDate = dtEnd.Value.ToShortDateString() + " 23:59:59";

                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@startDate", DateTime.Parse(strDate));
                cmd.Parameters.AddWithValue("@endDate", DateTime.Parse(endDate));

                DataSet        ds      = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.SelectCommand = cmd;
                adapter.Fill(ds);

                DataRowCollection rows  = ds.Tables[0].Rows;
                decimal           man   = 0;
                decimal           woman = 0;
                foreach (var item in rows)
                {
                    if (rows.Count > 1)
                    {
                        man   = decimal.Parse(ds.Tables[0].Rows[0][1].ToString());
                        woman = decimal.Parse(ds.Tables[0].Rows[1][1].ToString());
                    }
                }
                if (man == 0 && woman == 0)
                {
                    chartGender.Series["Gender"].Points.AddXY("데이터값 없음", 100);
                    chartGender.Series["Gender"].Points[0].Color = Color.Coral;
                }
                if (man != 0)
                {
                    chartGender.Series["Gender"].Points.AddXY("남자", man);
                    chartGender.Series["Gender"].Points[0].IsValueShownAsLabel = true;
                    chartGender.Series["Gender"].Points[0].LabelFormat         = "{0.0}%";
                    chartGender.Series["Gender"].Points[0].Color = Color.SkyBlue;
                }
                if (woman != 0)
                {
                    chartGender.Series["Gender"].Points.AddXY("여자", woman);
                    chartGender.Series["Gender"].Points[1].IsValueShownAsLabel = true;
                    chartGender.Series["Gender"].Points[1].LabelFormat         = "{0.0}%";
                    chartGender.Series["Gender"].Points[1].Color = Color.LightPink;
                }

                chartGender.Series["Gender"].Font = new Font("맑은 고딕", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
                con.Close();
            }
        }
예제 #26
0
        //로그인버튼 클릭
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string employeeID = tboxID.Text;
            string storePw    = tboxPw.Text;

            //유효성 검사
            if (Check(employeeID, storePw))
            {
                //우선쿼리로 제작(직원 아이디로 접근 )
                var con = DBcontroller.Instance();
                try
                {
                    using (var cmd = new SqlCommand("FirstLoginSelect", con))
                    {
                        con.Open();
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@EmployeeID", int.Parse(employeeID));
                        cmd.Parameters.AddWithValue("@StorePW", int.Parse(storePw));
                        var sdr = cmd.ExecuteScalar();

                        if (sdr.ToString() != "0")
                        {
                            con.Close();
                            this.Visible = false;
                            EmpName      = sdr.ToString();
                            WriteLog.Start(EmpName, "프로그램시작을 위한 로그인을 하였습니다");
                            frmMain main = new frmMain(sdr.ToString(), tboxID.Text);
                            main.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("다시입력해주세요");
                            tboxID.Text = "";
                            tboxPw.Text = "";
                            tboxID.Focus();
                            con.Close();
                            return;
                        }
                    }
                }
                catch (Exception msg)
                {
                    con.Close();
                    MessageBox.Show(msg.Message);
                }
            }
            else
            {
                tboxID.Text = "";
                tboxPw.Text = "";
                tboxID.Focus();
                MessageBox.Show("다시 입력해주세요.");
            }
        }
예제 #27
0
        /// <summary>
        /// 회원번호, 휴대전화 중복 체크
        /// </summary>
        /// <returns></returns>
        private bool CheckPK()
        {
            string memberNum   = this.txtUserNum.Text.Trim().Replace(" ", "");
            string memberPhone = this.cbPhone1.Text + "-" + txtPhone2.Text + "-" + txtPhone3.Text;

            con = DBcontroller.Instance();

            try
            {
                using (var cmd = new SqlCommand("MemberCheckPK", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@memberNum", memberNum);
                    cmd.Parameters.AddWithValue("@phone", memberPhone);
                    con.Open();
                    var sdr = cmd.ExecuteScalar();

                    if (sdr.ToString() == "0")
                    {
                        MessageBox.Show("회원번호 중복");
                        userRandomNum   = new Random().Next(00000000, 99999999);
                        txtUserNum.Text = userRandomNum.ToString();
                        con.Close();
                        return(false);
                    }
                    else if (sdr.ToString() == "1")
                    {
                        MessageBox.Show("전화번호 중복");
                        txtPhone2.Text = txtPhone3.Text = "";
                        con.Close();
                        return(false);
                    }
                    else if (sdr.ToString() == "2")
                    {
                        MessageBox.Show("회원번호, 전화번호 중복");
                        txtPhone2.Text  = txtPhone3.Text = "";
                        userRandomNum   = new Random().Next(00000000, 99999999);
                        txtUserNum.Text = userRandomNum.ToString();
                        con.Close();
                        return(false);
                    }
                    else
                    {
                        con.Close();
                        return(true);
                    }
                }
            }
            catch (Exception msg)
            {
                MessageBox.Show(msg.Message);
                con.Close();
                return(false);
            }
        }
예제 #28
0
        private void frmSalesinquiry_Load(object sender, EventArgs e)
        {
            var con = DBcontroller.Instance();

            using (var cmd = new SqlCommand("SellAllView", con))
            {
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                dataset(cmd);
                con.Close();
            }
            return;
        }
예제 #29
0
        private void Category()
        {
            MethodReturnChart.Visible = true;
            CateNFChart.Visible       = true;

            CateNFChart.Series["categoryNF"].Points.Clear();
            MethodReturnChart.Series["categoryF"].Points.Clear();
            MethodReturnChart.Series["method"].Points.Clear();
            MethodReturnChart.Series["return"].Points.Clear();

            var con = DBcontroller.Instance();

            con.Open();
            using (var cmd = new SqlCommand("SalesCate", con))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@sdate", DateTime.Parse(dtStart.Value.ToShortDateString() + " 00:00:00"));
                cmd.Parameters.AddWithValue("@edate", DateTime.Parse(dtEnd.Value.ToShortDateString() + " 23:59:59"));


                DataSet        ds      = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.SelectCommand = cmd;
                adapter.Fill(ds);
                DataTable food    = ds.Tables[0];
                DataTable notfood = ds.Tables[1];
                MethodReturnChart.Size = new Size(450, 350);
                CateNFChart.Location   = new Point(913, CateNFChart.Location.Y);
                CateNFChart.Size       = new Size(450, 350);


                if (food.Rows.Count == 0)
                {
                    MethodReturnChart.Series["categoryF"].Points.AddXY("없음", 100);
                }
                foreach (DataRow item in food.Rows)
                {
                    MethodReturnChart.Series["categoryF"].Points.AddXY(item[0].ToString(), item[1].ToString());
                }
                if (notfood.Rows.Count == 0)
                {
                    CateNFChart.Series["categoryNF"].Points.AddXY("없음", 100);
                }
                foreach (DataRow item in notfood.Rows)
                {
                    CateNFChart.Series["categoryNF"].Points.AddXY(item[0].ToString(), item[1].ToString());
                }
                con.Close();
            }
        }
예제 #30
0
        private bool CheckPK()
        {
            string empNum = this.txtEmpNum.Text.Trim().Replace(" ", "");
            string phone  = cbPhone1.Text + txtPhone2.Text + txtPhone3.Text;

            con = DBcontroller.Instance();

            using (var cmd = new SqlCommand("EmployeeCheckPK", con))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@empNum", empNum);
                cmd.Parameters.AddWithValue("@phone", phone);

                con.Open();
                var sdr = cmd.ExecuteScalar();

                if (sdr.ToString() == "0")
                {
                    MessageBox.Show("직원번호 중복");
                    empRandomNum   = new Random().Next(00000000, 99999999);
                    txtEmpNum.Text = empRandomNum.ToString();
                    con.Close();
                    return(false);
                }
                else if (sdr.ToString() == "1")
                {
                    MessageBox.Show("전화번호 중복");
                    txtPhone2.Text = txtPhone3.Text = "";
                    con.Close();
                    return(false);
                }
                else if (sdr.ToString() == "2")
                {
                    MessageBox.Show("직원번호, 전화번호 중복");
                    txtPhone2.Text = txtPhone3.Text = "";
                    empRandomNum   = new Random().Next(00000000, 99999999);
                    txtEmpNum.Text = empRandomNum.ToString();
                    con.Close();
                    return(false);
                }
                else
                {
                    con.Close();
                    return(true);
                }
            }
        }