Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            M_WsMenuMainDB.WsMenuMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";
            string reData = "";

            try
            {
                wSvc         = new M_WsMenuMainDB.WsMenuMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/Menu/WsMenuMainDB.svc";
                wSvc.Timeout = 1000;

                int reCnt = 0;
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value != null)
                    {
                        if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value.ToString() == "1")
                        {
                            reCnt++;
                        }
                    }
                }
                if (reCnt < 1)
                {
                    MessageBox.Show(msgRM.GetString("msgNotSelected"));
                    return;
                }

                reCnt = 0;
                int reCnt2 = 0;

                if (_codeGrp == "2")
                {
                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value != null)
                        {
                            if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value.ToString() == "1")
                            {
                                string menuCd_val    = dataGridView1.Rows[i].Cells["dgv1_MENU_CD"].Value.ToString();
                                string usingFlag_val = dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value.ToString();
                                string pNm_val       = dataGridView1.Rows[i].Cells["dgv1_NM"].Value.ToString();

                                string sortNo_val = "1";
                                if (dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value != null)
                                {
                                    sortNo_val = dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value.ToString();
                                }

                                string menuPath_val = "";
                                if (dataGridView1.Rows[i].Cells["dgv1_MENU_PATH"].Value != null)
                                {
                                    menuPath_val = dataGridView1.Rows[i].Cells["dgv1_MENU_PATH"].Value.ToString();
                                }

                                string fileFolder_val = "";
                                if (dataGridView1.Rows[i].Cells["dgv1_FILE_FOLDER"].Value != null)
                                {
                                    fileFolder_val = dataGridView1.Rows[i].Cells["dgv1_FILE_FOLDER"].Value.ToString();
                                }

                                string memo_val = "";
                                if (dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value != null)
                                {
                                    memo_val = dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value.ToString();
                                }

                                string pInputId = "1";

                                reCode = wSvc.mMenu(_tMenuCd, _sMenuCd, menuCd_val, usingFlag_val, sortNo_val, menuPath_val, fileFolder_val, out reMsg, out reData);

                                if (reCode == "Y")
                                {
                                    reCode = wSvc.mMenuMemberDB(_DBNM, cmbSite.SelectedValue.ToString(), menuCd_val, usingFlag_val, sortNo_val, memo_val, out reMsg, out reData);
                                    if (Convert.ToInt16(reData) < 1)
                                    {
                                        if (usingFlag_val == "1")
                                        {
                                            //Member DB 업데이트 실패시 INSERT 해준다.
                                            reCode = wSvc.aMenuMemberDB(_DBNM, cmbSite.SelectedValue.ToString(), menuCd_val, _tMenuCd, _sMenuCd, pNm_val, usingFlag_val, sortNo_val, memo_val, pInputId, out reMsg, out reData);
                                        }
                                        else
                                        {
                                            MessageBox.Show(msgRM.GetString("msgClickUsingFlagPlz"));
                                            return;
                                        }
                                    }
                                }


                                if (reCode == "Y" && reData != "0")
                                {
                                    reCnt++;
                                }
                                else
                                {
                                    reCnt2++;
                                }
                            }
                        }
                    }

                    MessageBox.Show(wRM.GetString("wSuccess") + "[" + reCnt.ToString() + "], " + wRM.GetString("wFail") + "[" + reCnt2.ToString() + "]");
                    SetDataBind_gridView1(_codeGrp, _tMenuCd, _sMenuCd);
                }
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmMenuSite.cs  (Function)::btnSave_Click  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            M_WsMenuMainDB.WsMenuMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";
            string reData = "";

            string colNm = dataGridView2.Columns[e.ColumnIndex].Name;

            if (colNm == "dgv2_BTNADD")
            {
                if (_codeGrp == "2")
                {
                    string reVal = ChkDgv2Param();

                    if (reVal != "")
                    {
                        MessageBox.Show(wRM.GetString("wCheck") + " :: " + reVal);
                    }
                    else
                    {
                        string menuCd_val = dataGridView2.Rows[0].Cells["dgv2_MENU_CD"].Value.ToString();
                        string Nm_val     = dataGridView2.Rows[0].Cells["dgv2_NM"].Value.ToString();

                        string sortNo_val = "1";
                        if (dataGridView2.Rows[0].Cells["dgv2_SORT_NO"].Value != null)
                        {
                            sortNo_val = dataGridView2.Rows[0].Cells["dgv2_SORT_NO"].Value.ToString();
                        }

                        string menuPath_val = "";
                        if (dataGridView2.Rows[0].Cells["dgv2_MENU_PATH"].Value != null)
                        {
                            menuPath_val = dataGridView2.Rows[0].Cells["dgv2_MENU_PATH"].Value.ToString();
                        }

                        string fileFolder_val = "";
                        if (dataGridView2.Rows[0].Cells["dgv2_FILE_FOLDER"].Value != null)
                        {
                            fileFolder_val = dataGridView2.Rows[0].Cells["dgv2_FILE_FOLDER"].Value.ToString();
                        }

                        string memo_val = "";

                        string pInputId = "1";

                        try
                        {
                            wSvc         = new M_WsMenuMainDB.WsMenuMainDB();
                            wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/Menu/WsMenuMainDB.svc";
                            wSvc.Timeout = 1000;

                            reCode = wSvc.exMenu(menuCd_val, _tMenuCd, _sMenuCd, out reMsg, out reData);
                            if (reCode == "Y" && reData != "0")
                            {
                                MessageBox.Show(msgRM.GetString("msgDuplicated"));
                            }
                            else
                            {
                                reCode = "";
                                reCode = wSvc.aMenu(_tMenuCd, _sMenuCd, menuCd_val, Nm_val, "1", sortNo_val, menuPath_val, fileFolder_val, pInputId, out reMsg, out reData);
                                int reCnt = 0;

                                if (reCode == "Y")
                                {
                                    if (reData != "")
                                    {
                                        reCode = "";
                                        // * 멤버 디비에 인서트를 해준다.
                                        reCode = wSvc.aMenuMemberDB(_DBNM, cmbSite.SelectedValue.ToString(), menuCd_val, _tMenuCd, _sMenuCd, Nm_val, "1", sortNo_val, memo_val, pInputId, out reMsg, out reData);


                                        if (reCode == "Y" && reData != "")
                                        {
                                            reCnt = Convert.ToInt16(reData);
                                        }
                                    }
                                }

                                if (reCnt > 0)
                                {
                                    MessageBox.Show(wRM.GetString("wSave") + " " + wRM.GetString("wSuccess") + " : " + reCnt.ToString());
                                }
                                else
                                {
                                    MessageBox.Show(wRM.GetString("wSave") + " " + wRM.GetString("wFail"));
                                }

                                SetDataBind_gridView1(_codeGrp, _tMenuCd, _sMenuCd);
                            }
                        }
                        catch (Exception ex)
                        {
                            logs.SaveLog("[error]  (page)::FrmMenuSite.cs  (Function)::dataGridView2_CellClick  (Detail):: " + "\r\n" + ex.ToString(), "Error");
                        }
                        finally
                        {
                            if (wSvc != null)
                            {
                                wSvc.Dispose();
                            }
                        }
                    }
                }
            }
        }