Exemple #1
0
        public override int HandleCommand(CommandContext context, ISyncResult result)
        {
            //return base.HandleCommand(context, result);

            lock (lockObj)
            {
                Console.WriteLine("HandleCommand");

                PatientRemoteObject rObject = SerializeObj.Desrialize <PatientRemoteObject>(context.sSerializeObject);

                Console.WriteLine("InvokeTag:\t" + rObject.InvokeTag);

                switch (rObject.InvokeTag)
                {
                case "NewPatient":
                    _patientManager.NewPatient(rObject.Paramters.First() as Patient);
                    result.SetSerializedObject(SerializeObj.Serialize(true));
                    break;

                case "DeletePatient":
                    _patientManager.DeletePatient((ulong)(rObject.Paramters.First()));
                    result.SetSerializedObject(SerializeObj.Serialize(true));
                    break;

                case "ModifyPatient":
                    _patientManager.ModifyPatient(rObject.Paramters.First() as Patient);
                    result.SetSerializedObject(SerializeObj.Serialize(true));
                    break;

                case "GetPatients":
                    IList <Patient> patientList = _patientManager.GetPatients();
                    result.SetSerializedObject(SerializeObj.Serialize <IList <Patient> >(patientList));
                    break;

                default:
                    break;
                }
            }

            return(0);
        }
        /// <summary>
        /// For local only
        /// </summary>
        //private UIH.XA.XSample.BusinessLogicExcutor.PatientManager TestPatientSource = new BusinessLogicExcutor.PatientManager();



        private byte[] SendSyncToPatientManager(string method, params object[] args)
        {
            CommandContext context = new CommandContext();

            context.iCommandId = BusinessLogicCommand;
            //context.sSender
            context.sReceiver             = BusinessLogicProxyName;
            context.bServiceAsyncDispatch = true;

            PatientRemoteObject rObject = new PatientRemoteObject();

            rObject.InvokeTag = method;
            rObject.Paramters = args;

            context.sSerializeObject = SerializeObj.Serialize(rObject);
            context.iWaitTime        = 30000;


            CLRCommunicationProxy proxy = _appContext.GetObject <ICommunicationProxy>(AppContextObjectName.DefaultCommunicationProxy) as CLRCommunicationProxy;

            ISyncResult result = proxy.SyncSendCommand(context);

            return(result.GetSerializedObject());
        }
        //
        protected void BatchSelect()
        {
            for (int i = 0; i < gvProject.Rows.Count; i++)
            {
                GridViewRow row       = gvProject.Rows[i];
                bool        isChecked = ((CheckBox)row.FindControl("SelectCheckBox")).Checked;
                Guid        CurrentId = Guid.Parse(gvProject.DataKeys[i].Values["ProjectId"].ToString());
                if (isChecked)
                {
                    //Guid CurrentId = Guid.Parse(gvProject.DataKeys[gvProject.Rows[i].DataItemIndex].Values["ProjectId"].ToString());
                    if (BatchProjectId.Contains(CurrentId))
                    {
                    }
                    else
                    {
                        BatchProjectId.Add(CurrentId);
                    }
                }
                else
                {
                    if (BatchProjectId.Contains(CurrentId))
                    {
                        BatchProjectId.Remove(CurrentId);
                    }
                    else
                    {
                    }
                }
            }
            hidBatchId.Value   = SerializeObj.Serialize(BatchProjectId);
            Session["BatchId"] = hidBatchId.Value;

            if (BatchProjectId.Count > 0)
            {
                if (this.Request["mode"] == "capture")
                {
                    tips.Text = "";
                    string CurrentProgress = "";
                    bool   check           = true;
                    for (int i = 0; i < gvProject.Rows.Count; i++)
                    {
                        GridViewRow row       = gvProject.Rows[i];
                        bool        isChecked = ((CheckBox)row.FindControl("SelectCheckBox")).Checked;
                        if (isChecked)
                        {
                            CurrentProgress = gvProject.Rows[i].Cells[5].Text;
                            break;
                        }
                    }
                    for (int i = 0; i < gvProject.Rows.Count; i++)
                    {
                        GridViewRow row       = gvProject.Rows[i];
                        bool        isChecked = ((CheckBox)row.FindControl("SelectCheckBox")).Checked;
                        if (isChecked)
                        {
                            if (gvProject.Rows[i].Cells[5].Text == CurrentProgress)
                            {
                            }
                            else
                            {
                                check = false;
                                break;
                            }
                        }
                    }
                    if (check)
                    {
                        //aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=capturebatchhandle&BatchId=" + hidBatchId.Value;
                        aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=capturebatchhandle";
                    }
                    else
                    {
                        tips.ForeColor = System.Drawing.Color.Red;
                        tips.Text      = "只能多选状态相同的工单!";
                    }
                }
                if (this.Request["mode"] == "contentreceive")
                {
                    //aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=contentreceivebatchhandle&BatchId=" + hidBatchId.Value;
                    aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=contentreceivebatchhandle";
                }
                else if (this.Request["mode"] == "contentfinish")
                {
                    aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=contentfinishbatchhandle";
                }
                else if (this.Request["mode"] == "contentcheck")
                {
                    aBatchSave.NavigateUrl   = "~/pages/ProjectCreateEdit.aspx?mode=contentcheckbatchsave";
                    aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=contentcheckbatchhandle";
                }
                if (this.Request["mode"] == "productionreceive")
                {
                    aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=productionreceivebatchhandle";
                }
                else if (this.Request["mode"] == "productionfinish")
                {
                    aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=productionfinishbatchhandle";
                }
                else if (this.Request["mode"] == "productioncheck")
                {
                    aBatchSave.NavigateUrl   = "~/pages/ProjectCreateEdit.aspx?mode=productioncheckbatchsave";
                    aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=productioncheckbatchhandle";
                }
                else if (this.Request["mode"] == "shorthand")
                {
                    aBatchHandle.NavigateUrl = "~/pages/ProjectCreateEdit.aspx?mode=shorthandbatchhandle";
                }
            }
            else
            {
                aBatchSave.NavigateUrl   = "";
                aBatchHandle.NavigateUrl = "";
            }
        }