示例#1
0
 /// <summary>
 /// Handles the RowDataBound event of the gridServiceRequested control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="GridViewRowEventArgs"/> instance containing the event data.</param>
 protected void gridServiceRequested_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             OrderedService rowView             = (OrderedService)e.Row.DataItem;
             string         serviceOrderId      = rowView.Id.ToString();
             string         serviceId           = rowView.ServiceId.ToString();
             Label          labelReportedbyName = e.Row.FindControl("labelReportedbyName") as Label;
             Label          labelRequestNotes   = e.Row.FindControl("labelRequestNotes") as Label;
             Button         buttonResult        = e.Row.FindControl("buttonResult") as Button;
             buttonResult.OnClientClick = string.Format("javascript:ShowModalPopup({0},'{1}');return false;", rowView.Id, rowView.ServiceName);
             if (rowView.ResultBy.HasValue)
             {
                 string resultby   = this.GetUserFullName(rowView.ResultBy.Value);
                 string resultDate = rowView.ResultDate.Value.ToString("dd-MMM-yyyy");
                 labelReportedbyName.Text = string.Format("{0} on {1}", resultby, resultDate);
             }
             else
             {
             }
             string requestNotes = rowView.RequestNotes;
             if (rowView.ResultNotes.Length > 200)
             {
                 requestNotes = rowView.RequestNotes.Substring(0, 199);
             }
             labelRequestNotes.Text = requestNotes;
         }
     }
     catch (Exception ex)
     {
         this.ShowErrorMessage(ref ex);
     }
 }
示例#2
0
        /// <summary>
        /// Handles the Click event of the buttonSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void buttonSave_Click(object sender, EventArgs e)
        {
            string strvalue = this.Request[hdServiceTestId.UniqueID].ToString();
            string v1       = hdServiceTestId.Value;

            try
            {
                int serviceOrderId = Int32.Parse(strvalue);

                int             resultBy   = Convert.ToInt32(ddlReportedbyName.SelectedValue);
                string          strResult  = textResult.Text;
                string          strDate    = txtReportedbyDate.Text;
                IServiceRequest requestMgr = (IServiceRequest)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BServiceRequest, BusinessProcess.Clinical");
                OrderedService  service    = this.thisOrder.Services.DefaultIfEmpty(null).FirstOrDefault(s => s.Id == serviceOrderId);

                if (resultBy > 0 && strResult != "" && strDate != "" && null != service)
                {
                    DateTime resultDate = Convert.ToDateTime(strDate);
                    if (thisOrder.OrderDate > resultDate)
                    {
                        this.NotifyAction("Wrong information: result date cannot be before the order date", "Validation", true, "");
                        this.ServiceDialog.Show();
                        return;
                    }
                    service.ResultNotes = strResult;
                    service.ResultDate  = resultDate;
                    service.ResultBy    = resultBy;
                    List <OrderedService> services = new List <OrderedService>();
                    services.Add(service);
                    requestMgr.SaveOrderResult(services, this.ServiceOrderId, this.UserId);
                    this.PopulateRequest();
                    BindServices();
                    this.NotifyAction("Results has been saved", "Success", false, "javascript:HideModalPopup();return true;");
                    return;
                }
                else
                {
                    this.NotifyAction("Missing information, specify all the field", "Validation", true, "");
                    this.ServiceDialog.Show();
                    return;
                }
            }
            catch (Exception ex)
            {
                this.ShowErrorMessage(ref ex);
            }
        }
示例#3
0
        protected void btnAddRecord_Click(object sender, EventArgs e)
        {
            OrderedService thisService = null;
            ServiceOrder   order       = this.ServiceOrdered;

            if (null != order && null != order.Services && order.Services.Count > 0 && order.Services.Exists(o => o.ServiceId == this.ServiceId))
            {
                this.isDataEntry = false;
                this.ServiceId   = this.ServiceModuleId = -1;
                this.ServiceName = this.ServiceModuleName = "";
                hdCustID.Value   = textSelectService.Text = txtRequestNote.Text = txtResultNote.Text = "";
                return;
            }
            if (order.TargetModuleId == -1 && Convert.ToInt32(hdSelectedModule.Value) > 0)
            {
                order.TargetModuleId         = Convert.ToInt32(hdSelectedModule.Value);
                labelSelectedDepartment.Text = hdSelectedModuleName.Value;
                //ddlDepartment.Enabled = false;
            }
            if (null == order.Services)
            {
                order.Services = new List <OrderedService>();
            }
            thisService         = new OrderedService();
            thisService.Service = new Service()
            {
                Id            = this.ServiceId,
                Name          = this.ServiceName,
                ServiceArea   = this.ServiceModuleName,
                ServiceAreaId = this.ServiceModuleId,
                DeleteFlag    = false
            };
            thisService.Id           = -1;
            thisService.RequestNotes = txtRequestNote.Text;
            thisService.Quantity     = Convert.ToInt32(textQuantity.Text);
            if (!IsPaperless)
            {
                thisService.ResultNotes = txtResultNote.Text;
            }
            order.Services.Add(thisService);
            this.ServiceOrdered = order;
            hdCustID.Value      = textSelectService.Text = txtRequestNote.Text = txtResultNote.Text = "";
            this.isDataEntry    = false;
            // ddlDepartment.Enabled = false;
            this.BindServiceRequests();
        }
示例#4
0
        protected void gridServiceRequested_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Remove")
                {
                    string       serviceId = (e.CommandArgument.ToString());
                    ServiceOrder order     = this.ServiceOrdered;

                    OrderedService orderedService = order.Services.FirstOrDefault(w => w.ServiceId.ToString() == serviceId);
                    if (orderedService != null)
                    {
                        if (orderedService.Id > 0)
                        {
                            order.Services.FirstOrDefault(w => w.ServiceId.ToString() == serviceId).DeleteFlag = true;
                        }
                        else
                        {
                            order.Services.Remove(orderedService);
                        }
                    }
                    if (null == order.Services || order.Services.Count == 0 || order.Services.Count(w => w.DeleteFlag == false) == 0)
                    {
                        order.TargetModuleId = -1;
                    }
                    this.ServiceOrdered = order;
                    this.BindServiceRequests();
                    button1_Click(button1, null);
                    divTestComponent.Update();
                }
            }
            catch (Exception ex)
            {
                this.ShowErrorMessage(ref ex);
            }
        }