Пример #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //得到要插入的新的角色编号
        string strId = Guid.NewGuid().ToString().Substring(0, 8);

        string supId   = cblFunctionSelect.SelectedValue;
        string name    = txtRoleName.Text;
        string comment = txtRoleNote.Text;

        if (name == "")
        {
            //当没有输入角色名称时,弹出警告窗口
            Response.Write("<script type='text/javascript'>alert('请输入角色名称!')</script>");
        }
        else
        {
            db = new MDataBase(config.DBConn);

            //向数据库中插入新角色
            if (hfIsUpdate.Value == "Insert")
            {
                //向数据库中插入新角色
                string strRoleSql = "INSERT INTO SSysRole (Role_Id,Project_Id, Name, CreatedDate, StatusId) values('" + strId + "','" + config.ProjectId + "','" + name + "','" + DateTime.Now + "','0')";
                db.executeInsert(strRoleSql);

                //向数据库中插入角色功能关系
                for (int i = 0; i < cblFunctionSelect.Items.Count; i++)
                {
                    if (cblFunctionSelect.Items[i].Selected)
                    {
                        string strRoleFuncSql = "Insert Into SSysRoleFunction values('" + strId + "','" + cblFunctionSelect.Items[i].Value + "')";
                        db.executeInsert(strRoleFuncSql);
                    }
                }
            }
            else
            {
                //更新角色数据
                string sqlUpdate = "UPDATE SSysRole SET Project_Id='" + config.ProjectId + "',Name='" + name + "',ModifiedDate='" + DateTime.Now + "' WHERE Role_Id='" + hfIsUpdate.Value + "'";
                db.executeUpdate(sqlUpdate);

                //先删除相关角色功能关系
                string sqlDelete = "Delete from SSysRoleFunction Where Role_Id='" + hfIsUpdate.Value + "'";
                db.executeDelete(sqlDelete);

                //向数据库中插入角色功能关系
                for (int i = 0; i < cblFunctionSelect.Items.Count; i++)
                {
                    if (cblFunctionSelect.Items[i].Selected)
                    {
                        string strRoleFuncSql = "Insert Into SSysRoleFunction values('" + hfIsUpdate.Value + "','" + cblFunctionSelect.Items[i].Value + "')";
                        db.executeInsert(strRoleFuncSql);
                    }
                }

                Response.Write("<script>window.dialogArguments.reload();</script>");
            }
        }
    }
Пример #2
0
    //保存数据到数据库
    public void Save()
    {
        //得到要插入的新的部门编号
        string strId   = Guid.NewGuid().ToString().Substring(0, 8);
        string supId   = ddlSupDepartment.SelectedValue;
        string name    = txtDepartmentName.Text;
        string comment = txtDepartmentNote.Text;
        string sql     = "";

        if (name == "")
        {
            //当没有输入部门名称时,弹出警告窗口
            Response.Write("<script type='text/javascript'>alert('请输入部门名称!')</script>");
        }
        else
        {
            db = new MDataBase(config.DBConn);

            //向数据库中插入新部门
            if (hfIsUpdate.Value == "Insert")
            {
                sql = "INSERT INTO SSysDepartment (Dept_Id, Parent_Id, Name, Comment,CreatedDate, StatusId) values('" + strId + "','" + supId + "','" + name + "','" + comment + "','" + DateTime.Now + "','0')";
            }
            else
            {
                sql = "UPDATE SSysDepartment SET Parent_Id ='" + supId + "',Comment='" + comment + "',Name='" + name + "',ModifiedDate='" + DateTime.Now + "' WHERE Dept_Id='" + hfIsUpdate.Value + "'";
            }

            db.executeInsert(sql);

            //插入新部门后关闭部门添加页面
            //Response.Write("<script type='text/javascript'>window.opener.location.href=window.opener.location.href; this.window.close();</script>");
        }
    }
Пример #3
0
    public void InsertVisited(string KBaseArticle_Guid, string SessionID)
    {
        string VisitedGuid = Guid.NewGuid().ToString();

        sql = "insert into SKbsVisited(Visited_Guid,KBaseArticle_Guid,Staff_Id,CreatedDate) values('" + VisitedGuid + "','" + KBaseArticle_Guid + "','" + SessionID + "',getdate())";
        db.executeInsert(sql);
    }
Пример #4
0
    /// <summary>
    /// SC_QuestionType对象Insert方法
    /// </summary>
    private bool executeInsert()
    {
        bool   blnFirstField = true;
        string sql           = "insert into SC_QuestionType(";
        string sqlTmp        = " values(";

        // (QuestionType_Id)字段
        if (_blnQuestionType_IdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "QuestionType_Id";
            sqlTmp += "'" + _QuestionType_Id + "'";
        }
        // (QuestionTypeName)字段
        if (_blnQuestionTypeNameChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "QuestionTypeName";
            sqlTmp += "'" + _QuestionTypeName + "'";
        }
        sql += ")" + sqlTmp + ")";
        try
        {
            MDataBase db = new MDataBase(_DBConn);
            db.executeInsert(sql);

            return(true);
        }
        catch (Exception err)
        {
            throw;
            return(false);
        }
    }
Пример #5
0
 public void UpdateArticle(string KBaseArticleGuid, string KBaseArticleId, string ArticleTitle, string ArticleWriter, string ArticleType, string ArticleLevel, string ArticleContent, string ArticlePoint, string Keyword1, string Keyword2, string Keyword3, string StartDate, string AbolishDate, string SessionID)
 {
     try
     {
         sql = KnowledgeArticleSql.UpdateAticleSql(KBaseArticleGuid, KBaseArticleId, ArticleTitle, ArticleWriter, ArticleType, ArticleLevel, ArticleContent, ArticlePoint, Keyword1, Keyword2, Keyword3, StartDate, AbolishDate, SessionID);
         db.executeInsert(sql);
         WebWindow.alert("ÎÄÕÂÐ޸ijɹ¦!");
         WebWindow.Close();
     }
     catch (Exception Err)
     {
         ErrorLog.LogInsert(Err.Message, "CS/KnowledgeBase/ArticleEditRule", SessionID);
         return;
     }
 }
Пример #6
0
 public void AddArticle(string KBaseArticleGuid, string KBaseArticleId, string ArticleTitle, string ArticleWriter, string ArticleType, string ArticleLevel, string ArticleContent, string ArticlePoint, string Keyword1, string Keyword2, string Keyword3, string StartDate, string AbolishDate, string StaffId)
 {
     try
     {
         //string StrDateTime = GetInformation.GetCurrentDataTime();
         sql = KnowledgeArticleSql.AddAticleSql(KBaseArticleGuid, KBaseArticleId, ArticleTitle, ArticleWriter, ArticleType, ArticleLevel, ArticleContent, ArticlePoint, Keyword1, Keyword2, Keyword3, StartDate, AbolishDate, StaffId);
         db.executeInsert(sql);
         WebWindow.alert("文章添加成功!");
         WebWindow.Close();
     }
     catch (Exception Err)
     {
         ErrorLog.LogInsert(Err.Message, "CS/KnowledgeBase/ArticleAddRule", StaffId);
         WebWindow.alert("文章内容过多!");
         return;
     }
 }
Пример #7
0
    /// <summary>
    /// SExmExam对象Insert方法
    /// </summary>
    private bool executeInsert()
    {
        bool   blnFirstField = true;
        string sql           = "insert into SExmExam(";
        string sqlTmp        = " values(";

        // (Exam_Id)字段
        if (_blnExam_IdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Exam_Id";
            sqlTmp += "'" + _Exam_Id + "'";
        }
        // (ExamName)字段
        if (_blnExamNameChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "ExamName";
            sqlTmp += "'" + _ExamName + "'";
        }
        // (ScoreType)字段
        if (_blnScoreTypeChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "ScoreType";
            sqlTmp += _ScoreType.ToString();
        }
        // (BeginTime)字段
        if (_blnBeginTimeChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "BeginTime";
            sqlTmp += "'" + _BeginTime.ToString() + "'";
        }
        // (EndTime)字段
        if (_blnEndTimeChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "EndTime";
            sqlTmp += "'" + _EndTime.ToString() + "'";
        }
        // (Times)字段
        if (_blnTimesChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Times";
            sqlTmp += _Times.ToString();
        }
        // (Count)字段
        if (_blnCountChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Count";
            sqlTmp += _Count.ToString();
        }
        // (ExamEmploees)字段
        if (_blnExamEmploeesChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "ExamEmploees";
            sqlTmp += _ExamEmploees.ToString();
        }
        // (Average)字段
        if (_blnAverageChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Average";
            sqlTmp += _Average.ToString();
        }
        // (CreatedBy)字段
        if (_blnCreatedByChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "CreatedBy";
            sqlTmp += "'" + _CreatedBy + "'";
        }
        // (CreatedDate)字段
        if (blnFirstField == true)
        {
            blnFirstField = false;
        }
        else
        {
            sql    += ",";
            sqlTmp += ",";
        }
        sql    += "CreatedDate";
        sqlTmp += "GETDATE()";
        // (StatusId)字段
        if (_blnStatusIdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "StatusId";
            sqlTmp += _StatusId.ToString();
        }
        sql += ")" + sqlTmp + ")";
        try
        {
            MDataBase db = new MDataBase(_DBConn);
            db.executeInsert(sql);

            return(true);
        }
        catch (Exception err)
        {
            throw;
            return(false);
        }
    }
Пример #8
0
    /// <summary>
    /// SPsnWorkTime对象Insert方法
    /// </summary>
    private bool executeInsert()
    {
        bool   blnFirstField = true;
        string sql           = "insert into SPsnWorkTime(";
        string sqlTmp        = " values(";

        // (WorkTime_Guid)字段
        if (_blnWorkTime_GuidChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "WorkTime_Guid";
            sqlTmp += "'" + _WorkTime_Guid + "'";
        }
        // (Staff_Id)字段
        if (_blnStaff_IdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Staff_Id";
            sqlTmp += "'" + _Staff_Id + "'";
        }
        // (Day)字段
        if (_blnDayChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Day";
            sqlTmp += "'" + _Day.ToString() + "'";
        }
        // (WorkStatusId)字段
        if (_blnWorkStatusIdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "WorkStatusId";
            sqlTmp += _WorkStatusId.ToString();
        }
        // (Job)字段
        if (_blnJobChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Job";
            sqlTmp += "'" + _Job + "'";
        }
        // (Address)字段
        if (_blnAddressChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Address";
            sqlTmp += "'" + _Address + "'";
        }
        // (Remark)字段
        if (_blnRemarkChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Remark";
            sqlTmp += "'" + _Remark + "'";
        }
        // (CreatedBy)字段
        if (_blnCreatedByChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "CreatedBy";
            sqlTmp += "'" + _CreatedBy + "'";
        }
        // (CreatedDate)字段
        if (blnFirstField == true)
        {
            blnFirstField = false;
        }
        else
        {
            sql    += ",";
            sqlTmp += ",";
        }
        sql    += "CreatedDate";
        sqlTmp += "GETDATE()";
        // (StatusId)字段
        if (_blnStatusIdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "StatusId";
            sqlTmp += _StatusId.ToString();
        }
        sql += ")" + sqlTmp + ")";
        try
        {
            MDataBase db = new MDataBase(_DBConn);
            db.executeInsert(sql);

            return(true);
        }
        catch (Exception err)
        {
            throw;
            return(false);
        }
    }
Пример #9
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (drpOrder_ID.SelectedValue == "0")
        {
            WebWindow.alert("请选择要操作的勤务的编号");
            return;
        }
        string Order_ID = drpOrder_ID.SelectedValue.ToString();
        string NJGuard  = Getstring(Chknj1, Chknj2, Chknj3, Chknj4, Chknj5, Chknj6, Chknj7, Chknj8, Chknj9, Chknj10, Chknj11, Chknj12);
        string XVGuard  = Getstring(Chkxz1, Chkxz2, Chkxz3, Chkxz4, Chkxz5, Chkxz6, Chkxz7, Chkxz8, Chkxz9, Chkxz10, Chkxz11, Chkxz12);
        string WXGuard  = Getstring(Chkwx1, Chkwx2, Chkwx3, Chkwx4, Chkwx5, Chkwx6, Chkwx7, Chkwx8, Chkwx9, Chkwx10, Chkwx11, Chkwx12);
        string CZGuard  = Getstring(Chkcz1, Chkcz2, Chkcz3, Chkcz4, Chkcz5, Chkcz6, Chkcz7, Chkcz8, Chkcz9, Chkcz10, Chkcz11, Chkcz12);
        string SZGuard  = Getstring(Chksz1, Chksz2, Chksz3, Chksz4, Chksz5, Chksz6, Chksz7, Chksz8, Chksz9, Chksz10, Chksz11, Chksz12);
        string NTGuard  = Getstring(Chknt1, Chknt2, Chknt3, Chknt4, Chknt5, Chknt6, Chknt7, Chknt8, Chknt9, Chknt10, Chknt11, Chknt12);
        string LYGGuard = Getstring(Chklyg1, Chklyg2, Chklyg3, Chklyg4, Chklyg5, Chklyg6, Chklyg7, Chklyg8, Chklyg9, Chklyg10, Chklyg11, Chklyg12);
        string HAGuard  = Getstring(Chkha1, Chkha2, Chkha3, Chkha4, Chkha5, Chkha6, Chkha7, Chkha8, Chkha9, Chkha10, Chkha11, Chkha12);
        string ZJGuard  = Getstring(Chkzj1, Chkzj2, Chkzj3, Chkzj4, Chkzj5, Chkzj6, Chkzj7, Chkzj8, Chkzj9, Chkzj10, Chkzj11, Chkzj12);
        string TZGuard  = Getstring(Chktz1, Chktz2, Chktz3, Chktz4, Chktz5, Chktz6, Chktz7, Chktz8, Chktz9, Chktz10, Chktz11, Chktz12);
        string SQGuard  = Getstring(Chksq1, Chksq2, Chksq3, Chksq4, Chksq5, Chksq6, Chksq7, Chksq8, Chksq9, Chksq10, Chksq11, Chksq12);
        string YCGuard  = Getstring(Chkyc1, Chkyc2, Chkyc3, Chkyc4, Chkyc5, Chkyc6, Chkyc7, Chkyc8, Chkyc9, Chkyc10, Chkyc11, Chkyc12);
        string YZGuard  = Getstring(Chkyz1, Chkyz2, Chkyz3, Chkyz4, Chkyz5, Chkyz6, Chkyz7, Chkyz8, Chkyz9, Chkyz10, Chkyz11, Chkyz12);

        string Remark    = this.TextBox1.Text.Trim();
        string CreatedBy = "";


        if (ViewState["State"].ToString() == "Insert")
        {
            string Insert = "INSERT INTO SOrdSummarize([Order_ID] ,[NJGuard] ,[XVGuard],[WXGuard],[CZGuard],[SZGuard],[NTGuard],[LYGGuard]," +
                            "[HAGuard],[ZJGuard],[TZGuard],[SQGuard],[YCGuard], [YZGuard],[Remark],[CreatedBy],[CreatedDate] " +
                            " ) VALUES ('" + Order_ID + "','" + NJGuard + "','" + XVGuard + "','" + WXGuard + "','" + CZGuard + "','" +
                            SZGuard + "','" + NTGuard + "','" + LYGGuard + "','" + HAGuard + "','" + ZJGuard + "','" + TZGuard + "','" +
                            SQGuard + "','" + YCGuard + "','" + YZGuard + "','" + Remark + "','" + CreatedBy + "',getdate())";

            try
            {
                db.executeInsert(Insert);
                WebWindow.alert("保存成功");
            }
            catch (Exception er)
            {
                WebWindow.alert(er.Message);
            }
        }
        else if (ViewState["State"].ToString() == "Update")
        {
            string update = "UPDATE SOrdSummarize set " +
                            " [NJGuard] = '" + NJGuard + "'," +
                            " [XVGuard] = '" + XVGuard + "'," +
                            " [WXGuard] = '" + WXGuard + "'," +
                            " [CZGuard] = '" + CZGuard + "'," +
                            " [SZGuard] = '" + SZGuard + "'," +
                            " [NTGuard] = '" + NTGuard + "'," +
                            " [LYGGuard] = '" + LYGGuard + "'," +
                            " [HAGuard] = '" + HAGuard + "'," +
                            " [ZJGuard] = '" + ZJGuard + "'," +
                            " [TZGuard] = '" + TZGuard + "'," +
                            " [SQGuard] = '" + SQGuard + "'," +
                            " [YCGuard] = '" + YCGuard + "'," +
                            " [YZGuard] = '" + YZGuard + "'," +
                            " [Remark] = '" + Remark + "'," +
                            " [ModifiedBy] = '" + CreatedBy + "'," +
                            " [ModifiedDate] = getdate() WHERE Order_ID = '" + drpOrder_ID.SelectedValue.ToString() + "'";

            try
            {
                db.executeUpdate(update);
                WebWindow.alert("修改成功");
            }
            catch (Exception er)
            {
                WebWindow.alert(er.Message);
            }
        }
    }
Пример #10
0
    /// <summary>
    /// SSysRunParameter对象Insert方法
    /// </summary>
    private bool executeInsert()
    {
        bool   blnFirstField = true;
        string sql           = "insert into SSysRunParameter(";
        string sqlTmp        = " values(";

        // (Parameter_Guid)字段
        if (_blnParameter_GuidChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Parameter_Guid";
            sqlTmp += "'" + _Parameter_Guid + "'";
        }
        // (ParameterName)字段
        if (_blnParameterNameChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "ParameterName";
            sqlTmp += "'" + _ParameterName + "'";
        }
        // (ParameterValue)字段
        if (_blnParameterValueChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "ParameterValue";
            sqlTmp += "'" + _ParameterValue + "'";
        }
        // (Detail)字段
        if (_blnDetailChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Detail";
            sqlTmp += "'" + _Detail + "'";
        }
        // (IsUser)字段
        if (_blnIsUserChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "IsUser";
            sqlTmp += _IsUser.ToString();
        }
        sql += ")" + sqlTmp + ")";
        try
        {
            MDataBase db = new MDataBase(_DBConn);
            db.executeInsert(sql);

            return(true);
        }
        catch (Exception err)
        {
            throw;
            return(false);
        }
    }
Пример #11
0
    /// <summary>
    /// SExmScore对象Insert方法
    /// </summary>
    private bool executeInsert()
    {
        bool   blnFirstField = true;
        string sql           = "insert into SExmScore(";
        string sqlTmp        = " values(";

        // (Score_Guid)字段
        if (_blnScore_GuidChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Score_Guid";
            sqlTmp += "'" + _Score_Guid + "'";
        }
        // (Exam_Id)字段
        if (_blnExam_IdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Exam_Id";
            sqlTmp += "'" + _Exam_Id + "'";
        }
        // (Staff_Id)字段
        if (_blnStaff_IdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Staff_Id";
            sqlTmp += "'" + _Staff_Id + "'";
        }
        // (StartTime)字段
        if (_blnStartTimeChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "StartTime";
            sqlTmp += "'" + _StartTime.ToString() + "'";
        }
        // (EndTime)字段
        if (_blnEndTimeChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "EndTime";
            sqlTmp += "'" + _EndTime.ToString() + "'";
        }
        // (RightCount)字段
        if (_blnRightCountChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "RightCount";
            sqlTmp += _RightCount.ToString();
        }
        // (WrongCount)字段
        if (_blnWrongCountChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "WrongCount";
            sqlTmp += _WrongCount.ToString();
        }
        // (UnfinishCount)字段
        if (_blnUnfinishCountChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "UnfinishCount";
            sqlTmp += _UnfinishCount.ToString();
        }
        // (Score)字段
        if (_blnScoreChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Score";
            sqlTmp += _Score.ToString();
        }
        // (Gradation)字段
        if (_blnGradationChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Gradation";
            sqlTmp += _Gradation.ToString();
        }
        sql += ")" + sqlTmp + ")";
        try
        {
            MDataBase db = new MDataBase(_DBConn);
            db.executeInsert(sql);

            return(true);
        }
        catch (Exception err)
        {
            throw;
            return(false);
        }
    }
Пример #12
0
    static StringBuilder str;  //显示区域用来放动态的table

    protected void Page_Load(object sender, EventArgs e)
    {
        Config Config = (Config)Session["Config"];
        //   string staff_Id = Config.Staff.Staff_Id; //得到登录的用户名
        string staff_Id = "00000003";

        ViewState["Satff_Id"] = staff_Id;
        //    string Role = Config.LoginRole.ToString();  //得到登录角色

        // string selectRole = db.GetDataScalar("SELECT Name FROM SSysRole WHERE (Role_Id = '" + Role + "')");     //根据传来的角色ID得到角色的名称
        string selectRole = "";

        if (!this.IsPostBack)
        {
            if (Request.QueryString["Tel_ID"] == null || Request.QueryString["Tel_ID"].ToString() == "") //编码
            {
                Tel_ID = "";                                                                             //
            }
            else
            {
                Tel_ID = Request.QueryString["Tel_ID"].ToString();
            }

            ControlDataBind drp = new ControlDataBind(ConfigurationManager.ConnectionStrings["OA"].ToString());
            drp.DropDownListBind(dropTelNotion, "SSFugleideaConfig", "IdeaContent", "IdeaID", 1, "", staff_Id);
            drp.DropDownListBind(drpInceptMode, "SOrdInceptFashion", "FashionName", "FashionID", 1, "", staff_Id);
        }

        if (Tel_ID == "")
        {
            if (this.lblTel_ID.Text == "")
            {
                #region 编辑电话编号为空,就是首次登记的时候

                //获取今天的年+月+日
                string Day = System.DateTime.Today.Year.ToString() + System.DateTime.Today.Month.ToString() +
                             System.DateTime.Today.Day.ToString();

                //查找出数据库中该天电话记录的最大的编号
                string Sql = "select top 1 Tel_ID from STelEnrol where Tel_ID like '" + Day + "%' order by Tel_ID desc";

                try
                {
                    Day    = db.GetDataScalar(Sql);                      //得到最大的ID
                    Tel_ID = Convert.ToString(Convert.ToInt32(Day) + 1); //在最大ID的基础上加1,确定本次勤务的编号,该编号贯彻真个程序
                }
                catch                                                    //报错说明查不到值
                {
                    Tel_ID = Convert.ToString(Convert.ToInt32(Day) + "001");
                }


                PanelVisibleFalse();         //设置全部模板不可见
                this.panelDJ.Visible = true; //登记
                this.panelAN.Visible = true; //按钮

                //电话登记的时候往流程表里写一条记录

                string Number = Guid.NewGuid().ToString();                                                                                     //该步骤编号,要在保存里用到 
                ViewState["Number"] = Number;                                                                                                  //保存住这个值,在功能保存中要用到

                ViewState["PFunction"] = "1";                                                                                                  //新建的勤务默认为电话登记功能
                string SY = "insert into STelFlow(TelFlow_Guid,Tel_ID,Number,PFunction,PExecute,CreatedBy,CreatedDate,OperateStep) " +
                            " values('" + Number + "','" + Tel_ID + "','" + Number + "',1,'" + staff_Id + "','" + staff_Id + "',getdate(),1)"; //Insert语句
                try
                {
                    db.executeInsert(SY);
                }
                catch
                {
                }

                #endregion
            }

            lblTel_ID.Text = Tel_ID;  //显示勤务编号
        }
        else
        {
            #region 勤务编号不为空
            //不显示勤务编号说明虽然不是新建的勤务,但是是第一次打开该勤务单
            //用来控制显示的页面
            if (this.lblTel_ID.Text == "")
            {
                string Number = Guid.NewGuid().ToString();                                                    //该步骤编号,要在保存里用到 
                ViewState["Number"] = Number;                                                                 //保存住这个值,在功能保存中要用到

                PanelVisibleFalse();                                                                          //所有panel不可见

                EditPanel();                                                                                  //其他人员操作调用方法

                if (selectRole != "办公室" || (ViewState["XS"] != null && ViewState["XS"].ToString() == "TRUE")) //如果角色是办公室或者办公室还没有对来电记录进行审批
                {
                    panelXS.Visible = true;                                                                   //用来显示的panel可见
                    XSTable();                                                                                //设置上面显示的table//只显示到下送过的,如果保存没有下送的不显示
                }
            }

            lblTel_ID.Text = Tel_ID;  //显示勤务编号
            #endregion
        }
    }
Пример #13
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        CSSysStaff staff = new CSSysStaff(config.DBConn);

        if (hfIsUpdate.Value == "Insert")//执行插入操作
        {
            //设置部门为可写
            ddlDepartment.Enabled = true;

            //得到要插入的新的员工编号
            string strId = Guid.NewGuid().ToString().Substring(0, 8);

            try
            {
                staff.Staff_Id  = strId;
                staff.Username  = txtUserName.Text;
                staff.Password  = txtPwd.Text;
                staff.Name      = txtName.Text;
                staff.Dept_Id   = ddlDepartment.SelectedValue;
                staff.IsMonitor = Int32.Parse(ddlIsManager.SelectedValue);
                //staff.Name = "";
                staff.LoginTimes   = 0;
                staff.StatusId     = 0;
                staff.TotalUseTime = 0;
                staff.WorkStatusId = 0;
                staff.PasswordDate = DateTime.Now;
                staff.Insert();

                string[] strRole = hfSelectRole.Value.TrimEnd(',').Split(',');
                db = new MDataBase(config.DBConn);

                for (int i = 0; i < strRole.Length; i++)
                {
                    string strInsert = "insert into SSysStaffProjectRole values('" + strId + "','" + config.ProjectId + "','" + strRole[i] + "'," + 0 + ")";
                    db.executeInsert(strInsert);
                }

                Response.Write("<script type='text/javascript'>alert('添加成功!'); </script>");
            }
            catch (Exception exc)
            {
                Response.Write("<script type='text/javascript'>alert('添加失败!');</script>");
            }
        }
        else //执行更新操作
        {
            try
            {
                //设置更新条件
                staff.Staff_Id = hfIsUpdate.Value;

                if (hfRole.Value == "Adder") //
                {
                    //重置密码
                    //staff.Password = "******";

                    //修改部门
                    //staff.Dept_Id = ddlDepartment.SelectedValue;

                    //修改是否为主管
                    staff.IsMonitor = Int32.Parse(ddlIsManager.SelectedValue);


                    //进行更新
                    staff.Update();
                }
                else if (hfRole.Value == "Self")
                {
                    //更改姓名
                    if (txtName.Text != "")
                    {
                        staff.Name = txtName.Text;
                    }

                    //更改生日
                    if (txtBirthday.Text != "")
                    {
                        staff.Birthday = Convert.ToDateTime(txtBirthday.Text);
                    }

                    //更改家庭电话
                    if (txtHomeTel.Text != "")
                    {
                        staff.StringField6 = txtHomeTel.Text;
                    }

                    //更改移动电话
                    if (txtMobileTel.Text != "")
                    {
                        staff.StringField5 = txtMobileTel.Text;
                    }

                    //更改家庭住址
                    if (txtAddress.Text != "")
                    {
                        staff.StringField8 = txtAddress.Text;
                    }

                    //更改办公电话1
                    if (txtOfficeTel.Text != "")
                    {
                        staff.StringField3 = txtOfficeTel.Text;
                    }

                    //更改办公电话2
                    if (txtOfficeTel.Text != "")
                    {
                        staff.StringField4 = txtOfficeTel2.Text;
                    }

                    //更改电话短号
                    if (txtShortTel.Text != "")
                    {
                        staff.StringField7 = txtShortTel.Text;
                    }

                    //更改短信号码
                    if (txtSMSCode.Text != "")
                    {
                        staff.StringField18 = txtSMSCode.Text;
                    }

                    //进行更新
                    staff.Update();
                }
                else if (hfRole.Value == "Polity")
                {
                    //修改职务
                    if (txtBusiness.Text != "")
                    {
                        staff.StringField1 = txtBusiness.Text;
                    }

                    //修改军衔
                    //if (txtMilitary.Text != "")
                    //{
                    //    staff.StringField2 = txtMilitary.Text;
                    //}

                    //修改入伍时间
                    if (txtEnrollment.Text != "")
                    {
                        staff.StringField10 = Convert.ToDateTime(txtEnrollment.Text);
                    }

                    //进行更新
                    staff.Update();
                }
                else if (hfRole.Value == "Manager") //修改所有记录(密码不能修改)
                {
                    //重置密码
                    staff.Password = "******";

                    //修改部门
                    //staff.Dept_Id = ddlDepartment.SelectedValue;

                    //修改是否为主管
                    staff.IsMonitor = Int32.Parse(ddlIsManager.SelectedValue);
                    //更改姓名
                    if (txtName.Text != "")
                    {
                        staff.Name = txtName.Text;
                    }

                    //更改生日
                    if (txtBirthday.Text != "")
                    {
                        staff.Birthday = Convert.ToDateTime(txtBirthday.Text);
                    }

                    //更改家庭电话
                    if (txtHomeTel.Text != "")
                    {
                        staff.StringField6 = txtHomeTel.Text;
                    }

                    //更改移动电话
                    if (txtMobileTel.Text != "")
                    {
                        staff.StringField5 = txtMobileTel.Text;
                    }

                    //更改家庭住址
                    if (txtAddress.Text != "")
                    {
                        staff.StringField8 = txtAddress.Text;
                    }

                    //更改办公电话1
                    if (txtOfficeTel.Text != "")
                    {
                        staff.StringField3 = txtOfficeTel.Text;
                    }

                    //更改办公电话2
                    if (txtOfficeTel.Text != "")
                    {
                        staff.StringField4 = txtOfficeTel2.Text;
                    }

                    //更改电话短号
                    if (txtShortTel.Text != "")
                    {
                        staff.StringField7 = txtShortTel.Text;
                    }

                    //更改短信号码
                    if (txtSMSCode.Text != "")
                    {
                        staff.StringField18 = txtSMSCode.Text;
                    }

                    //修改职务
                    if (txtBusiness.Text != "")
                    {
                        staff.StringField1 = txtBusiness.Text;
                    }

                    ////修改军衔
                    //if (txtMilitary.Text != "")
                    //{
                    //    staff.StringField2 = txtMilitary.Text;
                    //}

                    //修改入伍时间
                    if (txtEnrollment.Text != "")
                    {
                        staff.StringField10 = Convert.ToDateTime(txtEnrollment.Text);
                    }

                    //进行更新
                    staff.Update();
                }
                Response.Write("<script type='text/javascript'>alert('更新成功!'); </script>");
            }
            catch (Exception exc)
            {
                Response.Write("<script type='text/javascript'>alert('更新失败!'); </script>");
            }
        }
    }
Пример #14
0
    protected void btnUp_Click(object sender, EventArgs e)
    {
        string AttachmentBatch_Guid = "";   //附件批次  一批附件一个批次

        if (ViewState["AttachmentBatch_Guid"] == null || ViewState["AttachmentBatch_Guid"].ToString() == "")
        {
            AttachmentBatch_Guid = Guid.NewGuid().ToString();
            ViewState["AttachmentBatch_Guid"] = AttachmentBatch_Guid;
        }
        else   //添多个附件或者在修改附件的情况下
        {
            AttachmentBatch_Guid = ViewState["AttachmentBatch_Guid"].ToString();
        }
        string Attachment_Guid = Guid.NewGuid().ToString();    //文件编号,一次一个


        string FileNameQ = FileTwo.PostedFile.FileName;  //注: loFile.PostedFile.FileName 返回的是通过文件对话框选择的文件名,

        //这之中包含了文件的目录信息
        FileNameQ = Path.GetFileName(FileNameQ);                        //去掉目录信息,返回原文件名
        string[] FileNameQQ    = FileNameQ.Split('.');
        string   FileName      = FileNameQQ[0].ToString();              //原文件名
        string   ExtensionName = FileNameQQ[1].ToString().ToLower();    //原文件扩展名  转换成小写
        string   SaveFileName  = Attachment_Guid + '.' + ExtensionName; //保存后的文件名

        //路径+当天日期的文件
        string Folder = "E://File/Order/DutyRegister/" + System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() +
                        System.DateTime.Now.Day.ToString() + "/"; //路径


        if (Directory.Exists(Folder) == false)  //测试路径存不存在
        {
            Directory.CreateDirectory(Folder);  //创建路径
        }

        string lstrFileNamePath = Folder + SaveFileName;

        //得到上传目录及文件名称
        FileTwo.PostedFile.SaveAs(lstrFileNamePath);
        //上传文件到服务器

        string Insert = "Insert into SSysAttachment(Attachment_Guid,AttachmentBatch_Guid,Folder,FileName,ExtensionName,SaveFileName, " +
                        " CreatedBy,CreatedDate) values( '" + Attachment_Guid + "','" + AttachmentBatch_Guid + "','" + Folder + "','" + FileNameQQ + "','" +
                        ExtensionName + "','" + SaveFileName + "','" + ViewState["Satff_Id"].ToString() + "',getdate())";



        try
        {
            db.executeInsert(Insert);
            WebWindow.alert("保存成功");
        }
        catch (Exception er)
        {
            WebWindow.alert("保存失败 " + er.Message.ToString());
        }
        // SSysAttachment

        //编码	Attachment_Guid	  一次一个新的
        //附件批次	AttachmentBatch_Guid	  一批一个新的,修改也不变
        //文件目录	Folder	目录相同
        //原文件名	FileName	文件的不版本的该字段相同 比如第一次传的文件名为:abc  修改后的也是 abc
        //原文件扩展名	ExtensionName		扩展名都是小写  doc/txt  传来的要转换成小写

        //保存的文件名	SaveFileName	Attachment_Guid+扩展名
        //创建者	CreatedBy
        //创建日期	CreatedDate	  同一文件的不同版本根据创建日期区分,最大日期为最新的
    }
Пример #15
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        if (drpOrder_ID.SelectedValue == "0")
        {
            WebWindow.alert("请选择要操作的勤务的编号");
            return;
        }


        string Order_ID       = drpOrder_ID.SelectedValue; //勤务编号
        string EnregisterTime = this.lblEnregisterTime.Text.Trim();

        string GuardSpec = drpGuardSpec.SelectedValue;  //警卫规格:
        string MoveDate  = txtMoveDate.Text.Trim();

        try
        {
            Convert.ToInt32(MoveDate);
        }
        catch
        {
            WebWindow.alert("抵达天数请输入日期型");
            return;
        }

        if (txtMoveTomeFrom3.Text == "")
        {
            txtMoveTomeFrom3.Text = "00";
        }
        string MoveTomeFrom = txtMoveTomeFrom1.Text.Trim() + " " + drpMoveTomeFrom2.Text.Trim() + ":" + txtMoveTomeFrom3.Text.Trim() + ":00";  //日期加小时加分秒

        try
        {
            Convert.ToDateTime(MoveTomeFrom);
        }
        catch
        {
            WebWindow.alert("活动日期从请输入日期型");
            return;
        }

        if (txtMoveTomeTo3.Text == "")
        {
            txtMoveTomeTo3.Text = "00";
        }
        string MoveTomeTo = txtMoveTomeTo1.Text.Trim() + " " + drpMoveTomeTo2.Text.Trim() + ":" + txtMoveTomeTo3.Text.Trim() + ":00";  //日期加小时加分秒

        try
        {
            Convert.ToDateTime(MoveTomeTo);
        }
        catch
        {
            WebWindow.alert("活动日期从请输入日期型");
            return;
        }

        string FrontUnit     = txtFrontUnit.Text.Trim();         //      主持或主办单位:
        string AppearedFugle = txtAppearedFugle.Text.Trim();     //      出席的主要领导:

        string CalendarArrange = txtCalendarArrange.Text.Trim(); //  活动日程

        string Principal = txtPrincipal.Text.Trim();             //      负责人:
        string Roster    = txtRoster.Text.Trim();                //      值勤人员:
        string Perform   = txtPerform.Text.Trim();
        string Remark    = txtRemark.Text.Trim();                //      备注:
        string CreatedBy = txtCreatedBy.Text.Trim();             //      填表人:



        if (ViewState["State"] == null || ViewState["State"].ToString() == null)
        {
            Response.Redirect("error2.htm");
        }
        else
        {
            if (ViewState["State"].ToString() == "Insert")
            {
                string Insert = "INSERT INTO SOrdSynodBenregister([Order_ID],[EnregisterTime],[GuardSpec] ,[MoveDate] ,[MoveTomeFrom] ,[MoveTomeTo], " +
                                " [FrontUnit] ,[AppearedFugle] ,[CalendarArrange] ,[Principal] ,[Roster] ,[Remark] ,[Perform],[CreatedBy] ," +
                                " [CreatedDate]) VALUES('" + Order_ID + "','" + EnregisterTime + "','" + GuardSpec + "','" + MoveDate + "','" +
                                MoveTomeFrom + "','" + MoveTomeTo + "','" + FrontUnit + "','" + AppearedFugle + "','" + CalendarArrange + "','" + Principal + "','" +
                                Roster + "','" + Remark + "','" + Perform + "','" + CreatedBy + "',getdate()) ";


                try
                {
                    db.executeInsert(Insert);
                    WebWindow.alert("保存成功");
                }
                catch (Exception er)
                {
                    WebWindow.alert(er.Message);
                }
            }
            else if (ViewState["State"].ToString() == "Update")
            {
                if (ViewState["Order_ID"] == null || ViewState["Order_ID"].ToString() == "")
                {
                    Response.Redirect("error2.htm");
                }
                string ModifiedBy = "";
                string Update     = "UPDATE SOrdSynodBenregister set " +
                                    "[EnregisterTime] = '" + EnregisterTime + "'," +
                                    "[GuardSpec] = '" + GuardSpec + "'," +
                                    "[MoveDate] = '" + MoveDate + "'," +
                                    "[MoveTomeFrom] = '" + MoveTomeFrom + "'," +
                                    "[MoveTomeTo] = '" + MoveTomeTo + "'," +
                                    "[FrontUnit] = '" + FrontUnit + "'," +
                                    "[AppearedFugle] = '" + AppearedFugle + "'," +
                                    "[CalendarArrange] = '" + CalendarArrange + "'," +
                                    "[Principal] = '" + Principal + "'," +
                                    "[Roster] = '" + Roster + "'," +
                                    "[Remark] = '" + Remark + "'," +
                                    "[Perform] = '" + Perform + "'," +
                                    "[ModifiedBy] = '" + ModifiedBy + "'," +
                                    "[ModifiedDate] = getdate() WHERE Order_ID = '" + Order_ID + "'";


                try
                {
                    db.executeUpdate(Update);
                    WebWindow.alert("修改成功");
                }
                catch (Exception er)
                {
                    WebWindow.alert(er.Message);
                }
            }
        }
    }
Пример #16
0
    /// <summary>
    /// CustomerSensitive对象Insert方法
    /// </summary>
    private bool executeInsert()
    {
        bool   blnFirstField = true;
        string sql           = "insert into CustomerSensitive(";
        string sqlTmp        = " values(";

        // (SenCustomer_Guid)字段
        if (_blnSenCustomer_GuidChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "SenCustomer_Guid";
            sqlTmp += "'" + _SenCustomer_Guid + "'";
        }
        // (Mobile)字段
        if (_blnMobileChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Mobile";
            sqlTmp += "'" + _Mobile + "'";
        }
        // (SenPeriod)字段
        if (_blnSenPeriodChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "SenPeriod";
            sqlTmp += _SenPeriod.ToString();
        }
        // (SenEndTime)字段
        if (_blnSenEndTimeChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "SenEndTime";
            sqlTmp += "'" + _SenEndTime.ToString() + "'";
        }
        // (CreatedBy)字段
        if (_blnCreatedByChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "CreatedBy";
            sqlTmp += "'" + _CreatedBy + "'";
        }
        // (CreatedDate)字段
        if (blnFirstField == true)
        {
            blnFirstField = false;
        }
        else
        {
            sql    += ",";
            sqlTmp += ",";
        }
        sql    += "CreatedDate";
        sqlTmp += "GETDATE()";
        sql    += ")" + sqlTmp + ")";
        try
        {
            MDataBase db = new MDataBase(_DBConn);
            db.executeInsert(sql);

            return(true);
        }
        catch (Exception err)
        {
            throw;
            return(false);
        }
    }
Пример #17
0
    ///// <summary>
    ///// SSysErrorLog对象Delete方法
    ///// </summary>
    //public bool Delete()
    //{
    //    return executeDelete();
    //}

    ///// <summary>
    ///// SSysErrorLog对象Update方法
    ///// </summary>
    //public bool Update()
    //{
    //    return executeUpdate();
    //}

    ///// <summary>
    ///// 取SSysErrorLog对象信息方法
    ///// 通过对象属性得到方法返回值
    ///// </summary>
    //public bool GetInfo()
    //{
    //    return executeGetInfo();
    //}

    ///// <summary>
    ///// SSysErrorLog对象查询数据表方法
    ///// </summary>
    //public DataTable GetDataTable()
    //{
    //    return executeGetDataTable();
    //}

    ///// <summary>
    ///// SSysErrorLog对象查询数据表方法
    ///// </summary>
    //public DataTable GetDataTable(bool blnLike)
    //{
    //    if (blnLike == true)
    //    {
    //        return executeGetDataTableLike();
    //    }
    //    else
    //    {
    //        return executeGetDataTable();
    //    }
    //}
    #endregion
    #region executeInsert
    /// <summary>
    /// SSysErrorLog对象Insert方法
    /// </summary>
    private bool executeInsert()
    {
        bool   blnFirstField = true;
        string sql           = "insert into SSysErrorLog(";
        string sqlTmp        = " values(";

        // (ID)字段
        if (_blnIDChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "ID";
            sqlTmp += "'" + _ID + "'";
        }
        // (Message)字段
        if (_blnMessageChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Message";
            sqlTmp += "'" + _Message + "'";
        }
        // (Src)字段
        if (_blnSrcChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Src";
            sqlTmp += "'" + _Src + "'";
        }
        // (CreatedDate)字段
        if (blnFirstField == true)
        {
            blnFirstField = false;
        }
        else
        {
            sql    += ",";
            sqlTmp += ",";
        }
        sql    += "CreatedDate";
        sqlTmp += "GETDATE()";
        // (Staff_Id)字段
        if (_blnStaff_IdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Staff_Id";
            sqlTmp += "'" + _Staff_Id + "'";
        }
        sql += ")" + sqlTmp + ")";
        try
        {
            MDataBase db = new MDataBase(_DBConn);
            db.executeInsert(sql);

            return(true);
        }
        catch (Exception err)
        {
            eventLog(err);
            return(false);
        }
    }
Пример #18
0
    private string SaveNet(string Personnel)
    {
        if (drpOrder_ID.SelectedValue == "0")
        {
            return("请选择要操作的勤务的编号");
        }
        string Net_Guid = Guid.NewGuid().ToString();

        if (ViewState["Net_Guid"] == null || ViewState["Net_Guid"].ToString() == "")
        {
            ViewState["Net_Guid"] = Net_Guid;     //得到编号
        }
        string Title = this.txtTitle.Text.Trim(); //标题 

        string Net = "";

        if (CheckNet1.Checked == true)
        {
            Net = "八局网站";
        }
        else if (CheckNet2.Checked == true)
        {
            Net = "省厅网站";
        }
        else if (CheckNet3.Checked == true)
        {
            Net = "省局网站";
        }

        string Type = "";

        if (radType1.Checked == true)
        {
            Type = "发布栏目";
        }
        else if (radType2.Checked == true)
        {
            Type = "发布子栏目";
        }
        else if (radType3.Checked == true)
        {
            Type = "勤务信息";
        }
        else if (radType4.Checked == true)
        {
            Type = "现场勤务";
        }
        string Unit1   = this.txtUnit.Text.Trim();    //单位
        string Content = this.txtContent.Text.Trim(); //内容

        string Man     = "";                          //得到当前的用户名ID
        string Time    = this.lblTime.Text.Trim();    //时间
        string Adjunct = "";

        if (ViewState["AttachmentBatch_Guid"] == null || ViewState["AttachmentBatch_Guid"].ToString() == "")
        {
        }
        else
        {
            Adjunct = ViewState["AttachmentBatch_Guid"].ToString(); //要改的 
        }

        if (ViewState["State"].ToString() == "Insert")
        {
              
            {
                string Insert = "INSERT INTO SOrdNet([Order_ID],[Net_Guid],[Title],[Net],[Type],[Content],[Unit],[Man] ,[Time] ,[Adjunct] ,[CreatedBy]," +
                                "[CreatedDate] ,[StatusId] ) VALUES ('" + drpOrder_ID.SelectedValue + "','" + ViewState["Net_Guid"].ToString() + "','" + Title + "','" + Net + "','" + Type + "','" + Content + "','" +
                                Unit1 + "','" + ViewState["Satff_Id"].ToString() + "','" + Time + "','" + Adjunct + "','" + ViewState["Satff_Id"].ToString() + "',getdate(),1)";

                try
                {
                    db.executeInsert(Insert);
                    return("保存成功");
                }
                catch (Exception er)
                {
                    return(er.Message);
                }
            }
        }
        else if (ViewState["State"].ToString() == "Update")
        {
            string Update = "UPDATE SOrdNet set " +
                            "[Net_Guid] = '" + Net_Guid + "'," +
                            "[Title] = '" + Title + "'," +
                            "[Net] = '" + Net + "'," +
                            "[Type] = '" + Type + "'," +
                            "[Content] = '" + Content + "'," +
                            "[Unit] = '" + Unit1 + "'," +
                            "[Man] = '" + Man + "'," +
                            "[Time] = '" + Time + "'," +
                            "[Adjunct] = '" + Adjunct + "'," +
                            "[Personnel] = '" + Personnel + "'," +
                            "[ModifiedBy] = '" + ViewState["Satff_Id"].ToString() + "'," +
                            "[ModifiedDate] = getdate() WHERE Order_ID = '" + ViewState["Order_ID"].ToString() + "'";

            try
            {
                db.executeUpdate(Update);
                return("修改成功");
            }
            catch (Exception er)
            {
                return(er.Message);
            }
        }
        return("");
    }
Пример #19
0
    /// <summary>
    /// SExmQuestion对象Insert方法
    /// </summary>
    private bool executeInsert()
    {
        bool   blnFirstField = true;
        string sql           = "insert into SExmQuestion(";
        string sqlTmp        = " values(";

        // (Question_Guid)字段
        if (_blnQuestion_GuidChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Question_Guid";
            sqlTmp += "'" + _Question_Guid + "'";
        }
        // (QuestionType_Id)字段
        if (_blnQuestionType_IdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "QuestionType_Id";
            sqlTmp += "'" + _QuestionType_Id + "'";
        }
        // (Question)字段
        if (_blnQuestionChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Question";
            sqlTmp += "'" + _Question + "'";
        }
        // (AnswerA)字段
        if (_blnAnswerAChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "AnswerA";
            sqlTmp += "'" + _AnswerA + "'";
        }
        // (AnswerB)字段
        if (_blnAnswerBChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "AnswerB";
            sqlTmp += "'" + _AnswerB + "'";
        }
        // (AnswerC)字段
        if (_blnAnswerCChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "AnswerC";
            sqlTmp += "'" + _AnswerC + "'";
        }
        // (AnswerD)字段
        if (_blnAnswerDChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "AnswerD";
            sqlTmp += "'" + _AnswerD + "'";
        }
        // (AnswerE)字段
        if (_blnAnswerEChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "AnswerE";
            sqlTmp += "'" + _AnswerE + "'";
        }
        // (Answer)字段
        if (_blnAnswerChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Answer";
            sqlTmp += "'" + _Answer + "'";
        }
        // (Times)字段
        if (_blnTimesChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "Times";
            sqlTmp += _Times.ToString();
        }
        // (CreatedBy)字段
        if (_blnCreatedByChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "CreatedBy";
            sqlTmp += "'" + _CreatedBy + "'";
        }
        // (CreatedDate)字段
        if (blnFirstField == true)
        {
            blnFirstField = false;
        }
        else
        {
            sql    += ",";
            sqlTmp += ",";
        }
        sql    += "CreatedDate";
        sqlTmp += "GETDATE()";
        // (StatusId)字段
        if (_blnStatusIdChanged == true)
        {
            if (blnFirstField == true)
            {
                blnFirstField = false;
            }
            else
            {
                sql    += ",";
                sqlTmp += ",";
            }
            sql    += "StatusId";
            sqlTmp += _StatusId.ToString();
        }
        sql += ")" + sqlTmp + ")";
        try
        {
            MDataBase db = new MDataBase(_DBConn);
            db.executeInsert(sql);

            return(true);
        }
        catch (Exception err)
        {
            throw;
            return(false);
        }
    }
Пример #20
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        if (drpOrder_ID.SelectedValue == "0")
        {
            WebWindow.alert("请选择要操作的勤务的编号");
            return;
        }


        string Order_ID       = drpOrder_ID.SelectedValue; //勤务编号
        string EnregisterTime = this.lblEnregisterTime.Text.Trim() + " 00:00:00";

        string GuardSpec = drpGuardSpec.SelectedValue;  //警卫规格:
        string TaskName  = txtTaskName.Text.Trim();     //警卫名称

        string DayNumber = txtDayNumber.Text.Trim();    // 抵达情况:

        try
        {
            Convert.ToInt32(txtDayNumber.Text.Trim());
        }
        catch
        {
            WebWindow.alert("抵达天数请输入日期型");
            return;
        }
        string ArrivalTime = txtArrivalTime1.Text.Trim() + " " + drpArrivalTime2.Text.Trim() + ":00:00";  //日期加小时加分秒

        try
        {
            Convert.ToDateTime(ArrivalTime);
        }
        catch
        {
            WebWindow.alert("抵达时间请输入日期型");
            return;
        }
        string FromArea    = txtFromArea.Text.Trim();                                                                  //自
        string RiteVehicle = txtRiteVehicle.Text.Trim();                                                               //   乘
        string ArrivalArea = txtArrivalArea.Text.Trim();                                                               //抵

        string ArrivalTimeTwo = txtArrivalTimeTwo1.Text.Trim() + " " + this.drpArrivalTimeTwo2.Text.Trim() + ":00:00"; //日期加小时加分秒

        try
        {
            Convert.ToDateTime(ArrivalTimeTwo);
        }
        catch
        {
            WebWindow.alert("抵达时间请输入日期型");
            return;
        }
        string FromAreaTwo    = txtFromAreaTwo.Text.Trim();    //自
        string RiteVehicleTwo = txtRiteVehicleTwo.Text.Trim(); //   乘
        string ArrivalAreaTwo = txtArrivalAreaTwo.Text.Trim(); //抵

        string ReceiveArea   = txtReceiveArea.Text.Trim();     //      接待单位:
        string AccompanyFugl = txtAccompanyFugle.Text.Trim();  //      省陪同领导:
        string MoveDate      = txtMoveDate.Text.Trim();        //      活动日程:

        string AccompanyPeo = txtAccompanyPeo.Text.Trim();     //  随行人员(姓名/职务):
        string GuardCuston  = txtGuardCuston.Text.Trim();      //   警卫对象生活习惯:

        string Principal = txtPrincipal.Text.Trim();           //      负责人:
        string Roster    = txtRoster.Text.Trim();              //      值勤人员:
        string Perform   = txtPerform.Text.Trim();

        string Remark    = txtRemark.Text.Trim();    //      备注:
        string CreatedBy = txtCreatedBy.Text.Trim(); //      填表人:



        if (ViewState["State"] == null || ViewState["State"].ToString() == null)
        {
            Response.Redirect("error2.htm");
        }
        else
        {
            if (ViewState["State"].ToString() == "Insert")
            {
                string Insert = "INSERT INTO SOrdNWBenregister ([Order_ID] ,[EnregisterTime] ,[GuardSpec] ,[DayNumber] ,[ArrivalTime] ,[FromArea] ,[RiteVehicle] ," +
                                "[ArrivalArea] ,[ArrivalTimeTwo] ,[FromAreaTwo] ,[RiteVehicleTwo] ,[ArrivalAreaTwo] ,[ReceiveArea] ,[AccompanyFugle] ,[MoveDate] ," +
                                "[AccompanyPeo] ,[GuardCuston] ,[Principal] ,[Roster] ,[Perform] ,[Remark] ,[CreatedBy] ,[CreatedDate]) VALUES " +
                                "('" + Order_ID + "','" + EnregisterTime + "','" + GuardSpec + "','" + DayNumber + "','" + ArrivalTime + "','" + FromArea + "','" + RiteVehicle + "','" + ArrivalArea + "','" + ArrivalTimeTwo + "','" +
                                FromAreaTwo + "','" + RiteVehicleTwo + "','" + ArrivalAreaTwo + "','" + ReceiveArea + "','" + AccompanyFugl + "','" + MoveDate + "','" + AccompanyPeo + "','" + GuardCuston + "','" +
                                Principal + "','" + Roster + "','" + Perform + "','" + Remark + "','" + CreatedBy + "',getdate())";

                try
                {
                    db.executeInsert(Insert);
                    WebWindow.alert("保存成功");
                }
                catch (Exception er)
                {
                    WebWindow.alert(er.Message);
                }
            }
            else if (ViewState["State"].ToString() == "Update")
            {
                if (ViewState["Order_ID"] == null || ViewState["Order_ID"].ToString() == "")
                {
                    Response.Redirect("error2.htm");
                }
                string ModifiedBy = "";
                string Update     = "UPDATE SOrdNWBenregister set [GuardSpec] = '" + GuardSpec + "',[DayNumber] = '" + DayNumber + "',[ArrivalTime]= '" + ArrivalTime + "',[FromArea] = '" +
                                    FromArea + "',[RiteVehicle]  = '" + RiteVehicle + "',[ArrivalArea] = '" + ArrivalArea + "', [ArrivalTimeTwo] = '" + ArrivalTimeTwo +
                                    "',[FromAreaTwo] = '" + FromAreaTwo + "',[RiteVehicleTwo] = '" + RiteVehicleTwo + "',[ArrivalAreaTwo] = '" + ArrivalAreaTwo +
                                    "',[ReceiveArea] = '" + ReceiveArea + "',[AccompanyFugle] = '" + AccompanyFugl + "',[MoveDate] = '" + MoveDate + "',[AccompanyPeo] = '" + AccompanyPeo + "',[GuardCuston] = '" +
                                    GuardCuston + "',[Principal] = '" + Principal + "',[Roster] = '" + Roster + "',[Perform]= '" + Perform + "',[Remark] = '" +
                                    Remark + "',[ModifiedBy] = '" + ModifiedBy + "',[ModifiedDate] = getdate() WHERE Order_ID = '" + ViewState["Order_ID"].ToString() + "'";

                try
                {
                    db.executeUpdate(Update);
                    WebWindow.alert("修改成功");
                }
                catch (Exception er)
                {
                    WebWindow.alert(er.Message);
                }
            }
        }
    }