コード例 #1
0
        protected void imgbtnAttEdit_Click(object sender, EventArgs e)
        {
            lblMessage.Text = "";
            List <HRM_ATTENDANCE> objAttendance = new List <HRM_ATTENDANCE>();
            ImageButton           imgbtn        = (ImageButton)sender;
            GridViewRow           row           = (GridViewRow)imgbtn.NamingContainer;

            try
            {
                string AttendanceId = "";
                Label  lblId        = (Label)GridViewEMP_AT.Rows[row.RowIndex].FindControl("lblId");
                if (lblId != null)
                {
                    string OCODE = ((SessionUser)Session["SessionUser"]).OCode;
                    AttendanceId  = lblId.Text;
                    objAttendance = objAtt_BLL.GetAttendanceById(AttendanceId, OCODE);

                    if (objAttendance.Count > 0)
                    {
                        foreach (HRM_ATTENDANCE attendance in objAttendance)
                        {
                            hiddenId.Value = attendance.ATTE_ID.ToString();
                            txtEID.Text    = attendance.EID;
                            //txtEmpName_AT.Text = attendance.HRM_PersonalInformations.FirstName + " " + attendance.HRM_PersonalInformations.LastName;
                            //lblHiddenId.Text = Convert.ToString(attendance.EmpId);

                            txtAttDate.Text    = Convert.ToDateTime(attendance.Attendance_Date).ToShortDateString();
                            txtRemarks_AT.Text = attendance.Remarks;
                            txtWorkingDay.Text = attendance.Working_Day;

                            if (attendance.Status == "p")
                            {
                                rdbPresent.Checked = true;
                            }
                            if (attendance.Status == "L")
                            {
                                rdbLate.Checked = true;
                            }
                            if (attendance.Status == "OL")
                            {
                                rdbOverLate.Checked = true;
                            }
                            if (attendance.Status == "A")
                            {
                                rdbAbsent.Checked = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }