/// <summary>
        /// 医生坐诊保存设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonControl2_Click(object sender, EventArgs e)
        {
            // string deptId = treeListLookUpEdit2.EditValue.ToString();//科室ID
            //int selectRow = gridView1.GetSelectedRows()[0];
            //string doctorName = this.gridView1.GetRowCellValue(selectRow, "doctorName").ToString();
            //SelectDoctor(treeListLookUpEdit2.EditValue.ToString());
            List <objJson>     custcode = new List <objJson>();
            List <OveradeJson> json     = new List <OveradeJson>();

            #region 获取列表的数据
            for (int i = 0; i < this.gridView1.RowCount; i++)
            {
                objJson list = new objJson();
                list.deptId   = this.gridView1.GetRowCellValue(i, "deptId").ToString();
                list.doctorId = this.gridView1.GetRowCellValue(i, "doctorId").ToString(); //string.Join(",", from s in doctorInfoEntity where s.name == this.gridView1.GetRowCellValue(i, "doctorName").ToString() select s.id);
                list.workDate = this.gridView1.GetRowCellValue(i, "workDate").ToString();
                list.period   = this.gridView1.GetRowCellValue(i, "period").ToString();
                list.clinicId = this.gridView1.GetRowCellValue(i, "clinicId").ToString();
                if (list.clinicId == "")
                {
                    MessageBoxUtils.Show("请将下方表格中的医生都安排诊室后在保存;\r\n"
                                         + "如只需安排某一个医生的某个日期,请先按查询条件过滤后进行设置诊室再保存。", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MainForm);
                    return;
                }
                custcode.Add(list);
            }
            #endregion
            #region 把列表的数据加入到List<T>中
            foreach (var item in custcode)
            {
                OveradeJson oj   = new OveradeJson();
                info        j    = new info();
                List <info> info = new List <info>();
                j.clinicId = item.clinicId;
                j.period   = item.period;
                info.Add(j);
                oj.deptId   = item.deptId;
                oj.doctorId = item.doctorId;
                oj.workDate = item.workDate;
                oj.values   = info;
                json.Add(oj);
            }
            #endregion
            var asfvsf = Newtonsoft.Json.JsonConvert.SerializeObject(json);
            SaveDoctorSetting(AppContext.Session.hospitalId, asfvsf);
        }
Пример #2
0
        /// <summary>
        /// 医生坐诊保存设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonControl2_Click(object sender, EventArgs e)
        {
            string             deptId   = treeListLookUpEdit2.EditValue.ToString(); //科室ID
            string             doctorId = lookUpEdit1.EditValue.ToString();         //医生ID
            List <objJson>     custcode = new List <objJson>();
            List <OveradeJson> json     = new List <OveradeJson>();

            #region 获取列表的数据
            for (int i = 0; i < this.gridView1.RowCount; i++)
            {
                objJson list = new objJson();
                list.workDate = this.gridView1.GetRowCellValue(i, "workDate").ToString();
                list.period   = this.gridView1.GetRowCellValue(i, "period").ToString();
                list.clinicId = this.gridView1.GetRowCellValue(i, "clinicId").ToString();
                if (list.clinicId == "")
                {
                    MessageBoxUtils.Show("医生坐诊诊室不可为空", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MainForm);
                    return;
                }
                custcode.Add(list);
            }
            #endregion
            #region 把列表的数据加入到List<T>中
            foreach (var item in custcode)
            {
                OveradeJson oj   = new OveradeJson();
                info        j    = new info();
                List <info> info = new List <info>();
                j.clinicId = item.clinicId;
                j.period   = item.period;
                info.Add(j);
                oj.workDate = item.workDate;
                oj.values   = info;
                json.Add(oj);
            }
            #endregion
            var asfvsf = Newtonsoft.Json.JsonConvert.SerializeObject(json);
            SaveDoctorSetting(AppContext.Session.hospitalId, deptId, doctorId, asfvsf);
        }
Пример #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string IdDoc = context.Request["IdDoc"];

            objJson Lista = new objJson();

            Lista.Doc  = new List <object>();
            Lista.Item = new List <object>();

            // Query Doc
            SqlCommand commDoc = new SqlCommand();

            commDoc.Connection  = con;
            commDoc.CommandText = @"SELECT do.IdDoc, do.IdTipoDoc, ti.NomeTipoDoc, do.IdEmpresa, e.NomeEmpresa, do.IdContato, c.NomeContato, do.IdUsuario, u.NomeUsuario, 
                                  do.DataCadastro, do.DataVencimento, do.SemVencimento, do.Vencimento,  
                                  do.Remessa, do.Observacao, do.NumeroDoc, do.IdSituacaoDoc, sd.NomeSituacaoDoc,

                                  (Select cast(sum(id.Total) as decimal(10,2)) 
                                  from ItemDoc id
                                  where id.IdDoc = do.IdDoc) as Total

                                  FROM Doc do
                                  join Empresa e on do.IdEmpresa = e.IdEmpresa
                                  join Contato c on do.IdContato = c.IdContato
                                  join TipoDoc ti on do.IdTipoDoc = ti.IdTipoDoc 
                                  join SituacaoDoc sd on do.IdSituacaoDoc = sd.IdSituacaoDoc
                                  join Usuario u on do.IdUsuario = u.IdUsuario 

                                  where do.IdDoc = " + IdDoc;

            con.Open();
            SqlDataReader readerDoc = commDoc.ExecuteReader();

            while (readerDoc.Read())
            {
                Lista.Doc.Add(new
                {
                    IdDoc           = readerDoc["IdDoc"],
                    NumeroDoc       = readerDoc["NumeroDoc"],
                    DataCadastro    = Convert.ToDateTime(readerDoc["DataCadastro"]).ToShortDateString(),
                    IdTipoDoc       = readerDoc["IdTipoDoc"],
                    NomeTipoDoc     = readerDoc["NomeTipoDoc"],
                    IdEmpresa       = readerDoc["IdEmpresa"],
                    NomeEmpresa     = readerDoc["NomeEmpresa"],
                    IdContato       = readerDoc["IdContato"],
                    NomeContato     = readerDoc["NomeContato"],
                    IdSituacaoDoc   = readerDoc["IdSituacaoDoc"],
                    NomeSituacaoDoc = readerDoc["NomeSituacaoDoc"],
                    DataVencimento  = readerDoc["DataVencimento"] != DBNull.Value ? Convert.ToDateTime(readerDoc["DataVencimento"]).ToShortDateString() : "",
                    SemVencimento   = readerDoc["SemVencimento"],
                    Vencimento      = readerDoc["Vencimento"],
                    IdUsuario       = readerDoc["IdUsuario"],
                    NomeUsuario     = readerDoc["NomeUsuario"],
                    Remessa         = readerDoc["Remessa"],
                    Observacao      = readerDoc["Observacao"],
                    Total           = readerDoc["Total"].ToString()
                });
            }
            con.Close();

            // Query Item
            SqlCommand commItem = new SqlCommand();

            commItem.Connection  = con;
            commItem.CommandText = @"SELECT i.IdItemDoc, i.IdDoc, i.IdItem, i.Ordem, i.Quantidade, cast(i.Valor as decimal(10,2)) as Valor, cast(i.Total as decimal(10,2)) as Total, e.NomeItem

                                   FROM ItemDoc i
                                   join Item e on i.IdItem = e.IdItem                                

                                   where i.IdDoc = " + IdDoc + " order by Ordem";

            con.Open();
            SqlDataReader readerItem = commItem.ExecuteReader();

            while (readerItem.Read())
            {
                Lista.Item.Add(new
                {
                    IdItemDoc  = readerItem["IdItemDoc"],
                    IdDoc      = readerItem["IdDoc"],
                    IdItem     = readerItem["IdItem"],
                    Ordem      = readerItem["Ordem"],
                    NomeItem   = readerItem["NomeItem"],
                    Quantidade = readerItem["Quantidade"],
                    Valor      = readerItem["Valor"].ToString(),
                    Total      = readerItem["Total"].ToString()
                });
            }
            con.Close();

            context.Response.Write(new JavaScriptSerializer().Serialize(Lista));
        }