Esempio n. 1
0
 private void mapSlnMaster(SlnMasterInfo oParam, DataRow tempdr)
 {
     oParam.SysNo        = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.ID           = Util.TrimNull(tempdr["ID"]);
     oParam.Name         = Util.TrimNull(tempdr["Name"]);
     oParam.Title        = Util.TrimNull(tempdr["Title"]);
     oParam.Description  = Util.TrimNull(tempdr["Description"]);
     oParam.SysUserSysNo = Util.TrimIntNull(tempdr["SysUserSysNo"]);
     oParam.DateStamp    = Util.TrimDateNull(tempdr["DateStamp"]);
     oParam.OrderNum     = Util.TrimIntNull(tempdr["OrderNum"]);
     oParam.Status       = Util.TrimIntNull(tempdr["Status"]);
 }
Esempio n. 2
0
        public void UpdateSlnMaster(SlnMasterInfo oParam)
        {
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                new SlnDac().Update(oParam);
                scope.Complete();
            }
        }
Esempio n. 3
0
        public SlnMasterInfo LoadSlnMaster(int SysNo)
        {
            string        sql    = "select * from sln_master where sysno=" + SysNo;
            DataSet       ds     = SqlHelper.ExecuteDataSet(sql);
            SlnMasterInfo oParam = new SlnMasterInfo();

            if (Util.HasMoreRow(ds))
            {
                mapSlnMaster(oParam, ds.Tables[0].Rows[0]);
            }
            else
            {
                oParam = null;
            }
            return(oParam);
        }
Esempio n. 4
0
        public int Insert(SlnMasterInfo oParam)
        {
            string     sql = @"INSERT INTO sln_master
                            (
                            ID, Name, Title, Description, 
                            SysUserSysNo, DateStamp, OrderNum, Status
                            )
                            VALUES (
                            @ID, @Name, @Title, @Description, 
                            @SysUserSysNo, @DateStamp, @OrderNum, @Status
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo        = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramID           = new SqlParameter("@ID", SqlDbType.NVarChar, 50);
            SqlParameter paramName         = new SqlParameter("@Name", SqlDbType.NVarChar, 500);
            SqlParameter paramTitle        = new SqlParameter("@Title", SqlDbType.NVarChar, 500);
            SqlParameter paramDescription  = new SqlParameter("@Description", SqlDbType.Text, 0);
            SqlParameter paramSysUserSysNo = new SqlParameter("@SysUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramDateStamp    = new SqlParameter("@DateStamp", SqlDbType.DateTime);
            SqlParameter paramOrderNum     = new SqlParameter("@OrderNum", SqlDbType.Int, 4);
            SqlParameter paramStatus       = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.ID != AppConst.StringNull)
            {
                paramID.Value = oParam.ID;
            }
            else
            {
                paramID.Value = System.DBNull.Value;
            }
            if (oParam.Name != AppConst.StringNull)
            {
                paramName.Value = oParam.Name;
            }
            else
            {
                paramName.Value = System.DBNull.Value;
            }
            if (oParam.Title != AppConst.StringNull)
            {
                paramTitle.Value = oParam.Title;
            }
            else
            {
                paramTitle.Value = System.DBNull.Value;
            }
            if (oParam.Description != AppConst.StringNull)
            {
                paramDescription.Value = oParam.Description;
            }
            else
            {
                paramDescription.Value = System.DBNull.Value;
            }
            if (oParam.SysUserSysNo != AppConst.IntNull)
            {
                paramSysUserSysNo.Value = oParam.SysUserSysNo;
            }
            else
            {
                paramSysUserSysNo.Value = System.DBNull.Value;
            }
            if (oParam.DateStamp != AppConst.DateTimeNull)
            {
                paramDateStamp.Value = oParam.DateStamp;
            }
            else
            {
                paramDateStamp.Value = System.DBNull.Value;
            }
            if (oParam.OrderNum != AppConst.IntNull)
            {
                paramOrderNum.Value = oParam.OrderNum;
            }
            else
            {
                paramOrderNum.Value = System.DBNull.Value;
            }
            if (oParam.Status != AppConst.IntNull)
            {
                paramStatus.Value = oParam.Status;
            }
            else
            {
                paramStatus.Value = System.DBNull.Value;
            }

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramID);
            cmd.Parameters.Add(paramName);
            cmd.Parameters.Add(paramTitle);
            cmd.Parameters.Add(paramDescription);
            cmd.Parameters.Add(paramSysUserSysNo);
            cmd.Parameters.Add(paramDateStamp);
            cmd.Parameters.Add(paramOrderNum);
            cmd.Parameters.Add(paramStatus);

            return(SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo));
        }
Esempio n. 5
0
        public int Update(SlnMasterInfo oParam)
        {
            string     sql = @"UPDATE sln_master SET 
                            ID=@ID, Name=@Name, 
                            Title=@Title, Description=@Description, 
                            SysUserSysNo=@SysUserSysNo, DateStamp=@DateStamp, 
                            OrderNum=@OrderNum, Status=@Status
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo        = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramID           = new SqlParameter("@ID", SqlDbType.NVarChar, 50);
            SqlParameter paramName         = new SqlParameter("@Name", SqlDbType.NVarChar, 500);
            SqlParameter paramTitle        = new SqlParameter("@Title", SqlDbType.NVarChar, 500);
            SqlParameter paramDescription  = new SqlParameter("@Description", SqlDbType.Text, 0);
            SqlParameter paramSysUserSysNo = new SqlParameter("@SysUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramDateStamp    = new SqlParameter("@DateStamp", SqlDbType.DateTime);
            SqlParameter paramOrderNum     = new SqlParameter("@OrderNum", SqlDbType.Int, 4);
            SqlParameter paramStatus       = new SqlParameter("@Status", SqlDbType.Int, 4);

            if (oParam.SysNo != AppConst.IntNull)
            {
                paramSysNo.Value = oParam.SysNo;
            }
            else
            {
                paramSysNo.Value = System.DBNull.Value;
            }

            if (oParam.ID != AppConst.StringNull)
            {
                paramID.Value = oParam.ID;
            }
            else
            {
                paramID.Value = System.DBNull.Value;
            }
            if (oParam.Name != AppConst.StringNull)
            {
                paramName.Value = oParam.Name;
            }
            else
            {
                paramName.Value = System.DBNull.Value;
            }
            if (oParam.Title != AppConst.StringNull)
            {
                paramTitle.Value = oParam.Title;
            }
            else
            {
                paramTitle.Value = System.DBNull.Value;
            }
            if (oParam.Description != AppConst.StringNull)
            {
                paramDescription.Value = oParam.Description;
            }
            else
            {
                paramDescription.Value = System.DBNull.Value;
            }
            if (oParam.SysUserSysNo != AppConst.IntNull)
            {
                paramSysUserSysNo.Value = oParam.SysUserSysNo;
            }
            else
            {
                paramSysUserSysNo.Value = System.DBNull.Value;
            }
            if (oParam.DateStamp != AppConst.DateTimeNull)
            {
                paramDateStamp.Value = oParam.DateStamp;
            }
            else
            {
                paramDateStamp.Value = System.DBNull.Value;
            }
            if (oParam.OrderNum != AppConst.IntNull)
            {
                paramOrderNum.Value = oParam.OrderNum;
            }
            else
            {
                paramOrderNum.Value = System.DBNull.Value;
            }
            if (oParam.Status != AppConst.IntNull)
            {
                paramStatus.Value = oParam.Status;
            }
            else
            {
                paramStatus.Value = System.DBNull.Value;
            }

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramID);
            cmd.Parameters.Add(paramName);
            cmd.Parameters.Add(paramTitle);
            cmd.Parameters.Add(paramDescription);
            cmd.Parameters.Add(paramSysUserSysNo);
            cmd.Parameters.Add(paramDateStamp);
            cmd.Parameters.Add(paramOrderNum);
            cmd.Parameters.Add(paramStatus);

            return(SqlHelper.ExecuteNonQuery(cmd));
        }