private PatientConsultation GetPatientConsultation()
 {
     using (GmConnection conn = App.CreateConnection())
     {
         return(PatientConsultation.GetPatientConsultation(conn, SelectedId));
     }
 }
        public static int Remove(GmConnection conn, int id)
        {
            GmCommand cmd = conn.CreateCommand("delete from PatientIdentifications where Id=@Id");

            cmd.AddInt("Id", id);
            return(cmd.ExecuteNonQuery());
        }
Exemplo n.º 3
0
        void LoadData()
        {
            using (GmConnection conn = App.ConnectionFactory.CreateConnection())
            {
                GmCommand cmd = conn.CreateCommand("select ProductCode, Name as ProductName, ParentProductCode from Product where DeletedFlag=0 and GroupFlag=1");


                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Product p = new Product(dr);
                        htProducts.Add(p.Code, p);
                    }
                }
            }
            foreach (Product p in htProducts.Values)
            {
                if (p.ParentCode != null)
                {
                    Product parent = htProducts[p.ParentCode] as Product;
                    p.SetParent(parent);
                }
                else
                {
                    rootProducts.Add(p);
                }
            }
            treeView.BeginUpdate();
            BuildTree(treeView.Nodes, rootProducts);
            treeView.EndUpdate();
            UpdateControls();
            UpdateStatus();
        }
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            ForumMessage forumMessage = new ForumMessage();
            forumMessage.userId       = userId;
            forumMessage.forumTopicId = forumTopicId;
            forumMessage.userName     = tbName.Text.Trim();
            forumMessage.text         = tbText.Text.Trim();

            using (GmConnection conn = Global.CreateConnection())
            {
                forumMessage.Save(conn);
            }
            Server.Transfer("ForumMessages.aspx?ft=" + forumTopicId);
            //			lblResult.Text = string.Format("Message добавлено.");
            //			WebUtils.Redirect(this, "Private/Users.aspx");
        }
        catch (System.Threading.ThreadAbortException ex)
        {
        }
        catch (Exception ex)
        {
            log.Exception(ex);
        }
    }
Exemplo n.º 5
0
    public void Update(GmConnection conn)
    {
        GmCommand cmd = conn.CreateCommand();

        cmd.AddInt("Id", id);
//		cmd.AddInt("RecordId", recordId);
        cmd.AddDateTime("Date", date);
        cmd.AddString("Name", name, MaxLength.UserInfo.Name);
        cmd.AddString("Email", email, MaxLength.UserInfo.Email);
        cmd.CommandText = "update UserInfo set Date=@Date,Name=@Name,Email=@Email";
        if (psw.Length > 0)
        {
            cmd.CommandText += ",Psw=@Psw";
            cmd.AddString("Psw", psw, MaxLength.UserInfo.Psw);
        }
        if (picture.Length > 0)
        {
            cmd.CommandText += ",Picture=@Picture";
            cmd.AddString("Picture", picture, MaxLength.UserInfo.Picture);
        }
//		cmd.AddInt("UserRole", (int)userRole);
//		cmd.AddInt("Status", (int)status);
        cmd.CommandText += " where Id=@Id";
        cmd.ExecuteNonQuery();
    }
    public void LoadData()
    {
        int userId = Utils.GetUserId(Context);

        if (userId == 0)
        {
            return;
        }
        UserInfo ui = null;

        using (GmConnection conn = Global.CreateConnection())
        {
            ui = UserInfo.GetUserInfo(conn, userId);
        }
        if (ui == null)
        {
            return;
        }
        hfId.Value = ui.Id.ToString();
//		tbDate.Text = Utils.ToString(userInfo.date);
        tbName.Text  = ui.name;
        tbEmail.Text = ui.email;

//		tbDate.MaxLength = MaxLength.Input.dateString;
        tbName.MaxLength     = MaxLength.UserInfo.Name;
        tbEmail.MaxLength    = MaxLength.UserInfo.Email;
        tbPassword.MaxLength = MaxLength.UserInfo.Psw;
    }
Exemplo n.º 7
0
 private void Open()
 {
     try
     {
         if (readOnly)
         {
             return;
         }
         DataRow dr = SelectedRow;
         if (dr != null)
         {
             int        id         = (int)dr["Id"];
             Medicament medicament = null;
             using (GmConnection conn = App.CreateConnection())
             {
                 medicament = Medicament.GetMedicament(conn, id);
             }
             if (medicament != null)
             {
                 MedicamentForm form = new MedicamentForm(medicament);
                 if (form.ShowDialog() == DialogResult.OK)
                 {
                     dr["Name"] = medicament.name;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
Exemplo n.º 8
0
    public static int Remove(GmConnection conn, int id)
    {
        GmCommand cmd = conn.CreateCommand("delete from LinkExchange where Id=@Id");        //!!!

        cmd.AddInt("Id", id);
        return(cmd.ExecuteNonQuery());
    }
Exemplo n.º 9
0
 private void InitPager(int parentId, int topNumber, bool enablePager)
 {
     ucPager.top    = "@TopNumber";
     ucPager.fields = "Id, Date, Title, Preview, Header, Link, IsGroup";
     ucPager.table  = "Articles";
     ucPager.cond   = "(ParentId = @ParentId) and Articles.Status>=0";
     ucPager.order  = "Date desc";
     if (enablePager)
     {
         int    count   = 0;
         string cmdText = ucPager.GetCountQuery();
         using (GmConnection conn = Global.CreateConnection())
         {
             GmCommand cmd = conn.CreateCommand(cmdText);
             cmd.AddInt("ParentId", parentId);
             cmd.AddInt("TopNumber", topNumber);
             count = (int)conn.ExecuteScalar(cmd);
         }
         ucPager.GenerateControls(count);
         this.SqlDataSource1.SelectCommand = ucPager.GetPageQuery();
     }
     else
     {
         ucPager.Visible = false;
         this.SqlDataSource1.SelectCommand = ucPager.GetSelectQuery();
     }
 }
Exemplo n.º 10
0
    void LoadData()
    {
        int id = RequestUtils.GetArticleId(this);

        if (id != 0)
        {
            using (GmConnection conn = Global.CreateConnection())
            {
                article = Article.GetArticle(conn, id);
            }
        }
        if (article == null)
        {
            article = new Article();
            int ag = RequestUtils.GetArticleGroupId(this);
            if (ag != 0)
            {
                article.parentId = ag;
            }
            else
            {
                article.isGroup = true;
            }
        }
    }
Exemplo n.º 11
0
 public static object ExecuteScalar(string cmdText)
 {
     using (GmConnection conn = Global.CreateConnection())
     {
         return(conn.ExecuteScalar(cmdText));
     }
 }
Exemplo n.º 12
0
        public static ReportsDataSet.PatientMedicamentsDataTable GetPatientMedicamentsTable(ConnectionFactory factory, int patientId)
        {
            ReportsDataSet.PatientMedicamentsDataTable dtPatientMedicaments = new ReportsDataSet.PatientMedicamentsDataTable();
            string cmdText = @"
SELECT StoreProducts.Id, Products.Name, Products.PackedNumber, Products.Maker, Prescriptions.Dose * Prescriptions.Multiplicity * Prescriptions.Duration AS Count,
                          StoreProducts.Price, Prescriptions.Dose * Prescriptions.Multiplicity * Prescriptions.Duration * StoreProducts.Price AS Sum, Series, MedLists
FROM Prescriptions 
LEFT OUTER JOIN StoreProducts ON StoreProducts.Id = Prescriptions.StoreProductId 
LEFT OUTER JOIN Products ON Products.Id = StoreProducts.ProductId
WHERE Prescriptions.PatientId = @PatientId";

            using (GmConnection conn = factory.CreateConnection())
            {
                GmCommand cmd = conn.CreateCommand(cmdText);
                cmd.AddInt("PatientId", patientId);
                conn.Fill(dtPatientMedicaments, cmd);
            }
            int index = 0;

            foreach (ReportsDataSet.PatientMedicamentsRow row in dtPatientMedicaments.Rows)
            {
                row.Id = ++index;
            }
            return(dtPatientMedicaments);
        }
Exemplo n.º 13
0
        public PatientMedicamentsReportBuilder(ConnectionFactory factory, Config config, Patient patient)
            : base(ReportBuilderId.PatientMedicaments)
        {
            AddDataSource("ReportsDataSet_PatientMedicaments", GetPatientMedicamentsTable(factory, patient.Id));
            Insurance insurance;
            string    insuranceCompanyName = "";

            using (GmConnection conn = factory.CreateConnection())
            {
                AddParameter("PatientName", patient.GetPatientName(conn));
                AddParameter("DoctorName", patient.GetDoctorName(conn));
                AddParameter("ChiefName", patient.GetChiefName(conn));
                AddParameter("Age", patient.GetAgeStr(conn));
                insurance = patient.GetInsurance(conn);
                if (insurance != null)
                {
                    insuranceCompanyName = insurance.GetInsuranceCompanyName(conn);
                }
            }
            AddParameter("HeadDoctor", config.departmentConfig.headDoctor);
            AddParameter("DepartmentName", config.departmentConfig.departmentName);
            AddParameter("HospitalName", config.departmentConfig.hospitalName);
            DiagnosisInfo di = patient.patientDiagnoses.LatestDiagnosisInfo;

            AddParameter("Diagnosis", di.text);
            AddParameter("DiagnosisCode", di.code);
            AddParameter("AdmissionDate", patient.admissionDate);
            AddParameter("DischargeDate", patient.DischargeDateStr);
            AddParameter("Duration", patient.Duration);
            AddParameter("CaseHistoryNumber", patient.patientData);
            AddParameter("InsuranceNumber", insurance != null?insurance.number:"");
            AddParameter("InsuranceCompany", insuranceCompanyName);
        }
Exemplo n.º 14
0
    public void Save(GmConnection conn)
    {
        GmCommand cmd = conn.CreateCommand();

        cmd.AddInt("Id", id);
        cmd.AddInt("PositionId", positionId);
        cmd.AddDateTime("Date", date);
        cmd.AddString("Name", name);
        cmd.AddString("Surname", surname);
        cmd.AddString("Address", address);
        cmd.AddString("Phone", phone);
        cmd.AddString("Link", link);
        cmd.AddString("Email", email);
        cmd.AddString("Resume", resume);
        cmd.AddString("Comments", comments);
        cmd.AddInt("Status", (int)status);
        if (id == 0)
        {
            cmd.CommandText = "insert into Candidates values (@PositionId,@Date,@Name,@Surname,@Address,@Phone,@Link,@Email,@Resume,@Comments,@Status) select @@Identity";
            id = (int)(decimal)cmd.ExecuteScalar();
        }
        else
        {
//            cmd.CommandText = "update Competitors set PositionId=@PositionId,Date=@Date,Name=@Name,Surname=@Surname,Address=@Address,Phone=@Phone,Link=@Link,Email=@Email, Resume=@Resume, Comments=@Comments,Status=@Status where Id=@Id";
//			cmd.ExecuteNonQuery();
        }
    }
Exemplo n.º 15
0
    void LoadData()
    {
        int id = RequestUtils.GetGalleryImageId(this);

        if (id != 0)
        {
            using (GmConnection conn = Global.CreateConnection())
            {
                galleryImage = GalleryImage.GetGalleryImage(conn, id);
            }
        }
        if (galleryImage == null)
        {
            galleryImage = new GalleryImage();
            int gl = RequestUtils.GetGalleryId(this);
            if (gl != 0)
            {
                galleryImage.galleryId = gl;
            }
        }
        using (GmConnection conn = Global.CreateConnection())
        {
            Utils.FillDDL(conn, ddlStatus, "select Id, Name from Statuses", (int)galleryImage.status);
        }
        tbFilename.Text = galleryImage.filename;
        tbName.Text     = galleryImage.name;
        tbText.Text     = galleryImage.text;

        tbName.MaxLength     = MaxLength.GalleryImages.Name;
        tbFilename.MaxLength = MaxLength.GalleryImages.Filename;
        tbText.MaxLength     = MaxLength.GalleryImages.Text;
    }
Exemplo n.º 16
0
        public void Save(GmConnection conn)
        {
            GmCommand cmd = conn.CreateCommand();

            cmd.AddInt("Id", id);
            cmd.AddString("SerialNumber", serialNumber);
            cmd.AddString("IssueDepartment", issueDepartment);
            cmd.AddDateTime("IssueDate", issueDate);
            cmd.AddString("DepartmentCode", departmentCode);
            cmd.AddString("Surname", surname);
            cmd.AddString("Name", name);
            cmd.AddString("MiddleName", middleName);
            cmd.AddInt("Gender", (int)gender);
            cmd.AddDateTime("Birthday", birthday);
            cmd.AddString("BirthPlace", birthPlace);
            cmd.AddString("Registration", registration);
            if (id == 0)
            {
                cmd.CommandText = "insert into Passports values (@SerialNumber,@IssueDepartment,@IssueDate,@DepartmentCode,@Surname,@Name,@MiddleName,@Gender,@Birthday,@BirthPlace,@Registration) select @@Identity";
                id = (int)(decimal)cmd.ExecuteScalar();
            }
            else
            {
                cmd.CommandText = "update Passports set SerialNumber=@SerialNumber,IssueDepartment=@IssueDepartment,IssueDate=@IssueDate,DepartmentCode=@DepartmentCode,Surname=@Surname,Name=@Name,MiddleName=@MiddleName,Gender=@Gender,Birthday=@Birthday,BirthPlace=@BirthPlace,Registration=@Registration where Id=@Id";
                cmd.ExecuteNonQuery();
            }
        }
Exemplo n.º 17
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            lblInfo.Text   = "";
            lblResult.Text = "";
            if (fileUpload.FileName.Trim().Length > 0)
            {
                Upload();
            }
            if (tbFilename.Text.Length > 0)
            {
                galleryImage.name     = tbName.Text.Trim();
                galleryImage.filename = tbFilename.Text.Trim();
                galleryImage.text     = tbText.Text.Trim();
                galleryImage.status   = (RecordStatus)int.Parse(ddlStatus.SelectedValue);
                using (GmConnection conn = Global.CreateConnection())
                {
                    galleryImage.Save(conn);
                }
                lblResult.Text = string.Format("Data saved.");
            }
//			WebUtils.Redirect(this, "Private/Users.aspx");
        }
        catch (Exception ex)
        {
            log.Exception(ex);
        }
    }
Exemplo n.º 18
0
        private void CheckDuration(GmConnection conn, List <Patient> patients)
        {
            string cmdText = @"SELECT PatientWardHistory.PatientId, MAX(PatientWardHistory.Date) AS PatientWardHistoryDate
FROM PatientWardHistory 
LEFT OUTER JOIN Patients ON Patients.Id = PatientWardHistory.PatientId AND Patients.PatientTypeId = PatientWardHistory.PatientTypeId";

            cmdText += string.Format(" where (PatientWardHistory.PatientTypeId={0} or PatientWardHistory.PatientTypeId={1}) and PatientWardHistory.PatientId in ({2})", (int)PatientTypeId.IntensiveCare, (int)PatientTypeId.Reanimation, GetCommaSeparatedList(patients));
            cmdText += " GROUP BY PatientWardHistory.PatientId";
            Dictionary <int, DateTime> transferDates = new Dictionary <int, DateTime>();

            using (DbDataReader dr = conn.ExecuteReader(cmdText)) while (dr.Read())
                {
                    transferDates.Add(dr.GetInt32(0), dr.GetDateTime(1));
                }

            List <Patient> commonPatients        = new List <Patient>();
            List <Patient> intensiveCarePatients = new List <Patient>();
            List <Patient> reanimationPatients   = new List <Patient>();

            foreach (Patient patient in patients)
            {
                DateTime whenArrived = transferDates.ContainsKey(patient.Id) ?  transferDates[patient.Id] : patient.admissionDate;
                TimeSpan ts          = DateTime.Now - whenArrived;
                switch (patient.patientTypeId)
                {
                case PatientTypeId.Reanimation:
                    if (ts.TotalDays >= depConfig.reanimationMaxDuration)
                    {
                        reanimationPatients.Add(patient);
                    }
                    break;

                case PatientTypeId.IntensiveCare:
                    if (ts.TotalDays >= depConfig.intensiveCareMaxDuration)
                    {
                        intensiveCarePatients.Add(patient);
                    }
                    break;

                case PatientTypeId.Common:
                    DiagnosisInfo di = patient.LatestDiagnosisInfo;
                    if (di != null)
                    {
                        Diagnosis d = appCache.GetDiagnosis(di.id);
                        if (d != null)
                        {
                            int hospitalStay = depConfig.GetRecommendedHospitalStay(d);
                            if (ts.TotalDays >= hospitalStay)
                            {
                                commonPatients.Add(patient);
                            }
                        }
                    }
                    break;
                }
            }
            AddTask(TaskTypeId.CommonDuration, commonPatients);
            AddTask(TaskTypeId.IntensiveCareDuration, intensiveCarePatients);
            AddTask(TaskTypeId.ReanimationDuration, reanimationPatients);
        }
Exemplo n.º 19
0
        public bool IsMultyLoginDenied()
        {
            bool denied = false;

            if (UserId != 0)
            {
                using (GmConnection conn = App.ConnectionFactory.CreateConnection())
                {
                    GmCommand cmd = conn.CreateCommand("select MultiLoginFlag, lastupdate, GETDATE() from [User] where UserCode=@UserCode");
                    cmd.AddInt("UserCode", UserId);
                    using (IDataReader dr = cmd.ExecuteReader())
                    {
                        if (dr.Read())
                        {
                            int  i = 0;
                            bool multiLoginFlag = dr.GetBoolean(i++);
                            if (multiLoginFlag)
                            {
                                DateTime lastUpdate = dr.GetDateTime(i++);
                                DateTime curTime    = dr.GetDateTime(i++);
                                TimeSpan ts         = curTime - lastUpdate;
                                denied = ts.TotalMilliseconds < this.config.PollTime * 2;                           //+config.CommandTimeout*1000
                            }
                        }
                    }
                }
            }
            return(denied);
        }
Exemplo n.º 20
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                int     patientId = SelectedId;
                DataRow dr        = SelectedRow;
                if (patientId != 0 && dr != null)
                {
                    int doctorId = (int)dr["DoctorId"];
                    if (doctorId == App.Instance.UserInfo.UserId)
//                    if (App.Instance.UserInfo.HasWatching && App.Instance.UserInfo.Watching.HasPatient(patientId))
                    {
                        if (MessageBoxUtils.Ask("¬ы уверены, что хотите удалить пациента " + patientId))
                        {
                            using (WaitCursor wc = new WaitCursor())
                            {
                                using (GmConnection conn = App.CreateConnection())
                                {
                                    Patient.SetStatus(conn, patientId, Status.Removed);
                                }
                                dr.Delete();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("¬ы можете удал¤ть только своих пациентов.");
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     log = new Log(this);
     try
     {
         forumTopicId = RequestUtils.GetForumTopicId(this);
         userId       = Utils.GetUserId(Context);
         if (!base.IsPostBack)
         {
             if (userId != 0)
             {
                 using (GmConnection conn = Global.CreateConnection())
                 {
                     string s = conn.ExecuteScalar("select Name from UserInfo where Id=" + userId) as string;
                     if (s != null)
                     {
                         tbName.Text = s;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         log.Exception(ex);
     }
 }
Exemplo n.º 22
0
        private void LoadPatients()
        {
            dataTable.Clear();
            string cmdText = @"
select Patients.Id, Passports.Surname, Passports.Name, Passports.MiddleName, AdmissionDate, DischargeDate, Wards.Number as WardNumber, Patients.DoctorId, Users.Name as DoctorName
from Patients 
left join Passports on PassportId=Passports.Id
left join Wards on WardId=Wards.Id
left join Users on DoctorId=Users.Id
where Patients.Status=1";

            if (App.Instance.UserInfo.HasWatching && !App.Instance.UserInfo.Watching.IsEmpty)
            {
                cmdText += string.Format("and Patients.Id in ({0})", App.Instance.UserInfo.Watching.GetCommaSeparatedPatientList());
            }
            if (chkDischarged.Checked)
            {
                cmdText += " and DischargeDate is not null";
            }
            else
            {
                cmdText += " and DischargeDate is null";
            }
            using (GmConnection conn = App.CreateConnection())
            {
                dataAdapter = conn.CreateDataAdapter(cmdText);
                dataAdapter.Fill(dataTable);
            }
            dataTable.DefaultView.Sort = "WardNumber";
            gridView.DataSource        = dataTable;
        }
Exemplo n.º 23
0
        public static ReportsDataSet.PrescriptionsDataTable GetPrescriptionsTable(ConnectionFactory factory, int patientId)
        {
            DataTable dataTable = new DataTable();
            string    cmdText   = @"
select Prescriptions.*, Products.Name as ProductName, BaseUnits.Name as BaseUnitName 
from Prescriptions 
left join StoreProducts on StoreProducts.Id=StoreProductId
left join Products on Products.Id=ProductId
left join BaseUnits on BaseUnits.Id=BaseUnitId
where PatientId=" + patientId;

            using (GmConnection conn = factory.CreateConnection())
            {
                conn.Fill(dataTable, cmdText);
            }
            ReportsDataSet.PrescriptionsDataTable dtPrescriptions = new ReportsDataSet.PrescriptionsDataTable();
            int[] rowIndexes = { 0, 0, 0, 0 };
            foreach (DataRow dr in dataTable.Rows)
            {
                int pt = GetColumnIndex((PrescriptionTypeId)dr["PrescriptionTypeId"]);
                if (pt < 1 || pt > 3)
                {
                    continue;
                }
                int startCol = (pt - 1) * 3;
                int rowIndex = rowIndexes[pt];
                rowIndexes[pt]++;
                ReportsDataSet.PrescriptionsRow row = GetRow(dtPrescriptions, rowIndex);
                row[startCol]     = string.Format("{0:dd.MM}", dr["StartDate"]);
                row[startCol + 1] = string.Format("{0:dd.MM}", dr["EndDate"]);
                row[startCol + 2] = string.Format("{0} {1}{2}x{3}ð", dr["ProductName"], dr["Dose"], dr["BaseUnitName"], dr["Multiplicity"]);
            }
            AppendAnalyses(factory, patientId, dtPrescriptions, rowIndexes[rowIndexes.Length - 1]);
            return(dtPrescriptions);
        }
Exemplo n.º 24
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     try
     {
         DataRow selRow = SelectedRow;
         if (selRow != null)
         {
             bool completed = (bool)selRow["Completed"];
             if (completed)
             {
                 FormUtils.Message("”комплектованный документ не может быть удален.");
                 return;
             }
             int id = (int)selRow[0];
             using (GmConnection conn = App.CreateConnection())
             {
                 Document.Remove(conn, id);
                 Document.RemoveDocumentProducts(conn, id);
             }
             dataTable.Rows.Remove(selRow);
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
Exemplo n.º 25
0
        public static DbDataAdapter CreateDataAdapter(GmConnection conn, Document doc)
        {
            DbDataAdapter da = conn.CreateDataAdapter();

            GmCommand cmd = conn.CreateCommand(selectCmdText);

            cmd.AddInt("DocumentId", doc.DocumentId);
            cmd.AddBool("FactFlag", false);
            (da as IDbDataAdapter).SelectCommand = cmd.DbCommand;

            cmd = conn.CreateCommand(insertCmdText);
            cmd.AddString("ProductCode").SourceColumn = "ProductCode";
            cmd.AddString("UnitCode").SourceColumn    = "UnitCode";
            cmd.AddInt("DocumentId", doc.DocumentId);
            cmd.AddDecimal("Coef").SourceColumn  = "Coef";
            cmd.AddDecimal("Count").SourceColumn = "Count";
            cmd.AddBool("FactFlag", true);
            cmd.AddBool("HandledFlag").SourceColumn = "HandledFlag";
            cmd.DbCommand.UpdatedRowSource          = UpdateRowSource.FirstReturnedRecord;
            (da as IDbDataAdapter).InsertCommand    = cmd.DbCommand;

            cmd = conn.CreateCommand(deleteCmdText);
            cmd.AddInt("DocumentProductId").SourceColumn = "DocumentProductId";
            (da as IDbDataAdapter).DeleteCommand         = cmd.DbCommand;

            cmd = conn.CreateCommand(updateCmdText);
            cmd.AddInt("DocumentProductId").SourceColumn = "DocumentProductId";
            cmd.AddDecimal("Count").SourceColumn         = "Count";
            cmd.AddBool("HandledFlag").SourceColumn      = "HandledFlag";
            (da as IDbDataAdapter).UpdateCommand         = cmd.DbCommand;

            return(da);
        }
Exemplo n.º 26
0
        private void Open()
        {
            try
            {
                int id = SelectedId;
                if (id != 0)
                {
                    Document doc = null;
                    using (GmConnection conn = App.CreateConnection())
                    {
                        doc = Document.GetDocument(conn, id);
                    }
                    if (doc != null)
                    {
                        if (OpenDocument(doc))
                        {
//							UpdateRow(SelectedRow,doc);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
Exemplo n.º 27
0
        private void Open()
        {
            try
            {
                using (WaitCursor wc = new WaitCursor())
                {
                    int id = SelectedId;
                    if (id != 0)
                    {
                        Observation observation = null;
                        using (GmConnection conn = App.CreateConnection())
                        {
                            observation = Observation.GetObservation(conn, id);
                        }
                        if (observation != null)
                        {
//							string observationTypeName = (string)SelectedRow["ObservationTypeName"];
                            ObservationForm form = new ObservationForm(observation, patientName);
                            if (form.ShowDialog() == DialogResult.OK)
                            {
                                UpdateRow(SelectedRow, observation);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        Log log = MainMasterPage.InitPage(this);
        int id  = RequestUtils.GetGalleryImageId(this);

        this.SqlDataSource1.SelectParameters["GalleryImageId"].DefaultValue = id.ToString();
        try
        {
            if (id != 0)
            {
                string name = null;
                using (GmConnection conn = Global.CreateConnection())
                {
                    name = conn.ExecuteScalar("select Name from GalleryImages where Id=" + id) as string;
                }
                if (name != null)
                {
                    (this.Master as MainMasterPage).PageInfo.AddInfo(name);
                }
            }
        }
        catch (Exception ex)
        {
            log.Exception(ex);
        }
    }
Exemplo n.º 29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Poll poll = null;

        try
        {
            log = new Log(this);
            if (!IsPostBack)
            {
                using (GmConnection conn = Global.CreateConnection())
                {
                    poll = Poll.GetLastPoll(conn);
                }
                if (poll != null)
                {
                    lblQuestion.Text = poll.question;
                    SqlDataSource1.SelectParameters["PollId"].DefaultValue = poll.Id.ToString();
                }
            }
        }
        catch (Exception ex)
        {
            if (log != null)
            {
                log.Exception(ex);
            }
        }
        finally
        {
            if (poll == null)
            {
                this.Visible = false;
            }
        }
    }
Exemplo n.º 30
0
        public static DataTable Fill(ComboBox cb, GmConnection conn, string cmdText, int selectedValue, string zeroText)
        {
            DataTable dt = Fill(cb, conn, cmdText, zeroText);

            cb.SelectedValue = selectedValue;
            return(dt);
        }