Esempio n. 1
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                string sql = "";

                //if (publicProperty.DATABASETYPE=="ORACLE")
                //{
                //Guid g = new Guid();
                sql = string.Format("insert into pt_xml_config(layout_name,ID,FIELD_NAME,pt_id) values('{0}','{2}','根节点','{1}')", txt_layout_name.Text, pt_id, Guid.NewGuid());
                //}
                //else if (publicProperty.DATABASETYPE=="SQLSERVER")
                //{
                //    sql = string.Format("insert into pt_xml_config(layout_name,FIELD_NAME,pt_id) values('{0}','根节点',{1})", txt_layout_name.Text, int.Parse(pt_id));
                //}
                if (DALUse.ExecuteSql(sql) == 1)
                {
                    this.FindForm().Close();
                    uctlMessageBox.frmDisappearShow("添加成功!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 2
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            string sqlupdatetable  = string.Format("update pt_tables_dict set table_name = '{0}' where id ='{1}'", txt_tablename.Text, table_id);
            string sqlupdatetable2 = string.Format("update PT_TARGET_FIELD set table_name = '{0}' where pt_id = '{1}' and table_name = '{2}'", txt_tablename.Text, pt_id, oldtablename);
            string sqlinserttable  = "";

            //if (publicProperty.DATABASETYPE=="ORACLE")
            //{
            //Guid g= new Guid();
            sqlinserttable = string.Format("insert into pt_tables_dict(id,pt_id,table_name,exportflag) values('{2}','{0}','{1}','TRUE')", pt_id, txt_tablename.Text, Guid.NewGuid());
            //}
            //else if (publicProperty.DATABASETYPE=="SQLSERVER")
            //{
            //    sqlinserttable = string.Format("insert into pt_tables_dict(pt_id,table_name) values({0},'{1}')", pt_id, txt_tablename.Text);
            //}
            if (kind == "update" && txt_tablename.Text != "")
            {
                DALUse.ExecuteSql(sqlupdatetable);
                DALUse.ExecuteSql(sqlupdatetable2);
            }
            else if (kind == "add" && txt_tablename.Text != "")
            {
                DALUse.ExecuteSql(sqlinserttable);
            }
            else
            {
                MessageBox.Show("表名不能为空!");
            }
            this.FindForm().Close();
        }
 private void btn_dellocaldict_Click(object sender, EventArgs e)
 {
     try
     {
         string sql  = string.Format("delete PT_LOCAL_DICT where type_name = '{0}'", cmb_local.SelectedValue.ToString());
         string sql1 = string.Format("update PT_COMPARISON_DETAIL_DICT set COMPARE_CODE = null ,COMPARE_NAME = null where  type_name = '{0}'", cmb_local.SelectedValue.ToString());
         if (MessageBox.Show(null, "确定删除所选字典?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             try
             {
                 int r1 = DALUse.ExecuteSql(sql);
             }
             catch (Exception exp)
             {
                 CommonFunction.WriteErrorLog(exp.ToString());
             }
             try
             {
                 int r2 = DALUse.ExecuteSql(sql1);
             }
             catch (Exception exp)
             {
                 CommonFunction.WriteErrorLog(exp.ToString());
             }
             InitDictData();
         }
     }
     catch (Exception exp)
     {
         CommonFunction.WriteErrorLog(exp.ToString());
     }
 }
Esempio n. 4
0
        private void btn_delnode_Click(object sender, EventArgs e)
        {
            //if (tl_node.FocusedNode.HasChildren)
            //{
            //    MessageBox.Show("请先清除子节点!");
            //}
            //else
            //{
            //DALUse.ExecuteSql(string.Format("delete pt_xml_config where id = {0}", ((DataRowView)tl_node.GetDataRecordByNode(tl_node.FocusedNode)).Row["ID"].ToString()));
            //}
            if (tl_node.FocusedNode == null)
            {
                return;
            }
            TreeListNode tln = tl_node.FocusedNode;

            RecursiveDel(tln);
            DALUse.ExecuteSql(string.Format("delete pt_xml_config where id = '{0}'", ((DataRowView)tl_node.GetDataRecordByNode(tln)).Row["ID"].ToString()));
            foreach (TreeListNode deln in tlist)
            {
                DALUse.ExecuteSql(string.Format("delete pt_xml_config where id = '{0}'", ((DataRowView)tl_node.GetDataRecordByNode(deln)).Row["ID"].ToString()));
            }
            Initgc_nodeData();
            InitTreeListData();
            tl_node.ExpandAll();
        }
Esempio n. 5
0
 private void btn_sqlconn_Click(object sender, EventArgs e)
 {
     try
     {
         if (cmb_pt.SelectedItem == null)
         {
             return;
         }
         string    sqlgetdata = string.Format("select * from PT_Up_DataBase_Setting where pt_id = '{0}'", ((DataRowView)cmb_pt.SelectedItem).Row["PT_ID"].ToString());
         DataTable connstr    = DALUse.Query(sqlgetdata).Tables[0];
         if (connstr.Rows.Count == 1)
         {
             string sqlupdate = string.Format("update PT_Up_DataBase_Setting set joins = '{0}',PT_DataBase ='{2}' where pt_id = '{1}'", txt_connstr.Text, cmb_pt.SelectedValue.ToString(), txt_database.Text);
             if (DALUse.ExecuteSql(sqlupdate) == 1)
             {
                 MessageBox.Show("修改成功!");
             }
         }
         else if (connstr.Rows.Count == 0)
         {
             string sqlinsert = string.Format("insert into  PT_Up_DataBase_Setting (pt_id,Joins,PT_DataBase) values('{0}','{1}','{2}')",
                                              cmb_pt.SelectedValue.ToString(),
                                              txt_connstr.Text,
                                              txt_database.Text);
             if (DALUse.ExecuteSql(sqlinsert) == 1)
             {
                 MessageBox.Show("添加成功!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 6
0
 private void btn_cancel_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(null, "确定删除所选项", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
     {
         return;
     }
     try
     {
         foreach (DataRow dr in source.Rows)
         {
             if (dr["CHK"].ToString() == "1")
             {
                 string sql = "delete from pt_comparison where compare_id = '" + dr["compare_id"] + "'";
                 DALUse.ExecuteSql(sql);
             }
         }
         MessageBox.Show("取消绑定成功!");
         source = InitData();
         gc_comparison.DataSource = source.DefaultView;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 7
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                bool ischecked = rb_hong.Checked | rb_element.Checked | rb_cengci.Checked;
                if (!ischecked)
                {
                    MessageBox.Show("ÇëÑ¡Ôñ±£´æÀàÐÍ£¡");
                    return;
                }
                string sqlinsert  = "";
                string sourcetype = "";
                //if (publicProperty.DATABASETYPE=="ORACLE")
                //{
                //Guid g = new Guid();
                if (rb_cengci.Checked)//²ã´ÎºÅ
                {
                    sourcetype = "0";
                    sqlinsert  = string.Format("insert into pt_temp_field(id,pt_name,class_name,item_name,item_code,cengci_code,field_name,pt_id,sourcetype) values('{8}','{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", pt_name, class_name, item_name, item_code, txt_cengci_code.Text.ToString(), txt_field.Text.ToString(), pt_id, sourcetype, Guid.NewGuid());
                }
                else if (rb_hong.Checked)//ºê
                {
                    sourcetype = "1";
                    sqlinsert  = string.Format("insert into pt_temp_field(id,pt_name,class_name,item_name,item_code,field_name,cengci_code,pt_id,sourcetype) values('{8}','{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", pt_name, class_name, item_name, item_code, txt_field.Text.ToString(), "**", pt_id, sourcetype, Guid.NewGuid());
                }
                else if (rb_element.Checked)//ÔªËØ
                {
                    sourcetype = "2";
                    sqlinsert  = string.Format("insert into pt_temp_field(id,pt_name,class_name,item_name,item_code,field_name,cengci_code,pt_id,sourcetype) values('{8}','{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", pt_name, class_name, item_name, item_code, txt_field.Text.ToString(), "**", pt_id, sourcetype, Guid.NewGuid());
                }
                //}
                //else if (publicProperty.DATABASETYPE =="mssqlserver")
                //{
                //    if (rb_cengci.Checked)//²ã´ÎºÅ
                //    {
                //        sourcetype = "0";
                //        sqlinsert = string.Format("insert into pt_temp_field(pt_name,class_name,item_name,item_code,cengci_code,field_name,pt_id,sourcetype) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", pt_name, class_name, item_name, item_code, txt_cengci_code.Text.ToString(), txt_field.Text.ToString(), pt_id, sourcetype);
                //    }
                //    else if (rb_hong.Checked)//ºê
                //    {
                //        sourcetype = "1";
                //        sqlinsert = string.Format("insert into pt_temp_field(pt_name,class_name,item_name,item_code,field_name,cengci_code,pt_id,sourcetype) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", pt_name, class_name, item_name, item_code, txt_field.Text.ToString(), "**", pt_id, sourcetype);
                //    }
                //    else if (rb_element.Checked)//ÔªËØ
                //    {
                //        sourcetype = "2";
                //        sqlinsert = string.Format("insert into pt_temp_field(pt_name,class_name,item_name,item_code,field_name,cengci_code,pt_id,sourcetype) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", pt_name, class_name, item_name, item_code, txt_field.Text.ToString(), "**", pt_id, sourcetype);
                //    }
                //}

                DALUse.ExecuteSql(sqlinsert);
                MessageBox.Show("±£´æ³É¹¦£¡");
                this.FindForm().Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 递归删除选定节点下的所有节点
        /// </summary>
        /// <param name="tln">焦点节点</param>
        private void RecursiveDel(TreeListNode tln)
        {
            //if (tln.HasChildren)
            //{
            //    foreach (TreeListNode tlnchild in tln.Nodes)
            //    {
            //        RecursiveDel((TreeListNode)tlnchild);
            //    }
            //}
            //else
            //{
            //    DALUse.ExecuteSql(string.Format("delete pt_xml_config where id = {0}", ((DataRowView)tl_node.GetDataRecordByNode(tln)).Row["ID"].ToString()));
            //    //RecursiveDel(tln);
            //}

            //-----------
            //if (tln.Nodes.Count >= 0)
            //{
            //    if (tln.Nodes.Count == 0)
            //    {
            //        DALUse.ExecuteSql(string.Format("delete pt_xml_config where id = {0}", ((DataRowView)tl_node.GetDataRecordByNode(tln)).Row["ID"].ToString()));
            //    }
            //    else
            //    {
            //        foreach (TreeListNode node in tln.Nodes)
            //        {
            //            DALUse.ExecuteSql(string.Format("delete pt_xml_config where id = {0}", ((DataRowView)tl_node.GetDataRecordByNode(tln)).Row["ID"].ToString()));
            //            if (node.Nodes.Count > 0)
            //            {
            //                RecursiveDel(node);
            //            }
            //        }
            //    }
            //}
            //else
            //{
            //    DALUse.ExecuteSql(string.Format("delete pt_xml_config where id = {0}", ((DataRowView)tl_node.GetDataRecordByNode(tln)).Row["ID"].ToString()));
            //}
            //-----------
            if (tl_node.FocusedNode == null)
            {
                return;
            }
            if (tln.Nodes.Count > 0)
            {
                foreach (TreeListNode node in tln.Nodes)
                {
                    //tlist.Add(node);
                    DALUse.ExecuteSql(string.Format("delete pt_xml_config where id = '{0}'", ((DataRowView)tl_node.GetDataRecordByNode(node)).Row["ID"].ToString()));
                    if (node.Nodes.Count > 0)
                    {
                        RecursiveDel(node);
                    }
                }
            }
        }
Esempio n. 9
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_node_name.Text != "")
                {
                    string multiple = "";
                    if (rb_no.Checked)
                    {
                        multiple = "NO";
                    }
                    else if (rb_yes.Checked)
                    {
                        multiple = "YES";
                    }
                    string sqlinsert = "";
                    //if (publicProperty.DATABASETYPE == "ORACLE")
                    //{
                    //Guid g = new Guid();
                    string field = "";
                    if (ckb_banding.Checked)
                    {
                        field = gridView1.FocusedRowHandle >= 0 ? gridView1.GetDataRow(gridView1.FocusedRowHandle)["COMPARE_NAME"].ToString() : "";
                    }
                    sqlinsert = string.Format("insert into pt_xml_config(id,parient_id,field_name,field,pt_id,multiple,layout_name) values('{5}','{0}','{1}','{2}','{3}','{4}','{6}')",
                                              lab_parientid.Text.ToString() == "" ? "-1" : lab_parientid.Text.ToString(),
                                              txt_node_name.Text,
                                              field,
                                              pt_id,
                                              multiple,
                                              Guid.NewGuid(),
                                              layout_name
                                              );
                    //}
                    //else if (publicProperty.DATABASETYPE=="SQLSERVER")
                    //{
                    //    string.Format("insert into pt_xml_config(parient_id,field_name,field,pt_id,multipel) values({0},'{1}','{2}',{3},'{4}')",
                    //    lab_parientid.Text.ToString() == "" ? "-1" : lab_parientid.Text.ToString(),
                    //    txt_node_name.Text,
                    //    gridView1.FocusedRowHandle >= 0 ? gridView1.GetDataRow(gridView1.FocusedRowHandle)["COMPARE_NAME"].ToString() : "",
                    //    pt_id,
                    //    multiple);
                    //}

                    DALUse.ExecuteSql(sqlinsert);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            this.FindForm().Close();
        }
Esempio n. 10
0
 private void btn_ok_Click(object sender, EventArgs e)
 {
     try
     {
         string sql = string.Format("update pt_xml_config set layout_name = '{0}' where layout_name = '{1}'", txt_layoutname.Text, layout_name);
         DALUse.ExecuteSql(sql);
         this.FindForm().Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 11
0
 private void btn_del_Click(object sender, EventArgs e)
 {
     try
     {
         string sql = string.Format("delete from pt_sql where id = {0}", gridView2.GetDataRow(gridView2.FocusedRowHandle)["ID"].ToString());
         DALUse.ExecuteSql(sql);
         MessageBox.Show("删除成功!");
     }
     catch (Exception EX)
     {
         MessageBox.Show(EX.ToString());
     }
     FreshSQL();
 }
Esempio n. 12
0
 private void btn_del_Click(object sender, EventArgs e)
 {
     if (gridView1.FocusedRowHandle < 0)
     {
         MessageBox.Show("未选择行!");
         return;
     }
     if (DialogResult.No == MessageBox.Show(null, "确定删除所选项?", "删除", MessageBoxButtons.YesNo))
     {
         return;
     }
     DALUse.ExecuteSql(string.Format("delete from pt_temp_field where class_name = '{0}'", gridView1.GetDataRow(gridView1.FocusedRowHandle)["class_name"].ToString()));
     //GetSelectedList();//获取选择的模板
     GetField();//获取字段
 }
        public static void WriteErrorLogTodataBase(string mess)
        {
            string sqlerror = "";

            try
            {
                string s = mess.Replace("'", "''");
                sqlerror = string.Format("insert into PT_ERROR_LOG values('{0}','{1}','{2}')", Guid.NewGuid(), DateTime.Now.ToString(), s);
                DALUse.ExecuteSql(sqlerror);
            }
            catch (Exception ex)
            {
                CommonFunction.WriteErrotLog(ex.Message + "=====" + sqlerror);
            }
        }
Esempio n. 14
0
        //将目标表的字段同步到本地
        public void SynTargetField()
        {
            try
            {
                string  sqltarget = string.Format("select * from {0} where 1=0 ", gridView1.GetDataRow(gridView1.FocusedRowHandle)["TABLE_NAME"].ToString());
                DataSet dstarget  = DALUseSpecial.Query(sqltarget, connstr);
                if (dstarget.Tables.Count > 0)
                {
                    foreach (DataColumn dc in dstarget.Tables[0].Columns)
                    {
                        string columntype = "";
                        if (dc.DataType.Name.ToString().Contains("String"))
                        {
                            columntype = "STRING";
                        }
                        else if (dc.DataType.Name.ToString().Contains("Decimal") || dc.DataType.Name.ToString().Contains("Int"))
                        {
                            columntype = "NUMBER";
                        }
                        else if (dc.DataType.Name.ToString().Contains("DateTime"))
                        {
                            columntype = "DATE";
                        }
                        else
                        {
                            MessageBox.Show(dc.DataType.Name.ToString());
                        }

                        string  sql  = string.Format("insert into PT_TARGET_FIELD(compare_id,pt_name,table_name,field_name,field,field_type,compare_name,pt_id) values('{7}','{0}','{1}','{2}','{3}','{4}','{5}','{6}')", cmb_ptname.Text, gridView1.GetDataRow(gridView1.FocusedRowHandle)["TABLE_NAME"].ToString(), dc.ColumnName, dc.ColumnName, columntype, "", cmb_ptname.SelectedValue.ToString(), Guid.NewGuid());
                        string  sql1 = string.Format("select * from PT_TARGET_FIELD where pt_id = '{0}' and table_name = '{1}' and field = '{2}'", cmb_ptname.SelectedValue.ToString(), gridView1.GetDataRow(gridView1.FocusedRowHandle)["TABLE_NAME"].ToString(), dc.ColumnName);
                        DataSet ds   = DALUse.Query(sql1);
                        if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 0)
                        {
                            DALUse.ExecuteSql(sql);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("目标库不存在表:" + gridView1.GetDataRow(gridView1.FocusedRowHandle)["TABLE_NAME"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 15
0
        private void btn_del_Click(object sender, EventArgs e)
        {
            if (gridView2.FocusedRowHandle < 0)
            {
                return;
            }

            string sql  = string.Format("delete from PT_TARGET_FIELD where compare_id='{0}'", gridView2.GetDataRow(gridView2.FocusedRowHandle)["compare_id"].ToString());
            string sql1 = string.Format("delete from pt_comparison where pt_id = '{0}' and table_name = '{1}' and field = '{2}'", cmb_ptname.SelectedValue.ToString(), gridView1.GetDataRow(gridView1.FocusedRowHandle)["TABLE_NAME"].ToString(), gridView2.GetDataRow(gridView2.FocusedRowHandle)["FIELD"].ToString());

            if (DialogResult.Yes == MessageBox.Show(null, "确定删除所选项!", "删除", MessageBoxButtons.YesNo))
            {
                DALUse.ExecuteSql(sql);
                DALUse.ExecuteSql(sql1);
            }
            RefreshContent();
        }
Esempio n. 16
0
 private void btn_ok_Click(object sender, EventArgs e)
 {
     try
     {
         string s         = sql.Replace("'", "''");
         string sqlinsert = string.Format("insert into pt_sql(pt_id,sql_name,sql,table_id,table_name) values('{0}','{1}','{2}','{3}','{4}')", ptid, txt_sqlname.Text, s, table_id, table_name);
         if (DALUse.ExecuteSql(sqlinsert) != 0)
         {
             MessageBox.Show("±£´æ³É¹¦£¡");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     this.FindForm().Close();
 }
Esempio n. 17
0
        public void InsertPt_Target_Field()
        {
            try
            {
                if (actionflag == "add")
                {
                    string sql = "";
                    //if (publicProperty.DATABASETYPE=="ORACLE")
                    //{
                    //Guid g = new Guid();
                    sql = string.Format("insert into PT_TARGET_FIELD(compare_id,pt_name,table_name,field_name,field,field_type,compare_name,pt_id) values('{7}','{0}','{1}','{2}','{3}','{4}','{5}','{6}')", pt_name, table_name, txt_fieldname.Text.Trim(), txt_field.Text.Trim(), cmb_type.Text.Trim(), "", pt_id, Guid.NewGuid());
                    //}
                    //else if (publicProperty.DATABASETYPE=="SQLSERVER")
                    //{
                    //    sql = string.Format("insert into PT_TARGET_FIELD(pt_name,table_name,field_name,field,field_type,compare_name,pt_id) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", pt_name, table_name, txt_fieldname.Text.Trim(), txt_field.Text.Trim(), cmb_type.Text.Trim(), "", pt_id);
                    //}

                    int effectresult = DALUse.ExecuteSql(sql);
                    if (effectresult == 1)
                    {
                        MessageBox.Show("保存成功!");
                    }
                    else
                    {
                        return;
                    }
                }
                else if (actionflag == "update")
                {
                    if (MessageBox.Show(null, "确定修改该所选项!", "确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        string sql = string.Format("update PT_TARGET_FIELD set field = '{0}',field_name='{1}',field_type='{2}' where compare_id ='{3}'", txt_field.Text.Trim(), txt_fieldname.Text.Trim(), cmb_type.Text.Trim(), compare_id);
                        if (DALUse.ExecuteSql(sql) == 1)
                        {
                            uctlMessageBox.frmDisappearShow("修改操作完成!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //this.FindForm().Close();
        }
Esempio n. 18
0
        /// <summary>
        /// 插入字典信息
        /// 1.选择平台
        /// 2.选择所维护的Excel字典文件
        /// 3.选择所插入的字典表
        /// 4.填写字典名(默认为文件名)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSaveData_Click(object sender, EventArgs e)
        {
            string insertSql          = "";
            string insertColumnString = "pt_id,id,type_name,field_code,field";

            if (CheckSelected() && MessageBox.Show(null, "该操作将把数据导入到系统的用户数据库中,您确定是否继续?", "", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            //t.WaitingThreadStart();
            //MessageBox.Show(myDs.Tables.Count.ToString() + "--" + myDs.Tables[0].Rows.Count.ToString());
            if (myDs != null && myDs.Tables.Count > 0 && myDs.Tables[0].Rows.Count > 0 && CheckDictColumns(myDs.Tables[0]))
            {
                try
                {
                    foreach (DataRow dr in myDs.Tables[0].Rows)
                    {
                        if (dr[0].ToString() == "")
                        {
                            continue;
                        }
                        string insertValueString = "";
                        insertValueString = "'" + cmb_pt.SelectedValue.ToString() + "','" + Guid.NewGuid().ToString() + "','" + txt_dict_name.Text + "',";
                        for (int i = 0; i < myDs.Tables[0].Columns.Count; i++)
                        {
                            insertValueString += string.Format("'{0}',", dr[i].ToString().Replace("'", "''"));
                        }
                        insertValueString = insertValueString.Trim(',');
                        insertSql         = string.Format(@"INSERT INTO {0} ({1}) VALUES({2})", tablename, insertColumnString, insertValueString);
                        DALUse.ExecuteSql(insertSql);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    CommonFunction.WriteErrorLog(ex.ToString() + "\n" + insertSql);
                }
            }
            //t.WaitingThreadStop();
            //}
            GetDictDetail();
            //string tips = string.Format("共导入{0}条数据", ((DataTable)gc_excel.DataSource).Rows.Count);
            //MessageBox.Show(tips);
        }
        private void btn_cancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (gridView3.FocusedRowHandle < 0)
                {
                    return;
                }
                DataRow      dr      = gridView3.GetDataRow(gridView3.FocusedRowHandle);
                DialogResult dresult = MessageBox.Show(null, "确定取消绑定所选项", "确认", MessageBoxButtons.YesNo);
                if (dr["NEWROWFLAG"].ToString() != "1" && dresult == DialogResult.Yes)
                {
                    //string sqldel = string.Format("delete from PT_COMPARISON_DETAIL_DICT where target_id={0} and local_id = {1}", dr["target_id"].ToString(), dr["local_id"].ToString());
                    //string sqlupdatetarget = string.Format("update PT_TARGET_DICT set compare_flag ='{0}' where id={1}", "0", dr["target_id"].ToString());
                    //string sqlupdatelocal = string.Format("update PT_LOCAL_DICT set compare_flag = '{0}' where ID = {1}", "0", dr["local_id"].ToString());
                    //string[] sqls = { sqldel, sqlupdatetarget, sqlupdatelocal };
                    //DALUse.ExecuteSqlTran(sqls);
                    string sqlcancel = string.Format("update PT_COMPARISON_DETAIL_DICT set compare_name='{0}',compare_code='{1}'where id = '{2}'",
                                                     "",
                                                     "",
                                                     dr["ID"].ToString());
                    if (DALUse.ExecuteSql(sqlcancel) == 1)
                    {
                        MessageBox.Show("操作成功过!");
                        //uctlMessageBox.frmDisappearShow("取消绑定操作成功!");
                    }
                    else
                    {
                        MessageBox.Show("操作失败");
                    }

                    InitData();
                }
                else if (dr["NEWROWFLAG"].ToString() != "0" && dresult == DialogResult.Yes)
                {
                    MessageBox.Show("撤销为绑定项点击【取消】按钮。");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
 private void btn_deltargetdict_Click(object sender, EventArgs e)
 {
     try
     {
         string sql = string.Format("delete PT_COMPARISON_DETAIL_DICT where pt_id = '{0}' and type_name = '{1}'", cmb_pt_name.SelectedValue.ToString(), cmb_target.SelectedValue.ToString());
         if (MessageBox.Show(null, "确定删除所选字典?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             if (DALUse.ExecuteSql(sql) > 0)
             {
                 InitDictData();
                 MessageBox.Show("删除成功!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private void btn_save_Click(object sender, EventArgs e)
        {
            //t.WaitingThreadStart();
            string insertSql   = "";
            int    insertcount = 0;

            if (myDs != null && myDs.Tables[0].Rows.Count > 0)
            {
                string    insertColumnString = "pt_id,pt_name,table_name,compare_id,field_name,field,field_type";
                DataTable dt = myDs.Tables[0];
                try
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr[0].ToString() == "")
                        {
                            continue;
                        }
                        string insertValueString = "";
                        insertValueString = "'" + pt_id + "','" + pt_name + "','" + table_name + "','" + Guid.NewGuid().ToString() + "',";
                        for (int i = 0; i < dt.Columns.Count; i++)
                        {
                            insertValueString += string.Format("'{0}',", dr[i].ToString().Replace("'", "''"));
                        }
                        insertValueString = insertValueString.Trim(',');
                        insertSql         = string.Format(@"INSERT INTO {0} ({1}) VALUES({2})", "pt_target_field", insertColumnString, insertValueString);
                        if (DALUse.ExecuteSql(insertSql) == 1)
                        {
                            insertcount++;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                if (insertcount != 0)
                {
                    MessageBox.Show("成功导入" + insertcount.ToString() + "条数据!");
                }
            }
            //t.WaitingThreadStop();
        }
Esempio n. 22
0
 private void btn_del_Click(object sender, EventArgs e)
 {
     if (gridView2.FocusedRowHandle < 0)
     {
         return;
     }
     try
     {
         string sqldel = string.Format("delete from PT_Up_DataBase_Table where id = '{0}'", gridView2.GetDataRow(gridView2.FocusedRowHandle)["ID"].ToString());
         if (DALUse.ExecuteSql(sqldel) == 1)
         {
             getData();
             MessageBox.Show("删除成功!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 23
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         if (cmb_pt.SelectedItem == null)
         {
             return;
         }
         string sqlinsert = string.Format("insert into PT_Up_DataBase_Table(PT_ID,PT_TABLE,PT_DATA,PT_DATA_TABLE,ID) values('{0}','{1}','{2}','{3}','{4}')", cmb_pt.SelectedValue.ToString(), txt_targetbale.Text, txt_database.Text, txt_databasetable.Text, Guid.NewGuid().ToString());
         if (DALUse.ExecuteSql(sqlinsert) == 1)
         {
             getData();
             MessageBox.Show("保存成功!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 24
0
 private void btn_del_Click(object sender, EventArgs e)
 {
     try
     {
         if (gridView2.FocusedRowHandle < 0)
         {
             return;
         }
         DALUse.ExecuteSql(string.Format("delete pt_xml_config where layout_name = '{0}'", gridView2.GetDataRow(gridView2.FocusedRowHandle)["layout_name"].ToString()));
         //InitLayOutData();
         //Initgc_nodeData();
         //InitTreeListData();
         //tl_node.ExpandAll();
         getLayoutData();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 25
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            string sqlupdatept = string.Format("update pt_dict set pt_name = '{0}' where pt_id ='{1}'", txt_pt_name.Text, ptid);
            string sqlinsertpt = "";

            //if (publicProperty.DATABASETYPE =="ORACLE")
            //{
            //Guid g = new Guid();
            sqlinsertpt = string.Format("insert into pt_dict(pt_id,pt_name) values('{1}','{0}')", txt_pt_name.Text, Guid.NewGuid());
            //}
            //else if (true)
            //{
            //    sqlinsertpt = string.Format("insert into pt_dict(pt_name) values('{0}')", txt_pt_name.Text);
            //}

            try
            {
                if (kind == "update" && txt_pt_name.Text != "")
                {
                    DALUse.ExecuteSql(sqlupdatept);
                }
                else if (kind == "add" && txt_pt_name.Text != "")
                {
                    DALUse.ExecuteSql(sqlinsertpt);
                }
                else
                {
                    MessageBox.Show("平台名不能为空!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            this.FindForm().Close();
        }