Exemplo n.º 1
0
        public bool add(Car entity)
        {
            string sqlstr = String.Format(@"insert into t_c_carinfo(carid,num,createdate,createuser) values('{0}','{1}','{2}','{3}')", entity.CarNO, entity.Num, entity.CreateDate, entity.CreateUser);

            MyDataOp db = new MyDataOp(sqlstr);
            return db.ExecuteCommand();
        }
Exemplo n.º 2
0
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[3].Text;
        string strSql;

        strSql = "select * from t_M_AnalysisItemEx where id = '" + strSelectedId + "'";
        DataSet ds = new MyDataOp(strSql).CreateDataSet();

        if (ds.Tables.Count == 1)
        {
            strSql = "DELETE FROM t_M_AnalysisItemEx WHERE id = '" + strSelectedId + "'";
            MyDataOp mdo = new MyDataOp(strSql);
            if (mdo.ExecuteCommand())
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
            }
            Query();
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('没有该项目类型,数据删除失败!!')", true);
        }
    }
Exemplo n.º 3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool delete(string id)
        {
            string   sqlstr = String.Format(@"delete from t_c_outdetail where id='{0}'", id);
            MyDataOp db     = new MyDataOp(sqlstr);

            return(db.ExecuteCommand());
        }
Exemplo n.º 4
0
        public bool update(Car entity)
        {
            string sqlstr = String.Format(@"update t_c_carinfo set num='{0}',updatedate='{1}',updateuser='******' where carid='{3}'",  entity.Num, entity.UpdateDate, entity.UpdateUser,entity.CarNO);

            MyDataOp db = new MyDataOp(sqlstr);
            return db.ExecuteCommand();
        }
Exemplo n.º 5
0
        public bool delete(string id)
        {
            string sqlstr = String.Format(@"delete from t_c_carinfo where carid='{0}'", id);

            MyDataOp db = new MyDataOp(sqlstr);
            return db.ExecuteCommand();
        }
Exemplo n.º 6
0
    protected void grdvw_drawList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_drawList.Rows[e.RowIndex].Cells[2].Text;
        strDrawId     = grdvw_drawList.Rows[e.RowIndex].Cells[1].Text;
        string namelist = grdvw_drawList.Rows[e.RowIndex].Cells[5].Text;
        string strSql;

        string[] deletelist = new string[4];
        int      i          = 0;

        strSql = "DELETE FROM t_DrawSample WHERE id = '" + strDrawId + "'";
        deletelist.SetValue(strSql, i++);
        strSql = "DELETE FROM t_DrawSampleDetail WHERE DrawID = '" + strDrawId + "'";
        deletelist.SetValue(strSql, i++);
        strSql = "update t_MonitorItemDetail set flag=0,fxDanID=0 where fxDanID='" + strDrawId + "'";
        deletelist.SetValue(strSql, i++);

        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(i, deletelist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        string logstr = "insert into t_Y_LogInfo(functionid,LogMessage,LogDate,UserID)values('79','删除样品领用记录" + strSelectedId + strDrawId + namelist + "',getdate(),'" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";

        mdo.ExecuteCommand(logstr);
        DrawList();
        Query();
    }
Exemplo n.º 7
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool update(OutCar entity)
        {
            string sqlstr = String.Format(@"update t_c_outinfo set carid='{0}',updatedate='{1}',updateuser='******',destn='{3}',remark='{4}',outstart='{5}',outend='{6}',driver='{7}' where id='{8}'", entity.CarNO, entity.UpdateDate, entity.UpdateUser, entity.Destn, entity.Remark, entity.OutStart, entity.OutEnd, entity.Driver, entity.ID);

            MyDataOp db = new MyDataOp(sqlstr);

            return(db.ExecuteCommand());
        }
Exemplo n.º 8
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool update(Person entity)
        {
            string sqlstr = String.Format(@"update t_c_outdetail set name='{0}',updatedate='{1}',updateuser='******',destn='{3}',remark='{4}' where id='{5}'", entity.Name, entity.CreateDate, entity.CreateUser, entity.Destn, entity.Remark, entity.ID);

            MyDataOp db = new MyDataOp(sqlstr);

            return(db.ExecuteCommand());
        }
Exemplo n.º 9
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool add(Person entity)
        {
            string sqlstr = String.Format(@"insert into t_c_outdetail(name,destn,remark,createdate,createuser,outid) values('{0}','{1}','{2}','{3}','{4}','{5}')", entity.Name, entity.Destn, entity.Remark, entity.CreateDate, entity.CreateUser, entity.OutID);

            MyDataOp db = new MyDataOp(sqlstr);

            return(db.ExecuteCommand());
        }
Exemplo n.º 10
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (btn_OK.Text == "编辑")
        {
            AllTxtCanWrite();
            btn_OK.Text   = "确定";
            lbl_Type.Text = "编辑";
        }
        else
        {
            #region 当按钮文字为“确定”时,执行添加或编辑操作

            if (txt_date.Text.Trim() == string.Empty || txt_ulog.Text.Trim() == string.Empty)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('信息填写不完整!');", true);
                return;
            }

            //添加新纪录
            if (lbl_Type.Text == "添加")
            {
                string   strSql    = @"insert into t_R_UserLog
                        (name,ulog,utime,dtime,uid)  
                        values('" + txt_name.Text.Trim() + "','" + txt_ulog.Text.Trim() + "','" + DateTime.Now.ToString() + "','" + txt_date.Text.Trim() + "','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";
                MyDataOp mdo       = new MyDataOp(strSql);
                bool     blSuccess = mdo.ExecuteCommand();
                if (blSuccess == true)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加成功!');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加失败!');", true);
                }
                Query();
            }

            //编辑记录
            if (lbl_Type.Text == "编辑")
            {
                string   strSql    = @"update t_R_UserLog 
                            set ulog='" + txt_ulog.Text.Trim() + "',dtime='" + txt_date.Text.Trim() + "' where id = '" + strSelectedId + "'";
                MyDataOp mdo       = new MyDataOp(strSql);
                bool     blSuccess = mdo.ExecuteCommand();
                if (blSuccess == true)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑成功!');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据编辑失败!');", true);
                }
                //CleanAllText();
                Query();
            }
            #endregion
        }
    }
Exemplo n.º 11
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (btn_OK.Text == "编辑")
        {
            AllTxtCanWrite();
            btn_OK.Text   = "确定";
            lbl_Type.Text = "编辑";
        }
        else
        {
            #region 当按钮文字为“确定”时,执行添加或编辑操作

            //添加新纪录
            if (lbl_Type.Text == "添加")
            {
                string   strSql    = @"insert into t_行业信息
                        (descs,code)  
                        values('" + txt_hy.Text + "','" + txt_hyCode.Text + "')";
                MyDataOp mdo       = new MyDataOp(strSql);
                bool     blSuccess = mdo.ExecuteCommand();
                if (blSuccess == true)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加成功!');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加失败!');", true);
                }
                txt_hy.Text     = "";
                txt_hyCode.Text = "";
                Query();
            }

            //编辑记录
            if (lbl_Type.Text == "编辑")
            {
                string   strSql    = @"update t_行业信息 
                            set descs='" + txt_hy.Text + "',des='" + txt_hy.Text + "',code = '" + txt_hyCode.Text + "' where id = '" + strSelectedId + "'";
                MyDataOp mdo       = new MyDataOp(strSql);
                bool     blSuccess = mdo.ExecuteCommand();
                if (blSuccess == true)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑成功!');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑失败!');", true);
                }
                txt_hy.Text     = "";
                txt_hyCode.Text = "";
                Query();
            }
            #endregion
        }
    }
Exemplo n.º 12
0
    void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
    {
        string strSql, strTmp;

        strTmp = eventArgument;



        strSql = "update  t_chart_type set line='" + linepoint + strTmp + "' where id=" + drop_List.SelectedValue + "";
        MyDataOp mdo = new MyDataOp(strSql);

        mdo.ExecuteCommand();
    }
Exemplo n.º 13
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        string strFlag = Verify();

        if (strFlag != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true);
        }
        else
        {
            #region 添加新纪录
            if (lbl_Type.Text == "添加")
            {
                string   strSql    = @"insert into t_操作员级别
                    (级别名称)  
                    values('" + txt_levelName.Text.Trim() + "')";
                MyDataOp mdo       = new MyDataOp(strSql);
                bool     blSuccess = mdo.ExecuteCommand();
                if (blSuccess == true)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加成功!');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加失败!');", true);
                }
            }
            #endregion

            #region 编辑记录
            if (lbl_Type.Text == "编辑")
            {
                string strSql = @"update t_操作员级别 
                        set 级别名称='" + txt_levelName.Text.Trim() +
                                "' where 级别='" + strSelectedId + "'";
                MyDataOp mdo       = new MyDataOp(strSql);
                bool     blSuccess = mdo.ExecuteCommand();
                if (blSuccess == true)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑成功!');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑失败!');", true);
                }
            }

            #endregion
            Query();
        }
    }
Exemplo n.º 14
0
    protected void btn_delete_Click(object sender, EventArgs e)
    {
        string strSql, strTmp;

        strTmp = "";
        strSql = "update t_chart_type set line='" + strTmp + "' where id=" + drop_List.SelectedValue + "";
        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.ExecuteCommand())
        {
            btn_search_Click(null, null);
            Response.Write("<script language='javascript'>alert('删除成功!');</script>");
        }
    }
Exemplo n.º 15
0
    //审核

    protected void btn_sh_Click(object sender, EventArgs e)
    {
        if (btn_sh.Text == "编辑")
        {
            AllTxtCanWrite();
            btn_sh.Text   = "审核";
            lbl_Type.Text = "审核";
        }
        else
        {
            #region 当按钮文字为“确定”时,执行添加或编辑操作
            //if (txt_date.Text.Trim()==string.Empty||txt_time1.Text.Trim() == string.Empty || txt_time2.Text.Trim() == string.Empty || txt_num.Text.Trim() == string.Empty)
            //{
            //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('信息填写不完整!');", true);
            //    return;
            //}
            //try
            //{
            //    double num = double.Parse(txt_num.Text);
            //}
            //catch {
            //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('小时数必须为数值型!');", true);

            //}
            //string period = txt_time1.Text + "-" + txt_time2.Text;

            //编辑记录
            if (lbl_Type.Text == "审核")
            {
                string   strSql    = @"update t_R_OTUserLog 
                            set flag='" + drop_flag.SelectedValue.ToString() + "',remark='" + txt_remark.Text + "',checkuser='******' ,checkdate=getdate() where id = '" + strSelectedId + "'";
                MyDataOp mdo       = new MyDataOp(strSql);
                bool     blSuccess = mdo.ExecuteCommand();
                if (blSuccess == true)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据审核成功!');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据审核失败!');", true);
                }
                //CleanAllText();
                Query();
            }
            #endregion
        }
    }
Exemplo n.º 16
0
    //保存
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        string strFlag = Verify();

        if (strFlag != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true);
        }
        else
        {
            #region 编辑记录
            string strSql = "";
            //判断是否为第一次保存
            string  selectidstr = "select * from t_Y_Detail where itemid='" + strSelectedId + "' and flag='0' and statusid='9'";
            DataSet dsid        = new MyDataOp(selectidstr).CreateDataSet();
            //编辑
            if (dsid.Tables[0].Rows.Count > 0)
            {
                strSql = @"update t_Y_Detail 
                        set bz='" + txt_Remark_now.Text + "',CreateDate=getdate() where itemid='" + strSelectedId + "' and statusid='9' and id='" + SelectedId + "'";
            }
            //新加备注
            else
            {
                strSql = @"insert into t_Y_Detail
                                    (itemid,statusid,userid,CreateDate,bz)  
                                    values('" + strSelectedId + "','9','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate(),'" + txt_Remark_now.Text + "')";
            }
            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.ExecuteCommand();
            if (blSuccess == true)
            {
                WebApp.Components.Log.SaveLogY("编辑保存(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 9);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据保存成功!');", true);
            }
            else
            {
                WebApp.Components.Log.SaveLogY("编辑保存(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 9);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据保存失败!');", true);
            }



            #endregion
            Query();
        }
    }
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[6].Text;
        string strSql;

        strSql = "DELETE FROM t_R_UserInfo WHERE id = '" + strSelectedId + "'";
        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.ExecuteCommand())
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        Query();
    }
Exemplo n.º 18
0
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;

        //string strSql = "Delete from t_企业信息 where id='" + strSelectedId + "'";
        string   strSql  = "update t_企业信息 set 启用 = '0' where id='" + strSelectedId + "'";
        MyDataOp mdo     = new MyDataOp(strSql);
        bool     success = mdo.ExecuteCommand();

        if (success)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
            Query();
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
    }
Exemplo n.º 19
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int add(OutCar entity)
        {
            int    id     = 0;
            string sqlstr = String.Format(@"insert into t_c_outinfo(carid,destn,remark,createdate,createuser,outstart,outend,driver) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", entity.CarNO, entity.Destn, entity.Remark, entity.CreateDate, entity.CreateUser, entity.OutStart, entity.OutEnd, entity.Driver);

            MyDataOp db = new MyDataOp(sqlstr);

            if (db.ExecuteCommand())
            {
                db = null;
                string        selectstr = String.Format(@"select * from t_c_outinfo  where carid='{0}' and outstart='{1}' and outend='{2}'", entity.CarNO, entity.OutStart, entity.OutEnd);
                SqlDataReader sdr       = new MyDataOp(selectstr).CreateReader();
                while (sdr.Read())
                {
                    id = int.Parse(sdr["id"].ToString());
                }
            }
            return(id);
        }
Exemplo n.º 20
0
    private void InsertRow(string insertFileName, string parentID, string allPath, string path, Stream file, string guid, string type)
    {
        byte[] bytelist = new byte[file.Length];
        file.Read(bytelist, 0, int.Parse(file.Length.ToString()));
        string strsql = String.Format("insert into t_document(NAME,PARENTID,FILEPATH,SORT,TYPE,KEYWORDS,LINK,guid,cFileType) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", insertFileName, parentID, allPath, "", "1", this.TextBox_KeyWord.Text.Trim(), path, guid, type);


        StringBuilder str = new StringBuilder();

        str.Append(String.Format("insert into t_document(NAME,PARENTID,FILEPATH,SORT,TYPE,KEYWORDS,LINK,guid,cContent) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',@content)", insertFileName, parentID, allPath, "", "1", this.TextBox_KeyWord.Text.Trim(), path, guid));

        try
        {
            MyDataOp dbdo = new MyDataOp(strsql);
            if (dbdo.ExecuteCommandpara(bytelist, str))
            {
                Response.Write("<script>window.alert('保存文件成功!'); window.location.href ='ExpertTree.aspx';</script>");
                return;
            }
            else
            {
                if (dbdo.ExecuteCommand())
                {
                    Response.Write("<script>window.alert('保存文件成功!'); window.location.href ='ExpertTree.aspx';</script>");
                    return;
                }
                else
                {
                    Response.Write("<script>window.alert('保存文件失败!'); window.location.href ='ExpertTree.aspx';</script></script>");
                    return;
                }
            }
        }
        catch (Exception msg)
        {
        }
        finally
        {
        }
    }
Exemplo n.º 21
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        DateTime pswdTime = DateTime.Parse(DateTime.Now.ToString());
        string   strSql   = "select * from t_R_UserInfo where UserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "'";
        DataSet  ds       = new MyDataOp(strSql).CreateDataSet();

        if (txt_OrigPwd.Text.Trim() != ds.Tables[0].Rows[0]["PWD"].ToString())
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('原密码不正确!');", true);
            txt_OrigPwd.Text = "";
            return;
        }

        if (txt_NewPwd.Text.Trim() != txt_RetypePwd.Text.Trim())
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('新密码与确认密码不匹配!');", true);
            txt_NewPwd.Text    = "";
            txt_RetypePwd.Text = "";
            return;
        }

        strSql = "update t_R_UserInfo " +
                 " set PWD='" + txt_NewPwd.Text.Trim() + "',PWDModifyTime = '" + pswdTime + "' where UserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "'";
        MyDataOp mdo       = new MyDataOp(strSql);
        bool     blSuccess = mdo.ExecuteCommand();

        if (blSuccess == true)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('密码修改成功!请重新登陆');parent.location='../login.aspx';", true);
            return;
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('密码修改失败!');", true);
            return;
        }
    }
Exemplo n.º 22
0
    protected void btn_OKAnalysis_Click(object sender, EventArgs e)
    {
        if (txt_endtime.Text.Trim() == "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请填写收到时间!');", true);
        }
        else if (txt_receivetime.Text.Trim() == "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请填写装订时间!');", true);
        }
        else
        {
            #region 编辑记录


            string strSql = @"update t_M_SampleInfor set ReportSignDate='" + txt_receivetime.Text.Trim() +
                            "',StatusID=6,ReportBindDate='" + txt_endtime.Text.Trim() + "' where id='" + strSelectedId + "'";
            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.ExecuteCommand();
            if (blSuccess == true)
            {
                WebApp.Components.Log.SaveLog("报告装订中保存提交:" + strSampleId + "(" + strSelectedId + ")!成功", Request.Cookies["Cookies"].Values["u_id"].ToString(), 10);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑成功!');", true);
            }
            else
            {
                WebApp.Components.Log.SaveLog("报告装订中保存提交:" + strSampleId + "(" + strSelectedId + ")!失败", Request.Cookies["Cookies"].Values["u_id"].ToString(), 10);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑失败!');", true);
            }



            #endregion
        }
        queryAnalysisItem();
    }
Exemplo n.º 23
0
    void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
    {
        string strSql, strTmp;

        strTmp = eventArgument;
        char[]   sign           = { ',' };
        string[] arrstrPosition = strTmp.Split(sign);
        int      j = 0;

        for (int i = 0; i < intPointSum; i++)
        {
            arrstrInfo[i][2] = arrstrPosition[j];
            arrstrInfo[i][3] = arrstrPosition[j + 1];
            j = j + 2;
        }


        for (int i = 0; i < intPointSum; i++)
        {
            strSql = "update t_chart_main set x=" + arrstrInfo[i][2] + ",y=" + arrstrInfo[i][3] + " where id='" + arrstrInfo[i][1] + "'";
            MyDataOp mdo = new MyDataOp(strSql);
            mdo.ExecuteCommand();
        }
    }
Exemplo n.º 24
0
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strReportId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;
        string strSql;



        strSql = "DELETE FROM t_Y_FlowInfo WHERE id= '" + strReportId + "'";


        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.ExecuteCommand())
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
            WebApp.Components.Log.SaveLog("样品接收中删除样品信息" + txt_ReportID.Text.Trim() + "(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
        }
        else
        {
            WebApp.Components.Log.SaveLog("样品接收中删除样品信息" + txt_ReportID.Text.Trim() + "(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        Query();
    }
Exemplo n.º 25
0
    //删除目录
    protected void Button3_Click(object sender, EventArgs e)
    {
        if (this.TreeView1.SelectedNode == null)
        {
            Response.Write("<script>window.alert('请选择要删除的目录或文件!')</script>");
            return;
        }

        string name  = this.TreeView1.SelectedNode.Text;
        int    point = 0;

        point = name.LastIndexOf('.');

        if (point > 0)//删除文件 (先删除文件再删除数据库中的信息)
        {
            string filePath = "";
            string truePath = "";
            string fileName = this.TreeView1.SelectedNode.Text;

            DataSet ds   = new DataSet();
            string  path = this.ReturnPath(this.TreeView1.SelectedNode.Parent, "");

            string str = String.Format("select * from t_document where FILEPATH like '%{0}'", path);


            try
            {
                ds = new MyDataOp(str).CreateDataSet();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    filePath = row["FILEPATH"].ToString();
                }
            }
            catch (Exception msg)
            {
                //logExpert.writOperateLog("专家系统删除文件,从数据库中读取信息时出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001");
            }
            finally
            {
                if (ds != null)
                {
                    ds.Dispose();
                    ds = null;
                }
            }
            if (filePath == "")
            {
                Response.Write("<script>alert('数据库中没有文件路径!');</script>");
                return;
            }
            else
            {
                try
                {
                    truePath = filePath + "\\" + fileName;
                    File.Delete(truePath);
                }
                catch (Exception msg)
                {
                    // logExpert.writOperateLog("删除实际文件时出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "38");
                    Response.Write("<script>alert('删除文件时出错!');</script>");
                    return;
                }

                //删除数据库中的信息
                string   delstr = String.Format("delete from t_document where FILEPATH = '{0}'", truePath);
                MyDataOp dbdo   = new MyDataOp(delstr);
                int      i      = 0;
                try
                {
                    if (dbdo.ExecuteCommand())
                    {
                        Response.Write("<script>alert('删除文件成功!');window.location.href='ExpertTree.aspx';</script>");
                        return;
                    }
                    else
                    {
                        Response.Write("<script>alert('删除文件失败!');window.location.href='ExpertTree.aspx';</script>");
                        return;
                    }
                }
                catch (Exception msg)
                {
                    //logExpert.writOperateLog("删除文件时删除数据库中信息时出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "38");
                }
                finally
                {
                }
            }
        }
        else//删除目录  (先删除目录再删除数据库中的信息)
        {
            string directoryPath = "";
            string parentID      = "";

            DataSet ds   = new DataSet();
            string  path = this.ReturnPath(this.TreeView1.SelectedNode, "");
            string  str  = String.Format("select * from t_document where FILEPATH like '%{0}'", path);
            try
            {
                ds = new MyDataOp(str).CreateDataSet();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    directoryPath = row["FILEPATH"].ToString();
                    parentID      = row["ID"].ToString();
                }
            }
            catch (Exception msg)
            {
                // logExpert.writOperateLog("专家系统删除目录出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001");
            }
            finally
            {
                if (ds != null)
                {
                    ds.Dispose();
                    ds = null;
                }
            }
            if (directoryPath == "")
            {
                Response.Write("<script>alert('数据库中没有目录路径!');</script>");
                return;
            }
            else
            {
                try
                {
                    Directory.Delete(directoryPath, true);
                }
                catch
                {
                    Response.Write("<script>alert('删除目录时出错!');</script>");
                    return;
                }

                // 删除数据库中的信息
                string   delstr = String.Format("delete from t_document where FILEPATH like '{0}%'", directoryPath);
                MyDataOp dbdo   = new MyDataOp(delstr);
                try
                {
                    if (dbdo.ExecuteCommand())
                    {
                        Response.Write("<script>alert('删除目录成功!');window.location.href='ExpertTree.aspx';</script>");
                        return;
                    }
                    else
                    {
                        Response.Write("<script>alert('删除目录失败!');window.location.href='ExpertTree.aspx';</script>");
                        return;
                    }
                }
                catch (Exception msg)
                {
                    //logExpert.writOperateLog("专家系统删除目录出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001");
                }
                finally
                {
                }
            }
        }
    }
Exemplo n.º 26
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (btn_OK.Text == "编辑")
        {
            AllTxtCanWrite();
            btn_OK.Text   = "确定";
            lbl_Type.Text = "编辑";
        }
        else
        {
            #region 当按钮文字为“确定”时,执行添加或编辑操作

            int num   = 0;
            int dw    = 0;
            int hours = 0;
            //if (txt_num.Text.Trim() != "")
            //{
            //    try
            //    {
            //        num = int.Parse(txt_num.Text.Trim());
            //    }
            //    catch
            //    {
            //        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请正确填写样品的有效性!');", true);
            //    }
            //    dw = rbl_dw.SelectedIndex;
            //    if (dw == 0)
            //        hours = num;
            //    else
            //        hours = num * 24;
            //}
            //添加新纪录
            if (lbl_Type.Text == "添加")
            {
                string str = "select id,AIName from t_M_ANItemInf where AIName='" + txt_AIName.Text + "'";

                DataSet dscheck = new MyDataOp(str).CreateDataSet();
                if (dscheck.Tables[0].Rows.Count > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('已存在该分析项目!请直接在原有分析项目上修改信息!');", true);
                }
                else
                {
                    string strSql = @"insert into t_M_ANItemInf
                        (AIName,AICode,num,dw,hours)  
                        values('" + txt_AIName.Text + "','" + txt_AICode.Text + "','" + num + "','" + dw + "','" + hours + "')";
                    if (txt_AICode.Text.Trim() == "")
                    {
                        strSql = @"insert into t_M_ANItemInf
                        (AIName,num,dw,hours)  
                        values('" + txt_AIName.Text + "','" + num + "','" + dw + "','" + hours + "')";
                    }
                    MyDataOp mdo       = new MyDataOp(strSql);
                    bool     blSuccess = mdo.ExecuteCommand();
                    if (blSuccess == true)
                    {
                        //string strc = "select id,AIName from t_M_ANItemInf where AIName='" + txt_AIName.Text + "'";
                        //DataSet dsc= new MyDataOp(strc).CreateDataSet();
                        //strSelectedId = dsc.Tables[0].Rows[0][0].ToString().Trim();
                        //string[] strlist = new string[cbl_Method.Items.Count+1];
                        //int j=0;
                        //strlist.SetValue("delete from t_M_AIStandard where AIID='"+strSelectedId+"'", j++);
                        //for (int i = 0; i < cbl_Method.Items.Count; i++)
                        //{
                        //    if (cbl_Method.Items[i].Selected)
                        //    {
                        //        string temp = " insert into t_M_AIStandard(AIID,Standardid,Standard)valuse('"+strSelectedId+"','"+cbl_Method.Items[i].Value.ToString().Trim()+"','"+cbl_Method.Items[i].Text.Trim()+"')";
                        //        strlist.SetValue(temp, j++);
                        //    }
                        //}
                        //if (j > 0)
                        //{
                        //    if (mdo.DoTran(j, strlist))
                        //    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加成功!');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据添加失败!');", true);
                    }
                    //    }
                    //}
                    //else
                    //{
                    //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据添加失败!');", true);
                    //}
                    txt_AIName.Text = "";
                    txt_AICode.Text = "";

                    Query();
                }
            }

            //编辑记录
            if (lbl_Type.Text == "编辑")
            {
                string str = "select id,AIName from t_M_ANItemInf where AIName='" + txt_AIName.Text + "' and id!='" + strSelectedId + "'";

                DataSet dscheck = new MyDataOp(str).CreateDataSet();
                if (dscheck.Tables[0].Rows.Count > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('已存在同名称的分析项目!请直接在原有分析项目上修改信息!');", true);
                }
                else
                {
                    string strSql = @"update t_M_ANItemInf 
                            set AIName='" + txt_AIName.Text + "',AICode = '" + txt_AICode.Text + "',num='" + num + "',dw='" + dw + "',hours='" + hours + "' where id = '" + strSelectedId + "'";
                    if (txt_AICode.Text.Trim() == "")
                    {
                        strSql = @"update t_M_ANItemInf 
                            set AIName='" + txt_AIName.Text + "',AICode = null,num='" + num + "',dw='" + dw + "',hours='" + hours + "' where id = '" + strSelectedId + "'";
                    }

                    MyDataOp mdo       = new MyDataOp(strSql);
                    bool     blSuccess = mdo.ExecuteCommand();
                    if (blSuccess == true)
                    {
                        //string strc = "select id,AIName from t_M_ANItemInf where AIName='" + txt_AIName.Text + "'";
                        //DataSet dsc = new MyDataOp(strc).CreateDataSet();
                        //strSelectedId = dsc.Tables[0].Rows[0][0].ToString().Trim();
                        //string[] strlist = new string[cbl_Method.Items.Count + 1];
                        //int j = 0;
                        //strlist.SetValue("delete from t_M_AIStandard where AIID='" + strSelectedId + "'", j++);
                        //for (int i = 0; i < cbl_Method.Items.Count; i++)
                        //{
                        //    if (cbl_Method.Items[i].Selected)
                        //    {
                        //        string temp = " insert into t_M_AIStandard(AIID,Standardid,Standard)values('" + strSelectedId + "','" + cbl_Method.Items[i].Value.ToString().Trim() + "','" + cbl_Method.Items[i].Text.Trim() + "')";
                        //        strlist.SetValue(temp, j++);
                        //    }
                        //}
                        //if (j > 0)
                        //{
                        //    if (mdo.DoTran(j, strlist))
                        //    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('分析项目编辑成功!');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('分析项目编辑失败!');", true);
                    }
                    //    }
                    //}
                    //else
                    //{
                    //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑失败!');", true);
                    //}
                    txt_AIName.Text = "";
                    txt_AICode.Text = "";
                    Query();
                }
            }
            #endregion
        }
    }
Exemplo n.º 27
0
    protected void btn_OKAnalysis_Click(object sender, EventArgs e)
    {
        string        retstr   = "";
        List <string> namelist = new List <string>();

        namelist = getnum(lbl_sample.Text, ref retstr);
        if (retstr != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('" + retstr + "');", true);
            return;
        }
        int sampleNum = namelist.Count;;

        //自动通过样品编号计算
        if (sampleNum == 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);
            WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
        }
        else
        {
            try
            {
                if (int.Parse(txt_num.Text.Trim()) != sampleNum)
                {
                    if (int.Parse(txt_num.Text.Trim()) != 0)
                    {
                        sampleNum = int.Parse(txt_num.Text.Trim());
                    }

                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);
                        WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                        return;
                    }
                }
                else
                {
                    int      selectnum = 0;
                    string   str       = "";
                    int      M         = cb_analysisList.Items.Count;
                    string[] liststr   = new string[M + 1 + M * sampleNum];
                    int      i         = 0;
                    //更新样品单表
                    liststr.SetValue("update t_M_SampleInfor set snum='" + sampleNum + "' where id='" + strSelectedId + "'", i++);
                    foreach (ListItem LI in cb_analysisList.Items)
                    {
                        if (LI.Selected)
                        {
                            selectnum++;
                            //分析项目表
                            str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";

                            DataSet dscheck = new MyDataOp(str).CreateDataSet();
                            if (dscheck.Tables[0].Rows.Count <= 0)
                            {
                                str = "insert into t_M_MonitorItem(SampleID,MonitorItem,Num) values('" + strSelectedId + "','" + LI.Value + "','" + sampleNum + "')";
                                liststr.SetValue(str, i++);
                            }
                            else
                            {
                                str = "update t_M_MonitorItem set Num='" + sampleNum + "' where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                                liststr.SetValue(str, i++);
                            }
                            dscheck.Dispose();
                            //string strcheckup = "Delete from t_MonitorItemDetail where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";
                            //liststr.SetValue(strcheckup, i++);
                            for (int j = 0; j < sampleNum; j++)
                            {
                                string    strcheck      = "select SampleNo,SampleID from t_MonitorItemDetail where SampleNo='" + namelist[j] + "' and MonitorItem='" + LI.Value + "' ";
                                DataSet   dsdetialcheck = new MyDataOp(strcheck).CreateDataSet();
                                DataRow[] seldr         = dsdetialcheck.Tables[0].Select(" SampleID<>'" + strSelectedId + "'");
                                if (seldr.Length <= 0)
                                {
                                    DataRow[] checkdr = dsdetialcheck.Tables[0].Select(" SampleID='" + strSelectedId + "'");
                                    if (checkdr.Length <= 0)
                                    {
                                        str = "insert into t_MonitorItemDetail(SampleID,MonitorItem,SampleNo,createdate,createuser) values('" + strSelectedId + "','" + LI.Value + "','" + namelist[j] + "',getdate(),'" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";
                                        liststr.SetValue(str, i++);
                                    }
                                }
                                else
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品重复,请检查!');", true);
                                    WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品重复,请检查!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";

                            DataSet dscheck = new MyDataOp(str).CreateDataSet();
                            if (dscheck.Tables[0].Rows.Count > 0)
                            {
                                str = "delete from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                                liststr.SetValue(str, i++);
                                string strcheckup = "Delete from t_MonitorItemDetail where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                                liststr.SetValue(strcheckup, i++);
                            }
                            dscheck.Dispose();
                        }
                    }
                    if (selectnum == 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请选择分析项目!');", true);
                        return;
                    }
                    else
                    {
                        MyDataOp OpObj = new MyDataOp(str);
                        if (OpObj.DoTran(i, liststr))
                        {
                            bool detailret = true;
                            if (txt_own.Text.Trim() != "")
                            {
                                string   strown   = txt_own.Text.Trim();
                                string[] strlist  = strown.Split(',', ',');
                                string[] liststr2 = new string[strlist.Length + 1];
                                for (int j = 0; j < strlist.Length; j++)
                                {
                                    if (strlist[j].ToString().Trim() != "")
                                    {
                                        str = "select id,AIName from t_M_AnalysisItem where AIName='" + strlist[j].ToString() + "'";

                                        DataSet dscheck = new MyDataOp(str).CreateDataSet();
                                        if (dscheck.Tables[0].Rows.Count > 0)
                                        {
                                            str = "insert into t_M_MonitorItem(SampleID,MonitorItem,Num) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + sampleNum + "')";
                                            liststr2.SetValue(str, i++);
                                            for (int m = 0; m < sampleNum; m++)
                                            {
                                                string    strcheck      = "select SampleNo,SampleID from t_MonitorItemDetail where SampleNo='" + namelist[m] + "' and MonitorItem='" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "' ";
                                                DataSet   dsdetialcheck = new MyDataOp(strcheck).CreateDataSet();
                                                DataRow[] seldr         = dsdetialcheck.Tables[0].Select(" SampleID<>'" + strSelectedId + "'");
                                                if (seldr.Length <= 0)
                                                {
                                                    DataRow[] checkdr = dsdetialcheck.Tables[0].Select(" SampleID='" + strSelectedId + "'");
                                                    if (checkdr.Length <= 0)
                                                    {
                                                        str = "insert into t_MonitorItemDetail(SampleID,MonitorItem,SampleNo,createdate,createuser) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + namelist[m] + "',getdate(),'" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";
                                                        liststr2.SetValue(str, i++);
                                                    }
                                                }
                                                else
                                                {
                                                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品重复,请检查!');", true);
                                                    WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品重复,请检查!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                                    return;
                                                }
                                            }
                                            //for (int m = 0; m < sampleNum; m++)
                                            //{
                                            //    string strcheck = "select SampleNo,SampleID from t_MonitorItemDetail where SampleNo='" + namelist[m] + "' and  SampleID!='" + strSelectedId + "'";
                                            //    DataSet dsdetialcheck = new MyDataOp(strcheck).CreateDataSet();
                                            //    if (dsdetialcheck.Tables[0].Rows.Count <= 0)
                                            //    {
                                            //        string strcheckup = "Delete from t_MonitorItemDetail where SampleID='" + strSelectedId + "'";
                                            //        liststr2.SetValue(strcheckup, i++);

                                            //        str = "insert into t_MonitorItemDetail(SampleID,MonitorItem,SampleNo) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + namelist[m] + "')";
                                            //        liststr2.SetValue(str, i++);

                                            //    }
                                            //    else
                                            //    {
                                            //        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不能重复!');", true);
                                            //        Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不能重复!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                            //        return;
                                            //    }
                                            //}
                                        }
                                        else
                                        {
                                            str = @"insert into t_M_AnalysisItem
                    (ClassID,AIName,AICode)  
                    values('1','" + strlist[j] + "','" + strlist[j] + "')";
                                            MyDataOp mdo       = new MyDataOp(str);
                                            bool     blSuccess = mdo.ExecuteCommand();
                                            if (blSuccess == true)
                                            {
                                                DataSet myDR = new MyDataOp("select id from t_M_AnalysisItem where AIName='" + strlist[j] + "'").CreateDataSet();

                                                if (myDR.Tables[0].Rows.Count > 0)
                                                {
                                                    string itemname = myDR.Tables[0].Rows[0]["id"].ToString();
                                                    myDR.Dispose();
                                                    str = @"insert into t_M_MonitorItem
                    (SampleID,MonitorItem,Num,UserID,CreateDate)  
                    values('" + strSelectedId + "','" + itemname + "','" + sampleNum + "','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate())";
                                                    liststr2.SetValue(str, i++);
                                                    for (int m = 0; m < sampleNum; m++)
                                                    {
                                                        string    strcheck      = "select SampleNo,SampleID from t_MonitorItemDetail where SampleNo='" + namelist[m] + "' and MonitorItem='" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "' ";
                                                        DataSet   dsdetialcheck = new MyDataOp(strcheck).CreateDataSet();
                                                        DataRow[] seldr         = dsdetialcheck.Tables[0].Select(" SampleID<>'" + strSelectedId + "'");
                                                        if (seldr.Length <= 0)
                                                        {
                                                            DataRow[] checkdr = dsdetialcheck.Tables[0].Select(" SampleID='" + strSelectedId + "'");
                                                            if (checkdr.Length <= 0)
                                                            {
                                                                str = "insert into t_MonitorItemDetail(SampleID,MonitorItem,SampleNo,createdate,createuser) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + namelist[m] + "',getdate(),'" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";
                                                                liststr2.SetValue(str, i++);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品重复,请检查!');", true);
                                                            WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品重复,请检查!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                                            return;
                                                        }
                                                    }
                                                }
                                            }
                                        }


                                        dscheck.Dispose();
                                    }
                                }
                                MyDataOp OpObj2 = new MyDataOp(str);
                                detailret = OpObj.DoTran(i, liststr);
                            }
                            if (detailret)
                            {
                                WebApp.Components.Log.SaveLog("样品接收添加分析项目" + strSampleId + "(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);

                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存成功!');", true);
                                DataBindAll();
                                txt_own.Text = "";
                            }
                            else
                            {
                                WebApp.Components.Log.SaveLog("样品接收添加分析项目" + strSampleId + "(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存失败!');", true);
                            }
                        }
                    }
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);
                WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
            }



            Query();
        }
    }
Exemplo n.º 28
0
    protected void btn_upload_Click(object sender, EventArgs e)
    {
        string  str1 = "select * from t_M_ReporInfo where id='" + strSelectedId + "' and ReportAddress is Null";
        DataSet dss  = new MyDataOp(str1).CreateDataSet();

        if (dss.Tables[0].Rows.Count > 0)
        {
            bool   fileOK = false;
            string path   = filedirectory;
            if (FileUpload1.FileName != "")
            {
                String   fileExtension     = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName).ToLower();
                String[] allowedExtensions = { ".doc", ".xls" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string pathstr = path + "\\Report\\" + FileUpload1.FileName;
                    try
                    {
                        FileUpload1.SaveAs(pathstr);

                        LabMessage1.Text = "文件上传成功.";
                        LabMessage2.Text = "<b>原文件路径:</b>" + FileUpload1.PostedFile.FileName + "<br />" +
                                           "<b>文件大小:</b>" + FileUpload1.PostedFile.ContentLength + "字节<br />" +
                                           "<b>文件类型:</b>" + FileUpload1.PostedFile.ContentType + "<br />";
                        string   savestr = "update t_M_ReporInfo set ReportAddress='" + pathstr + "', ReportUploadDate=getdate(),fileflag=1 where id='" + strSelectedId + "'";
                        MyDataOp doobj   = new MyDataOp(savestr);
                        if (doobj.ExecuteCommand())
                        {
                            WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")成功! " + LabMessage2.Text, Request.Cookies["Cookies"].Values["u_id"].ToString(), 6);
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "window.alert('文件上传成功!');window.opener.location.href = '" + filestr + "';if(window.opener.progressWindow)window.opener.progressWindow.close();window.close();", true);
                        }
                        else
                        {
                            WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")文件上传成功!路径保存失败! " + LabMessage2.Text, Request.Cookies["Cookies"].Values["u_id"].ToString(), 6);
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('文件上传成功!路径保存失败!')", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")!存在异常: " + ex.Message.ToString(), Request.Cookies["Cookies"].Values["u_id"].ToString(), 6);
                        LabMessage1.Text = "文件上传不成功.";
                    }
                }
                else
                {
                    WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")!存在异常: 只能够Word和Excel文件.", Request.Cookies["Cookies"].Values["u_id"].ToString(), 6);

                    LabMessage1.Text = "只能够Word和Excel文件.";
                }
            }
            else
            {
                WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")!存在异常: 没有要上传的文件.", Request.Cookies["Cookies"].Values["u_id"].ToString(), 6);

                LabMessage1.Text = " 没有要上传的文件.";
            }
            string  str = "select id,ReportNumber 报告编号,ReportUploadDate 报告上传日期,ReportAddress 报告地址 from t_M_ReporInfo where id='" + strSelectedId + "' and fileflag=1";
            DataSet ds  = new MyDataOp(str).CreateDataSet();
            GridView_Report.DataSource = ds;
            GridView_Report.DataBind();
        }
        else
        {
            WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")已存在同名样品的报告文档! " + LabMessage2.Text, Request.Cookies["Cookies"].Values["u_id"].ToString(), 6);

            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('已存在改报告的监测报告文档!')", true);
        }
        dss.Dispose();
    }
Exemplo n.º 29
0
    protected void btn_SampleSave_Click(object sender, EventArgs e)
    {
        string        retstr   = "";
        List <string> namelist = new List <string>();

        namelist = getnum(lbl_sample.Text, ref retstr);
        if (retstr != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('" + retstr + "');", true);
            return;
        }
        int sampleNum = namelist.Count;;  //自动通过样品编号计算

        try
        {
            if (int.Parse(txt_num.Text.Trim()) != sampleNum)
            {
                if (int.Parse(txt_num.Text.Trim()) != 0)
                {
                    sampleNum = int.Parse(txt_num.Text.Trim());
                }

                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);
                    WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                }
            }



            string   str     = "";
            int      M       = cb_analysisList.Items.Count;
            string[] liststr = new string[M + 1];
            int      i       = 0;
            liststr.SetValue("update t_M_SampleInfor set snum='" + sampleNum + "' where id='" + strSelectedId + "'", i++);
            foreach (ListItem LI in cb_analysisList.Items)
            {
                if (LI.Selected)
                {
                    str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";

                    DataSet dscheck = new MyDataOp(str).CreateDataSet();
                    if (dscheck.Tables[0].Rows.Count <= 0)
                    {
                        str = "insert into t_M_MonitorItem(SampleID,MonitorItem,Num) values('" + strSelectedId + "','" + LI.Value + "','" + sampleNum + "')";
                        liststr.SetValue(str, i++);
                    }
                    else
                    {
                        str = "update t_M_MonitorItem set Num='" + sampleNum + "' where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                        liststr.SetValue(str, i++);
                    }
                    dscheck.Dispose();
                }
                else
                {
                    str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";

                    DataSet dscheck = new MyDataOp(str).CreateDataSet();
                    if (dscheck.Tables[0].Rows.Count > 0)
                    {
                        str = "delete from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                        liststr.SetValue(str, i++);
                    }
                    dscheck.Dispose();
                }
            }
            if (txt_own.Text.Trim() != "")
            {
                string   strown  = txt_own.Text.Trim();
                string[] strlist = strown.Split(',', ',');
                for (int j = 0; j < strlist.Length; j++)
                {
                    if (strlist[j].ToString().Trim() != "")
                    {
                        str = "select id,AIName from t_M_AnalysisItem where AIName='" + strlist[j].ToString() + "'";

                        DataSet dscheck = new MyDataOp(str).CreateDataSet();
                        if (dscheck.Tables[0].Rows.Count > 0)
                        {
                            str = "insert into t_M_MonitorItem(SampleID,MonitorItem,Num) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + sampleNum + "')";
                            liststr.SetValue(str, i++);
                        }
                        else
                        {
                            str = @"insert into t_M_AnalysisItem
                    (ClassID,AIName,AICode)  
                    values('1','" + strlist[j] + "','" + strlist[j] + "')";
                            MyDataOp mdo       = new MyDataOp(str);
                            bool     blSuccess = mdo.ExecuteCommand();
                            if (blSuccess == true)
                            {
                                DataSet myDR = new MyDataOp("select id from t_M_AnalysisItem where AIName='" + strlist[j] + "'").CreateDataSet();

                                if (myDR.Tables[0].Rows.Count > 0)
                                {
                                    string itemname = myDR.Tables[0].Rows[0]["id"].ToString();
                                    myDR.Dispose();
                                    str = @"insert into t_M_MonitorItem
                    (SampleID,MonitorItem,Num,UserID,CreateDate)  
                    values('" + strSelectedId + "','" + itemname + "','" + sampleNum + "','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate())";
                                    liststr.SetValue(str, i++);
                                }
                            }
                        }
                        dscheck.Dispose();
                    }
                }
            }
            str = "select * from t_M_MonitorItem where SampleID='" + strSelectedId + "'";
            DataSet ds = new MyDataOp(str).CreateDataSet();
            if (ds.Tables[0].Rows.Count > 0)
            {
                str = "update t_M_SampleInfor set StatusID=1 where id='" + strSelectedId + "'";

                liststr.SetValue(str, i++);
                MyDataOp OpObj = new MyDataOp(str);
                if (OpObj.DoTran(i, liststr))
                {
                    WebApp.Components.Log.SaveLog("样品接收添加分析项目" + lbl_sample.Text + "(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存成功!');", true);
                    DataBindAll();
                    txt_own.Text = "";
                }
                else
                {
                    WebApp.Components.Log.SaveLog("样品接收添加分析项目" + lbl_sample.Text + "(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存失败!');", true);
                }
                ds.Dispose();
            }
            else
            {
                WebApp.Components.Log.SaveLog("样品接收添加分析项目" + lbl_sample.Text + "(" + strSelectedId + ")未保存分析项目时提交!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请添加分析项目!再提交');", true);
            }
        }
        catch
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);

            WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
        }
        Query();
        //queryAnalysisItem();
    }
Exemplo n.º 30
0
    //添加目录
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (this.TreeView1.SelectedNode == null)
        {
            Response.Write("<script>window.alert('请选择要添加到哪个目录!')</script>");
            return;
        }

        if (this.TextBox_Catalog.Text == "")
        {
            Response.Write("<script>window.alert('目录名不能为空!')</script>");
            return;
        }

        string name  = this.TreeView1.SelectedNode.Text;
        int    point = 0;

        point = name.LastIndexOf('.');
        //所选的是文件
        if (point > 0)
        {
            string directoryPath = "";
            string parentID      = "";

            DataSet ds   = new DataSet();
            string  path = this.ReturnPath(this.TreeView1.SelectedNode.Parent, "");

            string str = String.Format("select * from t_document where FILEPATH like '%{0}'", path);

            try
            {
                ds = new MyDataOp(str).CreateDataSet();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    directoryPath = row["FILEPATH"].ToString();
                    parentID      = row["ID"].ToString();
                }
            }
            catch (Exception msg)
            {
                //logExpert.writOperateLog("专家系统添加目录,保存实际目录路径时出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001");
            }
            finally
            { if (ds != null)
              {
                  ds.Dispose();
                  ds = null;
              }
            }
            if (directoryPath == "")
            {
                Response.Write("<script>alert('数据库中没有目录路径!');</script>");
                return;
            }
            else
            {
                if (Directory.Exists(directoryPath))
                {
                    string newPath = directoryPath + "\\" + this.TextBox_Catalog.Text;

                    //判断是否有同名的文件夹
                    if (!this.IsSameFolder(newPath))
                    {
                        Response.Write("<script>alert('已存在该文件夹')</script>");
                        return;
                    }

                    Directory.CreateDirectory(newPath);
                    //添加到数据库
                    string strCommand = String.Format("insert into t_document(ID,NAME,PARENTID,FILEPATH,SORT,TYPE,KEYWORDS) values(expertinfor_id.nextval,'{0}',{1},'{2}','{3}','{4}','{5}')"
                                                      , this.TextBox_Catalog.Text, parentID, newPath, "", "", "", "");
                    MyDataOp dbdo = new MyDataOp(strCommand);

                    int i = 0;
                    try
                    {
                        if (dbdo.ExecuteCommand())
                        {
                        }
                        else
                        {
                        };
                    }
                    catch (Exception msg)
                    {
                        // logExpert.writOperateLog("专家系统添加目录,保存目录路径等信息到数据库出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001");
                    }
                    finally
                    {
                    }
                    if (i > 0)
                    {
                        Response.Write("<script>alert('添加目录成功!');window.location.href='left.aspx';</script>");
                        return;
                    }
                    else
                    {
                        Response.Write("<script>alert('添加目录失败!');window.location.href='left.aspx';</script>");
                        return;
                    }
                }
                else
                {
                    Response.Write("<script>alert('服务器上没有该目录!');</script>");
                    return;
                }
            }
        }
        else//选的是文件夹
        {
            string directoryPath = "";
            string parentID      = "";

            DataSet ds   = new DataSet();
            string  path = this.ReturnPath(this.TreeView1.SelectedNode, "");

            string str = String.Format("select * from t_document where FILEPATH like '%{0}'", path);

            try
            {
                ds = new MyDataOp(str).CreateDataSet();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    directoryPath = row["FILEPATH"].ToString();
                    parentID      = row["ID"].ToString();
                }
            }
            catch (Exception msg)
            {
                //logExpert.writOperateLog("专家系统添加文件,从数据库中读取信息时出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001");
            }
            finally
            {
                if (ds != null)
                {
                    ds.Dispose();
                    ds = null;
                }
            }
            if (directoryPath == "")
            {
                Response.Write("<script>alert('数据库中没有目录路径!');</script>");
                return;
            }
            else
            {
                if (Directory.Exists(directoryPath))
                {
                    string newPath = directoryPath + "\\" + this.TextBox_Catalog.Text;

                    //判断是否有同名的文件夹
                    if (!this.IsSameFolder(newPath))
                    {
                        Response.Write("<script>alert('已存在该文件夹')</script>");
                        return;
                    }

                    Directory.CreateDirectory(newPath);
                    //添加到数据库

                    string strCommand = String.Format("insert into t_document(NAME,PARENTID,FILEPATH,SORT,TYPE,KEYWORDS) values('{0}',{1},'{2}','{3}','{4}','{5}')"
                                                      , this.TextBox_Catalog.Text, parentID, newPath, "", "", "", "");

                    try
                    {
                        MyDataOp dbdo = new MyDataOp(strCommand);
                        if (dbdo.ExecuteCommand())
                        {
                            Response.Write("<script>alert('添加目录成功!');window.location.href='ExpertTree.aspx';</script>");
                            return;
                        }
                        else
                        {
                            Response.Write("<script>alert('添加目录失败!');window.location.href='ExpertTree.aspx';</script>");
                            return;
                        }
                    }
                    catch (Exception msg)
                    {
                        //logExpert.writOperateLog("专家系统添加文件,保存文件路径等信息到数据库出错" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001");
                    }
                    finally
                    {
                    }
                }
                else
                {
                    Response.Write("<script>alert('服务器上没有该目录!');</script>");
                    return;
                }
            }
        }
    }