protected void btnSubmit_Click(object sender, EventArgs e)
        {
            objSecureMedicalRecordBLL              = new BLL.SecureMedicalRecordBLL();
            objSecureMedicalRecordDTO              = new DTO.SecureMedicalRecordDTO();
            objSecureMedicalRecordDTO.PatientId    = int.Parse(txtPatientId.Text);
            objSecureMedicalRecordDTO.DoctorId     = int.Parse(Session["UserId"].ToString());
            objSecureMedicalRecordDTO.ProblemTitle = txtProblem.Text;
            Shamir obj           = new Shamir();
            Random rnd           = new Random();
            int    key           = rnd.Next(1000, 9999);
            string attributedata = obj.AttributeValue(key);

            attributedata = attributedata.Remove(0, 1);
            objSecureMedicalRecordDTO.PastData = AESCryptoClass.EncryptData(txtDesp.Text, key.ToString());

            objSecureMedicalRecordDTO.DataKey = attributedata;
            string res = objSecureMedicalRecordBLL.PatientTreatment(objSecureMedicalRecordDTO);

            if (res == "1")
            {
                txtPatientId.Text = txtDesp.Text = txtProblem.Text = "";
                lblMsg.ForeColor  = System.Drawing.Color.Green;
                lblMsg.Text       = "Patient Treatment Uploaded Successfully";
            }
            else
            {
                lblMsg.ForeColor = System.Drawing.Color.Red;
                lblMsg.Text      = "Patient Treatment Upload Error";
            }
        }
        void lnk_Click(object sender, EventArgs e)
        {
            xList        = new ArrayList();
            yList        = new ArrayList();
            lagrangeList = new ArrayList();
            Shamir     objShamir = new Shamir();
            LinkButton lnk       = (LinkButton)sender;

            if (txtKey.Text == lnk.CommandArgument.ToString().Split('-')[0])
            {
                lblMsg.Text = "";
                string[] attval = lnk.CommandArgument.ToString().Split('-')[2].Split(',');
                Random   rnd    = new Random();
                for (int i = 0; i <= 2;)
                {
                    int v = rnd.Next(1, 6);
                    int p = valrnd.IndexOf(v);
                    if (p < 0)
                    {
                        valrnd.Add(v);
                        i++;
                    }
                }
                for (int i = 0; i <= 2; i++)
                {
                    xList.Add(valrnd[i]);
                    yList.Add(attval[int.Parse(valrnd[i].ToString()) - 1].ToString());
                }
                K = "3";
                for (int i = 0; i < int.Parse(K); i++)
                {
                    lagrangeList.Add(Lagarange(i));
                }
                double result = 0.0;
                for (int i = 0; i < int.Parse(K); i++)
                {
                    result = result + (double.Parse(yList[i].ToString()) * double.Parse(lagrangeList[i].ToString()));
                }
                if (result < 0)
                {
                    result = result * -1.0;
                }
                result = Math.Round(result, MidpointRounding.AwayFromZero);

                txtMedicalData.Text = AESCryptoClass.Decrypt(lnk.CommandArgument.ToString().Split('-')[1], result.ToString());
            }
            else
            {
                lblMsg.Text      = "Invalid Access Key";
                lblMsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        public string GetData(string datakey)
        {
            xList        = new ArrayList();
            yList        = new ArrayList();
            lagrangeList = new ArrayList();
            Shamir objShamir = new Shamir();

            string[] attval = datakey.Split(',');
            Random   rnd    = new Random();

            for (int i = 0; i <= 2;)
            {
                int v = rnd.Next(1, 6);
                int p = valrnd.IndexOf(v);
                if (p < 0)
                {
                    valrnd.Add(v);
                    i++;
                }
            }
            for (int i = 0; i <= 2; i++)
            {
                xList.Add(valrnd[i]);
                yList.Add(attval[int.Parse(valrnd[i].ToString()) - 1].ToString());
            }
            K = "3";
            for (int i = 0; i < int.Parse(K); i++)
            {
                lagrangeList.Add(Lagarange(i));
            }
            double result = 0.0;

            for (int i = 0; i < int.Parse(K); i++)
            {
                result = result + (double.Parse(yList[i].ToString()) * double.Parse(lagrangeList[i].ToString()));
            }
            if (result < 0)
            {
                result = result * -1.0;
            }
            result = Math.Round(result, MidpointRounding.AwayFromZero);
            return(result.ToString());
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            objSecureMedicalRecordBLL            = new BLL.SecureMedicalRecordBLL();
            objSecureMedicalRecordDTO            = new DTO.SecureMedicalRecordDTO();
            objSecureMedicalRecordDTO.RecordName = txtRecordName.Text;
            objSecureMedicalRecordDTO.DoctorId   = int.Parse(Session["UserId"].ToString());
            objSecureMedicalRecordDTO.RecordData = txtDescp.Text;

            Shamir obj           = new Shamir();
            Random rnd           = new Random();
            int    key           = rnd.Next(1000, 9999);
            string attributedata = obj.AttributeValue(key);

            attributedata = attributedata.Remove(0, 1);
            string Encryptdata = AESCryptoClass.EncryptData(objSecureMedicalRecordDTO.RecordData, key.ToString());

            objSecureMedicalRecordDTO.PastData = Encryptdata;
            objSecureMedicalRecordDTO.DataKey  = attributedata;
            int res = objSecureMedicalRecordBLL.UploadDoctorMedicalRecord(objSecureMedicalRecordDTO);

            if (res == 1)
            {
                txtRecordName.Text = txtDescp.Text = "";
                lblMsg.Text        = "Medical Upload Created Successfully";
                lblMsg.ForeColor   = System.Drawing.Color.Green;
            }
            else if (res == 2)
            {
                txtRecordName.Text = txtDescp.Text = "";
                lblMsg.Text        = "Medical Record Name Created Already";
                lblMsg.ForeColor   = System.Drawing.Color.Red;
            }
            else
            {
                txtRecordName.Text = txtDescp.Text = "";
                lblMsg.Text        = "Medical Upload Creation Error";
                lblMsg.ForeColor   = System.Drawing.Color.Red;
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            objSecureMedicalRecordBLL = new BLL.SecureMedicalRecordBLL();
            objSecureMedicalRecordDTO = new DTO.SecureMedicalRecordDTO();
            Shamir obj           = new Shamir();
            Random rnd           = new Random();
            int    key           = rnd.Next(1000, 9999);
            string attributedata = obj.AttributeValue(key);

            attributedata = attributedata.Remove(0, 1);
            objSecureMedicalRecordDTO.PatientId = PatientId;
            string PastData = txtMedicalHistory.Text + "-" + txtPatientAllergies.Text + "-" + txtSocialHistory.Text;

            objSecureMedicalRecordDTO.PastData = AESCryptoClass.EncryptData(PastData, key.ToString());
            objSecureMedicalRecordDTO.DataKey  = attributedata;
            string res = objSecureMedicalRecordBLL.CreatePatientClinical(objSecureMedicalRecordDTO);

            if (res == "1")
            {
                txtMedicalHistory.Text = txtPatientAllergies.Text = txtSocialHistory.Text = "";
                lblMsg.Text            = "Patient Past Medical History Uploaded Successfully & Patient Id:" + PatientId + " & Password:"******"Password"].ToString();
                lblMsg.ForeColor       = System.Drawing.Color.Green;
            }
            else if (res == "2")
            {
                txtMedicalHistory.Text = txtPatientAllergies.Text = txtSocialHistory.Text = "";
                lblMsg.Text            = "Patient Past Medical History Uploaded Already";
                lblMsg.ForeColor       = System.Drawing.Color.Red;
            }
            else
            {
                txtMedicalHistory.Text = txtPatientAllergies.Text = txtSocialHistory.Text = "";
                lblMsg.Text            = "Patient Past Medical History Upload Error";
                lblMsg.ForeColor       = System.Drawing.Color.Red;
            }
        }