Exemple #1
0
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            WaitDialogForm waitForm = new WaitDialogForm("正在批量保存数据...", "请稍等");

            try
            {
                string    messageAll  = "";
                bool      hasSave     = true;
                DataTable dataTablePL = gridControl1.DataSource as DataTable;
                if (dataTablePL == null || dataTablePL.Rows.Count <= 0)
                {
                    return;
                }
                foreach (DataRow item in dataTablePL.Rows)
                {
                    if ((bool)item["check"] != true)
                    {
                        continue;
                    }
                    string hisrowflow = Guid.NewGuid().ToString();
                    string groupflow  = item["groupflow"].ToString();
                    foreach (var inItem in dicitemList[groupflow])
                    {
                        string message    = "";
                        bool   itemresult = m_InCommonNoteBiz.SaveIncommonNoteItem(inItem, ref message);
                        if (!itemresult)
                        {
                            hasSave    = false;
                            messageAll = message;
                        }
                        InCommonNoteBiz.AddInCommonColHistory(inItem, hisrowflow);
                    }
                    InCommonNoteBiz.AddInCommonRowHistory(dicitemList[groupflow][0], hisrowflow);
                }
                if (hasSave == false)
                {
                    MyMessageBox.Show("保存失败!" + messageAll, 1);
                }
                else
                {
                    MyMessageBox.Show("保存成功!", 1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
            finally
            {
                waitForm.Close();
            }
        }
Exemple #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                int     index   = gridView1.FocusedRowHandle;
                DataRow dataRow = gridView1.GetFocusedDataRow();
                if (dataRow == null)
                {
                    m_app.CustomMessageBox.MessageShow("未选中要删除的记录");
                    return;
                }
                DialogResult diaResult = m_app.CustomMessageBox.MessageShow("确定要删除选中数据吗?", DrectSoft.Core.CustomMessageBoxKind.QuestionYesNo);
                if (diaResult == DialogResult.No)
                {
                    return;
                }
                string groupflow = dataRow["groupFlow"].ToString();
                List <InCommonNoteItemEntity> inCommonNoteItemEntityList = dicitemList[groupflow];

                if (m_CommonNoteEntity.UsingPicSign == "1" && inCommonNoteItemEntityList[0].RecordDoctorId != m_app.User.DoctorId)
                {
                    m_app.CustomMessageBox.MessageShow("只有记录者才可删除该记录");
                    return;
                }


                //如果改变的集合中有改数据 移除删除的数据
                if (dicitemListChanged.ContainsKey(groupflow))
                {
                    dicitemListChanged.Remove(groupflow);
                }

                //直接从数据库中删除
                string message    = "";
                string hisrowflow = Guid.NewGuid().ToString();
                foreach (var item in inCommonNoteItemEntityList)
                {
                    if (string.IsNullOrEmpty(item.InCommonNote_Item_Flow))
                    {
                        continue;
                    }
                    item.Valide = "0";
                    bool itemresult = m_InCommonNoteBiz.SaveIncommonNoteItem(item, ref message);
                    InCommonNoteBiz.AddInCommonColHistory(item, hisrowflow);
                }

                InCommonNoteBiz.AddInCommonRowHistory(inCommonNoteItemEntityList[0], hisrowflow);


                //将删除的集合添加到删除的集合中
                //if (!dicitemListDel.ContainsKey(groupflow))
                //{
                //    dicitemListDel.Add(groupflow, inCommonNoteItemEntityList);
                //}

                //m_InCommonNoteTab中的项目中移除删除的项目
                foreach (InCommonNoteItemEntity item in inCommonNoteItemEntityList)
                {
                    InCommonNoteItemEntityListAll.Remove(item);
                }
                BindDate();
                txtSearch_EditValueChanged(null, null);
                gridView1.MoveBy(index);
            }
            catch (Exception ex)
            {
                DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(ex.StackTrace);
            }
        }
Exemple #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string messageAll = "";
                bool   hasSave    = true;

                //保存修改的数据
                foreach (List <InCommonNoteItemEntity> itemList in dicitemListChanged.Values)
                {
                    string hisrowflow = Guid.NewGuid().ToString();
                    foreach (var item in itemList)
                    {
                        string message    = "";
                        bool   itemresult = m_InCommonNoteBiz.SaveIncommonNoteItem(item, ref message);
                        if (!itemresult)
                        {
                            hasSave    = false;
                            messageAll = message;
                        }
                        InCommonNoteBiz.AddInCommonColHistory(item, hisrowflow);
                    }
                    InCommonNoteBiz.AddInCommonRowHistory(itemList[0], hisrowflow);
                }
                if (hasSave == false)
                {
                    DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("保存失败!" + messageAll, 1);
                    return;
                }
                //保存删除的数据
                //foreach (var itemDelList in dicitemListDel.Values)
                //{
                //    foreach (var item in itemDelList)
                //    {
                //        string message = "";
                //        if (string.IsNullOrEmpty(item.InCommonNote_Item_Flow)) continue;
                //        item.Valide = "0";
                //        bool itemresult = m_InCommonNoteBiz.SaveIncommonNoteItem(item, ref message);
                //        if (!itemresult)
                //        {
                //            hasSave = false;
                //            messageAll = message;
                //        }
                //    }
                //}

                if (hasSave == false)
                {
                    DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("保存失败!" + messageAll, 1);
                }
                else
                {
                    DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("保存成功!", 1);
                    GetData();
                    txtSearch_EditValueChanged(null, null);
                    dicitemListChanged = new Dictionary <string, List <InCommonNoteItemEntity> >();
                    dicitemListDel     = new Dictionary <string, List <InCommonNoteItemEntity> >();
                }
            }
            catch (Exception ex)
            {
                DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(ex.StackTrace);
            }
        }