protected void btnOK_Click(object sender, EventArgs e)
        {
            int           n       = int.Parse(lblApprovalStateID.Text);
            string        strConn = ConfigurationManager.ConnectionStrings["Conn1"].ToString();
            string        strSQL  = string.Format("insert into AskLeaveApprovalState values({0},'{1}');", n, txtApprovalState.Text);
            SqlConnection conn    = new SqlConnection(strConn);
            SqlCommand    com     = new SqlCommand(strSQL, conn);

            conn.Open();
            try
            {
                n = com.ExecuteNonQuery();
                if (n == 1)
                {
                    Response.Write(DialogMessage.CreateMessage("添加成功!"));
                }
                else
                {
                    Response.Write(DialogMessage.CreateMessage("添加不成功!"));
                }
            }
            catch (Exception ex)
            {
                lblResult.Text = ex.Message;
            }
            finally
            {
                com.Dispose();
                conn.Close();
            }

            grdAskLeaveApprovalState.DataBind();

            btnCancel_Click(null, null);
        }
예제 #2
0
        protected void grdAskLeave_SelectedIndexChanged(object sender, EventArgs e)
        {
            int    AskID = int.Parse(grdAskLeave.SelectedRow.Cells[2].Text);
            int    n     = 0;
            string CheckID;

            lblResult.Text = AskID.ToString();
            string        strConn = ConfigurationManager.ConnectionStrings["Conn1"].ToString();
            string        strSQL  = string.Format("update StudentLeaveInfo set AskLeaveApprovalStateID=2 where StuLeaveID={0};", AskID);
            SqlConnection conn    = new SqlConnection(strConn);
            SqlCommand    com     = new SqlCommand(strSQL, conn);
            SqlDataReader dr;

            conn.Open();
            n = com.ExecuteNonQuery();
            if (n == 1)
            {
                strSQL          = string.Format("select CheckTeacherID from AskLeaveCheckTurn where CheckTurn = 1;");
                com.CommandText = strSQL;
                dr = com.ExecuteReader();
                if (dr.HasRows)
                {
                    strSQL = "";
                    while (dr.Read())
                    {
                        CheckID = dr.GetValue(0).ToString();
                        strSQL += string.Format("insert into StudentLeaveCheckProcess(StuLeaveID,CheckTurn,CheckID) values({0},1,'{1}');", AskID, CheckID);
                    }
                    dr.Close();
                    com.CommandText = strSQL;
                    n = com.ExecuteNonQuery();
                    Response.Write(DialogMessage.CreateMessage("提交成功,请等待辅导员审核!"));
                }
                else
                {
                    strSQL          = string.Format("update StudentLeaveInfo set AskLeaveApprovalStateID=1 where StuLeaveID={0};", AskID);
                    com.CommandText = strSQL;
                    com.ExecuteNonQuery();
                    Response.Write(DialogMessage.CreateMessage("提交不成功,请联系管理员!"));
                }
            }
            else
            {
                Response.Write(DialogMessage.CreateMessage("提交不成功,请联系系统管理员!"));
            }


            com.Dispose();
            conn.Close();
            UpdateData();
        }
예제 #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int    n = 0, turn, stateID = 0;
            int    LeaveID = int.Parse(lblLeaveID.Text);
            string strConn = ConfigurationManager.ConnectionStrings["Conn1"].ToString();
            //update StudentLeaveCheckProcess set IsPass='******' where StuLeaveId=7;

            string        strSQL = string.Format("update StudentLeaveCheckProcess set IsPass='******',ReasonForNoPass='******',CheckDate='{2}' where StuLeaveID={3} and CheckID='{4}';", "不同意", txtReason.Text, DateTime.Now, LeaveID, Session["UserName"].ToString());
            SqlConnection conn   = new SqlConnection(strConn);

            conn.Open();
            SqlCommand com = new SqlCommand(strSQL, conn);

            n = com.ExecuteNonQuery();
            if (n > 0)
            {
                strSQL          = string.Format("select CheckTurn from AskLeaveCheckTurn where CheckTeacherID = '{0}';", Session["UserName"].ToString());
                com.CommandText = strSQL;
                turn            = (int)com.ExecuteScalar();
                switch (turn)
                {
                case 1:
                    stateID = 4;
                    break;

                case 2:
                    stateID = 6;
                    break;

                case 3:
                    stateID = 8;
                    break;

                case 4:
                    stateID = 10;
                    break;
                }
                strSQL          = string.Format("Update StudentLeaveInfo set IsPass={0},AskLeaveApprovalStateID={1} where StuLeaveID={2};", -1, stateID, LeaveID);
                com.CommandText = strSQL;
                com.ExecuteNonQuery();
                Response.Write(DialogMessage.CreateMessage("审核处理完成!"));
                UpdateGridView();
            }

            com.Dispose();
            conn.Close();
            ReasonReject.Visible = false;
            txtReason.Text       = "";
        }
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (filePath.FileName == "")
     {
         int           n = 0, StuOutCampusID = int.Parse(lblRendID.Text);
         string        RentingContract = System.IO.Path.GetFileName(filePath.PostedFile.FileName);
         string        strConn         = ConfigurationManager.ConnectionStrings["Conn1"].ToString();
         string        strSQL          = string.Format("insert into StudentOutCampusInfo values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}');", StuOutCampusID, Session["UserName"].ToString(), txtAddress.Text, txtName.Text, txtPhone.Text, "null", DateStart.Text, DateEnd.Text);
         SqlConnection conn            = new SqlConnection(strConn);
         SqlCommand    com             = new SqlCommand(strSQL, conn);
         conn.Open();
         n = com.ExecuteNonQuery();
         if (n > 0)
         {
             Response.Write(DialogMessage.CreateMessage("租房信息更新成功!"));
         }
     }
     else
     {
         Response.Write(DialogMessage.CreateMessage("你还没有选择租房合同复印件!"));
     }
 }
예제 #5
0
        protected void txtStart_TextChanged(object sender, EventArgs e)
        {
            int year, month, day;
            int m = 0;

            if (txtStart.Text != "")
            {
                year  = int.Parse(txtStart.Text.Substring(0, 4));
                month = int.Parse(txtStart.Text.Substring(5, 2));
                day   = int.Parse(txtStart.Text.Substring(8, 2));
                DateTime dtstart = new DateTime(year, month, day);
                if (dtstart < DateTime.Now)
                {
                    Response.Write(DialogMessage.CreateMessage("请假时间不能早于今天!"));
                    txtStart.Text     = "";
                    txtEnd.Text       = "";
                    lblDaysLeave.Text = "";
                    return;
                }
                if (txtEnd.Text != "")
                {
                    year  = int.Parse(txtEnd.Text.Substring(0, 4));
                    month = int.Parse(txtEnd.Text.Substring(5, 2));
                    day   = int.Parse(txtEnd.Text.Substring(8, 2));
                    DateTime dtend = new DateTime(year, month, day);
                    m = (dtend - dtstart).Days;
                    if (m < 0)
                    {
                        Response.Write(DialogMessage.CreateMessage("请假开始时间不能晚于请假结束时间!"));
                        txtStart.Text     = "";
                        txtEnd.Text       = "";
                        lblDaysLeave.Text = "";
                        return;
                    }
                    lblDaysLeave.Text = m.ToString();
                }
            }
        }
예제 #6
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            int    LeaveID, n = 0, turn, stateID = 0;
            Button btn = (Button)sender;

            LeaveID = int.Parse(btn.CommandArgument);
            string strConn = ConfigurationManager.ConnectionStrings["Conn1"].ToString();
            //update StudentLeaveCheckProcess set IsPass='******' where StuLeaveId=7;


            string strSQL;

            strSQL = string.Format("select CheckTurn from AskLeaveCheckTurn where CheckTeacherID = '{0}';", Session["UserName"].ToString());
            SqlConnection conn = new SqlConnection(strConn);
            SqlCommand    com  = new SqlCommand(strSQL, conn);
            SqlDataReader dr;

            conn.Open();
            turn            = (int)com.ExecuteScalar();
            strSQL          = string.Format("select count(*) from StudentLeaveCheckProcess where StuLeaveID={0} and CheckTurn={1} and IsPass is not null;", LeaveID, turn);
            com.CommandText = strSQL;
            n = (int)com.ExecuteScalar();

            strSQL          = string.Format("update StudentLeaveCheckProcess set IsPass='******',Checkdate='{1}' where StuLeaveId={2} and CheckID='{3}';", "同意", DateTime.Now, LeaveID, Session["UserName"].ToString());
            strSQL         += string.Format("delete StudentLeaveCheckProcess where StuLeaveId={0} and CheckID!='{1}' and IsPass is null;", LeaveID, Session["UserName"].ToString());
            com.CommandText = strSQL;
            // Response.Write(DialogMessage.CreateMessage(strSQL));
            n = com.ExecuteNonQuery();
            if (n > 0)
            {
                //  Response.Write(DialogMessage.CreateMessage(turn.ToString()));
                switch (turn)
                {
                case 1:
                    stateID = 3;
                    break;

                case 2:
                    stateID = 5;
                    break;

                case 3:
                    stateID = 7;
                    break;

                case 4:
                    stateID = 9;
                    break;
                }
                if (turn == 4)
                {
                    strSQL = string.Format("update StudentLeaveInfo set AskLeaveApprovalStateID={0},IsPass={1} where StuLeaveID={2};", stateID, 1, LeaveID);
                    //请假条审批完成
                    com.CommandText = strSQL;
                    com.ExecuteNonQuery();
                    Response.Write(DialogMessage.CreateMessage("审批成功!"));
                }
                else
                {
                    turn++;
                    //   Response.Write(DialogMessage.CreateMessage(turn.ToString()));
                    strSQL          = string.Format("select CheckTeacherID from AskLeaveCheckTurn where CheckTurn = {0};", turn);
                    com.CommandText = strSQL;
                    dr     = com.ExecuteReader();
                    strSQL = "";
                    string chkID;
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            chkID   = dr.GetValue(0).ToString();
                            strSQL += string.Format("insert into StudentLeaveCheckProcess(StuLeaveID,CheckTurn,CheckID) values({0},{1},'{2}');", LeaveID, turn, chkID);
                        }
                    }
                    else
                    {
                        // Response.Write(DialogMessage.CreateMessage(turn.ToString()));
                    }
                    dr.Close();
                    com.CommandText = strSQL;
                    n = com.ExecuteNonQuery();
                    //  Response.Write(DialogMessage.CreateMessage("n=" + n.ToString()));
                    if (n > 0)
                    {
                        strSQL          = string.Format("update StudentLeaveInfo set AskLeaveApprovalStateID={0} where StuLeaveID={1};", stateID, LeaveID);
                        com.CommandText = strSQL;
                        com.ExecuteNonQuery();
                        Response.Write(DialogMessage.CreateMessage("审批完成!"));
                    }
                }
            }
            else
            {
                Response.Write(DialogMessage.CreateMessage("没有成功!"));
            }
            UpdateGridView();


            com.Dispose();
            conn.Close();
        }
예제 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserName"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     else
     {
         string        strConn = ConfigurationManager.ConnectionStrings["Conn1"].ToString();
         string        strSQL  = string.Format("select Building,RoomNo,Floor,RoomType.RoomType,RoomPrice,StudentNumber,RoomSate.RoomState  from StudentInCampusInfo,Rooms,RoomSate,RoomType where StudentInCampusInfo.RoomID=Rooms.RoomID and Rooms.State=RoomSate.RoomStateID and Rooms.RoomType = RoomType.RoomTypeID and StudentID='{0}';", Session["UserName"].ToString());
         SqlConnection conn    = new SqlConnection(strConn);
         SqlCommand    com     = new SqlCommand(strSQL, conn);
         conn.Open();
         SqlDataReader dr = com.ExecuteReader();
         if (dr.HasRows)
         {
             dr.Read();
             if (dr.GetValue(0) != null && dr.GetValue(1) != null)
             {
                 lblBuilding.Text = dr.GetValue(0).ToString() + dr.GetValue(1).ToString();
             }
             if (dr.GetValue(2) != null)
             {
                 lblFloor.Text = dr.GetValue(2).ToString();
             }
             if (dr.GetValue(3) != null)
             {
                 lblRoomType.Text = dr.GetValue(3).ToString();
             }
             if (dr.GetValue(4) != null)
             {
                 lblPrice.Text = dr.GetValue(4).ToString();
             }
             if (dr.GetValue(5) != null)
             {
                 lblStudentNumber.Text = dr.GetValue(5).ToString();
             }
             if (dr.GetValue(6) != null)
             {
                 lblRoomState.Text = dr.GetValue(6).ToString();
             }
             InCampus.Visible = true;
         }
         else
         {
             InCampus.Visible = false;
             dr.Close();
             strSQL          = string.Format("select RentingHouseAddress,LandlordName,LandlordPhone,RentingContract,RentDateStart,RentDateEnd from StudentOutCampusInfo where StudentID='{0}' order by RentDateStart;", Session["UserName"].ToString());
             com.CommandText = strSQL;
             dr = com.ExecuteReader();
             if (dr.HasRows)
             {
                 dr.Read();
                 if (dr.GetValue(0) != null)
                 {
                     lblAddress.Text = dr.GetValue(0).ToString();
                 }
                 if (dr.GetValue(1) != null)
                 {
                     lblName.Text = dr.GetValue(1).ToString();
                 }
                 if (dr.GetValue(2) != null)
                 {
                     lblPhone.Text = dr.GetValue(2).ToString();
                 }
                 if (dr.GetValue(3) != null)
                 {
                     linkContract.NavigateUrl = "File/RentContract/" + dr.GetValue(3).ToString();
                 }
                 if (dr.GetValue(4) != null)
                 {
                     lblDateStart.Text = dr.GetValue(4).ToString();
                 }
                 if (dr.GetValue(5) != null)
                 {
                     lblDateEnd.Text = dr.GetValue(5).ToString();
                 }
                 OutCampus.Visible = true;
                 dr.Close();
                 com.Dispose();
                 conn.Close();
             }
             else
             {
                 OutCampus.Visible = false;
                 Response.Write(DialogMessage.CreateMessage("没有您的住宿信息和租房信息!"));
             }
         }
     }
 }