Exemplo n.º 1
0
 public bool Notify()
 {
     if (string.IsNullOrEmpty(_listId)) return false;
     NotifyForm frmNotify = new NotifyForm();
     string keys = "", values = "";
     frmNotify.flowPath = _flowPath;
     frmNotify.listId = _listId;
     if (this.FLNotifySecControl)
         SetSecUsersAndRoles(frmNotify);
     object dataSource = this.BindingSource.GetDataSource();
     if (dataSource != null && dataSource is InfoDataSet)
     {
         InfoDataSet ds = (InfoDataSet)dataSource;
         frmNotify.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;
                 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 != "")
                 {
                     frmNotify.keys = keys.Substring(0, keys.LastIndexOf(';'));
                     frmNotify.values = values.Substring(0, values.LastIndexOf(';'));
                 }
             }
         }
         else
         {
             string selDataMessage = SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLTools", "GloFix", "SelectData", true);
             MessageBox.Show(selDataMessage);
             return false;
         }
     }
     bool b = frmNotify.ShowDialog() == DialogResult.OK;
     return b;
 }
Exemplo n.º 2
0
        private void SetSecUsersAndRoles(NotifyForm form)
        {
            form.secRoles.Clear();
            form.secUsers.Clear();

            string sqlGM = string.Format(GloFix.secGroups, this.MenuId);
            DataTable tabGM = null;

            object[] ret1 = CliUtils.CallMethod("GLModule", "ExcuteWorkFlow", new object[] { sqlGM });
            if (ret1 != null && (int)ret1[0] == 0)
            {
                tabGM = ((DataSet)ret1[1]).Tables[0];
            }
            foreach (DataRow row in tabGM.Rows)
            {
                form.secRoles.Add(row["GROUPID"].ToString());
            }
            string sqlUM = string.Format(GloFix.secUsers, this.MenuId);
            DataTable tabUM = null;

            object[] ret2 = CliUtils.CallMethod("GLModule", "ExcuteWorkFlow", new object[] { sqlUM });
            if (ret2 != null && (int)ret2[0] == 0)
            {
                tabUM = ((DataSet)ret2[1]).Tables[0];
            }
            foreach (DataRow row in tabUM.Rows)
            {
                form.secUsers.Add(row["USERID"].ToString());
            }
        }