コード例 #1
0
        public HttpResponseMessage GetAppoinmentDetailtoExport(BDMAppoinmentDetailExport objAppointmentDetail)
        {
            HttpResponseMessage message;

            try
            {
                // BDMAppointmentDetailDAL dal = new BDMAppointmentDetailDAL();
                var dynObj = new { result = _obj.GetAppoinmentDetailtoExport(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", "GetAppoinmentDetailtoExport");
            }
            return(message);
        }
コード例 #2
0
        public List <BDMAppoinmentExportExcel> GetAppoinmentDetailtoExport(BDMAppoinmentDetailExport ExportDetail)
        {
            List <BDMAppoinmentExportExcel> appoinments = new List <BDMAppoinmentExportExcel>();

            using (DbLayer dbLayer = new DbLayer())
            {
                if (ExportDetail.Position != 1)
                {
                    SqlCommand SqlCmd = new SqlCommand("spSelectBDMAppoinmentDetailExport");
                    SqlCmd.CommandType = CommandType.StoredProcedure;
                    SqlCmd.Parameters.AddWithValue("@ActionBy", ExportDetail.ActionBy);
                    if (ExportDetail.EmployeeId != 0)
                    {
                        SqlCmd.Parameters.AddWithValue("@EmployeeId", ExportDetail.EmployeeId);
                        //if (FilterDetail.FromDate.Year == 1 && FilterDetail.ToDate.Year == 1)
                        //{
                        //    SqlCmd.Parameters.AddWithValue("@FromDate", DateTime.Now.AddDays(-30));
                        //    SqlCmd.Parameters.AddWithValue("@ToDate", DateTime.Now);
                        //}
                    }
                    if (ExportDetail.FirstName != null && ExportDetail.FirstName != "")
                    {
                        SqlCmd.Parameters.AddWithValue("@FirstName", ExportDetail.FirstName);
                        //if (FilterDetail.FromDate.Year == 1 && FilterDetail.ToDate.Year == 1)
                        //{
                        //    SqlCmd.Parameters.AddWithValue("@FromDate", DateTime.Now.AddDays(-30));
                        //    SqlCmd.Parameters.AddWithValue("@ToDate", DateTime.Now);
                        //}
                    }
                    if (ExportDetail.ClientName != null && ExportDetail.ClientName != "")
                    {
                        SqlCmd.Parameters.AddWithValue("@ClientName", ExportDetail.ClientName);
                    }
                    //{
                    //    SqlCmd.Parameters.AddWithValue("@FromDate", FilterDetail.FromDate);
                    //    if (FilterDetail.ToDate.Year != 1)
                    //    {
                    //        SqlCmd.Parameters.AddWithValue("@ToDate", FilterDetail.ToDate);
                    //    }
                    //}
                    SqlCmd.Parameters.AddWithValue("@FromDate", ExportDetail.FromDate);
                    SqlCmd.Parameters.AddWithValue("@ToDate", ExportDetail.ToDate);
                    appoinments = dbLayer.GetEntityList <BDMAppoinmentExportExcel>(SqlCmd);
                }
                else
                {
                    SqlCommand SqlCmd = new SqlCommand("spSelectBDMAppoinmentDetailExport");
                    SqlCmd.CommandType = CommandType.StoredProcedure;
                    SqlCmd.Parameters.AddWithValue("@ActionBy", ExportDetail.ActionBy);
                    if (ExportDetail.EmployeeId != 0)
                    {
                        SqlCmd.Parameters.AddWithValue("@EmployeeId", ExportDetail.EmployeeId);
                        //if (FilterDetail.FromDate.Year == 1 && FilterDetail.ToDate.Year == 1)
                        //{
                        //    SqlCmd.Parameters.AddWithValue("@FromDate", DateTime.Now.AddDays(-30));
                        //    SqlCmd.Parameters.AddWithValue("@ToDate", DateTime.Now);
                        //}
                    }
                    else if (ExportDetail.FirstName != null)
                    {
                        SqlCmd.Parameters.AddWithValue("@FirstName", ExportDetail.FirstName);
                        //if (FilterDetail.FromDate.Year == 1 && FilterDetail.ToDate.Year == 1)
                        //{
                        //    SqlCmd.Parameters.AddWithValue("@FromDate", DateTime.Now.AddDays(-30));
                        //    SqlCmd.Parameters.AddWithValue("@ToDate", DateTime.Now);
                        //}
                    }
                    else if (ExportDetail.ClientName != null)
                    {
                        SqlCmd.Parameters.AddWithValue("@ClientName", ExportDetail.ClientName);
                        //if (FilterDetail.ToDate.Year != 1)
                        //{
                        //    SqlCmd.Parameters.AddWithValue("@ToDate", FilterDetail.ToDate);
                        //}
                    }
                    //else
                    //{
                    //    SqlCmd.Parameters.AddWithValue("@FromDate", DateTime.Now.AddDays(-30));
                    //    SqlCmd.Parameters.AddWithValue("@ToDate", DateTime.Now);
                    //}
                    SqlCmd.Parameters.AddWithValue("@FromDate", ExportDetail.FromDate);
                    SqlCmd.Parameters.AddWithValue("@ToDate", ExportDetail.ToDate);
                    appoinments = dbLayer.GetEntityList <BDMAppoinmentExportExcel>(SqlCmd);
                }

                return(appoinments);
            }
        }