Beispiel #1
0
        private void Search_button_Click(object sender, EventArgs e)
        {
            if (this.selTextInpt2.Value == null && this.selTextInpt_KS.Value == null)
            {
                WJs.alert("请选择入库库房或者科室");

                return;
            }
            SqlStr sql = new SqlStr();

            if (!this.selTextInpt2.Text.Equals(""))
            {
                sql.Add("and a.WARECODE=?", this.selTextInpt2.Value);
            }
            if (!this.selTextInpt_KS.Text.Equals(""))
            {
                sql.Add("and a.DEPTID=?", this.selTextInpt_KS.Value);
            }
            if (!this.selTextInpt1.Text.Equals(""))
            {
                sql.Add("and a.IOID=?", this.selTextInpt1.Value);
            }

            this.dataGView1.reLoad(new object[] { His.his.Choscode, this.dateTimePicker1.Value, this.dateTimePicker2.Value }, sql);
            this.TiaoSu.Text       = this.dataGView1.RowCount.ToString() + "笔";
            this.JinEHeJi.Text     = this.dataGView1.Sum("总金额").ToString() + "元";
            this.RuKuJinEHeJi.Text = this.dataGView1.Sum("运杂费金额").ToString() + "元";
            this.label7.Text       = this.dataGView1.Sum("发票金额").ToString() + "元";
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlStr sqls = SqlStr.newSql();//进行过滤的条件

            if (this.selTextInpt1.Value == null || this.selTextInpt1.Value.Trim() == "")
            {
                WJs.alert("请选择一个科室!");
                selTextInpt1.Focus();
                return;
            }
            DataRow dr1 = EQKind_ytTreeView.getSelectRow();

            if (EQKind_ytTreeView.SelectedNode != EQKind_ytTreeView.Nodes[0])
            {
                sqls.Add(" AND EQID IN (SELECT EQID FROM LKEQ.DICTEQ WHERE KINDCODE= " + dr1["KINDCODE"].ToString() + ")");
            }

            if (this.dateTimePicker1.Value.CompareTo(this.dateTimePicker2.Value) > 0)
            {
                WJs.alert("起始日期必须小于末尾日期!");
                return;
            }
            //select * from LKEQ.EQCARDREC WHERE  CHOSCODE =? AND DEPTID=? [Condition] AND OUTDATE>? AND OUTDATE <?
            this.dataGView1.reLoad(new object[] { His.his.Choscode, this.selTextInpt1.Value, dateTimePicker1.Value, dateTimePicker2.Value }, sqls);
            this.dataGView1.setFocus(0, 1);
            dataGView1_SelectionChanged(null, null);
        }
Beispiel #3
0
        /// <summary>
        ///  Write a single info
        ///  Update existing entry or add a new one if not present
        /// </summary>
        private void __writeInfo(string infoName, string infoVal)
        {
            List <object> colsAndValues = new List <object>();

            colsAndValues.Add(FSINFO.infoName.ToString());
            colsAndValues.Add(infoName);
            colsAndValues.Add(FSINFO.infoVal.ToString());
            colsAndValues.Add(infoVal);
            ContentValues contVals = SqlStr.genContentValues(colsAndValues);
            string        @where   = SqlStr.genWhere(new SqlStr.SqlSimpCond(FSINFO.infoName.ToString(), "=", infoName));

            try
            {
                // try update first
                if (db.update(DBNAMES.FsInfo.ToString(), contVals, @where, null) == 0)
                {
                    // nothing is updated, insert to table
                    db.insert(DBNAMES.FsInfo.ToString(), null, contVals);
                }
            }
            catch (SQLiteException e)
            {
                SqlFsLog.debug(e);
                SqlFsErrCode.CurrentError = FsErr.WriteFsInfoErr;
                throw e;
            }
        }
Beispiel #4
0
        /// <summary>
        ///  Create a new entry in FsBlock
        /// </summary>
        ///  <returns> new ID for the inserted node </returns>
        internal static FsID addFsNode(SQLiteDatabase db, SqlFsConst.FSTYPE type, string dirName, FsID parentID)
        {
            long          curTime       = SqlFsFunc.calToFileTime(new DateTime());
            List <object> colsAndValues = new List <object>(10);

            colsAndValues.Add(SqlFs.FSBLOCK.fsCreateTime.ToString());
            colsAndValues.Add(curTime);
            colsAndValues.Add(SqlFs.FSBLOCK.fsLastModTime.ToString());
            colsAndValues.Add(curTime);
            colsAndValues.Add(SqlFs.FSBLOCK.fsFileSize.ToString());
            colsAndValues.Add(0);
            colsAndValues.Add(SqlFs.FSBLOCK.fsType.ToString());
            colsAndValues.Add(type.v());
            colsAndValues.Add(SqlFs.FSBLOCK.fsName.ToString());
            colsAndValues.Add(dirName);
            colsAndValues.Add(SqlFs.FSBLOCK.fsParent.ToString());
            colsAndValues.Add(parentID);

            ContentValues contValues = SqlStr.genContentValues(colsAndValues);

            try
            {
                db.insert(SqlFs.DBNAMES.FsBlock.ToString(), null, contValues);
            }
            catch (Exception e)
            {
                SqlFsLog.debug(e);
                SqlFsErrCode.CurrentError = FsErr.AddFsNodeError;
                return(SqlFsConst.INVALIDID);
            }

            // retrieve the ID of the new entry
            return(SqlFs.getLastInsertID(db));
        }
Beispiel #5
0
        //////////////////////////FS operations ///////////////////////////////////

        ///  @param [in] id -- get entry using ID directly </param>
        internal static SqlFsNode getFsNodeByID(SQLiteDatabase db, SqlFsLocker fsLocker, FsID id)
        {
            SqlFsNode fsNode = null;

            string @where = SqlStr.genWhere(new SqlStr.SqlSimpCond(SqlFs.FSBLOCK.fsID.ToString(), "=", id));
            Cursor c      = null;

            try
            {
                c = db.query(SqlFs.DBNAMES.FsBlock.ToString(), new string[] { SqlFs.FSBLOCK.fsID.ToString(), SqlFs.FSBLOCK.fsType.ToString() }, @where, null, null, null, null);

                if (c.moveToFirst())
                {
                    fsNode = SqlFsNode.getFsNode(db, fsLocker, c);
                }
            }
            catch (Exception e)
            {
                SqlFsLog.debug(e);
                SqlFsErrCode.CurrentError = FsErr.GetFieldError;
            }
            finally
            {
                SqlFsFunc.close(c);
            }

            return(fsNode);
        }
Beispiel #6
0
        /// <summary>
        ///  Get data from data block table
        /// </summary>
        ///  @param [in] dataBlockID -- the data block ID
        /// </param>
        ///  <returns> true if OK </returns>
        ///  <returns> false if failed </returns>
        private bool __getData(SQLiteDatabase db, FsID dataBlockID)
        {
            string @where = SqlStr.genWhere(new SqlStr.SqlSimpCond(IFileData.IDCOL, "=", dataBlockID));
            Cursor c      = null;

            try
            {
                c = db.query(IFileData.DTABLENAME.ToString(), null, @where, null, null, null, null);

                if (c.moveToFirst())
                {
                    __getData(c);
                }
            }
            catch (Exception e)
            {
                Log.d("IFileData.__getData", e.Message);
                return(false);
            }
            finally
            {
                if (c != null)
                {
                    c.close();
                }
            }

            return(true);
        }
Beispiel #7
0
        /// <summary>
        ///  Get a single info
        /// </summary>
        ///  <returns> info value </returns>
        private string __getInfo(string infoName)
        {
            string value  = null;
            string @where = SqlStr.genWhere(new SqlStr.SqlSimpCond(FSINFO.infoName.ToString(), "=", infoName));

            Cursor c = null;

            try
            {
                c = db.query(DBNAMES.FsInfo.ToString(), new string[] { FSINFO.infoVal.ToString() }, @where, null, null, null, null);

                if (c != null && c.moveToFirst())
                {
                    value = c.getString(0);
                }
            }
            catch (SQLiteException e)
            {
                SqlFsLog.debug(e);
                SqlFsErrCode.CurrentError = FsErr.GetFsInfoErr;
            }
            finally
            {
                SqlFsFunc.close(c);
            }

            return(value);
        }
Beispiel #8
0
        /// <summary>
        ///  Return a ContentValues to be inserted or updated to DB
        /// </summary>
        protected internal override ContentValues __saveData()
        {
            List <object> colsAndValues = new List <object>(2);
            FILETYPE      fType         = FILETYPE.fBin;

            if (this.rawBinData != null)
            {
                colsAndValues.Add(FILEDATABLOCK.dRawBinData.ToString());
                colsAndValues.Add(this.rawBinData);
                colsAndValues.Add(FILEDATABLOCK.dTextData.ToString());            // clear text column
                colsAndValues.Add("");
            }
            else if (this.textData != null)
            {
                colsAndValues.Add(FILEDATABLOCK.dTextData.ToString());
                colsAndValues.Add(this.textData);
                colsAndValues.Add(FILEDATABLOCK.dRawBinData.ToString());            // clear rawbin column
                colsAndValues.Add(null);
                fType = FILETYPE.fText;
            }

            // file type
            colsAndValues.Add(FILEDATABLOCK.dFileType.ToString());
            colsAndValues.Add(fType.ordinal());

            return(SqlStr.genContentValues(colsAndValues));
        }
Beispiel #9
0
        /// < summary>
        /// 分析用户请求是否正常
        /// < /summary>
        /// < param name="Str">传入用户提交数据< /param>
        /// < returns>返回是否含有SQL注入式攻击代码< /returns>
        public static bool ProcessSqlStr(string str, int type = 1)
        {
            string SqlStr;

            if (type == 1)
            {
                SqlStr = "exec |insert |select |delete |update |count |chr |mid |master |truncate |char |declare ";
            }
            else
            {
                SqlStr = "'|and|exec|insert|select|delete|update|count|*|chr|mid|master|truncate|char|declare";
            }
            bool returnValue = true;

            try
            {
                if (!string.IsNullOrEmpty(str))
                {
                    string[] anySqlStr = SqlStr.Split('|');
                    foreach (string s in anySqlStr)
                    {
                        if (str.IndexOf(s, StringComparison.OrdinalIgnoreCase) != -1)
                        {
                            returnValue = false;
                        }
                    }
                }
            }
            catch
            {
                returnValue = false;
            }
            return(returnValue);
        }
Beispiel #10
0
        /// <summary>
        /// 检验用户提交的数据是否正常
        /// </summary>
        /// <param name="Str">用户提交的数据</param>
        /// <param name="type">1:更新 0:是查询</param>
        /// <returns></returns>
        public static bool ProcessSqlStr(string Str, int type)
        {
            string SqlStr;

            if (type == 1)
            {
                SqlStr = "exec |insert |select |delete |update |count |chr |mid |master |truncate |char |declare ";
            }
            else
            {
                SqlStr = "'|and |exec |insert |select |delete |update |count |*|chr |mid |master |truncate |char |declare ";
            }
            bool ReturnValue = true;

            try
            {
                if (Str != "")
                {
                    string[] anySqlStr = SqlStr.Split('|');
                    foreach (string ss in anySqlStr)
                    {
                        if (Str.IndexOf(ss) >= 0)
                        {
                            ReturnValue = false;
                        }
                    }
                }
            }
            catch
            {
                ReturnValue = false;
            }
            return(ReturnValue);
        }
Beispiel #11
0
        //查询
        private void button1_Click(object sender, EventArgs e)
        {
            SqlStr sqls = SqlStr.newSql();//进行过滤的条件

            if (this.selTextInpt1.Value == null || this.selTextInpt1.Value.Trim() == "")
            {
                WJs.alert("请选择一个科室!");
                selTextInpt1.Focus();
                return;
            }
            DataRow dr1 = EQKind_ytTreeView.getSelectRow();
            DataRow dr2 = UseStatus_ytTreeView.getSelectRow();

            if (EQKind_ytTreeView.SelectedNode != EQKind_ytTreeView.Nodes[0])
            {
                sqls.Add(" AND EQID IN (SELECT EQID FROM LKEQ.DICTEQ WHERE KINDCODE= " + dr1["KINDCODE"].ToString() + ")");
            }

            if (UseStatus_ytTreeView.SelectedNode != UseStatus_ytTreeView.Nodes[0])
            {
                sqls.Add(" AND STATUSCODE=" + dr2["STATUSCODE"].ToString());
            }

            if (this.ytComboBox1.SelectedIndex == 0)
            {
                sqls.Add(" AND STATUS=0 ");
            }
            if (this.ytComboBox1.SelectedIndex == 1)
            {
                sqls.Add(" AND STATUS=1 ");
            }
            if (this.ytComboBox1.SelectedIndex == 2)
            {
                sqls.Add(" AND STATUS=2 ");
            }
            if (this.ytComboBox1.SelectedIndex == 3)
            {
                sqls.Add(" AND STATUS=6 ");
            }
            if (this.ytComboBox1.SelectedIndex == 4)
            {
                sqls.Add(" AND STATUS=7 ");
            }
            else
            {
                sqls.Add(" AND  1=1 ");
            }

            this.dataGView1.reLoad(new object[] { this.selTextInpt1.Value, His.his.Choscode.ToString() }, sqls);

            this.TiaoSu.Text   = this.dataGView1.RowCount.ToString() + "笔";
            this.JinEHeJi.Text = this.dataGView1.Sum("价格").ToString() + "元";
            this.label6.Text   = this.dataGView1.Sum("原值").ToString() + "元";
        }
Beispiel #12
0
        private static bool ProcessSqlStr(string col, string Str, int type)
        {
            if (Str.Length == 0)
            {
                return(true);
            }
            string SqlStr;

            if (type == 0) //QueryString
            {
                SqlStr = "'|exists| and |exec|insert |select |delete |update |count|*|chr|mid|master|truncate |char|declare |script";
            }
            else //Form
            {
                //SqlStr = "'|exec |insert |select |delete |update |count |chr|mid|master |truncate |char |declare |and |script";
                SqlStr = "exec |insert |select |delete |update |count |chr |mid |master |truncate |char |declare |and |script";
            }
            string path = HttpContext.Current.Request.ServerVariables["Url"].ToLower();

            if (path.IndexOf("/system/") > -1)
            {
                return(true);                              //排除目录
            }
            if (path.IndexOf("/manage/") > -1)
            {
                return(true);                              //排除目录
            }
            if (path.IndexOf("/systemhui/") > -1)
            {
                return(true);                                 //排除目录
            }
            bool ReturnValue = true;

            try
            {
                if (Str != "")
                {
                    string[] anySqlStr = SqlStr.Split('|');
                    foreach (string ss in anySqlStr)
                    {
                        if (Str.ToLower().IndexOf(ss) >= 0)
                        {
                            ReturnValue = false;
                        }
                    }
                }
            }
            catch
            {
                ReturnValue = false;
            }
            return(ReturnValue);
        }
Beispiel #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.selTextInpt1.Value == null || this.selTextInpt1.Value.Trim() == "")
            {
                WJs.alert("请选择一个库房信息!");
                selTextInpt1.Focus();
                return;
            }
            if (this.Status_ytComboBox.SelectedIndex < 0)
            {
                WJs.alert("请选择状态信息!");
                return;
            }

            //  TvList.newBind().add("作废", "0").add("等待审核", "1").add("审核被拒", "2").add("已审核", "6").add("已冲销", "7").add("所有","10").Bind(this.Status_ytComboBox);
            SqlStr sqls = SqlStr.newSql();

            if (this.Status_ytComboBox.SelectedIndex == 0)
            {
                sqls.Add(" AND a.STATUS=0 ");
            }
            if (this.Status_ytComboBox.SelectedIndex == 1)
            {
                sqls.Add(" AND a.STATUS=1 ");
            }
            if (this.Status_ytComboBox.SelectedIndex == 2)
            {
                sqls.Add(" AND a.STATUS=2 ");
            }
            if (this.Status_ytComboBox.SelectedIndex == 3)
            {
                sqls.Add(" AND a.STATUS=6 ");
            }
            if (this.Status_ytComboBox.SelectedIndex == 4)
            {
                sqls.Add(" AND a.STATUS=7 ");
            }
            else
            {
                sqls.Add(" AND  1=1 ");
            }

            if (this.dateTimePicker1.Value.CompareTo(this.dateTimePicker2.Value) > 0)
            {
                WJs.alert("起始日期必须小于末尾日期!");
                return;
            }

            this.dataGView1.reLoad(new object[] { His.his.Choscode, this.selTextInpt1.Value, this.dateTimePicker1.Value, this.dateTimePicker2.Value }, sqls);

            this.TiaoSu.Text   = this.dataGView1.RowCount.ToString() + "笔";
            this.JinEHeJi.Text = this.dataGView1.Sum("总金额").ToString() + "元";
        }
Beispiel #14
0
        /// <summary>
        ///  Check existence of tables
        /// </summary>
        ///  <returns> true -- all tables present </returns>
        ///  <returns> false -- should create new tables </returns>
        private bool checkTables()
        {
            int tabCount = 0;

            string @where = SqlStr.genWhere(new SqlStr.SqlSimpCond(DBNAMES.type.ToString(), "=", DBNAMES.table.ToString())
                                            );

            Cursor c = db.query(DBNAMES.SQLITE_MASTER.ToString(), new string[] { DBNAMES.name.ToString() }, @where, null, null, null, null);

            // retrieve all table names and check against our list
            if (c != null && c.moveToFirst())
            {
                do
                {
                    string tabName = c.getString(0);
                    foreach (string n in TABLIST)
                    {
                        if (n.Equals(tabName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            tabCount += 1;
                            break;
                        }
                    }
                } while (c.moveToNext());
            }
            SqlFsFunc.close(c);

            bool isCheckingOK = false;

            do
            {
                // not all tables exists, may be some corruption ...
                if (tabCount < TABLIST.Length)
                {
                    break;
                }

                // may be more checking here ...


                isCheckingOK = true;
            } while (false);

            if (tabCount != 0 && !isCheckingOK)
            {
                close();
                backup();
                open();
            }

            return(isCheckingOK);
        }
Beispiel #15
0
        private void Search_button_Click(object sender, EventArgs e) //浏览//细节还需要进行权限判断
        {
            this.dataGView_Main.ClearData();

            SqlStr sql = SqlStr.newSql();            //创建SqlStr对象

            if (this.selTextInpt_KSID.Value != null) // 权限判断,要不要这个功能(暂时还未做权限判断)
            {
                if (selTextInpt_KSID.Value.Trim().Length > 0)
                {
                    //添加查询条件及其参数
                    sql.Add("and DEPTID = ?", selTextInpt_KSID.Value.Trim());
                }
            }
            else
            {
                WJs.alert("请选择科室!");
                return;
            }


            //添加查询条件及其参数
            if (this.comboBox1.Value != null)
            {
                if (this.comboBox1.Value.Trim().Length > 0)
                {
                    //添加查询条件及其参数
                    if (this.comboBox1.Value != "9")
                    {
                        sql.Add("and STATUS = ?", this.comboBox1.Value.Trim());
                    }
                }
            }
            else
            {
                WJs.alert("请选择状态!");
                return;
            }
            sql.Add("and PLANDATE <= ?", this.dateTimePicker2.Value);

            sql.Add("and PLANDATE >= ?", this.dateTimePicker1.Value);


            //加载查询数据
            this.dataGView_Main.Url = "EQAskBuy_ConditionScan";
            this.dataGView_Main.reLoad(new object[] { His.his.Choscode }, sql);
            this.dataGView_Main.setFocus(0, 0);
            this.TiaoSu.Text   = this.dataGView_Main.RowCount.ToString() + "笔";
            this.JinEHeJi.Text = this.dataGView_Main.Sum("预计总金额").ToString() + "元";
        }
Beispiel #16
0
        //private void button2_Click(object sender, EventArgs e)//清除
        //{
        //    this.textBox1.Text = "";
        //    this.yTxtBox_Name.Text = "";
        //    this.yTxtBox_PY.Text = "";
        //    this.yTxtBox_WB.Text = "";
        //}

        private void button1_Click(object sender, EventArgs e) //查询
        {
            SqlStr sql = SqlStr.newSql();                      //创建SqlStr对象

            ytTreeView1.sql = "ScanEQKind";
            this.ytTreeView1.reLoad(new object[] { His.his.Choscode });

            string strF  = this.Search_yTextBox1.Text.Trim();
            string strF1 = null;
            string strF2 = null;
            string strF3 = null;
            string strF4 = null;

            if (this.Search_yTextBox1.Text.Trim().Length > 0)
            {
                if (this.Search_ytComboBox1.SelectedIndex > -1)
                {
                    //在获取用户输入的前提下,加入下拉框中的内容 类似stringbuilder
                    if (this.Search_ytComboBox1.SelectedIndex == 0)
                    {
                        strF1 = strF;
                    }
                    if (this.Search_ytComboBox1.SelectedIndex == 1)
                    {
                        strF2 = strF;
                    }
                    if (this.Search_ytComboBox1.SelectedIndex == 2)
                    {
                        strF3 = strF;
                    }
                    if (this.Search_ytComboBox1.SelectedIndex == 3)
                    {
                        strF4 = strF;
                    }
                    if (this.Search_ytComboBox1.SelectedIndex == 4)
                    {
                        strF1 = "%" + strF + "%"; strF2 = "%" + strF + "%"; strF3 = "%" + strF + "%"; strF4 = "%" + strF + "%";
                    }
                }
                else
                {
                    WJs.alert("请选择查询条件!");
                }
            }


            string text = LData.Es("FindEQKind", null, new object[] { His.his.Choscode, strF1, strF2, strF3, strF4 });

            FindNode(this.ytTreeView1.Nodes, text);
        }
Beispiel #17
0
        //查询函数
        private void button1_Click(object sender, EventArgs e)
        {
            SqlStr strs = SqlStr.newSql();
            string strF = null;

            if (this.search_yTextBox.Text.Trim().Length > 0)
            {
                strF = this.search_yTextBox.Text.Trim();
                if (this.serachKind_ytComboBox.SelectedIndex == 0)
                {
                    strs.Add("AND (IOID=?) ", strF);
                }

                if (this.serachKind_ytComboBox.SelectedIndex == 1)
                {
                    strs.Add("AND (IONAME=?) ", strF);
                }

                if (this.serachKind_ytComboBox.SelectedIndex == 2)
                {
                    strs.Add("AND (upper(PYCODE)=upper(?)) ", strF);
                }

                if (this.serachKind_ytComboBox.SelectedIndex == 3)
                {
                    strs.Add("AND (WBCODE=?) ", strF);
                }

                if (this.serachKind_ytComboBox.SelectedIndex == 4)
                {
                    strF = "%" + this.search_yTextBox.Text.Trim() + "%";
                    strs.Add("AND (IOID LIKE ? OR IONAME LIKE ? or upper(PYCODE) like upper(?) or upper(WBCODE) like upper(?)) ", strF, strF, strF, strF);
                }
            }
            if (this.Filter_ytComboBox.SelectedIndex == 1)
            {
                strs.Add("AND (IOFLAG=0)");
            }
            if (this.Filter_ytComboBox.SelectedIndex == 2)
            {
                strs.Add("AND (IOFLAG=1)");
            }

            this.dataGView1.reLoad(new object[] { His.his.Choscode }, strs);
        }
Beispiel #18
0
        private void loadData()
        {
            //STATUSCODE,STATUSNAME,PYCODE,WBCODE,IFUSE,IFDEPRECIATION,IFDEFAULT,MEMO,USERID,USERNAME,RECDATE,CHOSCODE
            SqlStr sqls = SqlStr.newSql();

            if (this.Search_yTextBox1.Text.Trim().Length > 0)
            {
                string strF = null;
                if (this.Search_ytComboBox1.SelectedIndex > -1)
                {
                    strF = this.Search_yTextBox1.Text.Trim();
                    if (this.Search_ytComboBox1.SelectedIndex == 0)
                    {
                        sqls.Add(" and ( STATUSCODE =? )", strF);
                    }

                    if (this.Search_ytComboBox1.SelectedIndex == 1)
                    {
                        sqls.Add(" and ( STATUSNAME =? )", strF);
                    }

                    if (this.Search_ytComboBox1.SelectedIndex == 2)
                    {
                        sqls.Add(" and ( upper(PYCODE) =upper(?) )", strF);
                    }

                    if (this.Search_ytComboBox1.SelectedIndex == 3)
                    {
                        sqls.Add(" and ( WBCODE= ? )", strF);
                    }

                    if (this.Search_ytComboBox1.SelectedIndex == 4)
                    {
                        strF = "%" + this.Search_yTextBox1.Text.Trim() + "%";
                        sqls.Add(" and ( STATUSCODE like ? or STATUSNAME like ? or upper(PYCODE) like upper(?) or upper(WBCODE) like upper(?) )", strF, strF, strF, strF);
                    }
                }
                else
                {
                    WJs.alert("选择查询条件");
                }
            }
            this.dataGView1.reLoad(new object[] { His.his.Choscode }, sqls);
        }
Beispiel #19
0
        private void button2_Click(object sender, EventArgs e)//查询按钮点击事件
        {
            this.dataGView2.ClearData();
            SqlStr sql = SqlStr.newSql();//创建SqlStr对象

            if (this.comboBox1.Value != null)
            {
                if (this.comboBox1.Value.Trim().Length > 0)
                {
                    //添加查询条件及其参数
                    if (this.comboBox1.Value != "9")
                    {
                        sql.Add("and STATUS = ?", this.comboBox1.Value.Trim());
                    }
                }
            }
            if (Ware_selTextInpt.Value != null)
            {
                if (Ware_selTextInpt.Value.Trim().Length > 0)
                {
                    //添加查询条件及其参数
                    sql.Add("and WARECODE = ?", Ware_selTextInpt.Value.Trim());
                }
            }
            else
            {
                WJs.alert("请选择库房!");
                return;
            }


            //添加查询条件及其参数
            sql.Add("and PDDATE <= ?", this.dateTimePicker4.Value);

            sql.Add("and PDDATE >= ?", this.dateTimePicker3.Value);


            //加载查询数据
            this.dataGView1.Url = "FindEQPandianMainInfo";
            this.dataGView1.reLoad(new object[] { His.his.Choscode }, sql);
            this.dataGView1.setFocus(0, 0);

            this.TiaoSu.Text = this.dataGView1.RowCount.ToString() + "笔";
        }
Beispiel #20
0
        ///  @param [in] name -- if null, get all entry </param>
        ///  @param [in] type -- dir, file or any ? </param>
        private Cursor getEntryByName(string name, SqlFsConst.FSTYPE type)
        {
            // conditions
            List <object> conds = new List <object>(10);

            conds.Add(new SqlStr.SqlSimpCond(SqlFs.FSBLOCK.fsParent.ToString(), "=", this.ID));

            if (name != null)
            {
                conds.Add("and");
                conds.Add(new SqlStr.SqlSimpCond(SqlFs.FSBLOCK.fsName.ToString(), "=", name));
            }

            if (type != SqlFsConst.FSTYPE.ANY)
            {
                conds.Add("and");
                conds.Add(new SqlStr.SqlSimpCond(SqlFs.FSBLOCK.fsType.ToString(), "=", type.v()));
            }

            string @where = SqlStr.genWhere(conds);

            // query from DB
            Cursor c = null;

            try
            {
                c = db.query(SqlFs.DBNAMES.FsBlock.ToString(), new string[] { SqlFs.FSBLOCK.fsID.ToString(), SqlFs.FSBLOCK.fsType.ToString() }, @where, null, null, null, null);
            }
            catch (Exception e)
            {
                SqlFsLog.debug(e);
                SqlFsErrCode.CurrentError = SqlFsErrCode.FsErr.NoEntryByName;
            }

            // close and set to null if no rows at all
            if (c != null && c.Count == 0)
            {
                c.close();
                c = null;
            }

            return(c);
        }
Beispiel #21
0
        private void Search_button_Click(object sender, EventArgs e)
        {
            if (this.selTextInpt_KS.Value == null)
            {
                WJs.alert("请选择科室");
                return;
            }

            SqlStr sql = new SqlStr();


            if (!this.selTextInpt_KS.Text.Equals(""))
            {
                sql.Add(" and (DEPTID= ?)", this.selTextInpt_KS.Value);
            }
            this.dataGView1.reLoad(new object[] { His.his.Choscode, this.dateTimePicker1.Value, this.dateTimePicker2.Value }, sql);

            this.TiaoSu.Text = this.dataGView1.RowCount.ToString() + "笔";
        }
Beispiel #22
0
        private void Search_button_Click(object sender, EventArgs e)//查询
        {
            SqlStr sqlc = SqlStr.newSql();

            this.dataGView1.Url = "FindEQUnit";

            if (this.Search_yTextBox.Text.Trim().Length > 0)
            {
                string strF = null;
                if (this.Search_ytComboBox.SelectedIndex > -1)
                {
                    strF = this.Search_yTextBox.Text.Trim();
                    if (this.Search_ytComboBox.SelectedIndex == 0)
                    {
                        sqlc.Add("and (DICID = ?)", strF);
                    }
                    if (this.Search_ytComboBox.SelectedIndex == 1)
                    {
                        sqlc.Add("and (DICDESC = ?)", strF);
                    }
                    if (this.Search_ytComboBox.SelectedIndex == 2)
                    {
                        sqlc.Add("and (upper(PYCODE) = upper(?))", strF);
                    }
                    if (this.Search_ytComboBox.SelectedIndex == 3)
                    {
                        strF = "%" + this.Search_yTextBox.Text.Trim() + "%";
                        sqlc.Add(" and ( DICID like ? or DICDESC like ? or upper(PYCODE) like upper(?)) ", strF, strF, strF);
                    }
                }
                else
                {
                    WJs.alert("请选择查询条件!");
                }
            }

            // this.dataGView1.reLoad(null , sqlc);


            this.dataGView1.reLoad(null, sqlc);
            //reLoad();
            //rfresh_toolStripButton_Click(null, null);
        }
Beispiel #23
0
        /// <summary>
        ///  Save field to DB using ID
        /// </summary>
        private bool __setField(SqlFs.FSBLOCK field, object val)
        {
            List <object> colsAndValues = new List <object>(4);

            switch (field)
            {
            case com.sss.sqlfs.SqlFs.FSBLOCK.fsFileSize:
            case com.sss.sqlfs.SqlFs.FSBLOCK.fsType:
            case com.sss.sqlfs.SqlFs.FSBLOCK.fsName:
            case com.sss.sqlfs.SqlFs.FSBLOCK.fsParent:
                colsAndValues.Add(field.ToString());
                colsAndValues.Add(val);
                break;

            case com.sss.sqlfs.SqlFs.FSBLOCK.fsChild:
                sbyte[] blob = idList2Blob((List <FsID>)val);
                colsAndValues.Add(field.ToString());
                colsAndValues.Add(blob);
                break;
            }

            // update last mod time as well
            colsAndValues.Add(SqlFs.FSBLOCK.fsLastModTime.ToString());
            colsAndValues.Add(SqlFsFunc.calToFileTime(new DateTime()));
            ContentValues contValues = SqlStr.genContentValues(colsAndValues);

            string @where = SqlStr.genWhere(new SqlStr.SqlSimpCond(SqlFs.FSBLOCK.fsID.ToString(), "=", this.ID));

            int rowAffected = 0;

            try
            {
                rowAffected = db.update(SqlFs.DBNAMES.FsBlock.ToString(), contValues, @where, null);
            }
            catch (Exception e)
            {
                SqlFsLog.debug(e);
                SqlFsErrCode.CurrentError = FsErr.SetFieldError;
            }

            return(rowAffected > 0);
        }
Beispiel #24
0
        public void reLoad()
        {
            SqlStr sqlc = SqlStr.newSql();

            this.dataGView1.Url = "FindEQWares";

            if (this.Search_yTextBox1.Text.Trim().Length > 0)
            {
                string strF = null;
                if (this.Search_ytComboBox1.SelectedIndex > -1)
                {
                    strF = this.Search_yTextBox1.Text.Trim();
                    //在获取用户输入的前提下,加入下拉框中的内容 类似stringbuilder
                    if (this.Search_ytComboBox1.SelectedIndex == 0)
                    {
                        sqlc.Add("and (warecode =?)", strF);
                    }
                    if (this.Search_ytComboBox1.SelectedIndex == 1)
                    {
                        sqlc.Add("and (warename =?)", strF);
                    }
                    if (this.Search_ytComboBox1.SelectedIndex == 2)
                    {
                        sqlc.Add("and (upper(pycode) =upper(?))", strF);
                    }
                    if (this.Search_ytComboBox1.SelectedIndex == 3)
                    {
                        sqlc.Add("and (upper(wbcode) =upper(?))", strF);
                    }
                    if (this.Search_ytComboBox1.SelectedIndex == 4)
                    {
                        strF = "%" + this.Search_yTextBox1.Text.Trim() + "%";
                        sqlc.Add(" and (warecode like ? or warename like ? or upper(PYCODE) like upper(?) or upper(WBCODE) like upper(?))", strF, strF, strF, strF);
                    }
                }
                else
                {
                    WJs.alert("请选择查询条件!");
                }
            }
            this.dataGView1.reLoad(new object[] { His.his.Choscode }, sqlc);
        }
Beispiel #25
0
        /// <summary>
        ///  Delete entry in a table using ID
        /// </summary>
        ///  @param [in] tableName -- table name </param>
        ///  @param [in] idColName -- ID column name </param>
        ///  @param [in] id -- the actual ID </param>
        internal static bool deleteEntryByID(SQLiteDatabase db, string tableName, string idColName, FsID id)
        {
            string @where = SqlStr.genWhere(new SqlStr.SqlSimpCond(idColName, "=", id));

            bool isOK = false;

            try
            {
                if (db.delete(tableName, @where, null) > 0)
                {
                    isOK = true;
                }
            }
            catch (Exception e)
            {
                SqlFsLog.debug(e);
                SqlFsErrCode.CurrentError = FsErr.DeleteFsEntryError;
            }

            return(isOK);
        }
Beispiel #26
0
        /// <summary>
        ///  Prepare database tables if not already exists
        /// </summary>
        private void prepare(IFileData dummyInst, AtomicBoolean isNewTableCreated)
        {
            if (!checkTables())
            {
                // create new tables
                db.execSQL(SqlStr.genCreateTable(DBNAMES.FsBlock.ToString(), COLFSBLOCK));
                db.execSQL(SqlStr.genCreateTable(DBNAMES.FsInfo.ToString(), COLFSINFO));
                db.execSQL(SqlStr.genCreateTable(IFileData.DTABLENAME, dummyInst.ColSchema));

                // create root dir, too
                createRootDir();

                // Write default info
                writeInfo(FSINFOFIELDS.version.ToString(), SqlFsVersion.SqlFsVersion);
                writeInfo(FSINFOFIELDS.createTimeUtc.ToString(), TimeConverter.calendarToReadableDateTime(DateTime.getInstance(TimeZone.getTimeZone("GMT+00:00"))));
                writeInfo(FSINFOFIELDS.fsLabel.ToString(), SqlFsConst.DEFFSLABEL);
                writeInfo(FSINFOFIELDS.IDSize.ToString(), Convert.ToString(FsID.IDSize));

                isNewTableCreated.set(true);
            }
        }
Beispiel #27
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.dataGView_xi.ClearData();
            this.dataGView_Main.Url = "EQStockQuery_EQSearchMainStock";
            SqlStr sql = SqlStr.newSql();

            if (this.selTextInpt_Ware.Value == null && this.selTextInpt_KS.Value == null)
            {
                WJs.alert("请选择出库库房或者科室");

                return;
            }
            if (!this.selTextInpt_Ware.Text.Equals(""))
            {
                sql.Add("and c.WARECODE=?", this.selTextInpt_Ware.Value);
            }
            if (!this.selTextInpt_KS.Text.Equals(""))
            {
                sql.Add("and c.DEPTID=?", this.selTextInpt_KS.Value);
            }


            if (this.selTextInpt1.Value != null)
            {
                sql.Add(" and e.KINDCODE =? ", this.selTextInpt1.Value);
            }
            if (this.selTextInpt2.Value != null)
            {
                sql.Add(" and c.EQID=? ", this.selTextInpt2.Value);
            }



            this.dataGView_Main.reLoad(new object[] { His.his.Choscode }, sql);

            this.TiaoSu.Text = this.dataGView_Main.RowCount.ToString() + "条";
        }
Beispiel #28
0
        private void Search_button_Click(object sender, EventArgs e) //浏览//细节还需要进行权限判断
        {
            this.dataGView_Main.ClearData();

            SqlStr sql = SqlStr.newSql();//创建SqlStr对象

            //if (this.selTextInpt_KSID.Value != null) // 权限判断,要不要这个功能
            //{
            //    if (selTextInpt_KSID.Value.Trim().Length > 0)
            //    {
            //        //添加查询条件及其参数
            //        sql.Add("and DEPTID = ?", selTextInpt_KSID.Value.Trim());

            //    }
            //}
            //else
            //{
            //    WJs.alert("请选择科室!");
            //    return;
            //}


            //添加查询条件及其参数
            if (this.selTextInpt_KSID.Value != null)
            {
                sql.Add("and a.DEPTID = ?", this.selTextInpt_KSID.Value);
            }
            sql.Add("and a.PLANDATE <= ?", this.dateTimePicker2.Value);

            sql.Add("and a.PLANDATE >= ?", this.dateTimePicker1.Value);


            //加载查询数据
            this.dataGView_Main.Url = "EQAskBuy_ConditionScan1";
            this.dataGView_Main.reLoad(new object[] { warecode, His.his.Choscode, His.his.Choscode }, sql);
            this.dataGView_Main.setFocus(0, 0);
        }
Beispiel #29
0
        private void button1_Click(object sender, EventArgs e) //查询
        {
            SqlStr sql = SqlStr.newSql();                      //创建SqlStr对象

            this.dataGView_Main.Url = "FindEQDict";



            if (this.yTxtBox_Name.Text.Trim().Length > 0)
            {
                //添加查询条件及其参数
                sql.Add("and ( a.EQID like ?", "%" + this.yTxtBox_Name.Text.Trim() + "%");
                sql.Add("or a.EQNAME like ?", "%" + this.yTxtBox_Name.Text.Trim() + "%");
                sql.Add("or upper(a.PYCODE) like upper(?)", "%" + this.yTxtBox_Name.Text.Trim() + "%");
                sql.Add("or upper(a.WBCODE) like upper(?)", "%" + this.yTxtBox_Name.Text.Trim() + "%");
                sql.Add("or a.SHORTNAME like ?", "%" + this.yTxtBox_Name.Text.Trim() + "%");
                sql.Add("or a.SHORTCODE like ?", "%" + this.yTxtBox_Name.Text.Trim() + "%");
                sql.Add("or a.ALIASNAME like ?", "%" + this.yTxtBox_Name.Text.Trim() + "%");
                sql.Add("or a.ALIASCODE like ?", "%" + this.yTxtBox_Name.Text.Trim() + "%");
                sql.Add(")");
            }

            this.dataGView_Main.reLoad(new object[] { His.his.Choscode }, sql);
        }
Beispiel #30
0
        ///
        /// <summary>
        ///  Save data to data block table
        /// </summary>
        ///  @param [in] dataBlockID -- the data block ID if exist. Pass 0 if not exist
        /// </param>
        ///  <returns> dataBlockID if OK </returns>
        ///  <returns> 0 if failed </returns>
        private FsID __saveData(SQLiteDatabase db, FsID dataBlockID)
        {
            ContentValues contValues = __saveData();

            try
            {
                if (dataBlockID.compare(SqlFsConst.INVALIDID) <= 0)
                {
                    // save new data
                    if (db.insert(IFileData.DTABLENAME.ToString(), null, contValues) < 0)
                    {
                        dataBlockID = SqlFsConst.INVALIDID;
                    }
                    else
                    {
                        dataBlockID = getLastInsertID(db);
                    }
                }
                else
                {
                    // update data
                    string @where = SqlStr.genWhere(new SqlStr.SqlSimpCond(IFileData.IDCOL, "=", dataBlockID));
                    if (db.update(IFileData.DTABLENAME.ToString(), contValues, @where, null) == 0)
                    {
                        dataBlockID = SqlFsConst.INVALIDID;
                    }
                }
            }
            catch (Exception e)
            {
                Log.d("IFileData.__saveData", e.Message);
                dataBlockID = SqlFsConst.INVALIDID;
            }

            return(dataBlockID);
        }