示例#1
0
 private void grid2Bind()
 {
     sqlaccess.Open();
     try
     {
         string selstr = "";
         if (this.txtcondition.Text.Trim() == string.Empty)
         {
             selstr = "";
         }
         else
         {
             selstr = " and " + (this.RadioButton1.Checked ? "ModelID like'%" + this.txtcondition.Text.Trim() + "%' " : "BugPointCode like '%" + this.txtcondition.Text.Trim() + "%'");
         }
         string tmpsql = "SELECT ModelID,BugPointCode,BugPointDsc from TA_BugPoint where 1=1 " + selstr;
         ds = sqlaccess.OpenQuerry(tmpsql);
         this.GridView2.DataSource = ds;
         this.GridView2.DataBind();
     }
     catch (Exception ex)
     {
         LogManager.Write(this, ex.Message);
     }
     finally
     {
         sqlaccess.Close();
     }
 }
示例#2
0
        /// <summary>
        /// gridview1绑定用
        /// </summary>
        private void GridBind()
        {
            try
            {
                sqlaccess.Open();
                StringBuilder sb = new StringBuilder();
                //sb.Append("SELECT ID, Name,LeaderID,planID FROM TA_Group" + ViewState["conStr"].ToString());//在html中隐了查找,这里因为没地方设置viewstate 所以注掉了
                //string tmpgid = "";
                //if (this.GridView1.Rows.Count != 0 && this.GridView1.SelectedIndex != -1)
                //{
                //    tmpgid = this.GridView1.DataKeys[this.GridView1.SelectedIndex].Value.ToString();
                //}

                sb.Append("SELECT A.ID, A.Name, A.LeaderID, R.PlanID FROM TA_Group A, TRE_Group_Plan R where A.ID=R.GroupID and A.LeaderID='" + SessionUser.ID + "'");
                ds = sqlaccess.OpenQuerry(sb.ToString());

                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#3
0
        private void GridBind()
        {
            try
            {
                sqlaccess.Open();
                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT ID, Name,LeaderID,WorkDispatch FROM TA_Group where leaderid='" + SessionUser.ID + "'");

                ds = sqlaccess.OpenQuerry(sb.ToString());

                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                //Page.RegisterClientScriptBlock("错误", "<script language=Javascript>alert('当前登录用户不领导任何班组!" + ex.Message + "');< /script>");
                Methods.AjaxMessageBox(this, "当前登录用户不领导任何班组!" + ex.Message);
                Response.Redirect("/Main/index.aspx", true);
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#4
0
        private void generTree(string ID, string SN, string ModelName)
        {
            try
            {
                this.TreeView1.Nodes.Clear();
                TreeNode root = new TreeNode("生产序列号:" + ID + " 条码:" + SN + " 品名:" + ModelName, ID);
                root.NavigateUrl = "javascript:showDetail('" + ID + "--" + SN + "','" + ID + "')";
                this.TreeView1.Nodes.Add(root);//产品根节点
                sqlaccess.Open();
                //到产品结构中取结构

                ds = sqlaccess.OpenQuerry("select t.ID,t.itemID,tm.Name from TA_Relationship t inner join (select mdl.name,tp.id  from ta_model mdl,ta_product tp where tp.modelid=mdl.id and tp.modeltype=mdl.modeltype and mdl.modeltype='2') tm on t.itemid=tm.id where t.id='" + ID + "'");//Modeltype=2 只显示部件
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow r in ds.Tables[0].Rows)
                    {
                        TreeNode node = new TreeNode("生产序列号:" + r["itemID"].ToString() + " 品名:" + r["Name"].ToString(), r["itemID"].ToString()); //这里控制了只显示了部件的序列号
                        node.NavigateUrl = "javascript:showDetail('" + r["itemID"].ToString() + r["Name"].ToString() + "','" + r["itemID"].ToString() + "')";
                        this.AddNode(node);                                                                                                      //由于这里控制了只能添加部件,故这addnode方法只添加物料
                        root.ChildNodes.Add(node);                                                                                               //添加部件
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#5
0
        protected void GridBind(string ProductID)
        {
            sqlaccess.Open();
            try
            {
                string tmpsql = "  SELECT t.ProductID, t.DetectProcess, t.DetectEmployeeID AS dEmpID,"
                                + "  tdu.Name AS dEmpName, t.DetectTime AS FindTime, t.Exception,t.RepairEmployeeID,"
                                + "  tru.Name AS rEmpName, tt.Bug, t.BugPointCode, t.RepairInfo"
                                + "  FROM TB_RepairRecord AS t INNER JOIN"
                                + "  TA_Employee AS tdu ON t.DetectEmployeeID = tdu.ID INNER JOIN"
                                + "  TA_Employee AS tru ON t.RepairEmployeeID = tru.ID INNER JOIN"
                                + "  TA_BugType AS tt ON t.BugID = tt.ID INNER JOIN"
                                + "  (SELECT ID, ModelID"
                                + "  FROM TA_Product"
                                + "  WHERE (ID = '" + ProductID + "')) AS tm ON t.ProductID = tm.ID "
                                + "  WHERE (t.ProductID = '" + ProductID + "')"
                                + "  ORDER BY t.DetectTime DESC";

                ds = sqlaccess.OpenQuerry(tmpsql);
                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#6
0
    public void onYesBtn()
    {
        string username       = inputUser.text.Trim();
        string password       = inputPwd.text.Trim();
        string email          = inputEmail.text.Trim();
        string reponsecontent = httpscript.PostHttp(RegUrl, "username="******"&password="******"&email=" + email);

        Debug.Log(reponsecontent);
        if (reponsecontent != "failed")
        {
            Debug.Log("注册成功");
            try {
                SqlAccess sql = new SqlAccess();
                DataSet   ds  = sql.InsertInto("rank", new string[] { "userName" }, new string[] { username });
                sql.Close();
            }
            catch
            {
                Debug.Log("数据库操作出错");
            }
        }
        else
        {
            Debug.Log("注册失败");
        }
    }
示例#7
0
        private bool isAccountExist(string id, string Name)
        {
            bool      isExist   = false;
            SqlAccess accesstmp = new SqlAccess();
            string    queryStr  = "";

            try
            {
                if ((bool)ViewState["newMark"])//新建态
                {
                    queryStr = "select name from TA_Employee where id='" + id + "'";
                }
                else //更新态
                {
                    //queryStr = "select name from TA_Employee where id<>'" + id + "'";
                    return(false);
                }
                accesstmp.Open();
                ds = accesstmp.OpenQuerry(queryStr);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    isExist = true;
                }
                return(isExist);
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
                return(true);
            }
            finally
            {
                accesstmp.Close();
            }
        }
示例#8
0
 void OnDestroy()
 {
     if (sql != null)
     {
         sql.Close();
     }
 }
示例#9
0
        protected void btnquery_Click(object sender, EventArgs e)
        {
            string sql = "SELECT ProcessGraph FROM TA_Procedure WHERE Name = '" + this.txtcondition.Text.Trim() + "'";

            DataSet myds = Methods.getInforBySql(sql);

            if (myds != null && myds.Tables[0].Rows.Count > 0)
            {
                DataRow myrow     = myds.Tables[0].Rows[0];
                string  Procedure = myrow["ProcessGraph"].ToString();

                SqlCommand cmd = new SqlCommand();
                cmd.Parameters.AddWithValue("@p1", Procedure);
                cmd.Parameters.AddWithValue("@p2", ViewState["ProcedureID"]);
                cmd.CommandText = "UPDATE TA_Procedure SET ProcessGraph = @p1 WHERE (ID = @p2)";

                sqlaccess.Open();
                sqlaccess.ExecuteQuerryNOTransaction(cmd);
                sqlaccess.Close();
            }
            else
            {
                Methods.AjaxMessageBox(this, "未找到此工艺流程!");
                return;
            }
            Methods.Write(this, "window.parent.closeit();");
        }
示例#10
0
    public void SelectButtonOnClick()
    {
        SqlAccess sql = new SqlAccess();

        string[] selMessage = new string[3];
        DataSet  ds         = sql.Select(inputSelTable.text);

        if (ds != null)
        {
            DataTable table = ds.Tables[0];
            int       i     = 1;
            foreach (DataRow dataRow in table.Rows)
            {
                selectResult.text += i + ":";
                i++;
                foreach (DataColumn dataColumn in table.Columns)
                {
                    //Debug.Log(dataRow[dataColumn]);
                    selectResult.text += "    " + dataRow[dataColumn].ToString();
                }
                selectResult.text += "\n";
            }
        }
        sql.Close();
    }
示例#11
0
    private void TestSQL()
    {
        try
        {
            SqlAccess sql = new SqlAccess();
            //sql.CreateTableAutoID("user",new string[]{"id","name","qq","email","blog"}, new string[]{"int","text","text","text","text"});
            //sql.CreateTable("user",new string[]{"name","qq","email","blog"}, new string[]{"text","text","text","text"});
            sql.InsertInto("user", new string[] { "name", "qq", "email", "blog" }, new string[] { "circle", "289187120", "*****@*****.**", "circle.com" });
            sql.InsertInto("user", new string[] { "name", "qq", "email", "blog" }, new string[] { "circle01", "34546546", "*****@*****.**", "circle01.com" });

            DataSet ds = sql.SelectWhere("user", new string[] { "name", "qq" }, new string[] { "id" }, new string[] { "!=" }, new string[] { "1" });
            if (ds != null)
            {
                DataTable table = ds.Tables[0];
                foreach (DataRow row in table.Rows)
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        Debug.Log(row[column]);
                    }
                }
            }
            sql.UpdateInto("user", new string[] { "name", "qq" }, new string[] { "'circle01'", "'11111111'" }, "email", "'*****@*****.**'");
            sql.Delete("user", new string[] { "id", "email" }, new string[] { "1", "'*****@*****.**'" });
            sql.Close();
        }
        catch (Exception e)
        {
            Error = e.Message;
        }
    }
示例#12
0
    public void SelectButtonOnClick()
    {
        SqlAccess sql = new SqlAccess();

        string[] selMessage = new string[3];
        //string[] selCondition = new string[3];
        //string[] selConditionValue = new string[3];
        selMessage = inputSelMessage.text.Split(',');
        //selCondition = inputSelCondition.text.Split(',');
        //selConditionValue = inputSelConditionValue.text.Split(',');
        DataSet ds = sql.Select(inputSelTable.text, selMessage, new string[] { inputSelCondition.text }, new string[] { "=" }, new string[] { inputSelConditionValue.text });

        if (ds != null)
        {
            DataTable table = ds.Tables[0];
            int       i     = 1;
            foreach (DataRow dataRow in table.Rows)
            {
                foreach (DataColumn dataColumn in table.Columns)
                {
                    //Debug.Log(dataRow[dataColumn]);
                    selectResult.text += "\n" + i + ":" + dataRow[dataColumn].ToString();
                    i++;
                }
            }
        }
        sql.Close();
    }
示例#13
0
    public static string sbyaccount(string accout)
    {
        try
        {
            SqlAccess sql = new SqlAccess();

            DataSet ds = sql.SelectWhere("user", new string[] { "PSW" }, new string[] { "Account" }, new string[] { "=" }, new string[] { accout });
            if (ds != null)
            {
                DataTable table = ds.Tables[0];

                foreach (DataRow row in table.Rows)//设想只会有一个结果
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        Debug.Log(row[column].ToString());
                        return(row[column].ToString());
                    }
                }
            }
            sql.Close();
        }
        catch (Exception e)
        {
            Debug.Log(e.Message);
        }
        return(null);
    }
示例#14
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //没有实现
                sqlaccess.Open();
                sqlaccess.BeginTransaction();
                SqlCommand cmd = new SqlCommand();

                cmd.Parameters.AddWithValue("@p1", this.lblProductID.Text);
                cmd.Parameters.AddWithValue("@p2", txtPlanIDNew.Text);
                cmd.Parameters.AddWithValue("@p3", ViewState["procedureid"].ToString());//取得流程号 由品号
                cmd.Parameters.AddWithValue("@p4", this.txtRPInfo.Text.Trim() + System.DateTime.Now.ToString("yyyy年MM月dd日 HH时mm分ss秒") + ",客退登记,原计划单号:" + this.lblOldPlanID.Text);
                cmd.CommandText = "update ta_product set planid=@p2,ProcedureID=@p3,remark=remark+@p4 where id=@p1";

                sqlaccess.ExecuteQuerry(cmd);

                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@p1", this.lblProductID.Text);
                //cmd.Parameters.AddWithValue("@p2",this.lblModelID.Text);
                cmd.CommandText = "delete TB_ProcedureState where ProductID=@p1";

                sqlaccess.ExecuteQuerry(cmd);

                sqlaccess.Commit();

                this.lblModelID.Text   = "----";
                this.lblOldPlanID.Text = "----";
                this.lblProductID.Text = "----";
                this.lblSN.Text        = "----";
                this.txtRPInfo.Text    = "";
                this.txtID.Text        = "";

                ctrlState(false);
            }
            catch (Exception ex)
            {
                sqlaccess.Rollback();
                LogManager.Write("", ex.Message);
                Methods.AjaxMessageBox(this, "向数据库中插入记录的时候出现异常!");
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#15
0
        protected void GridBind()
        {
            sqlaccess.Open();
            try
            {
                string tmpsql = "";

                if (this.RadioButton3.Checked)
                {
                    tmpsql = "select t.sn,tm.name,tm.code from ta_product t,ta_model tm where t.modelid = tm.id and t.id ='" + this.txtID.Text.Trim() + "'";
                }
                if (this.RadioButton4.Checked)
                {
                    tmpsql = "select t.sn,tm.name,tm.code from ta_product t,ta_model tm where t.modelid = tm.id and t.sn ='" + this.txtID.Text.Trim() + "'";
                }

                ds = sqlaccess.OpenQuerry(tmpsql);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    //this.lblID.Text = ViewState["conStr"].ToString();
                    this.lblSN.Text        = ds.Tables[0].Rows[0]["SN"].ToString();
                    this.lblModelName.Text = ds.Tables[0].Rows[0]["Name"].ToString();
                    this.lblCode.Text      = ds.Tables[0].Rows[0]["Code"].ToString();
                }
                else
                {
                    this.lblID.Text        = "";
                    this.lblSN.Text        = "";
                    this.lblModelName.Text = "";
                    this.lblCode.Text      = "";
                    this.GridView1.Visible = false;
                    return;
                }
                this.GridView1.Visible = true;
                tmpsql = "select t.productid,t.Process,tdu.Name EmpName,t.BeginTime,t.EndTime"
                         + ",DATEDIFF(s, t.BeginTime, t.EndTime)/(60+0.00) usetime,t.Dispatch,t.result"
                         + ",case when t.result=0 then '通过' when t.result=1 then t.Exception end resultstr when t.result=2 then '通过',t.data,t.dataID"
                         + "  from TB_ProcedureHistory t,ta_employee tdu"
                         + "  where t.employeeid=tdu.id   " + ViewState["conStr"].ToString()
                         + "  order by t.begintime desc";

                ds = sqlaccess.OpenQuerry(tmpsql);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    this.lblID.Text = ds.Tables[0].Rows[0]["productid"].ToString();
                }
                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#16
0
        /// <summary>
        /// 删除时触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            if (this.GridView1.EditIndex != -1)
            {
                this.lblMsg.Visible = true;
                return;
            }
            Label  lbl    = (Label)this.GridView1.Rows[e.RowIndex].Cells[0].FindControl("lblid"); //强行转换为lable控件
            string delstr = "delete from TA_Model  where id='" + lbl.Text + "'";                  //取编号值

            try
            {
                sqlaccess.Open();
                sqlaccess.BeginTransaction();
                sqlaccess.ExecuteQuerry(delstr);
                string logStr = "删除品号[" + lbl.Text + "] ## " + delstr;
                Methods.WriteOprationLog(SessionUser.ID, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), logStr);

                sqlaccess.Commit();
                LogManager.WriteOprationLog(SessionUser.DetailInfo, delstr);
                this.GridView1.EditIndex = -1;
                this.lblMsg.Visible      = false;
                //删除后重新绑定
                this.GridBind();
            }
            catch (Exception ex)
            {
                if (ex.GetType().ToString().Equals("System.Data.SqlClient.SqlException") && ((SqlException)ex).ErrorCode == -2146232060)
                {
                    sqlaccess.Rollback();
                    this.lblMsg.Text    = "尚有其它表的记录与它相关联,不能删除!";
                    this.lblMsg.Visible = true;
                }
                else
                {
                    LogManager.Write(this, ex.ToString());
                }
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#17
0
 private void GridBind()
 {
     sqlaccess.Open();
     try
     {
         //如果已经定义过流程,则不允许编辑
         string tmpsql = "SELECT ModelID,Name,ID,ProcessConfig,ProcessGraph,case when ProcessConfig is null then 'true' else 'false' end EditState,case when ProcessConfig is null then '不完整' else '完整' end State from TA_Procedure where 1=1 " + ViewState["conStr"].ToString() + " order by id desc";
         ds = sqlaccess.OpenQuerry(tmpsql);
         this.GridView1.DataSource = ds;
         this.GridView1.DataBind();
     }
     catch (Exception ex)
     {
         LogManager.Write(this, ex.Message);
     }
     finally
     {
         sqlaccess.Close();
     }
 }
示例#18
0
        private DataSet getDS()
        {
            try
            {
                sqlaccess.Open();
                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT ID,SN,ModelID,PlanID,remark,FoundTime,ProcedureID from TA_Product where 1<>1 " + ViewState["conStr"].ToString());//由此取得结构不显示记录

                ds = sqlaccess.OpenQuerry(sb.ToString());
                return(ds);
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
                return(null);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#19
0
        private void GridBind()
        {
            sqlaccess.Open();
            try
            {
                string tmpsql = "";
                tmpsql = " select t.id planid,t.modelid,tm.name modelName,tm.code from ta_plan t,ta_model tm where t.modelid = tm.id and t.state= 2 order by t.FoundTime desc ";

                ds = sqlaccess.OpenQuerry(tmpsql);
                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#20
0
        protected void btnSaveRcd_Click(object sender, EventArgs e)
        {
            try
            {
                sqlaccess.Open();
                sqlaccess.BeginTransaction();
                for (int i = 0; i < ((DataTable)ViewState["dt"]).Rows.Count; i++)
                {
                    if (((DataTable)ViewState["dt"]).Rows[i]["upid"].ToString() == "" ||
                        ((DataTable)ViewState["dt"]).Rows[i]["dnid"].ToString() == ""
                        )
                    {
                        Methods.AjaxMessageBox(this, "换上或换下的序列号不能为空!"); return;
                    }
                    SqlCommand cmd = new SqlCommand();
                    cmd.Parameters.AddWithValue("@p1", ViewState["productID"].ToString());
                    cmd.Parameters.AddWithValue("@p2", ((DataTable)ViewState["dt"]).Rows[i]["upid"].ToString());
                    cmd.Parameters.AddWithValue("@p3", ((DataTable)ViewState["dt"]).Rows[i]["dnid"].ToString());

                    cmd.CommandText = "update ta_relationship set itemid=@p2 where id=@p1 and itemid=@p3 ";

                    sqlaccess.ExecuteQuerry(cmd);
                }
                sqlaccess.Commit();
                this.txtDownID.Text = this.txtUPID.Text = this.txtProductID.Text = "";
                ((DataTable)ViewState["dt"]).Clear();//清空表中的数据
                this.GridView1.DataSource = (DataTable)ViewState["dt"];
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                sqlaccess.Rollback();
                Methods.AjaxMessageBox(this, "保存的过程中出现异常!");
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#21
0
        private void generRSTree(string ID, string Name)
        {
            try
            {
                this.TreeStructure.Nodes.Clear();
                //TreeNode root = new TreeNode(ID, ID);
                TreeNode root = new TreeNode("品名:" + Name + " 序列号" + ID, ID);
                //root.NavigateUrl = "javascript:showDetail('" + ID + Name + "','" + ID + "')";
                this.TreeStructure.Nodes.Add(root);//产品根节点
                sqlaccess.Open();
                //到产品结构中取结构

                ds = sqlaccess.OpenQuerry("select t.ID,t.itemID,tm.Name from TA_Relationship t left outer join ta_model tm on SUBSTRING(t.itemid,1," + Len + ")=tm.id  where t.ID='" + ID + "'");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow r in ds.Tables[0].Rows)
                    {
                        //TreeNode node = new TreeNode(r["itemID"].ToString(), r["itemID"].ToString());
                        TreeNode node = new TreeNode("品名:" + r["Name"].ToString() + " 序列号:" + r["itemID"].ToString(), r["itemID"].ToString());
                        //node.NavigateUrl = "javascript:showDetail('" + r["itemID"].ToString() + r["Name"].ToString() + "','" + r["itemID"].ToString() + "')";
                        this.AddRSNode(node);
                        root.ChildNodes.Add(node);//添加部件或物料
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#22
0
        protected void GridBind()
        {
            sqlaccess.Open();
            try
            {
                string tmpsql = "";

                if (this.RadioButton1.Checked)
                {
                    tmpsql = "select t.id,t.sn,tm.name,tm.code from ta_product t,ta_model tm where t.modelid=tm.id and t.id ='" + this.txtcondition.Text.Trim() + "'";
                }
                if (this.RadioButton2.Checked)
                {
                    tmpsql = "select t.id,t.sn,tm.name,tm.code from ta_product t,ta_model tm where  t.modelid=tm.id and  t.sn ='" + this.txtcondition.Text.Trim() + "'";
                }

                ds = sqlaccess.OpenQuerry(tmpsql);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    this.lblPID.Text    = ds.Tables[0].Rows[0]["ID"].ToString();
                    this.lblSN.Text     = ds.Tables[0].Rows[0]["SN"].ToString();
                    this.lblName.Text   = ds.Tables[0].Rows[0]["Name"].ToString();
                    this.lblDaiHao.Text = ds.Tables[0].Rows[0]["Code"].ToString();
                }
                else
                {
                    this.lblPID.Text       = "";
                    this.lblSN.Text        = "";
                    this.lblName.Text      = "";
                    this.lblDaiHao.Text    = "";
                    this.GridView1.Visible = false;
                    return;
                }
                this.GridView1.Visible = true;
                tmpsql = "  select t.productid,t.Process,t.DataID,th.Data,th.result,case when th.result=0 then '通过' when th.result=1 then th.exception end resultstr "
                         + "  from TB_ProcedureState t,TB_ProcedureHistory th"
                         + "  where t.productid=th.productid and t.process=th.process and t.dataid=th.dataid  " + ViewState["conStr"].ToString()
                         + " order by th.begintime ";

                ds = sqlaccess.OpenQuerry(tmpsql);
                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#23
0
 private void gridBind()
 {
     try
     {
         sqlaccess.Open();
         //SqlCommand cmd = new SqlCommand();
         //cmd.Parameters.AddWithValue("@p1","'%"+this.txtcondition.Text.Trim()+"%'");
         //cmd.CommandText = "select t.*,tm.name  from TA_Product t left outer join ta_model tm on t.ModelID=tm.ID " + ViewState["conStr"].ToString();
         string sql = "select t.*,tm.name  from TA_Product t left outer join ta_model tm on t.ModelID=tm.ID " + ViewState["conStr"].ToString(); //从产品表里查产品,然后在界面上点击的时候结合结构表 构建产品列表
         ds = sqlaccess.OpenQuerry(sql + " and tm.modeltype=1");                                                                                //表示只查看产品的信息
         this.GridView1.DataSource = ds;
         this.GridView1.DataBind();
     }
     catch (Exception ex)
     {
         LogManager.Write(this, ex.Message);
     }
     finally
     {
         sqlaccess.Close();
     }
 }
示例#24
0
        private void GridBind()
        {
            try
            {
                sqlaccess.Open();
                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT Name, Version FROM TB_SoftwareVersion" + ViewState["conStr"].ToString());

                ds = sqlaccess.OpenQuerry(sb.ToString());

                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#25
0
        private void GridBind()
        {
            try
            {
                sqlaccess.Open();
                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT ID, Name,LeaderID,WorkDispatch FROM TA_Group" + ViewState["conStr"].ToString());

                ds = sqlaccess.OpenQuerry(sb.ToString());

                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#26
0
        ///// <summary>
        ///// 分页时处理
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        //{
        //    if (this.GridView1.EditIndex != -1)
        //    {
        //        this.lblMsg.Visible = true;
        //        return;
        //    }
        //    this.GridView1.PageIndex = e.NewPageIndex;//页面索引重新给定
        //    this.GridBind();
        //}


        /// <summary>
        /// 绑定grid
        /// </summary>
        private void GridBind()
        {
            try
            {
                sqlaccess.Open();
                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT t.*,case when plantype=1 then '常规' when plantype=2 then '客退' end plantypestr,case when t.state=1 then '初始' when t.state=2 then '激活' else '关闭' end statestr ,tp.Procedureid pid from TA_Plan t left outer join tc_planProcedure tp on t.id=tp.planid and t.modelid =tp.modelid  where  1=1 " + ViewState["conStr"].ToString() + " order by FoundTime desc");

                ds = sqlaccess.OpenQuerry(sb.ToString());

                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#27
0
        private void GridBind()
        {
            try
            {
                sqlaccess.Open();
                StringBuilder sb = new StringBuilder();
                //sb.Append("SELECT * from TA_Employee where state<>2 and id not in(select distinct(leaderid) from ta_group) and id not in(select distinct(Employeeid) from TRE_Group_Employee)"+ViewState["conStr"].ToString() );//
                sb.Append("SELECT * from TA_Employee where state<>2 and id not in(select distinct(Employeeid) from TRE_Group_Employee)" + ViewState["conStr"].ToString());//

                ds = sqlaccess.OpenQuerry(sb.ToString());

                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#28
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Label        txtID = (Label)this.GridView1.Rows[e.RowIndex].FindControl("txtID");
            CheckBoxList ckl   = (CheckBoxList)this.GridView1.Rows[e.RowIndex].FindControl("ckblstRight");

            try
            {
                sqlaccess.Open();
                sqlaccess.BeginTransaction();
                string strdel = "delete TRE_Employee_Role where EmployeeID='" + txtID.Text + "'";
                sqlaccess.ExecuteQuerry(strdel);
                LogManager.WriteOprationLog(SessionUser.DetailInfo, strdel);

                foreach (ListItem item in ckl.Items)
                {
                    if (item.Selected)
                    {
                        string insertStr = "insert into TRE_Employee_Role (EmployeeID,Role) values ('" + txtID.Text + "','" + item.Value + "')";
                        sqlaccess.ExecuteQuerry(insertStr);
                        LogManager.WriteOprationLog(SessionUser.DetailInfo, insertStr);
                    }
                }

                sqlaccess.Commit();
                this.GridView1.EditIndex = -1;
                this.lblMsg.Visible      = false;
                this.GridBind();
            }
            catch (Exception ex)
            {
                LogManager.Write(this, ex.Message);
            }
            finally
            {
                sqlaccess.Close();
            }
        }
示例#29
0
    private void register()
    {
        try
        {
            SqlAccess sql = new SqlAccess();

            long uniqueIdLong   = GuidToLongID();
            Debug.Log(uniqueIdLong);

            DataSet ds = sql.InsertInto("user", new string[] { uniqueIdLong.ToString(), username.text, account.text, psw.text });

            sql.Close();
        }
        catch (Exception e)
        {
            Debug.Log(e.Message);

        }
    }
示例#30
0
    void Start()
    {
        try
        {
            sql = new  SqlAccess();



            //	 sql.CreateTableAutoID("momo",new string[]{"id","name","qq","email","blog"}, new string[]{"int","text","text","text","text"});
            sql.CreateTable("momo", new string[] { "name", "qq", "email", "blog" }, new string[] { "text", "text", "text", "text" });
            sql.InsertInto("momo", new string[] { "name", "qq", "email", "blog" }, new string[] { "xuanyusong", "289187120", "*****@*****.**", "xuanyusong.com" });
            sql.InsertInto("momo", new string[] { "name", "qq", "email", "blog" }, new string[] { "ruoruo", "34546546", "*****@*****.**", "xuanyusong.com" });



            DataSet ds = sql.SelectWhere("momo", new string[] { "name", "qq" }, new string [] { "name" }, new string [] { "=" }, new string [] { "xuanyusong" });
            if (ds != null)
            {
                DataTable table = ds.Tables[0];


                foreach (DataRow row in table.Rows)
                {
                    Debug.Log(row[0]);
                    foreach (DataColumn column in table.Columns)
                    {
                        Debug.Log(row[column]);
                    }
                }
            }



            // sql.UpdateInto("momo",new string[]{"name","qq"},new string[]{"'ruoruo'","'11111111'"}, "email", "'*****@*****.**'"  );

            //sql.Delete("momo",new string[]{"id","email"}, new string[]{"1","'*****@*****.**'"}  );
            sql.Close();
        }catch (Exception e)
        {
            Error = e.Message;
        }
    }