private void SetDataBind_gridView1()
        {
            Mem_WsSysAuthMemberDB.WsSysAuthMemberDB wSvc = null;
            string reCode = "";
            string reMsg  = "";

            Mem_WsSysAuthMemberDB.DataSysAuthMemberDB[] getData = null;
            try
            {
                wSvc         = new Mem_WsSysAuthMemberDB.WsSysAuthMemberDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/SysAuth/WsSysAuthMemberDB.svc";
                wSvc.Timeout = 1000;

                reCode = wSvc.sSysAuthMemberDB(DBNM, cmbUse.SelectedValue.ToString(), out getData, out reMsg);

                if (reCode == "Y")
                {
                    if (getData != null && getData.Length > 0)
                    {
                        dataGridView1.Rows.Clear();
                        for (int i = 0; i < getData.Length; i++)
                        {
                            dataGridView1.Rows.Add();
                            dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value      = getData[i].AUTH_CD.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_AUTH_NM"].Value      = getData[i].AUTH_NM.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_MYBLOCK_FLAG"].Value = getData[i].MYBLOCK_FLAG.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_MYCON_FLAG"].Value   = getData[i].MYCON_FLAG.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_MYCOM_FLAG"].Value   = getData[i].MYCOM_FLAG.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_MYTEAM_FLAG"].Value  = getData[i].MYTEAM_FLAG.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value   = getData[i].USING_FLAG.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_AUTH_LEVEL"].Value   = getData[i].AUTH_LEVEL.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value         = getData[i].MEMO.ToString();
                        }

                        SetRowNumber(dataGridView1);
                    }
                }
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmSysAuthMemberDB.cs  (Function)::SetDataBind_gridView1  (Detail)::reMsg=[" + reMsg + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmSysAuthMemberDB.cs  (Function)::SetDataBind_gridView1  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
        private void GetDbNm()
        {
            Mem_WsSysAuthMemberDB.WsSysAuthMemberDB wSvc = null;
            string reCode = "";
            string reMsg  = "";
            string reData = "";

            try
            {
                wSvc         = new Mem_WsSysAuthMemberDB.WsSysAuthMemberDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/SysAuth/WsSysAuthMemberDB.svc";
                wSvc.Timeout = 1000;

                reCode = wSvc.sDbNm(AppInfo.SsMemcoCd, out reData, out reMsg);

                if (reCode == "Y")
                {
                    if (!string.IsNullOrEmpty(reData))
                    {
                        _dbNm = reData;
                    }
                }
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmSysAuthMemberDB.cs  (Function)::GetDbNm  (Detail)::reCode=[" + reCode + "], reMsg=[" + reMsg + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmSysAuthMemberDB.cs  (Function)::GetDbNm  (Detail)::" + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
Beispiel #3
0
        //수정
        private void btnSave_Click(object sender, EventArgs e)
        {
            Mem_WsSysAuthMemberDB.WsSysAuthMemberDB wSvc = null;
            string reCode = "";
            string reMsg  = "";
            string reData = "0";

            try
            {
                wSvc         = new Mem_WsSysAuthMemberDB.WsSysAuthMemberDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/SysAuth/WsSysAuthMemberDB.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;
                int reCnt3 = 0;

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value != null)
                    {
                        if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value != null)
                        {
                            if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value.ToString() == "1")
                            {
                                string sauthCd_val       = dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value.ToString();    //readonly
                                string sauthNm_val       = dataGridView1.Rows[i].Cells["dgv1_AUTH_NM"].Value.ToString();    //readonly
                                string sauthLevel_val    = dataGridView1.Rows[i].Cells["dgv1_AUTH_LEVEL"].Value.ToString(); //readonly
                                string lab_aprv_Flag_val = dataGridView1.Rows[i].Cells["dgv1_LAB_APRV_FLAG"].Value.ToString();
                                string usingFlag_val     = dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value.ToString();
                                string memo_val          = "";
                                if (dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value != null)
                                {
                                    memo_val = dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value.ToString();
                                }



                                reCode = wSvc.mSysAuthSiteDB(DBNM, cmbSite.SelectedValue.ToString(), sauthCd_val, lab_aprv_Flag_val, usingFlag_val, memo_val, out reMsg, out reData);

                                if (reCode == "Y")
                                {
                                    //SITE DB 업데이트 실패시 INSERT 해준다.
                                    if (Convert.ToInt16(reData) < 1)
                                    {
                                        string pInputId = AppInfo.SsLabNo;
                                        if (usingFlag_val == "1")
                                        {
                                            reCode = wSvc.aSysAuthSiteDB(DBNM, cmbSite.SelectedValue.ToString(), sauthCd_val, lab_aprv_Flag_val, usingFlag_val, sauthLevel_val, memo_val, pInputId, out reMsg, out reData);

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

                if (reCnt > 0)
                {
                    MessageBox.Show(wRM.GetString("wSuccess") + "[" + reCnt.ToString() + "], " + wRM.GetString("wFail") + "[" + reCnt2.ToString() + "], " + wRM.GetString("wNotUsing") + "[" + reCnt3.ToString() + "]");
                }
                else
                {
                    MessageBox.Show(wRM.GetString("wSuccess") + "[" + reCnt.ToString() + "], " + wRM.GetString("wFail") + "[" + reCnt2.ToString() + "], " + wRM.GetString("wNotUsing") + "[" + reCnt3.ToString() + "]");
                }

                SetDataBind_gridView1();
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmSysAuthSiteDB.cs  (Function)::btnSave_Click  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
        //추가버튼 클릭
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string colNm = dataGridView2.Columns[e.ColumnIndex].Name;

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

                if (reVal != "")
                {
                    MessageBox.Show(wRM.GetString("wCheck") + " :: " + reVal);
                }
                else
                {
                    string sauthCd_val     = dataGridView2.Rows[0].Cells["dgv2_AUTH_CD"].Value.ToString();
                    string sauthNm_val     = dataGridView2.Rows[0].Cells["dgv2_AUTH_NM"].Value.ToString();
                    string myblockFlag_val = dataGridView2.Rows[0].Cells["dgv2_MYBLOCK_FLAG"].Value.ToString();
                    string myconFlag_val   = dataGridView2.Rows[0].Cells["dgv2_MYCON_FLAG"].Value.ToString();
                    string mycomFlag_val   = dataGridView2.Rows[0].Cells["dgv2_MYCOM_FLAG"].Value.ToString();
                    string myteamFlag_val  = dataGridView2.Rows[0].Cells["dgv2_MYTEAM_FLAG"].Value.ToString();
                    string usingFlag_val   = "1";
                    string sauthLevel_val  = dataGridView2.Rows[0].Cells["dgv2_AUTH_LEVEL"].Value.ToString();
                    string memo_val        = "";
                    if (dataGridView2.Rows[0].Cells["dgv2_MEMO"].Value != null)
                    {
                        memo_val = dataGridView2.Rows[0].Cells["dgv2_MEMO"].Value.ToString();
                    }
                    string pInputId = AppInfo.SsLabNo;



                    Mem_WsSysAuthMemberDB.WsSysAuthMemberDB wSvc = null;
                    string reCode = "";
                    string reMsg  = "";
                    string reData = "";
                    try
                    {
                        int reCnt = 0;

                        wSvc         = new Mem_WsSysAuthMemberDB.WsSysAuthMemberDB();
                        wSvc.Url     = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/SysAuth/WsSysAuthMemberDB.svc";
                        wSvc.Timeout = 1000;

                        //중복 확인 MAINDB를 확인한다. param = 코드,  이름
                        reCode = wSvc.exSysAuthMainDB(sauthCd_val, sauthNm_val, out reMsg, out reData);

                        if (reCode == "Y")
                        {
                            if (reData != "0")
                            {
                                MessageBox.Show(msgRM.GetString("msgDuplicated"));
                            }
                            else
                            {
                                reCode = "";
                                // * 메인 디비에 인서트를 해준다.
                                reCode = wSvc.aSysAuthMainDB(sauthCd_val, sauthNm_val, myblockFlag_val, myconFlag_val, mycomFlag_val, myteamFlag_val, usingFlag_val, sauthLevel_val, memo_val, pInputId, out reMsg, out reData);

                                if (reCode == "Y")
                                {
                                    if (reData != "")
                                    {
                                        reCode = "";
                                        // * 멤버 디비에 인서트를 해준다.
                                        reCode = wSvc.aSysAuthMemberDB(DBNM, sauthCd_val, sauthNm_val, myblockFlag_val, myconFlag_val, mycomFlag_val, myteamFlag_val, usingFlag_val, sauthLevel_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"));
                                }
                                else
                                {
                                    MessageBox.Show(wRM.GetString("wSave") + " " + wRM.GetString("wFail"));
                                }

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