示例#1
0
        private void Loadaffiliations()
        {
            affiliationslblSaveStatus.Text = "";
            using (AffiliationsAdminViewDBContext db = new AffiliationsAdminViewDBContext())
            {
                int EmpID  = int.Parse(Session["EmployeeID"].ToString());
                int linID  = int.Parse(Session["LineID"].ToString());
                int AreaId = int.Parse(Session["AreaID"].ToString());
                //var affiliationdata = from affiliation_tbl in db.View_Affiliations_Admin where affiliation_tbl.Deleted == null && affiliation_tbl.LineID == linID && affiliation_tbl.EmployeeID == EmpID && affiliation_tbl.SpecialtyValue>0 && affiliation_tbl.TotalValue!=affiliation_tbl.PrescriptionHappit+affiliation_tbl.NoOfPatients+affiliation_tbl.SpecialtyValue select affiliation_tbl;
                var affiliationdata = from affiliation_tbl in db.View_Affiliations_Admin where affiliation_tbl.Deleted == null && affiliation_tbl.LineID == linID && affiliation_tbl.EmployeeID == EmpID && affiliation_tbl.SpecialtyValue > 0 && affiliation_tbl.LastModifierID == null select affiliation_tbl;

                gvAffiliations.DataSource = affiliationdata.ToList();
                gvAffiliations.DataBind();
            }
        }
示例#2
0
        private void SearchQuery()
        {
            Panel1.Visible = false;
            int EmpID = int.Parse(Session["EmployeeID"].ToString());

            int LineID      = int.Parse(Session["LineID"].ToString());
            int AreaId      = int.Parse(Session["AreaID"].ToString());
            int BrickId     = int.Parse(ddlBrickSe.SelectedValue);
            int SpecialtyID = int.Parse(ddlSpecialtySe.SelectedValue);

            using (AffiliationsAdminViewDBContext db = new AffiliationsAdminViewDBContext())
            {
                if (ddlBrickSe.SelectedIndex > 0 && ddlSpecialtySe.SelectedIndex == 0)
                {
                    var affiliationdata = from affiliation_tbl in db.View_Affiliations_Admin where affiliation_tbl.Deleted == null && affiliation_tbl.BrickID == BrickId && affiliation_tbl.LineID == LineID && affiliation_tbl.EmployeeID == EmpID && affiliation_tbl.SpecialtyValue > 0 && affiliation_tbl.LastModifierID == null select affiliation_tbl;
                    gvAffiliations.DataSource = affiliationdata.ToList();
                }
                if (ddlBrickSe.SelectedIndex == 0 && ddlSpecialtySe.SelectedIndex > 0)
                {
                    var affiliationdata = from affiliation_tbl in db.View_Affiliations_Admin where affiliation_tbl.Deleted == null && affiliation_tbl.SpecialtyID == SpecialtyID && affiliation_tbl.LineID == LineID && affiliation_tbl.EmployeeID == EmpID && affiliation_tbl.SpecialtyValue > 0 && affiliation_tbl.LastModifierID == null select affiliation_tbl;
                    gvAffiliations.DataSource = affiliationdata.ToList();
                }
                if (ddlBrickSe.SelectedIndex == 0 && ddlSpecialtySe.SelectedIndex == 0)
                {
                    var affiliationdata = from affiliation_tbl in db.View_Affiliations_Admin where affiliation_tbl.Deleted == null && affiliation_tbl.LineID == LineID && affiliation_tbl.EmployeeID == EmpID && affiliation_tbl.SpecialtyValue > 0 && affiliation_tbl.LastModifierID == null select affiliation_tbl;
                    gvAffiliations.DataSource = affiliationdata.ToList();
                }
                if (ddlBrickSe.SelectedIndex > 0 && ddlSpecialtySe.SelectedIndex > 0)
                {
                    var affiliationdata = from affiliation_tbl in db.View_Affiliations_Admin where affiliation_tbl.Deleted == null && affiliation_tbl.BrickID == BrickId && affiliation_tbl.SpecialtyID == SpecialtyID && affiliation_tbl.LineID == LineID && affiliation_tbl.EmployeeID == EmpID && affiliation_tbl.SpecialtyValue > 0 && affiliation_tbl.LastModifierID == null select affiliation_tbl;
                    gvAffiliations.DataSource = affiliationdata.ToList();
                }
                gvAffiliations.DataBind();
                if (gvAffiliations.Rows.Count == 0)
                {
                    affiliationslblSaveStatus.Text = "No doctors found";
                }
            }
        }
示例#3
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ddlPHappit.SelectedIndex != -1)
            {
                int AffID = int.Parse(txtAffiliationID.Text);
                //using (AppointmentDBContext appdb = new AppointmentDBContext())
                //{
                //    int AffID = int.Parse(txtAffiliationID.Text);
                //    int cycleID = int.Parse(Session["CycleIDFromAdmin"].ToString());
                //    Appointment checkapp = (from Appointment_tbl in appdb.Appointments where Appointment_tbl.AffiliationID == AffID && Appointment_tbl.CycleID == cycleID  select Appointment_tbl).FirstOrDefault();
                //    if (checkapp == null)
                //    {
                using (AffiliationsDBContext db = new AffiliationsDBContext())
                {
                    Affiliation updateAff = (from Affiliation_tbl in db.Affiliations where Affiliation_tbl.Deleted == null && Affiliation_tbl.AffiliationID == AffID select Affiliation_tbl).FirstOrDefault();
                    updateAff.BestTimeFrom = txtBestTimeFrom.Text;
                    updateAff.BestTimeTo   = txtBestTimeTo.Text;
                    updateAff.Notes        = txtNotes.Text;
                    int roweffected = db.SaveChanges();
                    if (roweffected > 0)
                    {
                        affiliationslblSaveStatus.Text = "Updated";
                    }
                    else
                    {
                        affiliationslblSaveStatus.Text = "Error";
                    }
                }
                int LineID = int.Parse(Session["LineID"].ToString());

                using (PhysicianValueDBContext db = new PhysicianValueDBContext())
                {
                    PhysicianValueByLine updatePhByLine = (from PhyByLine_tbl in db.PhysicianValueByLines where PhyByLine_tbl.Deleted == null && PhyByLine_tbl.AffiliationID == AffID && PhyByLine_tbl.LineID == LineID select PhyByLine_tbl).FirstOrDefault();
                    updatePhByLine.NoOfPatients       = Math.Round(float.Parse(ddlNoOfPatients.SelectedValue), 3, MidpointRounding.AwayFromZero);
                    updatePhByLine.WaitingTime        = Math.Round(float.Parse(ddlWaitingTime.SelectedValue), 3, MidpointRounding.AwayFromZero);
                    updatePhByLine.PrescriptionHappit = Math.Round(float.Parse(ddlPHappit.SelectedValue), 3, MidpointRounding.AwayFromZero);
                    //updatePhByLine.PrescriptionHappit = Math.Round(float.Parse(ddlPHappit.SelectedValue), 3, MidpointRounding.AwayFromZero);

                    updatePhByLine.TotalValue           = updatePhByLine.NoOfPatients + updatePhByLine.PrescriptionHappit + Math.Round(float.Parse(txtSpecValue.Text), 3, MidpointRounding.AwayFromZero);
                    updatePhByLine.LastModifierID       = int.Parse(Session["EmployeeHRCode"].ToString());
                    updatePhByLine.LastModificationDate = DateTime.Today;
                    if (updatePhByLine.TotalValue >= 7)
                    {
                        updatePhByLine.PhysicianClass = "A";
                    }
                    if (updatePhByLine.TotalValue < 7)
                    {
                        if (updatePhByLine.TotalValue >= 5)
                        {
                            updatePhByLine.PhysicianClass = "B";
                        }
                        if (updatePhByLine.TotalValue < 5)
                        {
                            updatePhByLine.PhysicianClass = "C";
                        }
                    }

                    int roweffected = db.SaveChanges();
                    if (roweffected > 0)
                    {
                        affiliationslblSaveStatus.Text = "Updated";
                        btnUpdate.Visible = false;
                        saveorupdate();
                        clearFields();
                        Panel1.Visible = false;
                    }
                    else
                    {
                        affiliationslblSaveStatus.Text = "Error";
                    }
                }
                using (AffiliationsAdminViewDBContext db = new AffiliationsAdminViewDBContext())
                {
                    var affiliationdata = from affiliation_tbl in db.View_Affiliations_Admin where affiliation_tbl.Deleted == null && affiliation_tbl.AffiliationID == AffID && affiliation_tbl.LineID == LineID select affiliation_tbl;
                    gvAffiliations.DataSource = affiliationdata.ToList();
                    gvAffiliations.DataBind();
                }
            }


            //    else if (checkapp != null)
            //    {
            //        affiliationslblSaveStatus.Text = "Cannot update this affiliation.It has appointments";
            //}

            //}
            //}
            else
            {
                if (ddlPHappit.SelectedIndex == -1)
                {
                    lblPHappitReq.Visible = true;
                }

                affiliationslblSaveStatus.Text = "All Fields with red(*) is mandatory";
            }
        }