コード例 #1
0
 public ChenBenJinCangMake()
 {
     InitializeComponent();
     this.Location = new Point(0, 0);
     db            = SqlBase.GetInstance();
     init();
 }
コード例 #2
0
ファイル: SqlBase.cs プロジェクト: wrjwrjia/PCC-master
 /// <summary>
 ///  execute the procedure with params
 /// </summary>
 /// <param name="con"></param>
 /// <param name="sqlString">procedure name or sql expression</param>
 /// <param name="param">params array</param>
 /// <param name="type" >execute style</param>
 public static int ExecuteQuery(string sqlString, SqlParameter[] param, CommandType type)
 {
     if (sqlString == null || sqlString == "")
     {
         throw new Exception(nullSqlExpress);
     }
     using (SqlConnection con = SqlBase.GetConnection())
     {
         try
         {
             con.Open();
         }
         catch
         {
             throw new Exception(Sql_Connection_Err);
         }
         SqlCommand command = con.CreateCommand();
         command.CommandText = sqlString;
         command.CommandType = type;
         foreach (SqlParameter p in param)
         {
             command.Parameters.Add(p);
         }
         return((int)command.ExecuteNonQuery());
     }
 }
コード例 #3
0
        public IActionResult DBScript()
        {
            //type source name uname passwd
            M_APIResult retMod = new M_APIResult(Failed);

            try
            {
                string connStr = GetConnstr();
                DBCenter.DB = SqlBase.CreateHelper("mssql");
                DBCenter.DB.ConnectionString = SiteConfig.SiteInfo.ConnectionString = connStr;
                if (!DataConvert.CBool(GetParam("ignoreSql")))
                {
                    string sqlPath = function.VToP("/App_Data/Data.sql");
                    DBHelper.ExecuteSqlScript(GetConnstr(), sqlPath);
                }
                SiteConfig.Update();
                retMod.retcode = M_APIResult.Success;
            }
            catch (Exception ex)
            {
                retMod.retmsg = ex.Message;
                ZLLog.L("安装时出错,原因:" + ex.Message);
            }
            return(Content(retMod.ToString()));
        }
コード例 #4
0
 public static void CreateNew(string name, string password)
 {
     SqlBase.Instance("LogonSettings").Execute(
         string.Format(
             "INSERT INTO `accounts` (`login`, `password`, `banned`, `flags`) VALUES ('{0}', '{1}', '0', '44')",
             name, password));
 }
コード例 #5
0
ファイル: IQuery.cs プロジェクト: Jon2G/Xamarin.Tools
 //protected bool PreventSqlInjection;
 protected IQuery(SqlBase SQLH, string TableName)
 {
     this.SQLH       = SQLH;
     this.Parameters = new Dictionary <string, object>();
     this.TableName  = TableName;
     //this.PreventSqlInjection = false;
 }
コード例 #6
0
ファイル: MaDanMake.cs プロジェクト: tpc707494/C-Erp
 public MaDanMake()
 {
     InitializeComponent();
     this.Location = new Point(0, 0);
     db            = SqlBase.GetInstance();
     init();
 }
コード例 #7
0
ファイル: TemplateController.cs プロジェクト: baixue001/IPS
        public string LabelSql_API()
        {
            M_APIResult retMod = new M_APIResult(M_APIResult.Success);
            string      action = Request.Query["action"];

            try
            {
                switch (action)
                {
                case "tables":    //根据数据库获取表信息
                {
                }
                break;

                case "fields":    //根据当前选中的表,获取字段信息
                {
                    string    dsname = RequestEx["dsname"];
                    string    tbname = RequestEx["tbname"];
                    SqlBase   db     = B_DataSource.GetDSByType(dsname);
                    DataTable dt     = db.Field_List(tbname);
                    dt.DefaultView.Sort = "Name";
                    retMod.result       = JsonConvert.SerializeObject(dt);
                }
                break;
                }
            }
            catch (Exception ex) { retMod.retmsg = ex.Message; retMod.retcode = M_APIResult.Failed; }
            return(retMod.ToString());
        }
コード例 #8
0
        public ColorName()
        {
            InitializeComponent();
            this.TopLevel = false;
            this.Location = new Point(0, 0);
            db            = SqlBase.GetInstance();

            lblwait = new LblWait((Form)this);
            groupPanel1.ResumeLayout(false);
            groupPanel1.PerformLayout();

            Rectangle ScreenArea = Screen.GetWorkingArea(this);

            dgvEX1.BackgroundColor             = SystemColors.Window;
            dgvEX1.AutoGenerateColumns         = false;
            dgvEX1.AllowUserToAddRows          = false;
            dgvEX1.AllowUserToDeleteRows       = false;
            dgvEX1.AllowUserToResizeRows       = false;
            dgvEX1.AllowUserToAddRows          = false;                                                   //删除最后一条空白
            dgvEX1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //行高不可变
            dgvEX1.RowHeadersWidthSizeMode     = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            dgvEX1.MultiSelect   = false;
            dgvEX1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dgvEX1.EditMode      = DataGridViewEditMode.EditProgrammatically;

            var getAll = db.Queryable <T_Base>()
                         .Where(it => it.leibie == YanSe)
                         .ToList();

            ShowData(getAll);
        }
コード例 #9
0
ファイル: frmCL.cs プロジェクト: tpc707494/C-Erp
 public frmCL()
 {
     InitializeComponent();
     db = SqlBase.GetInstance();
     timerShowTime.Enabled  = true;
     timerShowTime.Interval = 1000;
     timerShowTime.Tick    += new EventHandler(this.timerShowTime_Tick);
     lblGS.Text             = UserProc.GSname + " 配方与称料控制系统";
     lblBB.Text             = "ver:" + UserProc.StrVer;
     if (Settings.Default.paraKeyB == 18)
     {
         lblBtnSch.Text = "查询料单(F1)";
         lblBtnMC.Text  = "免称扣除(F2)";
     }
     else
     {
         lblBtnSch.Text = "查询料单( • )";
         lblBtnMC.Text  = "免称扣除(上翻)";
     }
     this.dgvData.Dock        = DockStyle.Fill;
     this.txtJH.txt.TextAlign = HorizontalAlignment.Center;
     this.txtSL.txt.TextAlign = HorizontalAlignment.Center;
     this.txtZL.txt.TextAlign = HorizontalAlignment.Center;
     this.txtJH.txt.ForeColor = Color.DarkRed;
     this.txtSL.txt.ForeColor = Color.DarkRed;
     this.txtZL.txt.ForeColor = Color.DarkRed;
     this.lblDate.Text        = "";
     this.lblKeyS.Text        = "";
     this.lblTPerr.Text       = "";
 }
コード例 #10
0
ファイル: SqlBase.cs プロジェクト: wrjwrjia/PCC-master
    /// <summary>
    /// use datareader to get the data from database
    /// </summary>
    /// <param name="con">database connection object</param>
    /// <param name="sql">procedure name or sql expression</param>
    /// <returns>DataReader object</returns>
    public static SqlDataReader ExecuteDataReader(string sql, CommandType type)
    {
        if (sql == null || sql == "")
        {
            throw new Exception(nullSqlExpress);
        }
        SqlConnection con = SqlBase.GetConnection();

        try
        {
            con.Open();
        }
        catch
        {
            throw new Exception(Sql_Connection_Err);
        }
        SqlCommand command = con.CreateCommand();

        command.CommandText = sql;
        command.CommandType = type;

        SqlDataReader read = command.ExecuteReader(CommandBehavior.CloseConnection);

        return(read);
    }
コード例 #11
0
        public void MarkAsSynced(SqlBase origin)
        {
            try
            {
                SyncHistory syncHistory = new SyncHistory
                {
                    DeviceId = Daemon.Devices.Device.Current.DeviceId,
                    Guid     = this.Guid,
                    Date     = DateTime.Now
                };
                origin.Table <SyncHistory>().Delete(x => x.Guid == syncHistory.Guid);
                origin.Insert(syncHistory, string.Empty);

                //if (connection is SqlServer SQLH)
                //{
                //    SQLH.EXEC("INSERT INTO DESCARGAS_VERSIONES(ID_DESCARGA,ID_DISPOSITIVO) VALUES(@ID_DESCARGA,@ID_DISPOSITIVO)"
                //            , System.Data.CommandType.Text, false,
                //            new SqlParameter("ID_DESCARGA", Id),
                //            new SqlParameter("ID_DISPOSITIVO", Device.Current.DeviceId));
                //}
                //else if (connection is SqLite SQLHLite)
                //{
                //    SQLHLite.EXEC($"DELETE FROM VERSION_CONTROL WHERE ID=?", Id);
                //}
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex, "Al marcar como finalizada la sincronización - [{0}]", this);
            }
        }
コード例 #12
0
ファイル: SqlBase.cs プロジェクト: wrjwrjia/PCC-master
 public static DataTable ExecuteDataTable(string sql, SqlParameter[] param, CommandType type)
 {
     if (sql == null || sql == "")
     {
         throw new Exception(nullSqlExpress);
     }
     using (SqlConnection con = SqlBase.GetConnection())
     {
         try
         {
             con.Open();
         }
         catch
         {
             throw new Exception(Sql_Connection_Err);
         }
         SqlDataAdapter da = new SqlDataAdapter();
         da.SelectCommand             = new SqlCommand();
         da.SelectCommand.Connection  = con;
         da.SelectCommand.CommandText = sql;
         da.SelectCommand.CommandType = type;
         foreach (SqlParameter p in param)
         {
             da.SelectCommand.Parameters.Add(p);
         }
         DataTable dt = new DataTable();
         da.Fill(dt);
         return(dt);
     }
 }
コード例 #13
0
ファイル: FrmRHLCB.cs プロジェクト: tpc707494/C-Erp
 public FrmRHLCB()
 {
     InitializeComponent();
     bsSch   = new BindingSource();
     lblwait = new LblWait(this);
     db      = SqlBase.GetInstance();
 }
コード例 #14
0
ファイル: SqlBase.cs プロジェクト: wrjwrjia/PCC-master
 /// <summary>
 /// get the data with dataset object
 /// </summary>
 /// <param name="sql">procedure name or sql expression</param>
 /// <returns>DataSet</returns>
 public static DataSet ExecuteDataSet(string sql, CommandType type)
 {
     if (sql == null || sql == "")
     {
         throw new Exception(nullSqlExpress);
     }
     using (SqlConnection con = SqlBase.GetConnection())
     {
         try
         {
             con.Open();
         }
         catch
         {
             throw new Exception(Sql_Connection_Err);
         }
         SqlDataAdapter da = new SqlDataAdapter();
         da.SelectCommand             = new SqlCommand();
         da.SelectCommand.CommandType = type;
         da.SelectCommand.CommandText = sql;
         da.SelectCommand.Connection  = con;
         DataSet ds = new DataSet();
         da.Fill(ds);
         return(ds);
     }
 }
コード例 #15
0
ファイル: ShenChanLc.cs プロジェクト: tpc707494/C-Erp
        public ShenChanLc()
        {
            InitializeComponent();
            MaximizeBox   = false;
            this.TopLevel = false;
            this.Location = new Point(0, 0);
            dgvEX1Init();
            dgvEX2Init();

            Rectangle ScreenArea = Screen.GetWorkingArea(this);
            var       width      = (ScreenArea.Width) / Width;


            db = SqlBase.GetInstance();
            var getAll = db.Queryable <BaseList>()
                         .Where(it => it.leibie == "流程")
                         .Distinct()
                         .Select(it => new { it.itemkey })
                         .OrderBy(it => it.itemkey)
                         .ToList();

            Console.WriteLine("当前行数" + getAll.Count);

            dgvEX1.Rows.Clear();
            for (var i = 0; i < getAll.Count; i++)
            {
                var dataRowCollection = getAll[i];
                int index             = dgvEX1.Rows.Add();
                dgvEX1.Rows[index].Cells[0].Value = dataRowCollection.itemkey;
            }
        }
コード例 #16
0
 public Base()
 {
     InitializeComponent();
     this.TopLevel = false;
     this.Location = new Point(0, 0);
     db            = SqlBase.GetInstance();
 }
コード例 #17
0
ファイル: GetProjectInfos.cs プロジェクト: yangwenjie-u/cal
        public DataSet GetChiFengDate(string BH, string jydbh, string jydbhTo = "")
        {
            SqlBase sqlbase = new SqlBase(ESqlConnType.ConnectionStringCF);

            string where = "where 1=1";
            int top = 100;

            if (!string.IsNullOrEmpty(jydbh))
            {
                where = $" where   JYDBH={jydbh}";
            }
            if (!string.IsNullOrEmpty(jydbh) && !string.IsNullOrEmpty(jydbhTo))
            {
                where = $" where   JYDBH>={jydbh}";
                top   = 9999;
            }

            if (!string.IsNullOrEmpty(jydbhTo))
            {
                where += $" and  JYDBH<={jydbhTo}";
            }
            string sqlStr = $"select top {top} * from M{BH}   {where} and BGBH <>'' order by RECID DESC";

            DataSet mdata = sqlbase.ExecuteDataset(sqlStr);

            return(mdata);
        }
コード例 #18
0
        public void GetWhereTest()
        {
            var actual1 = SqlBase.GetWhere("");
            var actual2 = SqlBase.GetWhere("ID>10");

            Assert.AreEqual("", actual1);
            Assert.AreEqual(" WHERE ID>10", actual2);
        }
コード例 #19
0
 public override bool CustomUpload(SqlBase con, SqlBase targetcon, TableMapping map)
 {
     if (targetcon is not SQLServerConnection)
     {
         return(true);
     }
     return(Execute().GetAwaiter().GetResult().ToResponse().ResponseResult == APIResponseResult.OK);
 }
コード例 #20
0
ファイル: DaemonConfig.cs プロジェクト: Jon2G/Xamarin.Tools
 internal DaemonConfig(int DbVersion, SqlBase Local, SqlBase Remote, int MaxSleep = 30, bool showErrorDialog = false)
 {
     this.DbVersion       = DbVersion;
     this.Local           = Local;
     this.Remote          = Remote;
     this.MaxSleep        = MaxSleep;
     this.ShowErrorDialog = showErrorDialog;
 }
コード例 #21
0
ファイル: ChanLiangDjMake.cs プロジェクト: tpc707494/C-Erp
 public ChanLiangDjMake()
 {
     InitializeComponent();
     this.Location     = new Point(0, 0);
     db                = SqlBase.GetInstance();
     lblPIH.txt.Text   = "100%";
     lblPIH.txt.Leave += Txt_Leave;
 }
コード例 #22
0
ファイル: FrmLogin.cs プロジェクト: tpc707494/C-Erp
 public FrmLogin(bool _islock)
 {
     this.EnableGlass = false;
     this.InitializeComponent();
     //this.lblGS.Text = UserProc.GSname;
     this.islock = _islock;
     db          = SqlBase.GetInstance();
 }
コード例 #23
0
ファイル: FanXiuDjCha.cs プロジェクト: tpc707494/C-Erp
 public FanXiuDjCha()
 {
     InitializeComponent();
     lblwait  = new LblWait(this);
     TopLevel = false;
     Location = new Point(0, 0);
     db       = SqlBase.GetInstance();
 }
コード例 #24
0
 public FanXiuDjMake()
 {
     InitializeComponent();
     this.Location     = new Point(0, 0);
     db                = SqlBase.GetInstance();
     lblPIH.txt.Leave += Txt_Leave;
     //EableInput(false);
     Empty();
 }
コード例 #25
0
 public Search()
 {
     InitializeComponent();
     this.TopLevel = false;
     this.Location = new Point(0, 0);
     db            = SqlBase.GetInstance();
     lblwait       = new LblWait((Form)this);
     Column3.Tag   = (object)"行:";
 }
コード例 #26
0
 public FrmRLRK1()
 {
     InitializeComponent();
     db           = SqlBase.GetInstance();
     this.lblwait = new LblWait((Form)this);
     EditMode     = false;
     SearchMode   = false;
     RL();
 }
コード例 #27
0
        public override void SetDbName(string dbname)
        {
            SqlBase sqlBase = new SqlBase();

            sqlBase.SetDb(dbname);
            sqlConnection1.ConnectionString = sqlBase.ConnectionString;
            sqlConnection2.ConnectionString = sqlBase.ConnectionString;
            _table.Columns["Record_ID"].AutoIncrementSeed = GetLastId() + 1;
        }
コード例 #28
0
 public static DeviceInformation Get(SqlBase sql)
 {
     return(sql.Table <DeviceInformation>()
            .FirstOrDefault(x => x.DeviceId == Device.Current.DeviceId) ??
            new DeviceInformation()
     {
         DeviceId = Device.Current.DeviceId
     }.SetIsFirstLaunchTime(true).Save(sql));
 }
コード例 #29
0
ファイル: FrmDLJL.cs プロジェクト: tpc707494/C-Erp
 public FrmDLJL()
 {
     InitializeComponent();
     db            = SqlBase.GetInstance();
     this.lblwait  = new LblWait((Form)this);
     this.bsSch    = new BindingSource();
     mainColRL.Tag = "总行:";
     Search();
 }
コード例 #30
0
 public FrmUser(Bar bar)
 {
     InitializeComponent();
     this.TopLevel        = false;
     db                   = SqlBase.GetInstance();
     Bottom_Group.Visible = false;
     this._bar            = bar;
     lblwait              = new LblWait((Form)this);
 }
コード例 #31
0
ファイル: Default.aspx.cs プロジェクト: astutefox/AspNet
 protected void Page_Load(object sender, EventArgs e)
 {
     ISql t_Sql = new SqlBase();
 }