Exemple #1
0
        /// <summary>
        /// 释放预约资源
        /// </summary>
        /// <param name="_cfg3059"></param>
        /// <param name="_DataBase"></param>
        public static void UpdateYyResource(SystemCfg _cfg3059, RelationalDatabase _DataBase)
        {
            /*释放指定时间段内还未取号的预约资源,如当前时间为8点 8点半的号还未进行取号 如果参数设置为
             * 半个小时未取号就释放,则释放八点半的号源*/
            string    sql        = @"  SELECT convert(varchar(10),getdate(),120),
            convert(varchar(16),DATEADD(MINUTE,(SELECT CAST(CONFIG AS INT)
            FROM JC_CONFIG WHERE ID=1127),GETDATE()),120),
            SUBSTRING(convert(varchar(16),getdate(),120),11,16) ";
            DataTable dt_Date    = _DataBase.GetDataTable(sql);
            string    Date_Now   = dt_Date.Rows[0][0].ToString();
            string    Time_Now   = dt_Date.Rows[0][1].ToString();
            string    HourMinute = dt_Date.Rows[0][2].ToString();

            sql = @"SELECT *,substring(YYSD,1,5) AS KSSJ ,substring(YYSD,7,5) as JSSJ FROM MZ_YYGHLB 
            WHERE CONVERT(VARCHAR(10),YYRQ,120)='" + Date_Now + @"' AND substring('" + Time_Now + @"',12,len('" + Time_Now + @"')) >=
            substring(YYSD,7,5) AND BQHBZ=0 AND BSCBZ=0";
            //获取需要释放资源的预约记录
            DataTable dt_YYxx     = _DataBase.GetDataTable(sql);
            Order_Web _orderMeans = new Order_Web(_cfg3059);

            for (int i = 0; i < dt_YYxx.Rows.Count; i++)
            {
                /*作废预约信息,但是要根据时间判断是否释放分时段信息,如果预约的分时段
                 * 结束时间小于当前时间则不需要释放
                 */
                try
                {
                    string ptid  = Convertor.IsNull(dt_YYxx.Rows[i]["PTID"], "");
                    string qhyzm = dt_YYxx.Rows[i]["YZM"].ToString();
                    string czyh  = dt_YYxx.Rows[i]["DJY"].ToString();
                    string msg   = "";
                    _orderMeans.CancelOrder(ptid, qhyzm, czyh, ref msg);
                    //撤销预约后,需要对分时段资源进行处理
                    //获取资源id
                    int           ghks      = Convert.ToInt32(dt_YYxx.Rows[i]["GHKS"]);
                    int           ghjb      = Convert.ToInt32(dt_YYxx.Rows[i]["GHJB"]);
                    int           ghys      = Convert.ToInt32(dt_YYxx.Rows[i]["GHYS"]);
                    string        yydate    = dt_YYxx.Rows[i]["YYRQ"].ToString();
                    VisitResource _Resource = new VisitResource(ghks, ghjb, ghys, yydate, _DataBase);
                    if (_Resource.Resid <= 0)
                    {
                        return;
                    }

                    string kssj = dt_YYxx.Rows[i]["KSSJ"].ToString().Trim();
                    string jssj = dt_YYxx.Rows[i]["JSSJ"].ToString().Trim();
                    FsdClass.UpdateFsdStatus(_Resource.Resid, kssj, jssj, yydate, _DataBase);
                }
                catch (Exception ea)
                {
                    throw ea;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 作废预约
        /// </summary>
        private void DeleteOrder()
        {
            try
            {
                if (this.Dgv_OrderInfo.SelectedRows.Count < 1)
                {
                    MessageBox.Show("请先选择需要删除的预约挂号记录", "提示");
                    return;
                }
                if (Convert.ToInt16(this.Dgv_OrderInfo.SelectedRows[0].Cells["Cl_bqhbz"].Value) == 1)
                {
                    MessageBox.Show("当前预约记录已取号!无法进行删除操作!", "提示");
                    return;
                }
                if (Convert.ToInt32(this.Dgv_OrderInfo.SelectedRows[0].Cells["Cl_yylxid"].Value) != (int)_CurrentYylx)
                {
                    MessageBox.Show("不能删除当前预约类型的预约记录!", "提示");
                    return;
                }

                Guid   yyid = new Guid(this.Dgv_OrderInfo.SelectedRows[0].Cells["Cl_yyid"].Value.ToString());
                string name = Convertor.IsNull(this.Dgv_OrderInfo.SelectedRows[0].Cells["Cl_Name"].Value, "");
                if (_cfg1081.Config == "1") //平台注销
                {
                    string msg   = string.Empty;
                    string ptbh  = Convertor.IsNull(this.Dgv_OrderInfo.SelectedRows[0].Cells["cl_ptid"].Value, "");
                    string qhpwd = Convertor.IsNull(this.Dgv_OrderInfo.SelectedRows[0].Cells["cl_yzm"].Value, "");
                    if (!_orderMeans.CancelOrder(ptbh, qhpwd, _cfg3060.Config.Trim(), ref msg))
                    {
                        MessageBox.Show("撤销预约失败!原因:" + msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                    else
                    {
                        MessageBox.Show("删除成功!", "提示");
                    }
                }
                else
                {
                    if (!Mz_YYgh.CanCelYYGH(yyid, name, InstanceForm.BDatabase))
                    {
                        MessageBox.Show("删除失败!", "提示");
                    }
                    else
                    {
                        MessageBox.Show("删除成功!", "提示");
                    }
                }
            }
            catch (Exception ea)
            {
                MessageBox.Show("出现错误!原因:" + ea.ToString());
            }
        }