예제 #1
0
파일: FLWizard.cs 프로젝트: san90279/UK_OAS
        private bool GloOperate(FLNavigatorOperate operate, string stepid)
        {
            bool sucess = false;
            if (this.SqlMode == ESqlMode.ToDoList && this.BindingObject != null && this.BindingObject.SelectedRows.Count == 1)
            {
                DataRowView rowView = (DataRowView)(DataRowView)this.BindingObject.SelectedRows[0].DataBoundItem;
                SubmitConfirm frmSubmitConfirm = new SubmitConfirm();
                frmSubmitConfirm.listId = rowView["LISTID"].ToString();
                frmSubmitConfirm.flowPath = rowView["FLOWPATH"].ToString();
                frmSubmitConfirm.operate = operate;
                frmSubmitConfirm.provider = rowView["PROVIDER_NAME"].ToString();
                frmSubmitConfirm.keys = rowView["FORM_KEYS"].ToString();
                frmSubmitConfirm.values = rowView["FORM_PRESENTATION"].ToString().Replace("'", "''");
                frmSubmitConfirm.isFlowImportant = (rowView["FLOWIMPORTANT"].ToString() == "1");
                frmSubmitConfirm.isFlowUrgent = (rowView["FLOWURGENT"].ToString() == "1");
                frmSubmitConfirm.multiStepReturn = (rowView["MULTISTEPRETURN"].ToString() == "1");
                if (rowView["ATTACHMENTS"] != null && rowView["ATTACHMENTS"].ToString() != "")
                {
                    string[] attachments = rowView["ATTACHMENTS"].ToString().Split(';');
                    List<string> lstAttachments = new List<string>();
                    foreach (string attach in attachments)
                    {
                        if (attach != "")
                        {
                            lstAttachments.Add(attach);
                        }
                    }
                    frmSubmitConfirm.attachments = lstAttachments;
                }

                sucess = (frmSubmitConfirm.ShowDialog() == DialogResult.OK);
            }
            else if (this.SqlMode == ESqlMode.ToDoHis && operate == FLNavigatorOperate.Return && this.BindingObject != null && this.BindingObject.SelectedRows.Count == 1)
            {
                DataRowView rowView = (DataRowView)this.BindingObject.SelectedRows[0].DataBoundItem;
                string listId = rowView["LISTID"].ToString();
                string sql = "SELECT * FROM SYS_TODOHIS WHERE LISTID='" + listId + "' AND D_STEP_ID='" + stepid + "' ORDER BY UPDATE_TIME DESC";
                DataSet ds = null;

                object[] ret1 = CliUtils.CallMethod("GLModule", "ExcuteWorkFlow", new object[] { sql });
                if (ret1 != null && (int)ret1[0] == 0)
                {
                    ds = (DataSet)ret1[1];
                }
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show(SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLRuntime", "InstanceManager", "NotRetakePleaseRefresh"));
                        return sucess;
                    }

                    DataRow row = ds.Tables[0].Rows[0];
                    string currentFLActivityName = row["S_STEP_ID"].ToString();
                    string keys = row["FORM_KEYS"].ToString();
                    string keyvalues = row["FORM_PRESENTATION"].ToString();
                    keyvalues = keyvalues.Replace("'", "''");
                    object[] objParams = CliUtils.CallFLMethod("Retake", new object[] { new Guid(listId), new object[] { currentFLActivityName, "" }, new object[] { keys, keyvalues } });
                    if (Convert.ToInt16(objParams[0]) == 0)
                    {
                        sucess = true;
                        MessageBox.Show(SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLWizard", "RetakeSucess"));
                    }
                    else if (Convert.ToInt16(objParams[0]) == 2)
                    {
                        MessageBox.Show(objParams[1].ToString());
                    }
                }
            }
            return sucess;
        }
예제 #2
0
        private bool GloOperate(FLNavigatorOperate operate)
        {
            if ((_status == "NF" || _status == "NR") && operate == FLNavigatorOperate.Submit)
                operate = FLNavigatorOperate.Approve;
            bool sucess = false;
            string keys = "", values = "";
            SubmitConfirm frmSubmitConfirm = new SubmitConfirm();
            frmSubmitConfirm.listId = _listId;
            frmSubmitConfirm.flowFileName = _flowFileName;
            frmSubmitConfirm.flowPath = _flowPath;
            frmSubmitConfirm.operate = operate;
            frmSubmitConfirm.currentFLState = CurrentFLState;
            frmSubmitConfirm.isFlowImportant = _isImport;
            frmSubmitConfirm.isFlowUrgent = _isUrgent;
            frmSubmitConfirm.status = _status;
            frmSubmitConfirm.sendToId = _sendToId;
            frmSubmitConfirm.organizationControl = _organizationControl;
            frmSubmitConfirm.multiStepReturn = _multiStepReturn;
            if (!string.IsNullOrEmpty(RemarkField) && this.BindingSource.Current != null && this.BindingSource.Current is DataRowView)
            {
                frmSubmitConfirm.txtSuggest.Text = (this.BindingSource.Current as DataRowView)[RemarkField].ToString();
            }

            if (!string.IsNullOrEmpty(_attachments))
            {
                string[] attachments = _attachments.Split(';');
                List<string> lstAttachments = new List<string>();
                foreach (string attach in attachments)
                {
                    if (attach != "")
                    {
                        lstAttachments.Add(attach);
                    }
                }
                frmSubmitConfirm.attachments = lstAttachments;
            }

            object dataSource = this.BindingSource.GetDataSource();
            if (dataSource != null && dataSource is InfoDataSet)
            {
                InfoDataSet ds = (InfoDataSet)dataSource;
                frmSubmitConfirm.provider = ds.RemoteName;
                object objCurrent = this.BindingSource.Current;

                if (objCurrent != null && objCurrent is DataRowView)
                {
                    ArrayList lstKeys = ds.GetKeyFields();
                    if (lstKeys.Count > 0)
                    {
                        DataRowView rowView = (DataRowView)objCurrent;
                        DataSet host = ds.RealDataSet.Clone();
                        host.Tables[0].Rows.Add(rowView.Row.ItemArray);
                        frmSubmitConfirm.host = host;
                        foreach (string key in lstKeys)
                        {
                            keys += key + ";";
                            if (GloFix.IsNumeric(rowView[key].GetType()))
                            {
                                values += key + "=" + rowView[key].ToString() + ";";
                            }
                            else
                            {
                                values += key + "=''" + rowView[key].ToString() + "'';";
                            }
                        }
                        if (keys != "")
                        {
                            frmSubmitConfirm.keys = keys.Substring(0, keys.LastIndexOf(';'));
                            frmSubmitConfirm.values = values.Substring(0, values.LastIndexOf(';'));
                        }
                    }
                }
                else
                {
                    string selDataMessage = SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLTools", "GloFix", "SelectData", false);
                    MessageBox.Show(selDataMessage);
                    return false;
                }
            }
            if (frmSubmitConfirm.ShowDialog() == DialogResult.OK)
            {
                _flowPath = frmSubmitConfirm.flowPath;
                _listId = frmSubmitConfirm.listId;
                Form parentForm = this.FindForm().ParentForm;
                if (parentForm != null)
                {
                    RefreshWizard(parentForm, "wizToDoList");
                    RefreshWizard(parentForm, "wizToDoHis");
                    RefreshWizard(parentForm, "wizNotify");
                }
                sucess = true;
                if (CurrentState == "Insert")
                {
                    CurrentStateItem = null;
                    this.SetState("Insert");
                }
                else if (CurrentState == "Modify")
                {
                    CurrentStateItem = null;
                    this.SetState("Normal");
                }
                else if (CurrentState == "Prepare")
                {
                    CurrentStateItem = null;
                    this.SetState("Inquery");
                }
                else if (CurrentState == "Inquery")
                {
                    CurrentStateItem = null;
                    this.SetState("Inquery");
                }
            }
            else
            {
                sucess = false;
            }
            return sucess;
        }