public void TestOutputNoPane()
        {
            // Create an instance of the package and initialize it so that the GetService
            // will succeed, but the GetPane will fail.

            // As first create a service provider.
            using (OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices())
            {
                // Now create the mock object for the output window.
                if (null == mockOutputWindowFactory)
                {
                    mockOutputWindowFactory = new GenericMockFactory("MockOutputWindow", new Type[] { typeof(IVsOutputWindow) });
                }
                BaseMock mockBase = mockOutputWindowFactory.GetInstance() as BaseMock;
                mockBase.AddMethodReturnValues(string.Format("{0}.{1}", typeof(IVsOutputWindow).FullName, "GetPane"),
                                               new object[] { -1, Guid.Empty, null });
                // Add the output window to the services provided by the service provider.
                serviceProvider.AddService(typeof(SVsOutputWindow), mockBase, false);

                // Create an instance of the package and initialize it calling SetSite.
                ServicesPackage package = new ServicesPackage();
                int             result  = ((IVsPackage)package).SetSite(serviceProvider);
                Assert.IsTrue(Microsoft.VisualStudio.ErrorHandler.Succeeded(result), "SetSite failed.");

                // Now we can create an instance of the service
                MyGlobalService service = new MyGlobalService(package);
                service.GlobalServiceFunction();
                ((IVsPackage)package).SetSite(null);
                ((IVsPackage)package).Close();
            }
        }
        public JsonResult GetServicesChargesOPD(int ServiceID)
        {
            ServicesPackage location = new ServicesPackage();

            KeystoneProject.Buisness_Logic.Master.BL_ServicesPackage Bl_obj = new Buisness_Logic.Master.BL_ServicesPackage();
            List <ServicePackage_OPDCharges> serch = new List <ServicePackage_OPDCharges>();

            DataSet ds = Bl_obj.GetServicesChargesOPD(ServiceID);

            ServicesPackage obj = new ServicesPackage();


            // obj.ServiceChargesID = ds.Tables[0].Rows[0]["Advise"].ToString();
            // serch.Add(obj);
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                serch.Add(new ServicePackage_OPDCharges
                {
                    ServiceID        = Convert.ToInt32(dr["ServiceID"].ToString()),
                    Quantity         = Convert.ToInt32(dr["Quantity"].ToString()),
                    ServiceOrTestID  = Convert.ToInt32(dr["ServiceOrTestID"].ToString()),
                    ServiceNTestName = dr["ServiceOrTestName"].ToString(),
                    GeneralCharges   = dr["GeneralCharges"].ToString(),
                    EmergencyCharges = dr["EmergencyCharges"].ToString(),
                    ServiceType      = dr["ServiceType"].ToString(),
                });
            }
            return(new JsonResult {
                Data = serch, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public JsonResult ShowAllServiceDetailsPackage()
        {
            ServicesPackage location = new ServicesPackage();

            KeystoneProject.Buisness_Logic.Master.BL_ServicesPackage Bl_obj = new Buisness_Logic.Master.BL_ServicesPackage();
            List <ServicesPackage> serch = new List <ServicesPackage>();
            DataSet ds = Bl_obj.GetAllServiceDetailsPackage();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                serch.Add(new ServicesPackage
                {
                    ServiceID        = Convert.ToInt32(dr["ServiceID"].ToString()),
                    ServiceGroupID   = dr["ServiceGroupID"].ToString(),
                    ServiceName      = dr["ServiceName"].ToString(),
                    GeneralCharges   = Convert.ToDecimal(dr["General Charges"].ToString()),
                    EmergencyCharges = Convert.ToDecimal(dr["Emergency Charges"].ToString()),
                    ServiceType      = dr["ServiceType"].ToString(),
                    ServiceGroupName = dr["ServiceGroupName"].ToString(),
                    UnitName         = dr["UnitName"].ToString(),
                    chkrechange      = Convert.ToBoolean(dr["Rechange"].ToString())
                });
            }
            return(new JsonResult {
                Data = serch, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
예제 #4
0
        public void SetSiteSimple()
        {
            ServicesPackage packageObject = new ServicesPackage();
            IVsPackage      package       = (IVsPackage)packageObject;

            using (OleServiceProvider provider = OleServiceProvider.CreateOleServiceProviderWithBasicServices())
            {
                int result = package.SetSite(provider);
                Assert.IsTrue(Microsoft.VisualStudio.ErrorHandler.Succeeded(result), "SetSite failed.");
            }
            package.SetSite(null);
            package.Close();
        }
예제 #5
0
        public void GetLocalServiceSimple()
        {
            ServicesPackage packageObject = new ServicesPackage();
            IVsPackage      package       = (IVsPackage)packageObject;

            using (OleServiceProvider provider = OleServiceProvider.CreateOleServiceProviderWithBasicServices())
            {
                int result = package.SetSite(provider);
                Assert.IsTrue(Microsoft.VisualStudio.ErrorHandler.Succeeded(result), "SetSite failed.");
                IServiceProvider serviceProvider = package as IServiceProvider;
                object           o = serviceProvider.GetService(typeof(SMyLocalService));
                Assert.IsNotNull(o, "GetService returned null for the local service.");
                IMyLocalService service = o as IMyLocalService;
                Assert.IsNotNull(service, "The service SMyLocalService does not implements IMyLocalService.");
                service.LocalServiceFunction();
            }
            package.SetSite(null);
            package.Close();
        }
예제 #6
0
        public void GetGlobalServiceFromNativeProvider()
        {
            ServicesPackage packageObject = new ServicesPackage();
            IVsPackage      package       = (IVsPackage)packageObject;

            using (OleServiceProvider provider = OleServiceProvider.CreateOleServiceProviderWithBasicServices())
            {
                int result = package.SetSite(provider);
                Assert.IsTrue(Microsoft.VisualStudio.ErrorHandler.Succeeded(result), "SetSite failed.");
                IOleServiceProvider sp = package as IOleServiceProvider;
                Assert.IsNotNull(sp, "The pacckage does not implements the native IServiceProvider");
                Guid   guidService   = typeof(SMyGlobalService).GUID;
                Guid   guidInterface = typeof(IMyGlobalService).GUID;
                IntPtr ppvObj        = IntPtr.Zero;
                int    hr            = sp.QueryService(ref guidService, ref guidInterface, out ppvObj);
                Assert.IsTrue(Microsoft.VisualStudio.ErrorHandler.Succeeded(hr), "QueryService failed for the global service.");
                Assert.IsTrue(ppvObj != IntPtr.Zero, "QueryService returned a NULL pointer for the global service.");
                Marshal.Release(ppvObj);
            }
            package.SetSite(null);
            package.Close();
        }
        public void TestOutput()
        {
            callbackExecuted = false;
            // As first create a service provider.
            using (OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices())
            {
                // Create a mock object for the output window pane.
                GenericMockFactory mockWindowPaneFactory = new GenericMockFactory("MockOutputWindowPane", new Type[] { typeof(IVsOutputWindowPane) });
                BaseMock           mockWindowPane        = mockWindowPaneFactory.GetInstance();
                mockWindowPane.AddMethodCallback(string.Format("{0}.{1}", typeof(IVsOutputWindowPane).FullName, "OutputString"),
                                                 new EventHandler <CallbackArgs>(OutputWindowPaneCallback));

                // Now create the mock object for the output window.
                if (null == mockOutputWindowFactory)
                {
                    mockOutputWindowFactory = new GenericMockFactory("MockOutputWindow1", new Type[] { typeof(IVsOutputWindow) });
                }
                BaseMock mockOutputWindow = mockOutputWindowFactory.GetInstance();
                mockOutputWindow.AddMethodReturnValues(
                    string.Format("{0}.{1}", typeof(IVsOutputWindow).FullName, "GetPane"),
                    new object[] { 0, Guid.Empty, (IVsOutputWindowPane)mockWindowPane });

                // Add the output window to the services provided by the service provider.
                serviceProvider.AddService(typeof(SVsOutputWindow), mockOutputWindow, false);

                // Create an instance of the package and initialize it calling SetSite.
                ServicesPackage package = new ServicesPackage();
                int             result  = ((IVsPackage)package).SetSite(serviceProvider);
                Assert.IsTrue(Microsoft.VisualStudio.ErrorHandler.Succeeded(result), "SetSite failed.");

                // Now we can create an instance of the service
                MyGlobalService service = new MyGlobalService(package);
                service.GlobalServiceFunction();
                Assert.IsTrue(callbackExecuted, "OutputText not called.");
                ((IVsPackage)package).SetSite(null);
                ((IVsPackage)package).Close();
            }
        }
예제 #8
0
        public bool Save(ServicesPackage objModel, ServicesPackage_ServicesCharges objServicepkg, ServicePackage_OPDCharges objserPkgOPD)
        {
            Services        ServicesMod     = new Services();
            ServicesCharges servicesCharges = new ServicesCharges();
            //   ServicesPackage_ServicesCharges servicepkg_servicecharge = new ServicesPackage_ServicesCharges();
            //  ServicesCharges servicesCharges = new ServicesCharges();


            bool flag = true;

            Connect();
            con.Open();

            SqlCommand cmd;

            if (objModel.serviceID1 > 0)
            {
                ServicesMod.Mode = "Edit";
            }
            else
            {
                ServicesMod.Mode = "Add";
            }
            try
            {
                #region ----------------------Add Services--------------------------------

                cmd             = new SqlCommand("IUServices", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
                cmd.Parameters.AddWithValue("@LocationID", LocationID);

                if (ServicesMod.Mode == "Add")
                {
                    cmd.Parameters.AddWithValue("@ServiceID", 0);
                    cmd.Parameters["@ServiceID"].Direction = ParameterDirection.Output;
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ServiceID", objModel.serviceID1);
                }

                if (objModel.ServiceGroupID == null)
                {
                    cmd.Parameters.AddWithValue("@ServiceGroupID", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ServiceGroupID", objModel.ServiceGroupID);
                }
                cmd.Parameters.AddWithValue("@ReferenceCode", 1);

                cmd.Parameters.AddWithValue("@ServiceName", objModel.ServiceName);

                if (objModel.UnitID == null)
                {
                    cmd.Parameters.AddWithValue("@UnitID", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@UnitID", objModel.UnitID);
                }

                cmd.Parameters.AddWithValue("@GeneralCharges", objModel.GeneralCharges);
                cmd.Parameters.AddWithValue("@EmergencyCharges", objModel.EmergencyCharges);
                cmd.Parameters.AddWithValue("@ServiceType", objModel.ServiceType);

                if (ServicesMod.TPAHSNCode == "")
                {
                    cmd.Parameters.AddWithValue("@TPAHSNCode", "");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@TPAHSNCode", ServicesMod.TPAHSNCode);
                }
                if (ServicesMod.HospitalHSNCode != "")
                {
                    cmd.Parameters.AddWithValue("@HospitalHSNCode", "");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@HospitalHSNCode", ServicesMod.HospitalHSNCode);
                }

                if (ServicesMod.HSNCode == "")
                {
                    cmd.Parameters.AddWithValue("@HSNCode", "");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@HSNCode", ServicesMod.HSNCode);
                }

                cmd.Parameters.AddWithValue("@RecommendedByDoctor", ServicesMod.RecommendedByDoctor);
                cmd.Parameters.AddWithValue("@HideInBilling", ServicesMod.RecommendedByDoctor);
                cmd.Parameters.AddWithValue("@CreationID", UserID);
                cmd.Parameters.AddWithValue("@Mode", ServicesMod.Mode);
                int RowNo = cmd.ExecuteNonQuery();
                #endregion


                if ("Both Package" == objModel.ServiceType || "IPD Package" == objModel.ServiceType)
                {
                    #region IPD Package



                    #region -------------------Add ServiceCharges-------------------

                    if ("Both Package" == objModel.ServiceType || "IPD Package" == objModel.ServiceType)
                    {
                        if (RowNo > 0)
                        {
                            ServicesMod.Mode = "Add";
                            int ServiceChargesID = 0;
                            objModel.ServiceID = Convert.ToInt32(cmd.Parameters["@ServiceID"].Value.ToString());
                            ServiceID          = objModel.ServiceID;

                            //     DataSet dsServiceCharge = new DataSet();
                            //    dsServiceCharge = SelectServiceChargesbyID(ServiceID);

                            for (int i = 0; i < objServicepkg.WardID.Length; i++)
                            {
                                cmd             = new SqlCommand("IUServiceCharges", con);
                                cmd.CommandType = CommandType.StoredProcedure;
                                cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
                                cmd.Parameters.AddWithValue("@LocationID", LocationID);

                                if (ServicesMod.Mode == "Add")
                                {
                                    cmd.Parameters.AddWithValue("@ServiceChargesID", 0);
                                    cmd.Parameters["@ServiceChargesID"].Direction = ParameterDirection.Output;
                                }
                                else
                                {
                                    cmd.Parameters.AddWithValue("@ServiceChargesID", 0);
                                }

                                cmd.Parameters.AddWithValue("@ServiceID", ServiceID);
                                cmd.Parameters.AddWithValue("@WardID", Convert.ToInt32(objServicepkg.WardID[i].ToString()));

                                if (objModel.GeneralCharges == null)
                                {
                                    cmd.Parameters.AddWithValue("@GeneralCharges", 0.00);
                                }
                                else
                                {
                                    cmd.Parameters.AddWithValue("@GeneralCharges", Convert.ToDecimal(objServicepkg.GeneralCharges1[i].ToString()));
                                }

                                if (objModel.EmergencyCharges == null)
                                {
                                    cmd.Parameters.AddWithValue("@EmergencyCharges", 0.00);
                                }
                                else
                                {
                                    cmd.Parameters.AddWithValue("@EmergencyCharges", Convert.ToDecimal(objServicepkg.EmergencyCharges1[i].ToString()));
                                }

                                cmd.Parameters.AddWithValue("@CreationID", UserID);
                                cmd.Parameters.AddWithValue("@Mode", ServicesMod.Mode);
                                ServiceChargesID = cmd.ExecuteNonQuery();
                            }
                            #endregion --------------------------------------

                            #region ServiceDetailsPackage
                            objModel.ServiceID = Convert.ToInt32(cmd.Parameters["@ServiceID"].Value.ToString());
                            ServiceID          = objModel.ServiceID;

                            for (int i = 0; i < objServicepkg.ServiceOrTestID.Length; i++)
                            {
                                int servicedetailpkgID = 0;
                                cmd             = new SqlCommand("IUServiceDetailsPackage", con);
                                cmd.CommandType = CommandType.StoredProcedure;
                                cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
                                cmd.Parameters.AddWithValue("@LocationID", LocationID);

                                if (ServicesMod.Mode == "Add")
                                {
                                    cmd.Parameters.AddWithValue("@ServiceDetailsPackagelID", 0);
                                    cmd.Parameters["@ServiceDetailsPackagelID"].Direction = ParameterDirection.Output;
                                }
                                else
                                {
                                    //      cmd.Parameters.AddWithValue("@ServiceChargesID", dsServiceCharge.Tables[0].Rows[i]["ServiceChargesID"].ToString());
                                }

                                cmd.Parameters.AddWithValue("@ServiceID", ServiceID);
                                cmd.Parameters.AddWithValue("@ServiceOrTestID", objServicepkg.ServiceOrTestID[i].ToString());
                                int servicetestid = Convert.ToInt32(objServicepkg.ServiceOrTestID[i].ToString());
                                cmd.Parameters.AddWithValue("@ServiceOrTestName", objServicepkg.ServiceNTestName[i].ToString());

                                cmd.Parameters.AddWithValue("@ServiceType", "Service");
                                cmd.Parameters.AddWithValue("@Quantity", objServicepkg.Quantity[i].ToString());
                                int quantity = Convert.ToInt32(objServicepkg.Quantity[i].ToString());
                                cmd.Parameters.AddWithValue("@Rechange", objModel.chkrechange);


                                cmd.Parameters.AddWithValue("@CreationID", UserID);
                                cmd.Parameters.AddWithValue("@Mode", ServicesMod.Mode);
                                servicedetailpkgID = cmd.ExecuteNonQuery();
                            }


                            #endregion

                            #region  IUServicePackageForWardCharges

                            DataSet dsword = new DataSet();
                            dsword = GetWardName(ServiceID);
                            for (int j = 0; j < dsword.Tables[0].Rows.Count; j++)
                            {
                                int ServicePackageForWardCharges = 0;
                                cmd             = new SqlCommand("IUServicePackageForWardCharges", con);
                                cmd.CommandType = CommandType.StoredProcedure;
                                cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
                                cmd.Parameters.AddWithValue("@LocationID", LocationID);

                                if (ServicesMod.Mode == "Add")
                                {
                                    cmd.Parameters.AddWithValue("@SPWchargeID", 0);
                                    cmd.Parameters["@SPWchargeID"].Direction = ParameterDirection.Output;
                                }
                                else
                                {
                                    //      cmd.Parameters.AddWithValue("@ServiceChargesID", dsServiceCharge.Tables[0].Rows[i]["ServiceChargesID"].ToString());
                                }

                                cmd.Parameters.AddWithValue("@ServicePackageID", dsword.Tables[0].Rows[j]["ServiceDetailsPackagelID"].ToString());

                                cmd.Parameters.AddWithValue("@ServiceOrTestID", dsword.Tables[0].Rows[j]["ServiceOrTestID"].ToString());

                                cmd.Parameters.AddWithValue("@ServiceType", "Service");

                                cmd.Parameters.AddWithValue("@WardID", dsword.Tables[0].Rows[j]["WardID"].ToString());
                                cmd.Parameters.AddWithValue("@WardName", dsword.Tables[0].Rows[j]["WardName"].ToString());

                                //    cmd.Parameters.AddWithValue("@Quantity", quantity);

                                if (objModel.GeneralCharges == null)
                                {
                                    cmd.Parameters.AddWithValue("@GeneralCharges", 0.00);
                                }
                                else
                                {
                                    cmd.Parameters.AddWithValue("@GeneralCharges", Convert.ToDecimal(objServicepkg.GenralCharges[j].ToString()));
                                }

                                cmd.Parameters.AddWithValue("@CreationID", UserID);
                                cmd.Parameters.AddWithValue("@Mode", ServicesMod.Mode);
                                ServicePackageForWardCharges = cmd.ExecuteNonQuery();
                            }


                            #endregion


                            #region Add ServiceTPAWise

                            String Mode = "";
                            Mode = cmd.Parameters["@Mode"].Value.ToString();

                            if (Mode == "Add")
                            {
                                DataSet dsTPAWise = new DataSet();
                                dsTPAWise = GetServicesTPAWiseForOrganizationID();

                                for (int i = 0; i < dsTPAWise.Tables[0].Rows.Count; i++)
                                {
                                    cmd             = new SqlCommand("IUServicesTPAWise", con);
                                    cmd.CommandType = CommandType.StoredProcedure;
                                    cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
                                    cmd.Parameters.AddWithValue("@LocationID", LocationID);
                                    cmd.Parameters.AddWithValue("@ServicesTPAWiseID", 0);
                                    cmd.Parameters["@ServicesTPAWiseID"].Direction = ParameterDirection.Output;

                                    cmd.Parameters.AddWithValue("@ServiceID", ServiceID);

                                    cmd.Parameters.AddWithValue("@ReferenceCode", 1);


                                    if (objModel.UnitID == null)
                                    {
                                        cmd.Parameters.AddWithValue("@UnitID", 0);
                                    }
                                    else
                                    {
                                        cmd.Parameters.AddWithValue("@UnitID", objModel.UnitID);
                                    }

                                    cmd.Parameters.AddWithValue("@OrganizationID", Convert.ToInt32(dsTPAWise.Tables[0].Rows[i]["OrganizationID"].ToString()));
                                    cmd.Parameters.AddWithValue("@GeneralCharges", objModel.GeneralCharges);
                                    cmd.Parameters.AddWithValue("@EmergencyCharges", objModel.EmergencyCharges);
                                    cmd.Parameters.AddWithValue("@ServiceType", objModel.ServiceType);
                                    cmd.Parameters.AddWithValue("@RecommendedByDoctor", ServicesMod.RecommendedByDoctor);
                                    cmd.Parameters.AddWithValue("@CreationID", UserID);
                                    cmd.Parameters.AddWithValue("@Mode", "Add");
                                    int ServicesTPAWiseID = cmd.ExecuteNonQuery();

                                    //if (ServicesTPAWiseID > 0)
                                    //{
                                    //    flag = true;
                                    //}
                                    //else
                                    //{
                                    //    flag = false;
                                    //}
                                }
                                #endregion

                                #region Add ServicesTPAWiseDetailForOrganization

                                objModel.ServiceID = Convert.ToInt32(cmd.Parameters["@ServiceID"].Value.ToString());
                                ServiceID          = Convert.ToInt32(cmd.Parameters["@ServiceID"].Value.ToString());

                                DataSet dsWardDetailsTPAWise = new DataSet();
                                dsWardDetailsTPAWise = GetServicesTPAWiseDetailForOrganizationID();


                                for (int i = 0; i < dsWardDetailsTPAWise.Tables[0].Rows.Count; i++)
                                {
                                    cmd             = new SqlCommand("IUServicesDetailsTPAWise", con);
                                    cmd.CommandType = CommandType.StoredProcedure;
                                    cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
                                    cmd.Parameters.AddWithValue("@LocationID", LocationID);
                                    cmd.Parameters.AddWithValue("@ServicesDetailsTPAWiseID", 0);
                                    cmd.Parameters["@ServicesDetailsTPAWiseID"].Direction = ParameterDirection.Output;

                                    cmd.Parameters.AddWithValue("@ServicesTPAWiseID", Convert.ToInt32(dsWardDetailsTPAWise.Tables[0].Rows[i]["ServicesTPAWiseID"].ToString()));

                                    if (servicesCharges.WardID == null)
                                    {
                                        cmd.Parameters.AddWithValue("@WardID", 0);
                                    }
                                    else
                                    {
                                        cmd.Parameters.AddWithValue("@WardID", Convert.ToInt32(dsWardDetailsTPAWise.Tables[0].Rows[i]["WardID"].ToString()));
                                    }

                                    //  cmd.Parameters.AddWithValue("@WardName", Convert.ToString(ServicesMod.dsServicesCharges.Tables[0].Rows[0]["WardName"].ToString()));

                                    cmd.Parameters.AddWithValue("@GeneralCharges", Convert.ToDecimal(dsWardDetailsTPAWise.Tables[0].Rows[i]["GeneralCharges"].ToString()));
                                    cmd.Parameters.AddWithValue("@EmergencyCharges", Convert.ToDecimal(dsWardDetailsTPAWise.Tables[0].Rows[i]["GeneralCharges"].ToString()));
                                    cmd.Parameters.AddWithValue("@CreationID", UserID);
                                    cmd.Parameters.AddWithValue("@Mode", "Add");
                                    int Row2 = cmd.ExecuteNonQuery();

                                    if (Row2 > 0)
                                    {
                                        flag = true;
                                    }
                                    else
                                    {
                                        flag = false;
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    #endregion
                }

                else if ("OPD Package" == objModel.ServiceType)
                {
                    #region ServiceDetailsPackage for opd
                    ServicesMod.Mode = "Add";

                    objModel.ServiceID = Convert.ToInt32(cmd.Parameters["@ServiceID"].Value.ToString());
                    ServiceID          = objModel.ServiceID;

                    for (int i = 0; i < objserPkgOPD.ServiceOrTestIDOPD.Length; i++)
                    {
                        int servicedetailpkgOPDID = 0;
                        cmd             = new SqlCommand("IUServiceDetailsPackageOPD", con);
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
                        cmd.Parameters.AddWithValue("@LocationID", LocationID);

                        if (ServicesMod.Mode == "Add")
                        {
                            cmd.Parameters.AddWithValue("@ServiceDetailsPackageOPDID", 0);
                            cmd.Parameters["@ServiceDetailsPackageOPDID"].Direction = ParameterDirection.Output;
                        }
                        else
                        {
                            //cmd.Parameters.AddWithValue("@ServiceDetailsPackageOPDID", objserPkgOPD.ServiceOrTestIDOPD[i].ToString());
                        }

                        cmd.Parameters.AddWithValue("@ServiceID", ServiceID);
                        cmd.Parameters.AddWithValue("@ServiceOrTestID", objserPkgOPD.ServiceOrTestIDOPD[i].ToString());
                        // int servicetestid = Convert.ToInt32(objServicepkg.ServiceOrTestID[i].ToString());
                        cmd.Parameters.AddWithValue("@ServiceOrTestName", objserPkgOPD.ServiceNTestNameOPD[i].ToString());

                        cmd.Parameters.AddWithValue("@ServiceType", "Service");
                        cmd.Parameters.AddWithValue("@Quantity", objserPkgOPD.QuantityOPD[i].ToString());
                        cmd.Parameters.AddWithValue("@GeneralCharges", objserPkgOPD.OPDGenralCharges[i].ToString());
                        cmd.Parameters.AddWithValue("@EmergencyCharges", objserPkgOPD.OPDEmergencyCharges[i].ToString());
                        cmd.Parameters.AddWithValue("@Rechange", objModel.chkrechange);


                        cmd.Parameters.AddWithValue("@CreationID", UserID);
                        cmd.Parameters.AddWithValue("@Mode", ServicesMod.Mode);
                        servicedetailpkgOPDID = cmd.ExecuteNonQuery();
                    }


                    #endregion
                }



                if (flag == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
              #pragma warning disable CS0168 // The variable 'ex' is declared but never used
            catch (Exception ex)
              #pragma warning restore CS0168 // The variable 'ex' is declared but never used
            {
                flag = false;
            }
            con.Close();
            return(flag);
        }
        public ActionResult ServicesPackage(ServicesPackage objServicePackage, ServicesPackage_ServicesCharges obj, ServicePackage_OPDCharges objSerPkgOPD)
        {
            try
            {
                Services objservice = new Services();

                if (Request.Form["ServiceID1"].ToString() == "")
                {
                    objServicePackage.serviceID1 = 0;
                }
                else
                {
                    objServicePackage.serviceID1 = Convert.ToInt32(Request.Form["ServiceID1"].ToString());
                }


                objServicePackage.ServiceGroupID = Request.Form["ServiceGroupID"].ToString();
                objservice.UnitID = Request.Form["UnitID"].ToString();

                if (Request.Form["chkrechange"] == "on")
                {
                    objServicePackage.chkrechange = true;
                }
                else
                {
                    objServicePackage.chkrechange = false;
                }


                objservice.ServiceType = Request.Form["ServiceType"].ToString();

                if (objservice.ServiceType == "OPD Package")
                {
                    objSerPkgOPD.ServiceNTestNameOPD = Request.Form["ServiceNTestNameOPD"].Split(',');
                    objSerPkgOPD.ServiceOrTestIDOPD  = Request.Form["ServiceOrTestIDOPD"].Split(',');
                    objSerPkgOPD.QuantityOPD         = Request.Form["QuantityOPD"].Split(',');
                    objSerPkgOPD.OPDEmergencyCharges = Request.Form["OPDEmergencyCharges"].Split(',');
                    objSerPkgOPD.OPDGenralCharges    = Request.Form["OPDGenralCharges"].Split(',');
                }

                else
                {
                    obj.ServiceNTestName  = Request.Form["ServiceNTestName"].Split(',');
                    obj.ServiceOrTestID   = Request.Form["ServiceOrTestID"].Split(',');
                    obj.Quantity          = Request.Form["Quantity"].Split(',');
                    obj.WardID            = Request.Form["WardID"].Split(',');
                    obj.GeneralCharges1   = Request.Form["GeneralCharges1"].Split(',');
                    obj.EmergencyCharges1 = Request.Form["EmergencyCharges1"].Split(',');
                }



                if (Bl_obj.Save(objServicePackage, obj, objSerPkgOPD))
                {
                    TempData["Msg"] = "ServicePackage Save Successfully ";
                    ModelState.Clear();
                }

                return(RedirectToAction("ServicesPackage", "ServicesPackage"));
            }
            catch (Exception Ex)
            {
                return(RedirectToAction("ServicesPackage", "ServicesPackage"));
            }
        }