public void SetDataBind_treeView1()
        {
            treeView1.Nodes.Clear();

            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";

            M_WsCodeTMainDB.DataCodeTSiteTreeView[] getData1 = null;
            try
            {
                wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc";
                wSvc.Timeout = 1000;

                ImageList myimageList = new ImageList();
                myimageList.Images.Add(Image.FromFile(@"Image\treeicon1.png"));

                treeView1.ImageList  = myimageList;
                treeView1.ImageIndex = 0;

                reCode = wSvc.sCodeTSiteTreeView(AppInfo.SsDbNm, AppInfo.SsSiteCd, AppInfo.SsLabAuth, out getData1, out reMsg);
                if (reCode == "Y")
                {
                    if (getData1 != null && getData1.Length > 0)
                    {
                        for (int j = 0; j < getData1.Length; j++)
                        {
                            string ccode_val   = getData1[j].CCODE.ToString();
                            string ccodeNm_val = getData1[j].CCODE_NM.ToString();

                            TreeNode root = new TreeNode();
                            root.Tag  = ccode_val;
                            root.Text = ccodeNm_val;

                            treeView1.Nodes.Add(root);

                            if (treeView1.Nodes.Count > 0)
                            {
                                treeView1.SelectedNode = treeView1.GetNodeAt(0, 0);
                            }
                        }

                        treeView1.ExpandAll();
                    }
                }
            }

            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmCodeTSite.cs  (Function)::SetDataBind_treeView1  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
        public void SetDataBind_gridView1(string _ccode)
        {
            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";

            M_WsCodeTMainDB.DataCodeTSite[] getData1 = null;

            try
            {
                wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc";
                wSvc.Timeout = 1000;

                reCode = wSvc.sCodeTSite(AppInfo.SsDbNm, AppInfo.SsSiteCd, _ccode, out getData1, out reMsg);
                if (reCode == "Y")
                {
                    if (getData1 != null && getData1.Length > 0)
                    {
                        dataGridView1.Rows.Clear();
                        for (int i = 0; i < getData1.Length; i++)
                        {
                            dataGridView1.Rows.Add();
                            dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value         = getData1[i].TCODE.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_NM"].Value            = getData1[i].TCODE_NM.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_DEFAULT_VALUE"].Value = getData1[i].DEFAULT_VALUE.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value    = getData1[i].USING_FLAG.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value       = getData1[i].SORT_NO.ToString();
                            dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value          = getData1[i].MEMO.ToString();
                        }

                        SetRowNumber(dataGridView1);
                    }
                    else
                    {
                        dataGridView1.Rows.Clear();
                        //MessageBox.Show("데이터가 없습니다");
                    }
                }
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmCodeTSite.cs  (Function)::SetDataBind_gridView1  (Detail)::_ccode=[" + _ccode + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmCodeTSite.cs  (Function)::SetDataBind_gridView1  (Detail)::reMsg=[" + reMsg + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmCodeTSite.cs  (Function)::SetDataBind_gridView1  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";
            string reData = "";

            try
            {
                wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.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;


                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 pTcode      = dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value.ToString();
                            string pAuthCd     = dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value.ToString();
                            string pTcodeNm    = dataGridView1.Rows[i].Cells["dgv1_TCODE_NM"].Value.ToString();
                            string pViewFlag   = dataGridView1.Rows[i].Cells["dgv1_VIEW_FLAG"].Value.ToString();
                            string pNeweFlag   = dataGridView1.Rows[i].Cells["dgv1_NEW_FLAG"].Value.ToString();
                            string pModifyFlag = dataGridView1.Rows[i].Cells["dgv1_MODIFY_FLAG"].Value.ToString();
                            string pSiteCd     = AppInfo.SsSiteCd;

                            reCode = wSvc.mCodeTAuth(pTcode, pSiteCd, pAuthCd, pViewFlag, pNeweFlag, pModifyFlag, 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, _code);
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmCodeTAuthSite.cs  (Function)::btnSave_Click  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
        private void SetDataBind_gridView1(string codeGrp, string code_val)
        {
            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";

            M_WsCodeTMainDB.DataCodeTAuthSelect[] getData1 = null;

            try
            {
                wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc";
                wSvc.Timeout = 1000;

                if (codeGrp == "1")
                {
                    //SELECT WHEN USER CLICK TTYPTE (EX : TEXT, CHECK BOX ..)
                    reCode = wSvc.sCodeTAuthTtype(code_val, AppInfo.SsSiteCd, cmbSite.SelectedValue.ToString(), out getData1, out reMsg);

                    if (reCode == "Y")
                    {
                        if (getData1 != null && getData1.Length > 0)
                        {
                            dataGridView1.Rows.Clear();
                            for (int i = 0; i < getData1.Length; i++)
                            {
                                dataGridView1.Rows.Add();
                                dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value       = getData1[i].TCODE.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value     = getData1[i].AUTH_CD.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_TCODE_NM"].Value    = getData1[i].TCODE_NM.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_VIEW_FLAG"].Value   = getData1[i].VIEW_FLAG.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_NEW_FLAG"].Value    = getData1[i].NEW_FLAG.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_MODIFY_FLAG"].Value = getData1[i].MODIFY_FLAG.ToString();
                            }

                            SetRowNumber(dataGridView1);
                        }
                        else
                        {
                            dataGridView1.Rows.Clear();
                            //MessageBox.Show("데이터가 없습니다");
                        }
                    }
                }

                else if (codeGrp == "2")
                {
                    //SELECT WHEN USER CLICK TCODE
                    reCode = wSvc.sCodeTAuth(code_val, AppInfo.SsSiteCd, cmbSite.SelectedValue.ToString(), out getData1, out reMsg);


                    if (reCode == "Y")
                    {
                        if (getData1 != null && getData1.Length > 0)
                        {
                            dataGridView1.Rows.Clear();
                            for (int i = 0; i < getData1.Length; i++)
                            {
                                dataGridView1.Rows.Add();
                                dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value       = getData1[i].TCODE.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value     = getData1[i].AUTH_CD.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_TCODE_NM"].Value    = getData1[i].TCODE_NM.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_VIEW_FLAG"].Value   = getData1[i].VIEW_FLAG.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_NEW_FLAG"].Value    = getData1[i].NEW_FLAG.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_MODIFY_FLAG"].Value = getData1[i].MODIFY_FLAG.ToString();
                            }

                            SetRowNumber(dataGridView1);
                        }
                        else
                        {
                            dataGridView1.Rows.Clear();
                            //MessageBox.Show("데이터가 없습니다");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmCodeTAuthSite.cs  (Function)::SetDataBind_gridView1  (Detail)::codeGrp=[" + codeGrp + "], code_val=[" + code_val + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmCodeTAuthSite.cs  (Function)::SetDataBind_gridView1  (Detail)::reMsg=[" + reMsg + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmCodeTAuthSite.cs  (Function)::SetDataBind_gridView1  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
Beispiel #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";
            string reData = "";

            M_WsCodeTMainDB.DataCodeTSub[] getData = null;

            //_formCodeT.btnSearch_Click
            try
            {
                wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.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;

                if (btnSave.Text == wRM.GetString("wApply"))
                {
                    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[] param = new string[9];

                                param[0] = dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value.ToString();
                                param[1] = dataGridView1.Rows[i].Cells["dgv1_TTYPE_SCD"].Value.ToString();
                                param[2] = dataGridView1.Rows[i].Cells["dgv1_NM"].Value.ToString();
                                param[3] = dataGridView1.Rows[i].Cells["dgv1_REQUIRED_FLAG"].Value.ToString();
                                param[4] = dataGridView1.Rows[i].Cells["dgv1_NUMERIC_FLAG"].Value.ToString();
                                param[5] = dataGridView1.Rows[i].Cells["dgv1_LIST_FLAG"].Value.ToString();
                                param[6] = AppInfo.SsLabNo;
                                param[7] = AppInfo.SsSiteCd;
                                param[8] = _formCodeTSite.getTgrpCcd();

                                reCode = wSvc.aCodeTSite(AppInfo.SsDbNm, param, out reMsg, out reData);

                                if (reData == "2")
                                {
                                    MessageBox.Show(msgRM.GetString("msgAlreadyUsed"));
                                    return;
                                }
                                else
                                {
                                    if (dataGridView1.Rows[i].Cells["dgv1_TTYPE_SCD"].Value.ToString() == "Combobox")
                                    {
                                        reCode = wSvc.sCodeTSubTscode(param[0], out getData, out reMsg);
                                        if (reCode == "Y")
                                        {
                                            if (getData != null && getData.Length > 0)
                                            {
                                                for (int j = 0; j < getData.Length; j++)
                                                {
                                                    string[] paramSub = new string[5];

                                                    paramSub[0] = param[0];
                                                    paramSub[1] = getData[j].TSCODE.ToString();
                                                    paramSub[2] = getData[j].TSCODE_NM.ToString();
                                                    paramSub[3] = AppInfo.SsLabNo;
                                                    paramSub[4] = AppInfo.SsSiteCd;

                                                    reCode = wSvc.aCodeTSubSite(AppInfo.SsDbNm, paramSub, out reMsg, out reData);
                                                }
                                            }
                                        }
                                    }
                                    if (reCode == "Y" && reData != "" && reData != "2")
                                    {
                                        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"));
                    }

                    _formCodeTSite.Popup_End();
                    SetDataBind_gridView1(_codeGrp, _code);
                }
                else if (_codeGrp == "1")
                {
                    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 tcode_val        = dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value.ToString();
                                string listFlag_val     = dataGridView1.Rows[i].Cells["dgv1_LIST_FLAG"].Value.ToString();
                                string requiredFlag_val = dataGridView1.Rows[i].Cells["dgv1_REQUIRED_FLAG"].Value.ToString();
                                string numericFlag_val  = dataGridView1.Rows[i].Cells["dgv1_NUMERIC_FLAG"].Value.ToString();

                                reCode = wSvc.mCodeT(tcode_val, listFlag_val, requiredFlag_val, numericFlag_val, 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, _code);
                }
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmCodeTMainDB.cs  (Function)::btnSave_Click  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
Beispiel #6
0
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";
            string reData = "";

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

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

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

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

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

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

                        try
                        {
                            wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                            wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc";
                            wSvc.Timeout = 1000;

                            reCode = wSvc.exCodeT(tCode_val, tCodeNm_val, out reMsg, out reData);
                            if (reCode == "Y" && reData != "0")
                            {
                                MessageBox.Show(msgRM.GetString("msgDuplicated"));
                            }
                            else
                            {
                                reCode = "";
                                reCode = wSvc.aCodeT(tCode_val, _code, tCodeNm_val, listFlag_val, requiredFlag_val, numericFlag_val, AppInfo.SsLabNo, out reMsg, out reData);
                                if (btnSave.Text == wRM.GetString("wApply"))
                                {
                                    string[] param = new string[9];

                                    param[0] = tCode_val;
                                    param[1] = _code;
                                    param[2] = tCodeNm_val;
                                    param[3] = requiredFlag_val;
                                    param[4] = numericFlag_val;
                                    param[5] = listFlag_val;
                                    param[6] = AppInfo.SsLabNo;
                                    param[7] = AppInfo.SsSiteCd;
                                    param[8] = _formCodeTSite.getTgrpCcd();

                                    reCode = wSvc.aCodeTSite(AppInfo.SsDbNm, param, out reMsg, out reData);
                                    _formCodeTSite.Popup_End();
                                }



                                int reCnt = 0;

                                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, _code);
                            }
                        }
                        catch (Exception ex)
                        {
                            logs.SaveLog("[error]  (page)::FrmCodeTMainDB.cs  (Function)::dataGridView2_CellClick  (Detail):: " + "\r\n" + ex.ToString(), "Error");
                        }
                        finally
                        {
                            if (wSvc != null)
                            {
                                wSvc.Dispose();
                            }
                        }
                    }
                }

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

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

                        try
                        {
                            wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                            wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc";
                            wSvc.Timeout = 1000;

                            reCode = wSvc.exCodeTSub(tCode_val, tscodeNm_val, out reMsg, out reData);
                            if (reCode == "Y" && reData != "0")
                            {
                                MessageBox.Show(msgRM.GetString("msgDuplicated"));
                            }
                            else
                            {
                                reCode = "";
                                reCode = wSvc.aCodeTSub(tCode_val, tscodeNm_val, "0", AppInfo.SsLabNo, out reMsg, out reData);

                                int reCnt = 0;

                                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, _code);
                            }
                        }
                        catch (Exception ex)
                        {
                            logs.SaveLog("[error]  (page)::FrmCodeTMainDB.cs  (Function)::dataGridView2_CellClick  (Detail):: " + "\r\n" + ex.ToString(), "Error");
                        }
                        finally
                        {
                            if (wSvc != null)
                            {
                                wSvc.Dispose();
                            }
                        }
                    }
                }
            }
        }
Beispiel #7
0
        private void SetDataBind_gridView1(string codeGrp, string code_val)
        {
            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";

            M_WsCodeTMainDB.DataCodeT[]    getData1 = null;
            M_WsCodeTMainDB.DataCodeTSub[] getData2 = null;

            try
            {
                wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc";
                wSvc.Timeout = 1000;

                dataGridView2.Enabled = false;
                btnSave.Enabled       = false;

                if (codeGrp == "1")
                {
                    dataGridView2.Enabled = true;
                    btnSave.Enabled       = true;

                    dataGridView1.Columns["dgv1_TTYPE_SCD"].Visible     = true;
                    dataGridView1.Columns["dgv1_LIST_FLAG"].Visible     = true;
                    dataGridView1.Columns["dgv1_REQUIRED_FLAG"].Visible = true;
                    dataGridView1.Columns["dgv1_NUMERIC_FLAG"].Visible  = true;
                    dataGridView1.Columns["dgv1_USING_CNT"].Visible     = false;
                    dataGridView2.Columns["dgv2_LIST_FLAG"].Visible     = true;
                    dataGridView2.Columns["dgv2_REQUIRED_FLAG"].Visible = true;
                    dataGridView2.Columns["dgv2_NUMERIC_FLAG"].Visible  = true;
                    dataGridView2.Columns["dgv2_TCODE"].ReadOnly        = false;


                    reCode = wSvc.sCodeT(code_val, out getData1, out reMsg);
                    if (reCode == "Y")
                    {
                        if (getData1 != null && getData1.Length > 0)
                        {
                            dataGridView1.Rows.Clear();
                            for (int i = 0; i < getData1.Length; i++)
                            {
                                dataGridView1.Rows.Add();
                                dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value         = getData1[i].TCODE.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_TTYPE_SCD"].Value     = getData1[i].TTYPE_SCD.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_NM"].Value            = getData1[i].TCODE_NM.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_LIST_FLAG"].Value     = getData1[i].LIST_FLAG.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_REQUIRED_FLAG"].Value = getData1[i].REQUIRED_FLAG.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_NUMERIC_FLAG"].Value  = getData1[i].NUMERIC_FLAG.ToString();
                            }

                            SetRowNumber(dataGridView1);
                        }
                        else
                        {
                            dataGridView1.Rows.Clear();
                        }
                    }
                }
                else if (codeGrp == "2")
                {
                    dataGridView1.Columns["dgv1_TTYPE_SCD"].Visible     = false;
                    dataGridView1.Columns["dgv1_LIST_FLAG"].Visible     = false;
                    dataGridView1.Columns["dgv1_REQUIRED_FLAG"].Visible = false;
                    dataGridView1.Columns["dgv1_NUMERIC_FLAG"].Visible  = false;
                    dataGridView1.Columns["dgv1_USING_CNT"].Visible     = true;
                    dataGridView2.Columns["dgv2_LIST_FLAG"].Visible     = false;
                    dataGridView2.Columns["dgv2_REQUIRED_FLAG"].Visible = false;
                    dataGridView2.Columns["dgv2_NUMERIC_FLAG"].Visible  = false;

                    if (code_val == "InspectionMethod" || code_val == "CarSize")
                    {
                        dataGridView2.Enabled = true;
                        btnSave.Enabled       = true;

                        if (btnSave.Text == wRM.GetString("wApply"))
                        {
                            btnSave.Enabled       = false;
                            dataGridView2.Enabled = false;
                        }

                        dataGridView2.Rows[0].Cells["dgv2_TCODE"].Value = code_val;
                        dataGridView2.Columns["dgv2_TCODE"].ReadOnly    = true;

                        reCode = wSvc.sCodeTSub(code_val, out getData2, out reMsg);
                        if (reCode == "Y")
                        {
                            if (getData2 != null && getData2.Length > 0)
                            {
                                dataGridView1.Rows.Clear();

                                for (int i = 0; i < getData2.Length; i++)
                                {
                                    dataGridView1.Rows.Add();
                                    dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value     = getData2[i].TCODE.ToString();
                                    dataGridView1.Rows[i].Cells["dgv1_NM"].Value        = getData2[i].TSCODE_NM.ToString();
                                    dataGridView1.Rows[i].Cells["dgv1_USING_CNT"].Value = getData2[i].USING_CNT.ToString();
                                }

                                SetRowNumber(dataGridView1);
                            }
                            else
                            {
                                dataGridView1.Rows.Clear();
                                //MessageBox.Show("데이터가 없습니다");
                            }
                        }
                    }
                    else
                    {
                        dataGridView1.Rows.Clear();
                        lblName.Text = null;
                    }
                }
                else
                {
                    dataGridView1.Rows.Clear();
                    lblName.Text = null;
                }
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmCodeTMainDB.cs  (Function)::SetDataBind_gridView1  (Detail)::codeGrp=[" + codeGrp + "], code_val=[" + code_val + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmCodeTMainDB.cs  (Function)::SetDataBind_gridView1  (Detail)::reMsg=[" + reMsg + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmCodeTMainDB.cs  (Function)::SetDataBind_gridView1  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
Beispiel #8
0
        private void SetDataBind_treeView1()
        {
            treeView1.Nodes.Clear();

            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";

            M_WsCodeTMainDB.DataSysCode[]  getData1 = null;
            M_WsCodeTMainDB.DataCodeT[]    getData2 = null;
            M_WsCodeTMainDB.DataCodeTSub[] getData3 = null;
            try
            {
                wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc";
                wSvc.Timeout = 1000;

                ImageList myimageList = new ImageList();
                myimageList.Images.Add(Image.FromFile(@"Image\treeicon1.png"));

                treeView1.ImageList  = myimageList;
                treeView1.ImageIndex = 0;

                reCode = wSvc.sSysCode(out getData1, out reMsg);
                if (reCode == "Y")
                {
                    if (getData1 != null && getData1.Length > 0)
                    {
                        for (int j = 0; j < getData1.Length; j++)
                        {
                            string sCode_val   = getData1[j].SCODE.ToString();
                            string sCodeNm_val = getData1[j].SCODE_NM.ToString();

                            TreeNode root = new TreeNode();
                            root.Tag  = "1-" + sCode_val;
                            root.Text = sCodeNm_val;

                            reCode = wSvc.sCodeTTreeView(sCode_val, out getData2, out reMsg);
                            if (reCode == "Y")
                            {
                                if (getData2 != null && getData2.Length > 0)
                                {
                                    for (int k = 0; k < getData2.Length; k++)
                                    {
                                        string   tcode_val   = getData2[k].TCODE.ToString();
                                        string   tcodeNm_val = getData2[k].TCODE_NM.ToString();
                                        TreeNode node2       = new TreeNode();
                                        node2.Tag  = "2-" + tcode_val;
                                        node2.Text = tcodeNm_val;

                                        root.Nodes.Add(node2);

                                        reCode = wSvc.sCodeTSubTreeView(tcode_val, out getData3, out reMsg);
                                        if (reCode == "Y")
                                        {
                                            if (getData3 != null && getData3.Length > 0)
                                            {
                                                for (int i = 0; i < getData3.Length; i++)
                                                {
                                                    string   tscode_val   = getData3[i].TSCODE.ToString();
                                                    string   tscodeNm_val = getData3[i].TSCODE_NM.ToString();
                                                    TreeNode node3        = new TreeNode();
                                                    node3.Tag  = "3-" + tscode_val;
                                                    node3.Text = tscodeNm_val;

                                                    node2.Nodes.Add(node3);
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            treeView1.Nodes.Add(root);

                            if (treeView1.Nodes.Count > 0)
                            {
                                treeView1.SelectedNode = treeView1.GetNodeAt(0, 0);
                            }
                        }

                        treeView1.ExpandAll();
                    }
                }
            }

            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmCodeTMainDB.cs  (Function)::SetDataBind_treeView1  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
        public void btnSave_Click(object sender, EventArgs e)
        {
            M_WsCodeTMainDB.WsCodeTMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";
            string reData = "";

            try
            {
                wSvc         = new M_WsCodeTMainDB.WsCodeTMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.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;

                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 tcode_val = dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value.ToString();

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

                            string usingFlag_val = dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value.ToString();

                            string sortNo_val = "";
                            if (dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value != null)
                            {
                                sortNo_val = dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].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.mCodeTSite(AppInfo.SsDbNm, AppInfo.SsSiteCd, tcode_val, defaultValue_val, usingFlag_val, sortNo_val, memo_val, out reMsg, out reData);

                            if (reCode == "Y")
                            {
                                reCode = wSvc.aCodeTSiteLog(AppInfo.SsDbNm, AppInfo.SsSiteCd, tcode_val, _ccode, "0", "0", defaultValue_val, usingFlag_val, sortNo_val, memo_val, AppInfo.SsLabNo, out reMsg, out reData);

                                if (reCode == "N")
                                {
                                    MessageBox.Show(wRM.GetString("wLog ") + wRM.GetString("wSave") + wRM.GetString("wFail"));
                                }
                            }

                            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(_ccode);
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmCodeTSite.cs  (Function)::btnSave_Click  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }