Пример #1
0
 //check for the missing Sign out entries. Employee will not be allowed to sign in unless he has singed out for the corr sign-ins.
 public DataSet CheckMissingSignOut(SignInSignOutModel objSignInSignOutModel)
 {
     try
     {
         DataSet dsCheckMissingSignOut = new DataSet();
         dsCheckMissingSignOut = objSignInSignOutBOL.CheckMissingSignOut(objSignInSignOutModel);
         return(dsCheckMissingSignOut);
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "SignInSignOut.cs", "CheckMissingSignOut", ex.StackTrace);
         throw new V2Exceptions();
     }
 }
Пример #2
0
    public void CheckAndGetDateData()
    {
        try
        {
            objSignInSignOutModel.SignInTime = Convert.ToDateTime(txtSignInDate.Text);
            objSignInSignOutModel.EmployeeID = Convert.ToInt16(User.Identity.Name);
            dsGetOldData = objManualSignInSignOutBOL.CheckAndGetDateData(objSignInSignOutModel);
            DataSet  dsCheckMissingOutTime = objSignInSignOutBOL.CheckMissingSignOut(objSignInSignOutModel); //Missing Sign-Outs
            DateTime dt1 = Convert.ToDateTime(dsGetOldData.Tables[1].Rows[0]["ConfigItemValue"].ToString());

            if (dsGetOldData.Tables[0].Rows.Count != 0) // entry already exist
            {
                lblErrorMess.Text  = "Record for this date already exist. Please click the Date link on the Home Page to modify this record or Enter a new date";
                txtSignInDate.Text = "";
            }
            else if (dt1 >= objSignInSignOutModel.SignInTime)// freez date
            {
                lblErrorMess.Text  = "Administrator has frozen the data for the selected date";
                txtSignInDate.Text = "";
            }
            else if (dsCheckMissingOutTime.Tables[0].Rows.Count != 0) // Missing Sign-Outs
            {
                string Dates = "";
                for (int i = 0; i < dsCheckMissingOutTime.Tables[0].Rows.Count; i++)
                {
                    string strdate = DateTime.Today.ToString("MM/dd/yyyy");
                    if (dsCheckMissingOutTime.Tables[0].Rows[i]["Dates"].ToString() != strdate)
                    {
                        if (i == 0)
                        {
                            Dates = dsCheckMissingOutTime.Tables[0].Rows[i]["Dates"].ToString();
                        }
                        else
                        {
                            Dates = Dates + "," + dsCheckMissingOutTime.Tables[0].Rows[i]["Dates"].ToString();
                        }
                    }
                }
                if (Dates != "")
                {
                    lblErrorMess.Text   = "You have not signed out on " + Dates;
                    txtSignInDate.Text  = "";
                    txtSignOutDate.Text = "";
                }
                else
                {
                    lblErrorMess.Text   = "";
                    txtSignOutDate.Text = txtSignInDate.Text;
                }
            }
            else
            {
                lblErrorMess.Text   = "";
                txtSignOutDate.Text = txtSignInDate.Text;
            }

            #region Commented
            //DateTime dtInTime = Convert.ToDateTime(dsGetOldData.Tables[0].Rows[0]["SignInTime"].ToString());
            //txtSignInDate.Text = dtInTime.ToShortDateString();
            //txtInComments.Text = dsGetOldData.Tables[0].Rows[0]["SignInComment"].ToString();


            //ddlInHrs.SelectedValue = dtInTime.Hour.ToString();
            //ddlInMins.SelectedValue = dtInTime.Minute.ToString();



            //if(dsGetOldData.Tables[0].Rows[0]["SignOutTime"].ToString()!="")
            //{
            //    DateTime dtOutTime = Convert.ToDateTime(dsGetOldData.Tables[0].Rows[0]["SignOutTime"].ToString());
            //    txtSignOutDate.Text=dtOutTime.ToShortDateString();
            //    ddlOutHrs.SelectedValue = dtOutTime.Hour.ToString();
            //    ddlOutMins.SelectedValue = dtOutTime.Minute.ToString();
            //   txtOutComments.Text=dsGetOldData.Tables[0].Rows[0]["SignOutComment"].ToString();
            //}
            #endregion
        }
        catch (V2Exceptions ex)
        {
            throw;
        }
        catch (System.Exception ex)
        {
            FileLog objFileLog = FileLog.GetLogger();
            objFileLog.WriteLine(LogType.Error, ex.Message, "ManualSignInSignOut.cs", "CheckAndGetDateData", ex.StackTrace);


            throw new V2Exceptions();
        }
    }