示例#1
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string strID = string.Empty;

            Cesco.FW.Global.DBAdapter.DBAdapters db = new Cesco.FW.Global.DBAdapter.DBAdapters(_strUserID, System.Reflection.MethodBase.GetCurrentMethod());

            string strQuery = "";

            strQuery += string.Format("IF EXISTS (SELECT 1 FROM CESCOEIS.dbo.TB_VOC_TEMPLATE WITH (NOLOCK) "
                                      + "          WHERE VOCID = '" + text_L_vocid.Text + "')"
                                      + " BEGIN"
                                      + "    UPDATE CESCOEIS.dbo.TB_VOC_TEMPLATE "
                                      + "     SET template = '" + templateText.Text + "' "
                                      + "     WHERE VOCID = '" + text_L_vocid.Text + "'"
                                      + " END"
                                      + " ELSE"
                                      + "    BEGIN "
                                      + "    INSERT INTO CESCOEIS.dbo.TB_VOC_TEMPLATE"
                                      + "        (VOCID   ,PARENTID   ,VOCNAME   ,TEMPLATE   ,USEYN)"
                                      + "        Values"
                                      + "         ('" + text_L_vocid.Text + "' "
                                      + "         ,'0' "
                                      + "         ,'" + text_L_Name.Text + "' "
                                      + "         ,'" + templateText.Text + "' "
                                      + "         ,'Y')"
                                      + "END"
                                      );

            db.Query.QueryString.Append(strQuery);

            try
            {
                strID = text_L_vocid.Text;
                int result = db.QueryToNonQuery();
                templateText.Text = "";
                getLarge();

                //저장된 행 선택되어 있도록
                ColumnView view   = (ColumnView)gc_Large.FocusedView;
                GridColumn column = view.Columns["대분류VOCID"];
                if (column != null)
                {
                    int rhFound = view.LocateByDisplayText(0, column, strID);
                    if (rhFound != GridControl.InvalidRowHandle)
                    {
                        view.FocusedRowHandle = rhFound;
                    }
                }
                gv_Large_FocusedRowChanged(null, null);
            }
            catch (Cesco.FW.Global.DBAdapter.WcfException ex)
            {
                MessageBox.Show(ex.Message, "DB 에러");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "처리되지 않은 에러");
            }
        }