Exemple #1
0
        public int SaveNode(User user, string flag)
        {
            int i = 0;

            if (flag.Equals("新增用户"))
            {
                string sql = "insert into pacs_user(id,name,password,fullname,mail,phone,venderid,vendername,remark,isChecked,fct_code,createuser) " +
                             " select nvl(max(id),0)+1,:name,:password,:fullname,:mail,:phone,:venderid,:vendername,:remark,:isChecked,:fct_code,:createuser from pacs_user";
                OracleParameter[] cmdParam = new OracleParameter[] {
                    new OracleParameter(":name", OracleType.VarChar, 50),
                    new OracleParameter(":password", OracleType.VarChar, 50),
                    new OracleParameter(":fullname", OracleType.VarChar, 50),
                    new OracleParameter(":mail", OracleType.VarChar, 50),
                    new OracleParameter(":phone", OracleType.VarChar, 30),
                    new OracleParameter(":venderid", OracleType.VarChar, 50),
                    new OracleParameter(":vendername", OracleType.VarChar, 50),
                    new OracleParameter(":remark", OracleType.VarChar, 100),
                    new OracleParameter(":isChecked", OracleType.VarChar, 10),
                    new OracleParameter(":fct_code", OracleType.VarChar, 10),
                    new OracleParameter(":createuser", OracleType.VarChar, 10)
                };
                cmdParam[0].Value  = user.Name;
                cmdParam[1].Value  = user.Password;
                cmdParam[2].Value  = user.FullName;
                cmdParam[3].Value  = user.Mail;
                cmdParam[4].Value  = user.Phone;
                cmdParam[5].Value  = user.Venderid;
                cmdParam[6].Value  = user.Vendername;
                cmdParam[7].Value  = user.Remark;
                cmdParam[8].Value  = user.IsChecked;
                cmdParam[9].Value  = PaCSAdminTool.FactoryCode;
                cmdParam[10].Value = PaCSAdminTool.LoginUserId;

                i = OracleHelper.ExecuteNonQuery(sql, cmdParam);
            }
            else
            {
                string sql = "update pacs_user set name = :name,password = :password,fullname = :fullname," +
                             " mail=:mail,phone=:phone,venderid=:venderid,vendername=:vendername,remark=:remark," +
                             " UPDATEDATE=to_char(sysdate,'yyyyMMdd'),UPDATETIME=to_char(sysdate,'hh24miss')," +
                             " UPDATEUSER=:UPDATEUSER ,isChecked = :isChecked where id=:id";
                OracleParameter[] cmdParam = new OracleParameter[] {
                    new OracleParameter(":name", OracleType.VarChar, 50),
                    new OracleParameter(":password", OracleType.VarChar, 50),
                    new OracleParameter(":fullname", OracleType.VarChar, 50),
                    new OracleParameter(":mail", OracleType.VarChar, 50),
                    new OracleParameter(":phone", OracleType.VarChar, 30),
                    new OracleParameter(":venderid", OracleType.VarChar, 50),
                    new OracleParameter(":vendername", OracleType.VarChar, 50),
                    new OracleParameter(":remark", OracleType.VarChar, 100),
                    new OracleParameter(":UPDATEUSER", OracleType.VarChar, 20),
                    new OracleParameter(":isChecked", OracleType.VarChar, 10),
                    new OracleParameter(":id", OracleType.VarChar, 20),
                };
                cmdParam[0].Value  = user.Name;
                cmdParam[1].Value  = user.Password;
                cmdParam[2].Value  = user.FullName;
                cmdParam[3].Value  = user.Mail;
                cmdParam[4].Value  = user.Phone;
                cmdParam[5].Value  = user.Venderid;
                cmdParam[6].Value  = user.Vendername;
                cmdParam[7].Value  = user.Remark;
                cmdParam[8].Value  = PaCSAdminTool.LoginUserId;
                cmdParam[9].Value  = user.IsChecked;
                cmdParam[10].Value = user.Id;

                i = OracleHelper.ExecuteNonQuery(sql, cmdParam);
            }

            return(i);
        }