Esempio n. 1
0
        /// <summary>
        /// 添加实体给数据表
        /// </summary>
        /// <param name="changes"></param>
        /// <returns></returns>
        private ArrayList GetEntityFromTable(DataTable changes)
        {
            if (changes == null || changes.Rows.Count <= 0)
            {
                return(null);
            }
            ArrayList entities = new ArrayList();

            foreach (DataRow row in changes.Rows)
            {
                Neusoft.HISFC.Models.Admin.SysModelFunction fun = new Neusoft.HISFC.Models.Admin.SysModelFunction();
                fun.SysCode             = row[0].ToString();
                fun.FunName             = row[1].ToString();
                fun.WinName             = row[2].ToString();
                fun.DllName             = row[3].ToString();
                fun.FormShowType        = row[4].ToString();
                fun.FormType            = row[5].ToString();
                fun.Memo                = row[6].ToString();
                fun.Param               = row[7].ToString();
                fun.TreeControl.DllName = row[8].ToString();
                fun.TreeControl.WinName = row[9].ToString();
                fun.TreeControl.Param   = row[10].ToString();
                fun.ID     = row[11].ToString();
                fun.SortID = Neusoft.FrameWork.Function.NConvert.ToInt32(row[12].ToString());
                entities.Add(fun);
            }
            return(entities);
        }
Esempio n. 2
0
        public int UpdateConst(string GroupID, Neusoft.HISFC.Models.Admin.SysModelFunction obj)
        {
            string strSql = "";

            if (this.Sql.GetSql("Manager.Group.Const.Update", ref strSql) == -1)
            {
                return(-1);
            }
            try
            {
                string[] s = this.mySetConstInfo(GroupID, obj);
                strSql = string.Format(strSql, s);
            }
            catch (Exception ex)
            {
                this.Err = "赋值时候出错!" + ex.Message;
                this.WriteErr();
                return(-1);
            }
            if (this.ExecNoQuery(strSql) <= 0)
            {
                return(-1);
            }
            return(0);
        }
Esempio n. 3
0
 private string[] mySetConstInfo(string GroupID, object obj)
 {
     string[] s = new string[9];
     Neusoft.HISFC.Models.Admin.SysModelFunction o = obj as Neusoft.HISFC.Models.Admin.SysModelFunction;
     try
     {
         s[0] = GroupID;               //id
     }
     catch {}
     try
     {
         s[1] = o.ID;               //id
     }
     catch {}
     try
     {
         s[2] = o.Name;               //name
     }
     catch {}
     try
     {
         s[3] = o.WinName;              //
     }
     catch {}
     try
     {
         s[4] = o.Memo;
     }
     catch {}
     try
     {
         s[5] = this.Operator.ID;               //
     }
     catch {}
     try
     {
         s[6] = this.Operator.Name;              //operator naem
     }
     catch {}
     try
     {
         s[7] = o.Param;              //operator naem
     }
     catch {}
     try{
         s[8] = o.SortID.ToString();                     //顺序号
     }
     catch {}
     return(s);
 }
Esempio n. 4
0
        /// <summary>
        /// 显示列表
        /// </summary>
        public void ShowList()
        {
            //清空列表
            this.tvList.Nodes.Clear();
            this.tvList.ImageList = this.tvList.groupImageList;
            //显示根节点
            Neusoft.HISFC.Models.Admin.SysModelFunction obj = new Neusoft.HISFC.Models.Admin.SysModelFunction();
            obj.ID = ""; //显示所有数据
            TreeNode node = new TreeNode();

            node.Text               = "常数维护";
            node.ImageIndex         = 0;
            node.SelectedImageIndex = node.ImageIndex;
            //node.Tag = obj;
            this.tvList.Nodes.Add(node);

            //取当前用户组中可以维护的常数
            Neusoft.HISFC.BizLogic.Manager.SysGroup group = new Neusoft.HISFC.BizLogic.Manager.SysGroup();
            //
            //  I don't think this is a good idea to save the info in this class
            //  Robin   2006-11-14
            Neusoft.HISFC.Models.Base.Employee user = Neusoft.FrameWork.Management.Connection.Operator as Neusoft.HISFC.Models.Base.Employee;

            ArrayList al = group.GetConstByGroup(user.CurrentGroup.ID);

            if (al == null)
            {
                MessageBox.Show("没有可以维护的常数,请在系统管理中设置常数维护项");
                return;
            }

            //显示常数维护数据
            foreach (Neusoft.HISFC.Models.Admin.SysModelFunction info in al)
            {
                node                    = new TreeNode();
                node.Text               = info.Name;
                node.ImageIndex         = 3;
                node.SelectedImageIndex = 4;
                node.Tag                = info;
                this.tvList.Nodes[0].Nodes.Add(node);
            }

            this.tvList.Nodes[0].ExpandAll();
        }
Esempio n. 5
0
 public int SetConst(string GroupID, Neusoft.HISFC.Models.Admin.SysModelFunction obj)
 {
     #region "接口"
     //接口名称 Manager.SysGroup.Update.1
     #endregion
     string strSql = "", strSql1 = "";
     if (this.Sql.GetSql("Manager.Group.Const.Insert", ref strSql) == -1)
     {
         return(-1);
     }
     if (this.Sql.GetSql("Manager.Group.Const.Update", ref strSql1) == -1)
     {
         return(-1);
     }
     try
     {
         string[] s = this.mySetConstInfo(GroupID, obj);
         strSql  = string.Format(strSql, s);
         strSql1 = string.Format(strSql1, s);
     }
     catch (Exception ex)
     {
         this.Err = "赋值时候出错!" + ex.Message;
         this.WriteErr();
         return(-1);
     }
     if (this.ExecNoQuery(strSql) <= 0)         //insert
     {
         if (this.ExecNoQuery(strSql1) <= 0)    //update
         {
             return(-1);
         }
         else
         {
             return(0);
         }
     }
     return(0);
 }
Esempio n. 6
0
        /// <summary>
        /// 根据组获得常数-Neusoft.HISFC.Models.Power.SysModelFunction
        /// </summary>
        /// <param name="GroupID">组ID</param>
        /// <returns>模块列表Neusoft.HISFC.Models.Power.SysModelFunction </returns>
        public ArrayList GetConstByGroup(string GroupID)
        {
            ArrayList al  = new ArrayList();
            string    sql = "";

            if (this.Sql.GetSql("Manager.Group.Const.Select", ref sql) == -1)
            {
                return(null);
            }
            try
            {
                sql = string.Format(sql, GroupID);
            }
            catch { this.Err = "传参Manager.Group.Const.Select出错!"; this.WriteErr(); }
            if (this.ExecQuery(sql) == -1)
            {
                return(null);
            }

            while (this.Reader.Read())
            {
                Neusoft.HISFC.Models.Admin.SysModelFunction obj = new Neusoft.HISFC.Models.Admin.SysModelFunction();
                obj.ID           = this.Reader[0].ToString();
                obj.Name         = this.Reader[1].ToString();
                obj.FunName      = this.Reader[1].ToString();
                obj.WinName      = this.Reader[2].ToString();
                obj.DllName      = this.Reader[3].ToString();
                obj.FormType     = this.Reader[4].ToString();
                obj.FormShowType = this.Reader[5].ToString();
                obj.Memo         = this.Reader[6].ToString();
                obj.User01       = this.Reader[7].ToString();
                obj.User02       = this.Reader[8].ToString();
                obj.Param        = this.Reader[9].ToString();
                al.Add(obj);
            }

            this.Reader.Close();
            return(al);
        }
Esempio n. 7
0
        private bool SaveData()
        {
            if (IsDirty == false || ValidateValue() == false)
            {
                return(false);
            }

            this.fpSpread1.StopCellEditing();
            for (int i = 0; i < this.view.Count; i++)
            {
                this.view[i].EndEdit();
            }

            DataTable added    = table.GetChanges(DataRowState.Added);
            DataTable modified = table.GetChanges(DataRowState.Modified);
            DataTable deleted  = table.GetChanges(DataRowState.Deleted);

            if (added == null && deleted == null && modified == null)
            {
                IsDirty = false;
                MessageBox.Show("无变化!");
                return(true);
            }
            Neusoft.HISFC.BizLogic.Manager.SysModelFunctionManager funMgr = new Neusoft.HISFC.BizLogic.Manager.SysModelFunctionManager();

            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

            //Neusoft.FrameWork.Management.Transaction trans = new Neusoft.FrameWork.Management.Transaction(funMgr.Connection);

            bool saved = true;

            Neusoft.HISFC.Models.Admin.SysModelFunction errorFun = null;
            try
            {
                //trans.BeginTransaction();

                funMgr.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

                if (deleted != null)
                {
                    deleted.RejectChanges();
                    ArrayList entities = GetEntityFromTable(deleted);
                    if (entities != null)
                    {
                        foreach (Neusoft.HISFC.Models.Admin.SysModelFunction fun in entities)
                        {
                            if (funMgr.DeleteSysModelFunction(fun) < 0)
                            {
                                saved = false;
                                break;
                            }
                        }
                    }
                }
                if (added != null && saved)
                {
                    //added.AcceptChanges();
                    ArrayList entities = GetEntityFromTable(added);
                    if (entities != null)
                    {
                        foreach (Neusoft.HISFC.Models.Admin.SysModelFunction fun in entities)
                        {
                            if (funMgr.InsertSysModelFunction(fun) < 0)
                            {
                                errorFun = fun;

                                saved = false;
                                break;
                            }
                        }
                    }
                }
                if (modified != null && saved)
                {
                    ArrayList entities = GetEntityFromTable(modified);
                    if (entities != null)
                    {
                        foreach (Neusoft.HISFC.Models.Admin.SysModelFunction fun in entities)
                        {
                            if (funMgr.UpdateSysModelFunction(fun) < 0)
                            {
                                errorFun = fun;
                                saved    = false;
                                break;
                            }
                        }
                    }
                }

                if (saved)
                {
                    Neusoft.FrameWork.Management.PublicTrans.Commit();
                }
            }
            catch
            {
                saved = false;
            }
            finally
            {
                if (!saved)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();

                    string error = string.Empty;

                    if (funMgr.DBErrCode == 1 && errorFun != null)
                    {
                        error = "系统模块\"" + modelCache[errorFun.SysCode].ToString() + "\"中窗口名称 \"" + errorFun.WinName + "\" 有重复!";
                    }
                    else
                    {
                        error = funMgr.Err;
                    }

                    SetCellType();
                    MessageBox.Show("数据保存失败!" + error, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    table.AcceptChanges(); //因为用的是DataView ,所以先得置标志位,去除掉已经删除的行
                    foreach (DataRow row in table.Rows)
                    {
                        row["状态"] = "old";
                    }
                    table.AcceptChanges();
                    IsDirty = false;
                    SetCellType();
                }
            }
            if (saved)
            {
                MessageBox.Show("数据保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                IsDirty = false;
                return(true);
            }
            else
            {
                IsDirty = true;
                return(false);
            }
        }