示例#1
0
        /// <summary>
        /// 显示合同明细
        /// </summary>
        private void BindCostList(DataTable tb, string contractCostCode)
        {
            try
            {
                string   sFilter = "ContractCostCode='" + contractCostCode + "'";
                DataView dv      = new DataView(tb, "", "", DataViewRowState.CurrentRows);

                dv.RowFilter          = sFilter;
                ViewState["SumMoney"] = BLL.MathRule.SumColumn(tb.Select(sFilter), "Money");


                this.dgCostList.DataSource = dv;
                this.dgCostList.DataBind();

                int iCount = this.dgCostList.Items.Count;

                for (int i = 0; i < iCount; i++)
                {
                    ((WebNumericEdit)this.dgCostList.Items[i].FindControl("txtMoney")).ClientSideEvents.ValueChange
                        = "InfraMoneyValueChange" + ClientID.ToString();
                }
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示合同明细出错:" + ex.Message));
            }
        }
示例#2
0
        /// <summary>
        /// disconnect a client
        /// </summary>
        /// <param name="ConsoleInput"></param>
        public static void DisconnectClient(String ConsoleInput)
        {
            Int16  ClientID;
            String CantDisconnectReason;

            try
            {
                ClientID = System.Int16.Parse(ConsoleInput);

                if (TRemote.DisconnectClient(ClientID, out CantDisconnectReason))
                {
                    TLogging.Log("Client #" + ClientID.ToString() + ": disconnection will take place shortly.");
                }
                else
                {
                    TLogging.Log("Client #" + ClientID.ToString() + " could not be disconnected on admin request.  Reason: " + CantDisconnectReason);
                }
            }
            catch (System.FormatException)
            {
                Console.WriteLine("  Entered ClientID is not numeric!");
            }
            catch (Exception exp)
            {
                TLogging.Log(
                    Environment.NewLine + "Exception occured while trying to disconnect a Client on admin request:" + Environment.NewLine +
                    exp.ToString());
            }
        }
        public override string Serialize()
        {
            StringBuilder msg = new StringBuilder("$ID");

            msg.Append(From);
            msg.Append(DELIMITER);
            msg.Append(To);
            msg.Append(DELIMITER);
            msg.Append(ClientID.ToString("x4"));
            msg.Append(DELIMITER);
            msg.Append(ClientName);
            msg.Append(DELIMITER);
            msg.Append(MajorVersion.ToString());
            msg.Append(DELIMITER);
            msg.Append(MinorVersion.ToString());
            msg.Append(DELIMITER);
            msg.Append(CID);
            msg.Append(DELIMITER);
            msg.Append(SysUID);
            if (!string.IsNullOrEmpty(InitialChallenge))
            {
                msg.Append(DELIMITER);
                msg.Append(InitialChallenge);
            }
            return(msg.ToString());
        }
示例#4
0
        /// <summary>
        /// Returns a tuple from the distributed tuple space, deleting it.
        /// </summary>
        /// <param name="template">Template of the requested tuple.</param>
        /// <returns></returns>
        public ITuple Take(ITuple template)
        {
            if (View.Count == 0)
            {
                Console.WriteLine("No tuple space servers available.");
                return(null);
            }

            /*------------------------------------------------
            *   Phase 1: Selecting the tuple to be removed
            *  ------------------------------------------------*/

            ITuple selectedTuple = null;

            // Repeat phase 1 until all replicas return at least
            // one common matching tuple
            while (selectedTuple == null)
            {
                Console.WriteLine("Take 1: " + SequenceNumber);
                selectedTuple = this.Take1(template);
            }

            Console.WriteLine("Take: Phase 1 completed");


            /*------------------------------------------------
            *   Phase 2: Removing the selected tuple
            *  ------------------------------------------------*/
            TSpaceMsg message = new TSpaceMsg();

            message.Code      = "take2";
            message.Tuple     = selectedTuple;
            message.ProcessID = ClientID.ToString();
            message.RequestID = ClientID + "_" + (++SequenceNumber);
            message.MsgView   = GetCurrentView();


            // Create local callback.
            AsyncCallback remoteCallback = new AsyncCallback(AddCallback);

            //Clear acks
            ActiveOperations.Add(message.RequestID);
            AcksCounter = 0;

            //Repeat until all replicas have acknowledged deletion
            while (AcksCounter < Quorum())
            {
                // Send multicast request to remove tuples to all members of the view
                this.Multicast(message, remoteCallback);
            }
            ActiveOperations.Remove(message.RequestID);

            Console.WriteLine("Take: Phase 2 completed");

            Console.WriteLine("Take " + (++TakeCounter) + ": OK");
            return(message.Tuple);
        }
示例#5
0
        public override string ToString()
        {
            StringBuilder b = new StringBuilder();

            b.AppendLine(Name);
            b.AppendLine(Password);
            b.AppendLine(CountryID.ToString());
            b.AppendLine(IsAdmin.ToString());
            b.AppendLine(ClientID.ToString());
            return(b.ToString());
        }
示例#6
0
        //private string _ClientPostBackScript;
        //protected override void OnPreRender(EventArgs e)
        //{
        //    _ClientPostBackScript = Page.ClientScript.GetPostBackEventReference(this, string.Empty);
        //    base.OnPreRender(e);
        //}

        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            if (AutoPostBack)
            {
                string onClick = Page.ClientScript.GetPostBackEventReference(this, string.Empty);
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick);
                writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID.ToString());
                writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID.ToString());
            }

            base.AddAttributesToRender(writer);
        }
示例#7
0
 protected override string[] GetContent()
 {
     return(new[]
     {
         ID.ToString(),
         ClientID.ToString("X"),
         UserName,
         MachineName,
         OSVersion,
         Is64BitOperatingSystem? "64 Bits" : "32 Bits",
         HubVersion,
         AppArchitectures.GetArchitectureName(HubArchitecture)
     });
 }
示例#8
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        try
        {
            CommonFunctions.Event_Trap(this);
            //Added by Loveena in ref to task#2378 - CopyrightInfo
            if (Session["UserContext"] != null)
            {
                LabelCopyrightInfo.Text = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).CopyrightInfo;
            }

            #region "error message color added by rohit ref. #121"
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
            #endregion
            if (!Page.IsPostBack)
            {
                this.RadioButtonFaxToPharmacy.Attributes.Add("onclick", "return EnablesDisable('" + ButtonOk.ClientID + "','" + RadioButtonFaxToPharmacy.ClientID + "','" + RadioButtonPrintScript.ClientID + "')");
                this.RadioButtonPrintScript.Attributes.Add("onclick", "return EnablesDisable('" + ButtonOk.ClientID + "','" + RadioButtonFaxToPharmacy.ClientID + "','" + RadioButtonPrintScript.ClientID + "')");
                this.ButtonOk.Attributes.Add("onclick", "javascript:return ValidateInputsPrint('" + DropDownListPharmacies.ClientID + "','" + RadioButtonFaxToPharmacy.ClientID + "','" + RadioButtonPrintScript.ClientID + "','" + DropDownListScriptReason.ClientID + "');");
                FillPharmaciesCombo();
                FillScriptReasonCombo();
                HiddenFieldLatestClientMedicationScriptId.Value = Request.QueryString["ClientMedicationScriptId"].ToString();
                HiddenFieldOrderMethod.Value = Request.QueryString["OrderingMethod"].ToString();
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "###Source Function Name - MedicationPrintOrderDialog--Page_Load(), ParameterCount -0 ###";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);

            string strErrorMessage = "";

            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "closeDiv();", true);
        }
        finally
        {
        }
    }
        public void Read()
        {
            IsActive = true;


            PrimeNetMessage
                message = new PrimeNetMessage
            {
                MessageBody = ClientID.ToString(),
                NetMessage  = _connectInfo.IsServer ? EPrimeNetMessage.ClientConnected : EPrimeNetMessage.ServerConnected,
                SenderIP    = _connectInfo.HosHostAddress.ToString()
            };

            PublishDataReceived(new DataReceivedEvent(message.Serialize()));

            Stream.BeginRead(buffer, 0, buffer.Length, OnRead, null);
        }
示例#10
0
        /****************************************************************
        *                     AUX FUNCTIONS / CLASSES
        ****************************************************************/

        /// <summary>
        /// Determines the agreed sequence number of a message
        /// </summary>
        /// <param name="id">Message OperationID</param>
        /// <returns>Agreed sequence number</returns>
        private int GetSequenceNumber(string id)
        {
            //Console.WriteLine("Message " + id + " : request proposed sequence number");

            // Create request message
            TSpaceMsg message = new TSpaceMsg();

            message.Code        = "proposeSeq";
            message.OperationID = id;
            message.ProcessID   = ClientID.ToString();
            message.RequestID   = ClientID + "_" + (RequestCounter++);
            ActiveOperations.Add(message.RequestID);
            message.SequenceNumber = -1;
            message.MsgView        = GetCurrentView();


            // Create local callback
            AsyncCallback asyncCallback = new AsyncCallback(PropesedSeqCallback);

            // Clear proposed sequence number for previous messages
            lock (ProposedSeq)
            {
                AcksCounter = 0;
                ProposedSeq.Clear();
            }

            // Send message to all replicas until all have proposed a sequence number
            while (AcksCounter < Quorum())
            {
                this.Multicast(message, asyncCallback);
            }

            int agreedSeq;

            lock (ProposedSeq)
            {
                // Agreed sequence number = highest proposed sequence number
                agreedSeq = ProposedSeq.Max();
            }

            Console.WriteLine("Message " + message.OperationID + " (agreedSeq = " + agreedSeq + ")");
            // Remove operation from active operations
            ActiveOperations.Remove(message.RequestID);
            return(agreedSeq);
        }
        private void OnRead(IAsyncResult ar)
        {
            _hbTimer.ResetTimer();

            Debug.Log("OnRead: Beginning to receive data");
            int length = Stream.EndRead(ar);

            if (length <= 0)
            {
                Debug.Log("OnRead: Someone disconnected");

                PrimeNetMessage
                    message = new PrimeNetMessage
                {
                    MessageBody = ClientID.ToString(),
                    NetMessage  = _connectInfo.IsServer ? EPrimeNetMessage.ClientConnected : EPrimeNetMessage.ServerDisconnected,
                    SenderIP    = _connectInfo.HosHostAddress.ToString()
                };

                PublishDataReceived(new DataReceivedEvent(message.Serialize()));

                _hbTimer.Stop();

                IsActive = false;

                return;
            }

            if (length == 1) // HB
            {
            }

            string newMessage   = System.Text.Encoding.UTF8.GetString(buffer, 0, length);
            var    receivedData = System.Text.Encoding.Default.GetString(buffer);

            Debug.Log("Recieved message " + receivedData);
            PublishDataReceived(new DataReceivedEvent(receivedData));

            // Clear current buffer and look for more data from the server
            Array.Clear(buffer, 0, buffer.Length);
            Stream.BeginRead(buffer, 0, buffer.Length, OnRead, null);
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                AllergySearchCriteria = "";

                //Added by Loveena in ref to task#2378 - CopyrightInfo
                if (Session["UserContext"] != null)
                {
                    LabelCopyrightInfo.Text = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).CopyrightInfo;
                }
                if (Page.IsPostBack == false)
                {
                    try
                    {
                        GetAllergiesData(Request.QueryString["SearchCriteria"].ToString());
                        string ss = "";
                        ss = Request.QueryString["SearchCriteria"].ToString();

                        if (ss.IndexOf('!') > 0)
                        {
                            ss = ss.Replace('!', '&');
                        }
                        if (ss.IndexOf('^') > 0)
                        {
                            ss = ss.Replace('^', '#');
                        }

                        AllergySearchCriteria = ss;
                        BindGridAllergies();
                        //this.PlaceHolderScript.Controls.Clear();
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + ex.Message.ToString() + "', true);", true);
                    }
                }


                DataRow[] DataRowAllergyReaction = Streamline.UserBusinessServices.SharedTables.DataSetGlobalCodes.Tables[0].Select("CATEGORY='ALLERGYREACTION' AND ISNULL(RecordDeleted,'N')<>'Y' and Active='Y' ", "CodeName asc");
                DataRow[] DataRowAllergySeverity = Streamline.UserBusinessServices.SharedTables.DataSetGlobalCodes.Tables[0].Select("CATEGORY='ALLERGYSEVERITY' AND ISNULL(RecordDeleted,'N')<>'Y' and Active='Y' ", "CodeName asc");



                DataSet DataSetAllergyReaction = new DataSet();
                DataSetAllergyReaction.Merge(DataRowAllergyReaction);
                if (DataSetAllergyReaction.Tables.Count > 0)
                {
                    DataSetAllergyReaction.Tables[0].TableName = "GlobalCodesAllergyReaction";
                    if (DataSetAllergyReaction.Tables["GlobalCodesAllergyReaction"].Rows.Count > 0)
                    {
                        DropDownListAllergyReaction.DataSource     = DataSetAllergyReaction.Tables["GlobalCodesAllergyReaction"];
                        DropDownListAllergyReaction.DataTextField  = "CodeName";
                        DropDownListAllergyReaction.DataValueField = "GlobalCodeId";
                        DropDownListAllergyReaction.DataBind();
                        ListItem itemAllergyReaction = new ListItem(" ", "-1");
                        DropDownListAllergyReaction.Items.Insert(0, itemAllergyReaction);
                    }
                }

                DataSet DataSetAllergySeverity = new DataSet();
                DataSetAllergySeverity.Merge(DataRowAllergySeverity);
                if (DataSetAllergySeverity.Tables.Count > 0)
                {
                    DataSetAllergySeverity.Tables[0].TableName = "GlobalCodesAllergySeverity";
                    if (DataSetAllergySeverity.Tables["GlobalCodesAllergySeverity"].Rows.Count > 0)
                    {
                        DropDownListAllergySeverity.DataSource     = DataSetAllergySeverity.Tables["GlobalCodesAllergySeverity"];
                        DropDownListAllergySeverity.DataTextField  = "CodeName";
                        DropDownListAllergySeverity.DataValueField = "GlobalCodeId";
                        DropDownListAllergySeverity.DataBind();
                        ListItem itemAllergySeverity = new ListItem(" ", "-1");
                        DropDownListAllergySeverity.Items.Insert(0, itemAllergySeverity);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }

                string ParseMessage = ex.Message;
                if (ParseMessage.IndexOf("System.Data.SqlClient.SqlException:") > 0)
                {
                    int SubstringLen = ParseMessage.IndexOf("\n") - ParseMessage.IndexOf("System.Data.SqlClient.SqlException:");
                    ParseMessage = ParseMessage.Substring(ParseMessage.IndexOf("System.Data.SqlClient.SqlException:") + 35, SubstringLen - 35);
                    //  ShowError(ParseMessage, true);
                }
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + ex.Message.ToString() + "', true);", true);
            }
        }
示例#13
0
 public override string  ToString()
 {
     return(IP.ToString() + ":" + ClientID.ToString() + ":" + UdpPort.ToString() + ":" + Utilities.IDtoBin(UserID).Substring(0, 10));
 }
示例#14
0
        private static void DoLogIn()
        {
            if (ClientID == null)
            {
                RegistryKey key            = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Clussman Productions\MesaSuite");
                string      clientIDString = key.GetValue("ClientID") as string;

                if (!Guid.TryParse(clientIDString, out Guid clientID))
                {
                    ClientID = Guid.NewGuid();
                    key.SetValue("ClientID", ClientID.ToString());

                    frmRegister register = new frmRegister();
                    register.ClientID = ClientID.Value;
                    register.ShowDialog();
                }
                else
                {
                    ClientID = clientID;
                }
            }

            int openPort = -1;
            IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();

            TcpConnectionInformation[] connections = properties.GetActiveTcpConnections();
            IPEndPoint[] listeners = properties.GetActiveTcpListeners();
            foreach (int port in PORTS)
            {
                if (connections.Any(connection => connection.LocalEndPoint.Port == port) || listeners.Any(ipListener => ipListener.Port == port))
                {
                    continue;
                }

                openPort = port;
                break;
            }

            if (openPort == -1)
            {
                throw new Exception("Could not open a port for authentication");
            }

            Guid     state = Guid.NewGuid();
            frmLogin login = new frmLogin();

            login.Port         = openPort;
            login.ClientID     = ClientID.Value;
            login.State        = state;
            login.DialogResult = DialogResult.Cancel;

            HttpListener listener = null;

            try
            {
                listener = new HttpListener();
                ListenForResponse(listener, login, openPort, state);

                DialogResult result = login.ShowDialog();

                if (result == DialogResult.Cancel)
                {
                    return;
                }
            }
            finally
            {
                listener.Close();
            }

            if (!string.IsNullOrEmpty(AuthToken))
            {
                AuthenticationStatus = AuthenticationStatuses.LoggedIn;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            parent_id            = ClientID.ToString().Remove(ClientID.ToString().IndexOf(ID.ToString()), (ID.ToString()).Length);
            Horiz_Range.Visible  = false;
            Vert_Range.Visible   = false;
            Text.Visible         = false;
            Number.Visible       = false;
            Radio.Visible        = false;
            DropDownList.Visible = false;

            if (__Radio != null)
            {
                base.OnInit(e);
                _Radio.Controls.Add(__Radio);
            }

            if (__DropList != null)
            {
                base.OnInit(e);
                _DropDownList.Controls.Add(__DropList);
            }

            int type;

            // give an error when the given type does not exist.
            if (!global.listTypes.TryGetValue(in_type, out type))
            {
                throw new inputTypeException(string.Format("Input type does not exist! From widget: {0}", parent_id));
            }
            switch (type)
            {
            case 1:
                // horizontal slider
                Horiz_Range.Visible                  = true;
                Range_Input.Attributes["type"]       = "range";
                Range_Display.Attributes["type"]     = "number";
                Range_Input.Attributes["value"]      = stanvalue.ToString();
                Range_Display.Attributes["value"]    = stanvalue.ToString();
                Range_Input.Attributes["min"]        = minvalue.ToString();
                Range_Display.Attributes["min"]      = minvalue.ToString();
                Range_Input.Attributes["max"]        = maxvalue.ToString();
                Range_Display.Attributes["max"]      = maxvalue.ToString();
                Range_Input.Attributes["oninput"]    = "document.getElementById('" + ClientID + "_Range_Display').value = document.getElementById('" + ClientID + "_Range_Input').value";
                Range_Display.Attributes["oninput"]  = "document.getElementById('" + ClientID + "_Range_Input').value = document.getElementById('" + ClientID + "_Range_Display').value";
                Range_Display.Attributes["onchange"] = "checkuserinput('" + ClientID + "')";
                break;

            case 2:
                // vertical slider
                Vert_Range.Visible = true;
                Range_Input_Vert.Attributes["type"]       = "range";
                Range_Display_Vert.Attributes["type"]     = "number";
                Range_Input_Vert.Attributes["value"]      = stanvalue.ToString();
                Range_Display_Vert.Attributes["value"]    = stanvalue.ToString();
                Range_Input_Vert.Attributes["min"]        = minvalue.ToString();
                Range_Display_Vert.Attributes["min"]      = minvalue.ToString();
                Range_Input_Vert.Attributes["max"]        = maxvalue.ToString();
                Range_Display_Vert.Attributes["max"]      = maxvalue.ToString();
                Range_Input_Vert.Attributes["oninput"]    = "document.getElementById('" + ClientID + "_Range_Display_Vert').value = document.getElementById('" + ClientID + "_Range_Input_Vert').value";
                Range_Display_Vert.Attributes["oninput"]  = "document.getElementById('" + ClientID + "_Range_Input_Vert').value = document.getElementById('" + ClientID + "_Range_Display_Vert').value";
                Range_Display_Vert.Attributes["onchange"] = "checkuserinput('" + ClientID + "')";
                break;

            case 3:
                // Text input
                Text.Visible = true;
                TextInput.Attributes["type"]        = "Text";
                TextInput.Attributes["placeholder"] = stantext;
                break;

            case 4:
                // number input
                Number.Visible = true;
                NumberInput.Attributes["type"]  = "number";
                NumberInput.Attributes["value"] = stanvalue.ToString();
                NumberInput.Attributes["min"]   = minvalue.ToString();
                NumberInput.Attributes["max"]   = maxvalue.ToString();
                break;

            case 5:
                // radio button
                Radio.Visible    = true;
                RadioSubBTN.Text = button_text;
                break;

            case 7:
                // DropDownList button
                DropDownList.Visible = true;
                break;

            default:
                break;
            }

            InputField.DataBind();
        }
 //ID Number Section - - - - - - - - - - - - - - - -
 //Method OrderID
 public string OrderID()
 {
     return(OrderInitiated.ToShortDateString() + ClientID.ToString() + DateDue.ToShortDateString() + ItemsSold.ToString());
 }//end Method OrderID
示例#17
0
        private static void AccessTokenRequest(frmLogin login, int openPort, string code)
        {
            WebClient client = new WebClient();

            string responseString = null;

            try
            {
                client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");
                responseString = client.UploadString(new Uri($"{ConfigurationManager.AppSettings.Get("MesaSuite.Common.AuthHost")}/Token"), "POST", $"grant_type=authorization_code&code={code}&redirect_uri={WebUtility.UrlEncode("http://*****:*****@"SOFTWARE\Clussman Productions\MesaSuite");
                key.SetValue("AuthToken", AuthToken);
                key.SetValue("RefreshToken", RefreshToken);
                key.SetValue("Expiration", Expiration.ToBinary());

                UpdatePermissions();
            }
            else
            {
                ResetValues();

                login.Invoke(new MethodInvoker(() =>
                {
                    MessageBox.Show(failedObject.error + ":\r\n" + failedObject.error_description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    login.Close();
                }));
                AuthenticationStatus = AuthenticationStatuses.LoggedOut;
            }

            login.Invoke(new MethodInvoker(() =>
            {
                login.DialogResult = DialogResult.OK;
                login.Close();
            }));
        }
        public void GetRDLCContents()
        {
            #region Get RDLC Contents

            string     _ReportPath = "";
            string     mimeType;
            string     encoding;
            string     fileNameExtension;
            string[]   streams;
            DataSet    _DataSetGetRdlCName      = null;
            DataSet    _DataSetRdlForMainReport = null;
            DataSet    _DataSetRdlForSubReport  = null;
            DataRow[]  dr              = null;
            DataRow[]  _drSubReport    = null;
            string     _OrderingMethod = "";
            string     strErrorMessage = "";
            LogManager objLogManager   = null;

            ReportParameter[] _RptParam = null;
            int LocationId = 1;
            reportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer();
            string strIds = "";
            try
            {
                _ReportPath = Server.MapPath(".") + System.Configuration.ConfigurationManager.AppSettings["MedicationPerscriptionReportUrl"];
                if (_ReportPath == "")
                {
                    strErrorMessage = "ReportPath is Missing In WebConfig";
                    ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                    return;
                }
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                strErrorMessage = "ReportPath Key is Missing In WebConfig";
                ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                return;
            }
            finally
            {
                objLogManager = null;
            }
            try
            {
                Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
                objectClientMedications = new ClientMedication();
                _DataSetGetRdlCName     = objectClientMedications.GetRdlCNameDataBase(1026);
                _DataSetGetRdlCName.Tables[0].TableName = "DocumentCodes";
                _DataSetGetRdlCName.Tables[1].TableName = "DocumentCodesRDLSubReports";
                if (_DataSetGetRdlCName.Tables["DocumentCodes"].Rows.Count > 0)
                {
                    dr = _DataSetGetRdlCName.Tables["DocumentCodes"].Select();
                    if ((dr[0]["DocumentName"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["DocumentName"].ToString())) && (dr[0]["ViewStoredProcedure"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["ViewStoredProcedure"].ToString())))
                    {
                        #region Get the StoredProceudreName and Execute
                        string _StoredProcedureName = "";
                        string _ReportName          = "";
                        _StoredProcedureName = dr[0]["ViewStoredProcedure"].ToString();
                        _ReportName          = dr[0]["DocumentName"].ToString();
                        this.reportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                        this.reportViewer1.LocalReport.ReportPath = _ReportPath + "\\" + _ReportName + ".rdlc";
                        this.reportViewer1.LocalReport.DataSources.Clear();
                        //Testing By Vikas Vyas
                        reportViewer1.LocalReport.Refresh();
                        //End

                        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                        _DataSetRdlForMainReport = objectClientMedications.GetDataForHarborStandardConsentRdlC(_StoredProcedureName, Convert.ToInt32((((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId)), str, Convert.ToInt32(HiddenFieldLatestDocumentVersionId.Value));
                        Microsoft.Reporting.WebForms.ReportDataSource DataSource = new Microsoft.Reporting.WebForms.ReportDataSource("RDLReportDataSet_" + _StoredProcedureName, _DataSetRdlForMainReport.Tables[0]);
                        DataSet dstemp = (DataSet)Session["DataSetRdlTemp"];
                        if (dstemp == null)
                        {
                            dstemp = _DataSetRdlForMainReport;
                        }
                        else
                        {
                            dstemp.Merge(_DataSetRdlForMainReport);
                        }
                        Session["DataSetRdlTemp"] = dstemp;

                        #endregion
                        if (_DataSetGetRdlCName.Tables["DocumentCodesRDLSubReports"].Rows.Count > 0)
                        {
                            _drSubReport = _DataSetGetRdlCName.Tables["DocumentCodesRDLSubReports"].Select();
                            reportViewer1.LocalReport.SubreportProcessing -= new Microsoft.Reporting.WebForms.SubreportProcessingEventHandler(SetSubDataSource);
                            reportViewer1.LocalReport.SubreportProcessing += new Microsoft.Reporting.WebForms.SubreportProcessingEventHandler(SetSubDataSource);
                            for (int i = 0; i < _drSubReport.Length; i++)
                            {
                                if ((_drSubReport[i]["SubReportName"] != DBNull.Value || !String.IsNullOrEmpty(_drSubReport[i]["SubReportName"].ToString())) && (_drSubReport[i]["StoredProcedure"] != DBNull.Value || !String.IsNullOrEmpty(_drSubReport[i]["StoredProcedure"].ToString())))
                                {
                                    #region Get the StoredProcedureName For SubReport and Execute
                                    string _SubReportStoredProcedure = "";
                                    string _SubReportName            = "";
                                    _SubReportStoredProcedure = _drSubReport[i]["StoredProcedure"].ToString();
                                    _SubReportName            = _drSubReport[i]["SubReportName"].ToString();
                                    string str2 = Session["MedicationIdsForConsentDetailPage"].ToString();
                                    _DataSetRdlForSubReport = objectClientMedications.GetDataForHarborStandardConsentRdlC(_SubReportStoredProcedure, Convert.ToInt32((((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId)), str2, Convert.ToInt32(HiddenFieldLatestDocumentVersionId.Value));
                                    Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(_SubReportName, _DataSetRdlForSubReport.Tables[0]);
                                    reportViewer1.LocalReport.DataSources.Add(rds);
                                    string strRootPath = Server.MapPath(".");
                                    System.IO.StreamReader RdlSubReport = new System.IO.StreamReader(_ReportPath + "\\" + _SubReportName.Trim() + ".rdlc");
                                    reportViewer1.LocalReport.LoadReportDefinition(RdlSubReport);
                                    #endregion
                                }
                            }
                        }
                        _RptParam    = new ReportParameter[3];
                        _RptParam[0] = new ReportParameter("ClientId", Convert.ToString(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId));
                        string str1 = Session["MedicationIdsForConsentDetailPage"].ToString();
                        _RptParam[1] = new ReportParameter("ClientMedicationId", str1);
                        _RptParam[2] = new ReportParameter("ClientName", Convert.ToString(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.LastName + ", " + ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.FirstName));
                        reportViewer1.LocalReport.SetParameters(_RptParam);
                        reportViewer1.LocalReport.Refresh();
                        reportViewer1.LocalReport.DataSources.Add(DataSource);
                        strIds = str1;
                        //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowPrintDiv('" + Session["ChangedOrderMedicationIds"].ToString() + "');", true);
                    }
                }
                #endregion
                try
                {
                    if (Session["imgId1"] == null || Session["imgId1"] == "")
                    {
                        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                        Session["imgId1"] = str;
                    }
                    else
                    {
                        Session["imgId1"] = Convert.ToInt32(Session["imgId1"]) + 1;
                    }
                }
                catch (Exception ex)
                {
                }
                #region DeleteOldRenderedImages
                try
                {
                    using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                    {
                        objRDLC.DeleteRenderedImages(Server.MapPath("RDLC\\" + Context.User.Identity.Name));
                    }
                }
                catch (Exception ex)
                {
                    Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                }
                #endregion

                string         reportType = "PDF";
                IList <Stream> m_streams;
                m_streams = new List <Stream>();
                Microsoft.Reporting.WebForms.Warning[] warnings;
                string deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat><StartPage>0</StartPage></DeviceInfo>";
                //try
                //{
                //    if (Session["imgId1"] == null)
                //    {
                //        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                //        Session["imgId1"] = str;
                //    }
                //    else
                //    {
                //        Session["imgId1"] = Convert.ToInt32(Session["imgId1"]) + 1;
                //    }
                //}
                //catch (Exception ex)
                //{
                //}
                if (Session["imgId1"] == null)
                {
                    Session["imgId1"] = strIds;
                }
                using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                {
                    //objRDLC.Run(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), Session["imgId1"].ToString(), false, false);
                    objRDLC.RunConsent(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), Session["imgId1"].ToString(), false, false);

                    renderedBytes = reportViewer1.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
                }
                //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowPrintDiv('" + Session["imgId1"].ToString() + "');", true);
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                _DataSetGetRdlCName      = null;
                _DataSetRdlForMainReport = null;
                _DataSetRdlForSubReport  = null;
                _RptParam = null;
            }
        }
        }         //end Property DateDue



        public override string ToString()
        {
            return("Order Type:\t\t" + OrderType() + "OrderID: \t\t" + OrderID().ToString() + "\n" + "ClientID: \t\t" + ClientID.ToString() + "\n" + "Completed Status\t\t" + OrderStatus() + "TAX:\t\t" + TaxSales.ToString() + "\n" + "Items Sold:\t\t" + ItemsSold.ToString() + "\n" + "Unit Cost:\t\t" + ItemUnitCost.ToString() + "\n" + "Remaining Balance:\t\t" + OrderBalance().ToString());
        } //end method ToString Override
    public void GetRDLCContents()
    {
        #region Get RDLC Contents

        string   _ReportPath = "";
        string   mimeType;
        string   encoding;
        string   fileNameExtension;
        string[] streams;


        DataSet    _DataSetGetRdlCName      = null;
        DataSet    _DataSetRdlForMainReport = null;
        DataSet    _DataSetRdlForSubReport  = null;
        DataRow[]  dr              = null;
        DataRow[]  _drSubReport    = null;
        string     _OrderingMethod = "";
        string     strErrorMessage = "";
        LogManager objLogManager   = null;

        ReportParameter[] _RptParam = null;
        //Ref to Task#2660
        string FileName = "";
        int    seq      = 1;
        reportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer();

        try
        {
            _ReportPath = Server.MapPath(".") + System.Configuration.ConfigurationManager.AppSettings["MedicationPerscriptionReportUrl"];
            if (_ReportPath == "")//Check For Report Path
            {
                strErrorMessage = "ReportPath is Missing In WebConfig";
                ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                return;
            }
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);

            strErrorMessage = "ReportPath Key is Missing In WebConfig";
            ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
            return;
        }
        finally
        {
            objLogManager = null;
        }

        try
        {
            //Ref to Task#2660
            if (System.Configuration.ConfigurationSettings.AppSettings["SaveJpegOutput"].ToLower() == "true")
            {
                if (System.IO.Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name)))
                {
                    if (!System.IO.Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS")))
                    {
                        System.IO.Directory.CreateDirectory(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS"));
                    }

                    foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                    {
                        FileName = file.Substring(file.LastIndexOf("\\") + 1);
                        if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0))
                        {
                            //Added by Chandan on 16th Feb2010 ref task#2797
                            if (System.IO.File.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName))
                            {
                                if (FileName.ToUpper().IndexOf(".RDLC") == -1)
                                {
                                    System.IO.File.Delete(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\" + FileName));
                                }
                            }
                            else
                            {
                                while (seq < 1000)
                                {
                                    seq = seq + 1;
                                    if (!System.IO.File.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName))
                                    {
                                        System.IO.File.Move(file, Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName);
                                        break;
                                    }
                                    else
                                    {
                                        FileName = ApplicationCommonFunctions.GetFileName(FileName, seq);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                #region DeleteOldRenderedImages
                try
                {
                    using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                    {
                        objRDLC.DeleteRenderedImages(Server.MapPath("RDLC\\" + Context.User.Identity.Name));
                    }
                }
                catch (Exception ex)
                {
                    Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                }

                #endregion
            }
            //  _DataSetRdl = new DataSet();//Commented by Vikas Vyas On Dated March 04 2008
            Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
            objectClientMedications = new ClientMedication();
            //Added by Chandan for getting Location Id

            #region Added by Vikas Vyas


            _DataSetGetRdlCName = objectClientMedications.GetRdlCNameDataBase(1028);

            _DataSetGetRdlCName.Tables[0].TableName = "DocumentCodes";
            _DataSetGetRdlCName.Tables[1].TableName = "DocumentCodesRDLSubReports";


            if (_DataSetGetRdlCName.Tables["DocumentCodes"].Rows.Count > 0)
            {
                dr = _DataSetGetRdlCName.Tables["DocumentCodes"].Select();//because DocumentCodes table only contain one row



                //Check For Main Report
                if ((dr[0]["DocumentName"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["DocumentName"].ToString())) && (dr[0]["ViewStoredProcedure"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["ViewStoredProcedure"].ToString())))
                {
                    #region Get the StoredProceudreName and Execute
                    string _StoredProcedureName = "";
                    string _ReportName          = "";
                    _StoredProcedureName = dr[0]["ViewStoredProcedure"].ToString();//Get the StoredProcedure Name
                    _ReportName          = dr[0]["DocumentName"].ToString();

                    this.reportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                    this.reportViewer1.LocalReport.ReportPath = _ReportPath + "\\" + _ReportName + ".rdlc";
                    this.reportViewer1.LocalReport.DataSources.Clear();


                    //Get Data For Main Report
                    //One More Parameter Added by Chandan Task#85 MM1.7
                    _DataSetRdlForMainReport = objectClientMedications.GetDataForPrescriberRdlC(_StoredProcedureName, ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId, LabelReviewDateTime.Text, HiddenFieldRDLCurrentDateTime.Value);
                    //Microsoft.Reporting.WebForms.ReportDataSource DataSource = new ReportDataSource("RdlReportDataSet_" + _StoredProcedureName, _DataSetRdlForMainReport.Tables[0]);


                    Microsoft.Reporting.WebForms.ReportDataSource DataSource = new Microsoft.Reporting.WebForms.ReportDataSource("RDLReportDataSet_" + _StoredProcedureName, _DataSetRdlForMainReport.Tables[0]);
                    //Added by Chandan 0n 18th Dec 2008
                    //Session["DataSetRdlTemp"] = null;
                    DataSet dstemp = (DataSet)Session["DataSetRdlTemp"];
                    if (dstemp == null)
                    {
                        dstemp = _DataSetRdlForMainReport;
                    }
                    else
                    {
                        dstemp.Merge(_DataSetRdlForMainReport);
                    }
                    Session["DataSetRdlTemp"] = dstemp;
                    //HiddenFieldStoredProcedureName.Value = _StoredProcedureName;
                    //HiddenFieldReportName.Value = _ReportName;

                    #endregion

                    //Code addded by Loveena in ref to Task#2597
                    //Following parameters added with ref to Task 2371 SC-Support
                    _RptParam    = new ReportParameter[3];
                    _RptParam[0] = new ReportParameter("PrescriberId", ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId.ToString());
                    _RptParam[1] = new ReportParameter("LastReviewTime", LabelReviewDateTime.Text);
                    _RptParam[2] = new ReportParameter("ServerTime", HiddenFieldRDLCurrentDateTime.Value);
                    reportViewer1.LocalReport.SetParameters(_RptParam);

                    reportViewer1.LocalReport.Refresh();
                    reportViewer1.LocalReport.DataSources.Add(DataSource);
                }
            }



            #endregion



            //Added by Rohit. Ref ticket#84
            string         reportType = "PDF";
            IList <Stream> m_streams;
            m_streams = new List <Stream>();
            Microsoft.Reporting.WebForms.Warning[] warnings;
            string deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat><StartPage>0</StartPage></DeviceInfo>";

            if (Session["imgId"] == null)
            {
                Session["imgId"] = 0;
            }
            else
            {
                Session["imgId"] = Convert.ToInt32(Session["imgId"]) + 1;
            }

            string ScriptId = Session["imgId"] + "_" + DateTime.Now.ToString("yyyyMMHHMMss") + "." + seq.ToString();

            try
            {
                using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                {
                    //In case of Ordering method as X Chart copy will be printed

                    objRDLC.RunPreview(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), ScriptId, false, false);

                    //Added by Rohit. Ref ticket#84
                    renderedBytes = reportViewer1.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

                    ShowReport(ScriptId);
                }
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                objLogManager = null;
            }
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            //    //Added by Vikas Vyas In ref to task 2334 On Dated March 04th 2008

            _DataSetGetRdlCName      = null;
            _DataSetRdlForMainReport = null;
            _DataSetRdlForSubReport  = null;
            _RptParam = null;
            ////End
        }

        #endregion
    }
    protected void ButtonApprove_Click(object sender, EventArgs e)
    {
        int count = 0;

        new Streamline.UserBusinessServices.MedicationLogin();
        DataSet dsTemp = null;

        try
        {
            if (LabelErrorMessage.Text == "Your account is disabled.Please contact system administrator.")
            {
                Response.Redirect("MedicationLogin.aspx");
            }
            if (HiddenFieldFirstChance.Value == "")
            {
                HiddenFieldFirstChance.Value = "0";
            }

            if (HiddenFieldSecurityAnswer.Value.Trim().ToLower() == TextBoxAnswer.Text.Trim().ToLower())
            {
                ImageError.Style.Add("display", "none");
                ImageError.Style.Add("display", "none");
                LabelErrorMessage.Style.Add("display", "none");
                TextBoxAnswer.Focus();
                LabelErrorMessage.Text = "";
                objUserPreferences     = new Streamline.UserBusinessServices.UserPrefernces();
                count = objUserPreferences.ApprovePrescription(((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId, ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).LastPrescriptionReviewTime, HiddenFieldRDLCurrentDateTime.Value);
                ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).LastPrescriptionReviewTime = HiddenFieldRDLCurrentDateTime.Value;
                ScriptManager.RegisterStartupScript(LabelErrorMessage, LabelErrorMessage.GetType(), ClientID.ToString(), "redirectToStartPage();", true);
                //return count;
            }
            else
            {
                HiddenFieldFirstChance.Value = Convert.ToString(Convert.ToInt32(HiddenFieldFirstChance.Value) + 1);
                if (Convert.ToInt32(HiddenFieldFirstChance.Value) >= 2)
                {
                    if (HiddenFieldSecondChance.Value == "")
                    {
                        HiddenFieldSecondChance.Value = "0";
                    }
                    HiddenFieldSecondChance.Value = Convert.ToString(Convert.ToInt32(HiddenFieldSecondChance.Value) + 1);
                    if (HiddenFieldSecondChance.Value == "1")
                    {
                        dsTemp = (DataSet)Session["DataSetSecurityQustion"];
                        Random random = new Random();
                        if (dsTemp != null)
                        {
                            int num = random.Next(0, dsTemp.Tables[0].Rows.Count);
                            if (dsTemp.Tables[0].Rows.Count > 0)
                            {
                                LabelSecurityQuestion.Text      = dsTemp.Tables["StaffSecurityQuestion"].Rows[num]["CodeName"].ToString();
                                HiddenFieldSecurityAnswer.Value = dsTemp.Tables["StaffSecurityQuestion"].Rows[num]["SecurityAnswer"].ToString();
                            }
                        }
                    }
                    if (Convert.ToInt32(HiddenFieldSecondChance.Value) > 2)
                    {
                        objMedicationLogin = new Streamline.UserBusinessServices.MedicationLogin();
                        objMedicationLogin.chkCountLogin(((StreamlineIdentity)(Context.User.Identity)).UserCode);

                        ImageError.Style.Add("display", "block");
                        ImageError.Style.Add("display", "block");
                        LabelErrorMessage.Style.Add("display", "block");
                        TextBoxAnswer.Focus();
                        LabelErrorMessage.Text = "Your account is disabled.Please contact system administrator.";
                        return;
                    }
                }
                ImageError.Style.Add("display", "block");
                ImageError.Style.Add("display", "block");
                LabelErrorMessage.Style.Add("display", "block");
                TextBoxAnswer.Focus();
                LabelErrorMessage.Text = "The answers provided do not match the answers on record.";
            }
        }
        catch (Exception ex)
        {
            throw;
        }
    }
示例#22
0
    public override void Activate()
    {
        try
        {
            CommonFunctions.Event_Trap(this);

            if (Session["DataSetClientSummary"] == null)
            {
                GetClientSummaryData();
            }

            this.TextBoxAddAllergy.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + LinkButtonAddAllergy.UniqueID + "').focus();return false;}} else {return true}; ");
            this.LinkButtonAddAllergy.Attributes.Add("onfocus", "ShowAllergySearchDivonLostFocus1('" + TextBoxAddAllergy.ClientID + "')");

            base.Activate();
            if (Session != null)
            {
                if (System.Configuration.ConfigurationSettings.AppSettings["ExternalInterface"].ToString().ToUpper() == "TRUE" && Session["ExternalClientInformation"] != null)
                {
                    _DataSetClientSummary = (DataSet)Session["ExternalClientInformation"];
                    if (_DataSetClientSummary.Tables["ClientHTMLSummary"].Rows.Count > 0)
                    {
                        BindControls();
                    }
                    else
                    {
                        ClearControls();
                    }
                }
                else
                {
                    _DataSetClientSummary = (DataSet)Session["DataSetClientSummary"];
                    if (_DataSetClientSummary.Tables["ClientInfoAreaHtml"].Rows.Count > 0)
                    {
                        BindControls();
                    }
                    else
                    {
                        ClearControls();
                    }
                }
                //if (!IsPostBack)
                //{
                //    HealthData.Activate();
                //    HealthGraph.Activate();
                //}
            }
            else
            {
                ScriptManager.RegisterStartupScript(LabelClientScript, LabelClientScript.GetType(), ClientID.ToString(), "redirectToLoginPage();", true);
                return;
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }

            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
        }
    }
示例#23
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["AjaxAction"] == "saveHMTemplateUserDecisions")
            {
                string acceptedKeys = Request.QueryString["AcceptedKeys"].ToString();
                string rejectedKeys = Request.QueryString["RejectedKeys"].ToString();
                string clientIdStr  = Request.QueryString["ClientId"].ToString();
                int    clientId     = 0;
                if (clientIdStr != null && clientIdStr != "")
                {
                    clientId = Convert.ToInt32(clientIdStr);
                }
                using (Streamline.UserBusinessServices.HealthMaintenanceTemplate HealthMaintenanceObj = new Streamline.UserBusinessServices.HealthMaintenanceTemplate())
                {
                    string  pendingAlertCount = "";
                    DataSet dataSetObj        = HealthMaintenanceObj.SaveHealthMaintenaceUserDecisions(acceptedKeys, rejectedKeys, clientId);
                    if (dataSetObj != null && dataSetObj.Tables.Count > 0)
                    {
                        if (dataSetObj.Tables[0] != null && dataSetObj.Tables[0].Rows.Count > 0)
                        {
                            pendingAlertCount = dataSetObj.Tables[0].Rows[0][0].ToString();
                        }
                    }
                    Response.Clear();
                    Response.Write(pendingAlertCount);
                    Response.End();
                }
            }
            if (Request.QueryString["AjaxAction"] == "HealthMaintenanceAlertCheck")
            {
                string CheckAlert    = "true";
                int    CheckClientID = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;

                string retValue = HealthMaintenanceAlertCheck(CheckAlert, CheckClientID);
                Response.Write(retValue);
                Response.End();
            }

            try
            {
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                if (Session["UserContext"] != null)
                {
                    LabelCopyrightInfo.Text = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).CopyrightInfo;
                }
                if (Page.IsPostBack == false)
                {
                    try
                    {
                        bindTemplateGrid();
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + ex.Message.ToString() + "', true);", true);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }

                string ParseMessage = ex.Message;
                if (ParseMessage.IndexOf("System.Data.SqlClient.SqlException:") > 0)
                {
                    int SubstringLen = ParseMessage.IndexOf("\n") - ParseMessage.IndexOf("System.Data.SqlClient.SqlException:");
                    ParseMessage = ParseMessage.Substring(ParseMessage.IndexOf("System.Data.SqlClient.SqlException:") + 35, SubstringLen - 35);
                    //  ShowError(ParseMessage, true);
                }
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + ex.Message.ToString() + "', true);", true);
            }
        }
示例#24
0
 private void frmLogin_Load(object sender, EventArgs e)
 {
     browser.Load($"{ConfigurationManager.AppSettings.Get("MesaSuite.Common.AuthHost")}/Authorize?response_type=code&client_id={ClientID.ToString()}&redirect_uri={WebUtility.UrlEncode("http://localhost:" + Port)}&state={State.ToString()}");
 }
示例#25
0
    public override void Activate()
    {
        try
        {
            CommonFunctions.Event_Trap(this);

            base.Activate();
            if (Session != null)
            {
                _DataSetClientSummary = (DataSet)Session["DataSetClientSummary"];
                if (_DataSetClientSummary.Tables["ClientInformation"].Rows.Count > 0)
                {
                    BindControls();
                }
                else
                {
                    ClearControls();
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(LabelClientScript, LabelClientScript.GetType(), ClientID.ToString(), "redirectToLoginPage();", true);
                return;
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
        }
    }
示例#26
0
        protected void btnSaveClient_Click(object sender, EventArgs e)
        {
            try
            {
                BusinessObjects.Clients cl = new BusinessObjects.Clients();
                cl.OrganizationName  = txtOrganizationName.Text;
                cl.ContactPersonName = txtContactPersonName.Text;
                cl.MobileNo          = txtMobile.Text;
                cl.Email             = txtEmail.Text;
                cl.Address           = txtAddress.Text;
                cl.City        = txtCity.Text;
                cl.State       = txtState.Text;
                cl.GoverningId = ddlGoverningBody.SelectedItem.Value; //.SelectedValue

                cl.MemberCount = 0;                                   //String.IsNullOrEmpty(txtMembersCount.Text) ? 0 : Convert.ToInt32(txtMembersCount.Text);
                cl.UserAllowed = string.Empty;                        //txtUsersAllowedCount.Text;
                cl.CreateDate  = DateTime.Now;
                int ClientID = 0;
                if (litClientID.Text == string.Empty)
                {
                    ClientID = new ClientController().CreateNewClient(cl);
                }
                else
                {
                    ClientID = Convert.ToInt32(litClientID.Text);
                    cl.ID    = ClientID;
                    new ClientController().UpdateClient(cl);
                }
                if (fuLogo.HasFile)
                {
                    fuLogo.PostedFile.SaveAs(Server.MapPath("~/images/" + ClientID.ToString() + ".jpg"));
                }
                fuLogo.PostedFile.SaveAs(Server.MapPath("~/images/" + ClientID.ToString() + ".jpg"));


                User   u         = new User();
                string strUserID = string.Empty;

                if (litAdminID.Text == string.Empty && txtMobile.Text != string.Empty && isExist(txtMobile.Text, txtContactPersonName.Text))
                {
                    General.ShowAlertMessage("This Contact detail is already in database");
                }
                else
                {
                    string CouponCode = string.Empty;
                    u.FirstName               = txtContactPersonName.Text;
                    u.EMail                   = txtEmail.Text;
                    u.MobileNo                = txtMobile.Text;
                    u.CreateDate              = DateTime.Now;
                    u.DOB                     = Convert.ToDateTime("1/1/1900");
                    u.LastLockoutDate         = DateTime.Now;
                    u.LastLoginDate           = DateTime.Now;
                    u.LastPasswordChangedDate = DateTime.Now;
                    u.CouponCode              = CouponCode;
                    u.IsDeleted               = false;
                    u.IsLockedOut             = false;
                    u.RoleID                  = 2;
                    u.Custom1                 = "0";
                    u.Custom2                 = string.Empty;
                    u.Custom3                 = string.Empty;
                    u.Custom4                 = string.Empty;
                    u.Custom5                 = "3";//This field is used Type of Flow that it should go
                    u.PWD                     = Encryption.Encrypt("ab@345");
                    u.Session                 = General.GetCurrentSession;
                    u.ClientID                = ClientID;
                    if (litAdminID.Text == string.Empty)
                    {
                        strUserID = new UserController().CreateUser(u);
                        General.ShowAlertMessage("Success!");
                    }
                    else
                    {
                        u.UserID  = litAdminID.Text;
                        strUserID = new UserController().UpdateUser(u);
                        General.ShowAlertMessage("Success!");
                        litClientID.Text = string.Empty;
                    }
                }
                BindClients();
                txtOrganizationName.Text  = string.Empty;
                txtContactPersonName.Text = string.Empty;
                txtMobile.Text            = string.Empty;
                txtEmail.Text             = string.Empty;
                txtAddress.Text           = string.Empty;
                txtCity.Text  = string.Empty;
                txtState.Text = string.Empty;
            }
            catch (Exception ex)
            {
                General.ShowAlertMessage(ex.Message + "\r\n Please validate the details and try again.");
            }
        }
示例#27
0
        /// <summary>
        /// Executes the phase 1 of the take operation.
        /// </summary>
        /// <param name="template">Template of the requested tuple.</param>
        /// <returns></returns>
        private ITuple Take1(ITuple template)
        {
            // Create request message.
            TSpaceMsg message = new TSpaceMsg();

            message.Code      = "take1";
            message.Tuple     = template;
            message.ProcessID = ClientID.ToString();
            message.RequestID = ClientID + "_" + (++SequenceNumber);
            message.MsgView   = GetCurrentView();


            // Clear responses from previour requests
            lock (MatchingTuples)
            {
                AcksCounter = 0;
                MatchingTuples.Clear();
            }

            // Create local callback.
            AsyncCallback remoteCallback = new AsyncCallback(Take1Callback);

            // Repeat until all replicas have responded
            while (AcksCounter < View.Count)
            {
                //Send multicast take request to all members of the view
                this.Multicast(message, remoteCallback);
            }

            if (AcksCounter > View.Count)
            {
                throw new Exception();
            }
            List <ITuple> intersection;

            lock (MatchingTuples)
            {
                // Select one tuple from the intersection of all matching tuples lists
                intersection = MatchingTuples[0];

                foreach (List <ITuple> tupleList in MatchingTuples)
                {
                    intersection.Intersect(tupleList, new TupleComparator());
                }
            }


            // If intersection = {}
            // Send release locks to all replicas
            if (intersection.Count == 0)
            {
                //Create message
                message.Code      = "releaseLocks";
                message.RequestID = ClientID + "_" + (++SequenceNumber);


                // Clear acks
                AcksCounter = 0;

                // Create remote callback
                remoteCallback = new AsyncCallback(AddCallback);

                // Repeat until all replicas have acknowledged release
                while (AcksCounter < View.Count)
                {
                    //Send multicast take request to all members of the view
                    this.Multicast(message, remoteCallback);
                }

                Console.WriteLine("Take 1: intersection = {}");
                return(null);
            }

            return(intersection[0]);
        }
示例#28
0
    protected void ButtonOk_Click(object sender, EventArgs e)
    {
        int  PharmacyId     = 0;
        char OrderingMethod = 'F';

        int ScriptReason = -1;

        bool strUpdateDatabase = false;

        try
        {
            CommonFunctions.Event_Trap(this);
            objectClientMedications = new ClientMedication();

            if (RadioButtonFaxToPharmacy.Checked == true)
            {
                OrderingMethod = 'F';
            }
            else
            {
                OrderingMethod = 'P';
            }


            if (OrderingMethod == 'F')
            {
                if (DropDownListPharmacies.SelectedIndex != 0)
                {
                    PharmacyId = Convert.ToInt32(DropDownListPharmacies.SelectedValue.ToString());
                }
            }


            if (DropDownListScriptReason.SelectedIndex != 0)
            {
                ScriptReason = Convert.ToInt32(DropDownListScriptReason.SelectedValue.ToString());
            }

            //ClientMedicationScriptActivityId = objectClientMedications.InsertIntoClientMedicationScriptActivities(Convert.ToInt32(HiddenFieldLatestClientMedicationScriptId.Value), OrderingMethod, PharmacyId, ScriptReason, CreatedBy);
            //Send Fax for non-controlled medications if ordering Method is Fax
            if (OrderingMethod == 'F')
            {
                if (HiddenFieldOrderMethod.Value.IndexOf("Faxed") < 0 && HiddenFieldOrderMethod.Value.IndexOf("F") < 0)
                {
                    strUpdateDatabase = SendToPrinter(ScriptReason, PharmacyId);
                    ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "alert('Some Medications could not be Faxed,Please review script History!');", true);
                }
                strUpdateDatabase = SendToFax(ScriptReason, PharmacyId);
            }

            if (strUpdateDatabase)
            {
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "closeDiv();", true);
            }
            else
            {
                string strErrorMessage = "Error in Updating Database";
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
            }
        }


        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "Source function ButtonOk_Click of Print Order Dialog";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);

            string strErrorMessage = "Error in Updating Database";
            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
        }
        finally
        {
            DataSetClientScriptActivities = null;
        }
    }
示例#29
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        FileStream fs;
        TextWriter ts;
        string     _strScriptIds = "";
        ArrayList  ScriptArrays;
        string     _strChartScriptIds = "";
        ArrayList  ChartScriptArrays;
        bool       _strFaxSendStatus             = false;
        string     _strFaxFaildMessage           = "";
        Dictionary <string, string> filePathList = new Dictionary <string, string>();

        string imagePath = string.Empty;

        try
        {
            #region "error message color added by rohit ref. #121"
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
            #endregion

            string strPath  = "";
            string FileName = "";

            DataSet DatasetSystemConfigurationKeys = null;
            Streamline.DataService.SharedTables objSharedTables = new Streamline.DataService.SharedTables();
            DatasetSystemConfigurationKeys = objSharedTables.GetSystemConfigurationKeys();
            if (objSharedTables.GetSystemConfigurationKeys("PRINTFOURPRESCRIPTIONSPERPAGE", DatasetSystemConfigurationKeys.Tables[0]).ToUpper() == "YES")
            {
                Printheader.Text = "";
                Printfourprescriptionsperpage = "Y";
            }


            fs            = new FileStream(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\Report.html"), FileMode.Create);
            ts            = new StreamWriter(fs);
            _strScriptIds = Request.QueryString["varScriptIds"].ToString();
            if (Request.QueryString["varChartScriptIds"] != null)
            {
                _strChartScriptIds = Request.QueryString["varChartScriptIds"].ToString();
            }
            _strFaxSendStatus = Convert.ToBoolean(Request.QueryString["varFaxSendStatus"]);

            string strPageHtml = "";
            ScriptArrays = new ArrayList();
            if (_strScriptIds.Contains("^"))
            {
                ScriptArrays = ApplicationCommonFunctions.StringSplit(_strScriptIds, "^");
            }
            else if (_strScriptIds.Contains(","))
            {
                ScriptArrays = ApplicationCommonFunctions.StringSplit(_strScriptIds, ",");
            }
            else
            {
                ScriptArrays = ApplicationCommonFunctions.StringSplit(_strScriptIds, ",");
            }

            ChartScriptArrays = new ArrayList();
            if (_strChartScriptIds.Contains("^"))
            {
                ChartScriptArrays = ApplicationCommonFunctions.StringSplit(_strChartScriptIds, "^");
            }
            else if (_strChartScriptIds.Contains(","))
            {
                ChartScriptArrays = ApplicationCommonFunctions.StringSplit(_strChartScriptIds, ",");
            }
            else
            {
                ChartScriptArrays = ApplicationCommonFunctions.StringSplit(_strChartScriptIds, ",");
            }

            if (_strFaxSendStatus == false)
            {
                _strFaxFaildMessage = "Script could not be faxed at this time.  The fax server is not available.  Please print the script or re-fax the script later.";
                strPageHtml        += "<span style='float:left;position:absolute;padding-left:30%;color:Red;text-align:center;font-size: 12px;font-family:Microsoft Sans Serif;'><b>" + _strFaxFaildMessage + "</b></span><br/>";
            }
            //End here
            for (int i = 0; i < ScriptArrays.Count; i++)
            {
                foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                {
                    FileName = file.Substring(file.LastIndexOf("\\") + 1);
                    if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0) && (FileName.IndexOf(ScriptArrays[i].ToString()) >= 0))
                    {
                        strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName + "'  style='width:100%' />";
                        imagePath    = "RDLC\\" + Context.User.Identity.Name + "\\" + FileName;
                        filePathList.Add(FileName, imagePath);
                    }
                    strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName;
                    strPath = strPath.Replace(@"\", "/");
                }
            }

            //Get the Images from ChartScripts Folder
            for (int i = 0; i < ChartScriptArrays.Count; i++)
            {
                if (
                    Directory.Exists(
                        Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\" + "ChartScripts" + "\\")))
                {
                    foreach (
                        string file in
                        Directory.GetFiles(
                            Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\" + "ChartScripts" + "\\"))
                        )
                    {
                        FileName = file.Substring(file.LastIndexOf("\\") + 1);
                        if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0) &&
                            (FileName.IndexOf(ChartScriptArrays[i].ToString()) >= 0))
                        {
                            strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" +
                                           "ChartScripts" + "\\" + FileName + "'  style='width:100%' />";
                        }
                        strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + "ChartScripts" + "\\" +
                                  FileName;
                    }
                }
            }

            //byte[] photo = org_logo(imagePath);
            string pageHTMLWithWatermark = string.Empty;

            bool printWithWatermark = false;
            int  drugCategory       = 0;
            Streamline.UserBusinessServices.DataSets.DataSetClientMedicationOrders _DataSetOrderDetails = Session["DataSetOrderDetails"] as DataSetClientMedicationOrders;
            string PharmacyName   = Convert.ToString(Session["PharmacyName"]);
            string OrderingMethod = Convert.ToString(Session["OrderingMethod"]);
            if (OrderingMethod.Contains("Elec"))
            {
                if (Session["MedicationOrderStatus"] != null && Convert.ToString(Session["MedicationOrderStatus"]).Equals("Successful") &&
                    Session["DrugCategory"] != null)
                {
                    drugCategory = Convert.ToInt32(Session["DrugCategory"]);
                    if (drugCategory >= 2)
                    {
                        foreach (KeyValuePair <string, string> imageParameters in filePathList)
                        {
                            string phyisicalPathName = AddWatermark(imageParameters.Value, imageParameters.Key, OrderStatus.Success);
                            pageHTMLWithWatermark += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + phyisicalPathName + "'/>";
                            printWithWatermark     = true;
                        }
                    }
                }
                else if (Session["MedicationOrderStatus"] != null && !Convert.ToString(Session["MedicationOrderStatus"]).Equals("Successful") &&
                         Session["DrugCategory"] != null)
                {
                    drugCategory = Convert.ToInt32(Session["DrugCategory"]);
                    foreach (KeyValuePair <string, string> imageParameters in filePathList)
                    {
                        string phyisicalPathName = AddWatermark(imageParameters.Value, imageParameters.Key, OrderStatus.Failure);
                        pageHTMLWithWatermark += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + phyisicalPathName + "'/>";
                        printWithWatermark     = true;
                    }
                }
            }
            else
            {
                if (Session["MedicationOrderStatus"] != null && !Convert.ToString(Session["MedicationOrderStatus"]).Equals("Successful") &&
                    Session["DrugCategory"] != null)
                {
                    drugCategory = Convert.ToInt32(Session["DrugCategory"]);
                    foreach (KeyValuePair <string, string> imageParameters in filePathList)
                    {
                        if (ChartScriptArrays.Count == 0)
                        {
                            string phyisicalPathName = AddOriginalPrescriptionImage(imageParameters.Value, imageParameters.Key);
                            pageHTMLWithWatermark += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + phyisicalPathName + "'/>";
                            printWithWatermark     = true;
                        }
                    }
                }
                printWithWatermark = true;
            }

            ts.Close();
            if (printWithWatermark && pageHTMLWithWatermark != "")
            {
                Response.Write(pageHTMLWithWatermark);
            }
            else
            {
                strPageHtml = strPageHtml.Replace(@"\", "/");
            }
            Response.Write(strPageHtml);
            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "printScript();", true);
        }
        catch (Exception ex)
        {
            Response.Write("Error While Generating Report" + ex.Message.ToString());
        }
        finally
        {
            fs                 = null;
            ts                 = null;
            _strScriptIds      = null;
            ScriptArrays       = null;
            ChartScriptArrays  = null;
            _strChartScriptIds = null;
        }
    }
示例#30
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        FileStream fs;
        TextWriter ts;
        string     _strClientMedicationIds = "";
        ArrayList  MedicationArrays;

        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetExpires(DateTime.Now - new TimeSpan(0, 0, 0));
        Response.Cache.SetLastModified(DateTime.Now);
        Response.Cache.SetAllowResponseInBrowserHistory(false);
        Response.Expires = 0;
        Response.Cache.SetNoStore();
        Response.AppendHeader("Pragma", "no-cache");
        divReportViewer1.Visible   = true;
        divNonReportViewer.Visible = false;

        try
        {
            #region "error message color added by rohit ref. #121"
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
            #endregion

            string strPath  = "";
            string FileName = "";


            fs = new FileStream(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\Report.html"), FileMode.Create);
            ts = new StreamWriter(fs);
            _strClientMedicationIds    = Request.QueryString["varClientMedicationIds"].ToString();
            divReportViewer1.InnerHtml = "";

            string strPageHtml = "";
            MedicationArrays = new ArrayList();
            MedicationArrays = ApplicationCommonFunctions.StringSplit(_strClientMedicationIds, "^");


            for (int i = 0; i < MedicationArrays.Count; i++)
            {
                foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                {
                    FileName = file.Substring(file.LastIndexOf("\\") + 1);
                    if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0) && (FileName.IndexOf(MedicationArrays[i].ToString()) >= 0))
                    {
                        strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName + "' style='width:108%' />";
                    }
                    strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName;
                }
            }

            if (Request.QueryString["ReportViewer"].ToString() == "true")
            {
                divReportViewer1.InnerHtml = "";
                strPageHtml = strPageHtml.Replace(@"\", "/");
                divReportViewer1.InnerHtml = strPageHtml;
                ts.Close();
            }
            else if (Request.QueryString["ReportViewer"].ToString() == "false")
            {
                ts.Close();
                //Response.Write(strPageHtml);
                strPageHtml = strPageHtml.Replace(@"\", "/");
                divNonReportViewer.InnerHtml = strPageHtml;
                divReportViewer1.Visible     = false;
                divNonReportViewer.Visible   = true;
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "printScript1();", true);
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "###Source Event Name -Page_Load()";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            fs = null;
            ts = null;
        }
    }