public List <BDMAppointmentServerFilter> GetAllAppointmentDetails(BDMAppoinmentDetailGetDetailDTO objAppointmentDetail)
        {
            List <BDMAppointmentServerFilter> appoinment = new List <BDMAppointmentServerFilter>();

            using (DbLayer dbLayer = new DbLayer())
            {
                if (objAppointmentDetail.Position == 1)
                {
                    SqlCommand SqlCmd = new SqlCommand("spCEOSelectBDMAppoinmentDetail");
                    SqlCmd.CommandType = CommandType.StoredProcedure;
                    SqlCmd.Parameters.AddWithValue("@Position", objAppointmentDetail.Position);
                    if (objAppointmentDetail.FromDate.Year != 1)
                    {
                        SqlCmd.Parameters.AddWithValue("@FromDate", objAppointmentDetail.FromDate);
                        if (objAppointmentDetail.ToDate.Year != 1)
                        {
                            SqlCmd.Parameters.AddWithValue("@ToDate", objAppointmentDetail.ToDate);
                        }
                    }
                    else
                    {
                        SqlCmd.Parameters.AddWithValue("@FromDate", DateTime.Now.AddDays(-30));
                        SqlCmd.Parameters.AddWithValue("@ToDate", DateTime.Now);
                    }

                    SqlCmd.Parameters.AddWithValue("@ActionBy", objAppointmentDetail.ActionBy);
                    appoinment = dbLayer.GetEntityList <BDMAppointmentServerFilter>(SqlCmd);
                }
                else
                {
                    SqlCommand SqlCmd1 = new SqlCommand("spSelectBDMAppoinmentDetail");
                    SqlCmd1.CommandType = CommandType.StoredProcedure;
                    SqlCmd1.Parameters.AddWithValue("@ActionBy", objAppointmentDetail.ActionBy);
                    if (objAppointmentDetail.FromDate.Year != 1)
                    {
                        SqlCmd1.Parameters.AddWithValue("@FromDate", objAppointmentDetail.FromDate);
                        if (objAppointmentDetail.ToDate.Year != 1)
                        {
                            SqlCmd1.Parameters.AddWithValue("@ToDate", objAppointmentDetail.ToDate);
                        }
                    }
                    else
                    {
                        SqlCmd1.Parameters.AddWithValue("@FromDate", DateTime.Now.AddDays(-30));
                        SqlCmd1.Parameters.AddWithValue("@ToDate", DateTime.Now);
                    }
                    appoinment = dbLayer.GetEntityList <BDMAppointmentServerFilter>(SqlCmd1);
                }
            }
            return(appoinment);
        }
Esempio n. 2
0
        public HttpResponseMessage GetAllBDMAppointmentDetails(BDMAppoinmentDetailGetDetailDTO objAppointmentDetail)
        {
            HttpResponseMessage message;

            try
            {
                // BDMAppointmentDetailDAL dal = new BDMAppointmentDetailDAL();
                var dynObj = new { result = _obj.GetAllAppointmentDetails(objAppointmentDetail) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" });

                ErrorLog.CreateErrorMessage(ex, "BDMAppoinmentDetail", "GetAllBDMAppointmentDetails");
            }
            return(message);
        }